From eb2766304a6282e7a59bf49d47e67a15b2612ecb Mon Sep 17 00:00:00 2001 From: KeyboardCombination Date: Fri, 7 Apr 2023 15:04:01 -0400 Subject: [PATCH] bigger selectionbox --- Blocks3D.vcproj | 1 + src/source/DataModelV2/GuiRootInstance.cpp | 18 +++++++---- src/source/DataModelV2/SelectionService.cpp | 10 +++---- src/source/Listener/GUDButtonListener.cpp | 33 +++++++++++++-------- 4 files changed, 39 insertions(+), 23 deletions(-) diff --git a/Blocks3D.vcproj b/Blocks3D.vcproj index e7315b6..9a11ef0 100644 --- a/Blocks3D.vcproj +++ b/Blocks3D.vcproj @@ -185,6 +185,7 @@ OutputFile="./Blocks3D-Debug.exe" LinkIncremental="2" SuppressStartupBanner="true" + AdditionalLibraryDirectories="" GenerateDebugInformation="true" ProgramDatabaseFile=".\Debug/Blocks3D.pdb" SubSystem="1" diff --git a/src/source/DataModelV2/GuiRootInstance.cpp b/src/source/DataModelV2/GuiRootInstance.cpp index 72bb220..63e9d2a 100644 --- a/src/source/DataModelV2/GuiRootInstance.cpp +++ b/src/source/DataModelV2/GuiRootInstance.cpp @@ -213,7 +213,7 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0) button->boxBegin = Vector2(0,215); button->boxEnd = Vector2(80,235); button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F); - button->textColor = Color3::white(); + button->textColor = Color3(0,1,1); button->boxColor = Color4::clear(); button->textSize = 12; button->title = "Group"; @@ -229,7 +229,7 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0) button->boxBegin = Vector2(0,240); button->boxEnd = Vector2(80,260); button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F); - button->textColor = Color3::white(); + button->textColor = Color3(0,1,1); button->boxColor = Color4::clear(); button->textSize = 12; button->title = "UnGroup"; @@ -245,7 +245,7 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0) button->boxBegin = Vector2(0,265); button->boxEnd = Vector2(80,285); button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F); - button->textColor = Color3::white(); + button->textColor = Color3(0,1,1); button->boxColor = Color4::clear(); button->textSize = 12; button->title = "Duplicate"; @@ -520,11 +520,19 @@ void GuiRootInstance::update() if(g_dataModel->getSelectionService()->getSelection()[i]->canDelete) { button->disabled = false; - button2->disabled = false; - button3->disabled = false; button4->disabled = false; button5->disabled = false; button6->disabled = false; + + + if (g_dataModel->getSelectionService()->getSelection().size() > 1){ + button2->disabled = false; + } + + if (g_dataModel->getSelectionService()->getSelection()[i]->getClassName() == "GroupInstance"){ + button3->disabled = false; + } + break; } } diff --git a/src/source/DataModelV2/SelectionService.cpp b/src/source/DataModelV2/SelectionService.cpp index 3c78abf..d4189be 100644 --- a/src/source/DataModelV2/SelectionService.cpp +++ b/src/source/DataModelV2/SelectionService.cpp @@ -86,17 +86,17 @@ void SelectionService::render(RenderDevice * rd) void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, Vector3 size, Vector3 pos, CoordinateFrame c) { Color3 outline = Color3::cyan();//Color3(0.098F,0.6F,1.0F); - float offsetSize = 0.05F; + float offsetSize = 0.1F; //X Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear()); Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear()); //Y - Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.1, from.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.1, from.z - offsetSize))), rd, outline, Color4::clear()); - Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.1, from.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize - 0.1, from.z - offsetSize))), rd, outline, Color4::clear()); - Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.1, to.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize-0.1, to.z - offsetSize))), rd, outline, Color4::clear()); - Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.1, to.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.1, to.z - offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.2, from.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.2, from.z - offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.2, from.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize - 0.2, from.z - offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.2, to.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize-0.1, to.z - offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.2, to.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.2, to.z - offsetSize))), rd, outline, Color4::clear()); //Z Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, from.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear()); diff --git a/src/source/Listener/GUDButtonListener.cpp b/src/source/Listener/GUDButtonListener.cpp index b0b3413..176384d 100644 --- a/src/source/Listener/GUDButtonListener.cpp +++ b/src/source/Listener/GUDButtonListener.cpp @@ -16,7 +16,11 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button) } if(cont) { - AudioPlayer::playSound(dingSound); + + if(button->disabled == false){ + AudioPlayer::playSound(dingSound); + } + if(button->name == "Duplicate") { std::vector newinst; @@ -36,28 +40,31 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button) } else if(button->name == "Group") { - GroupInstance * inst = new GroupInstance(); - inst->setParent(g_dataModel->getWorkspace()); - for(size_t i = 0; i < g_dataModel->getSelectionService()->getSelection().size(); i++) - { - if(g_dataModel->getSelectionService()->getSelection()[i]->canDelete) + if (g_dataModel->getSelectionService()->getSelection().size() > 1){ + GroupInstance * inst = new GroupInstance(); + inst->setParent(g_dataModel->getWorkspace()); + for(size_t i = 0; i < g_dataModel->getSelectionService()->getSelection().size(); i++) { - g_dataModel->getSelectionService()->getSelection()[i]->setParent(inst); - if(PartInstance* part = dynamic_cast(g_dataModel->getSelectionService()->getSelection()[i])) + if(g_dataModel->getSelectionService()->getSelection()[i]->canDelete) { - inst->primaryPart = part; + g_dataModel->getSelectionService()->getSelection()[i]->setParent(inst); + if(PartInstance* part = dynamic_cast(g_dataModel->getSelectionService()->getSelection()[i])) + { + inst->primaryPart = part; + } } } - } - g_dataModel->getSelectionService()->clearSelection(); - g_dataModel->getSelectionService()->addSelected(inst); + g_dataModel->getSelectionService()->clearSelection(); + g_dataModel->getSelectionService()->addSelected(inst); + } } else if(button->name == "UnGroup") { std::vector newinst; for(size_t i = 0; i < g_dataModel->getSelectionService()->getSelection().size(); i++) { - if(g_dataModel->getSelectionService()->getSelection()[i]->canDelete) + Instance* selection = g_dataModel->getSelectionService()->getSelection()[i]; + if(selection->canDelete && selection->getClassName() == "GroupInstance") { if(GroupInstance* model = dynamic_cast(g_dataModel->getSelectionService()->getSelection()[i])) {