editor: added multiselection edit for many things

This commit is contained in:
Turánszki János
2024-07-23 06:56:01 +02:00
parent 65d863d5c7
commit 510fd5dce7
19 changed files with 1752 additions and 946 deletions
+21 -15
View File
@@ -1,6 +1,8 @@
#include "stdafx.h"
#include "ScriptWindow.h"
using namespace wi::scene;
void ScriptWindow::Create(EditorComponent* _editor)
{
editor = _editor;
@@ -61,11 +63,13 @@ void ScriptWindow::Create(EditorComponent* _editor)
playonceCheckBox.SetSize(XMFLOAT2(hei, hei));
playonceCheckBox.OnClick([=](wi::gui::EventArgs args) {
wi::scene::Scene& scene = editor->GetCurrentScene();
wi::scene::ScriptComponent* script = scene.scripts.GetComponent(entity);
if (script == nullptr)
return;
script->SetPlayOnce(args.bValue);
for (auto& x : editor->translator.selected)
{
ScriptComponent* script = scene.scripts.GetComponent(x.entity);
if (script == nullptr)
continue;
script->SetPlayOnce(args.bValue);
}
});
AddWidget(&playonceCheckBox);
@@ -74,17 +78,19 @@ void ScriptWindow::Create(EditorComponent* _editor)
playstopButton.SetSize(XMFLOAT2(wid, hei));
playstopButton.OnClick([=](wi::gui::EventArgs args) {
wi::scene::Scene& scene = editor->GetCurrentScene();
wi::scene::ScriptComponent* script = scene.scripts.GetComponent(entity);
if (script == nullptr)
return;
if (script->IsPlaying())
for (auto& x : editor->translator.selected)
{
script->Stop();
}
else
{
script->Play();
ScriptComponent* script = scene.scripts.GetComponent(x.entity);
if (script == nullptr)
continue;
if (script->IsPlaying())
{
script->Stop();
}
else
{
script->Play();
}
}
});
AddWidget(&playstopButton);