Update GUDButtonListener.cpp
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
|
||||
void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||
{
|
||||
SelectionService* getSelectionService = g_dataModel->getSelectionService();
|
||||
SoundService* getSoundService = g_dataModel->getSoundService();
|
||||
SelectionService* selectionService = g_dataModel->getSelectionService();
|
||||
SoundService* soundService = g_dataModel->getSoundService();
|
||||
|
||||
bool cont = false;
|
||||
for(size_t i = 0; i < getSelectionService->getSelection().size(); i++)
|
||||
if(getSelectionService->getSelection()[i]->canDelete)
|
||||
for(size_t i = 0; i < selectionService->getSelection().size(); i++)
|
||||
if(selectionService->getSelection()[i]->canDelete)
|
||||
{
|
||||
cont = true;
|
||||
break;
|
||||
@@ -21,19 +21,19 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||
if (cont)
|
||||
{
|
||||
if(button->disabled == false){
|
||||
getSoundService->playSound(getSoundService->findFirstChild("Ping"));
|
||||
soundService->playSound(soundService->findFirstChild("Ping"));
|
||||
}
|
||||
|
||||
if(button->name == "Duplicate")
|
||||
{
|
||||
std::vector<Instance*> newinst;
|
||||
for(size_t i = 0; i < getSelectionService->getSelection().size(); i++)
|
||||
for(size_t i = 0; i < selectionService->getSelection().size(); i++)
|
||||
{
|
||||
if(getSelectionService->getSelection()[i]->canDelete)
|
||||
if(selectionService->getSelection()[i]->canDelete)
|
||||
{
|
||||
Instance* tempinst = getSelectionService->getSelection()[i];
|
||||
Instance* tempinst = selectionService->getSelection()[i];
|
||||
|
||||
Instance* clonedInstance = getSelectionService->getSelection()[i]->clone();
|
||||
Instance* clonedInstance = selectionService->getSelection()[i]->clone();
|
||||
|
||||
if (clonedInstance->getClassName() == "PVInstance"){
|
||||
PartInstance* Part = dynamic_cast<PartInstance*>(clonedInstance);
|
||||
@@ -43,35 +43,35 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||
newinst.push_back(clonedInstance);
|
||||
}
|
||||
}
|
||||
getSelectionService->clearSelection();
|
||||
getSelectionService->addSelected(newinst);
|
||||
selectionService->clearSelection();
|
||||
selectionService->addSelected(newinst);
|
||||
}
|
||||
else if(button->name == "Group")
|
||||
{
|
||||
if (getSelectionService->getSelection().size() > 1){
|
||||
if (selectionService->getSelection().size() > 1){
|
||||
GroupInstance * inst = new GroupInstance();
|
||||
inst->setParent(g_dataModel->getWorkspace());
|
||||
for(size_t i = 0; i < getSelectionService->getSelection().size(); i++)
|
||||
for(size_t i = 0; i < selectionService->getSelection().size(); i++)
|
||||
{
|
||||
if(getSelectionService->getSelection()[i]->canDelete)
|
||||
if(selectionService->getSelection()[i]->canDelete)
|
||||
{
|
||||
getSelectionService->getSelection()[i]->setParent(inst);
|
||||
if(PartInstance* part = dynamic_cast<PartInstance*>(getSelectionService->getSelection()[i]))
|
||||
selectionService->getSelection()[i]->setParent(inst);
|
||||
if(PartInstance* part = dynamic_cast<PartInstance*>(selectionService->getSelection()[i]))
|
||||
{
|
||||
inst->primaryPart = part;
|
||||
}
|
||||
}
|
||||
}
|
||||
getSelectionService->clearSelection();
|
||||
getSelectionService->addSelected(inst);
|
||||
selectionService->clearSelection();
|
||||
selectionService->addSelected(inst);
|
||||
}
|
||||
}
|
||||
else if(button->name == "UnGroup")
|
||||
{
|
||||
std::vector<Instance*> newinst;
|
||||
for(size_t i = 0; i < getSelectionService->getSelection().size(); i++)
|
||||
for(size_t i = 0; i < selectionService->getSelection().size(); i++)
|
||||
{
|
||||
Instance* selection = getSelectionService->getSelection()[i];
|
||||
Instance* selection = selectionService->getSelection()[i];
|
||||
|
||||
if(GroupInstance* model = dynamic_cast<GroupInstance*>(selection))
|
||||
{
|
||||
@@ -81,8 +81,8 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||
model = NULL;
|
||||
}
|
||||
}
|
||||
getSelectionService->clearSelection();
|
||||
getSelectionService->addSelected(newinst);
|
||||
selectionService->clearSelection();
|
||||
selectionService->addSelected(newinst);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user