void Group::add( const EntityPtr& entity ) { if( !entity ) return; entity->setParent( this ); entities.push_back( entity ); onEntityAdded(entity); onEntityChanged(); }
bool Group::remove( const EntityPtr& entity ) { auto it = std::find(entities.begin(), entities.end(), entity); if( it == entities.end() ) return false; onEntityRemoved(entity); onEntityChanged(); entities.remove(it); return true; }
bool Group::remove( const EntityPtr& entity ) { std::vector<EntityPtr>::iterator it; it = std::find(entities.begin(), entities.end(), entity); if( it == entities.end() ) return false; onEntityRemoved(entity); onEntityChanged(); entities.erase(it); return true; }
QtPrototypeWindow::QtPrototypeWindow(const std::string& filePath, QtGLWorker* worker, QWidget* parent) : QtEditorWindowBase(filePath, worker, parent) , ui(new Ui::QtPrototypeWindow) { ui->setupUi(this); m_componentListModel = new QStandardItemModel(this); m_componentsWidget = new QtComponentsWidget(); m_componentsWidget->setAllowCreateAndDestroy(true); QDockWidget* componentsDockWidget = new QDockWidget("Components", this); componentsDockWidget->setWidget(m_componentsWidget); componentsDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); addDockWidget(Qt::LeftDockWidgetArea, componentsDockWidget); tabifyDockWidget(ui->constraintsDockWidget, componentsDockWidget); m_constraintListModel = new QStandardItemModel(this); ui->addConstraintComboBox->setModel(QtEditorInterface::getGlobalDataModel("global:constraintType")); ui->typeComboBox->setModel(QtEditorInterface::getGlobalDataModel("global:constraintType")); ui->constraintListView->setModel(m_constraintListModel); ui->componentAComboBox->setModel(m_componentListModel); ui->componentBComboBox->setModel(m_componentListModel); connect(ui->componentAComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onComponentAChanged(int))); connect(ui->componentBComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onComponentBChanged(int))); connect(ui->typeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onConstraintTypeChanged(int))); connect(ui->nameLineEdit, SIGNAL(editingFinished()), this, SLOT(onNameEditFinished())); connect(ui->colorPushButton, SIGNAL(clicked()), this, SLOT(onPickColorButtonClicked())); connect(ui->xSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onLocationChanged(double))); connect(ui->ySpinBox, SIGNAL(valueChanged(double)), this, SLOT(onLocationChanged(double))); connect(ui->zSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onLocationChanged(double))); connect(ui->xRotSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onRotationChanged(double))); connect(ui->yRotSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onRotationChanged(double))); connect(ui->zRotSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onRotationChanged(double))); connect(ui->sizeSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onSizeChanged(double))); m_actorDefaultsWidget = new QtActorDefaultsWidget(); QDockWidget* actorDefaultsDockWidget = new QDockWidget("Actor defaults", this); actorDefaultsDockWidget->setWidget(m_actorDefaultsWidget); actorDefaultsDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); addDockWidget(Qt::RightDockWidgetArea, actorDefaultsDockWidget); m_nodeSettingsWidget = new QtNodeSettingsWidget(); m_nodeSettingsWidget->m_propertyView->setLocalDataModel("local:componentList", m_componentListModel); QDockWidget* nodeSettingsDockWidget = new QDockWidget("Node settings", this); nodeSettingsDockWidget->setWidget(m_nodeSettingsWidget); nodeSettingsDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); addDockWidget(Qt::RightDockWidgetArea, nodeSettingsDockWidget); m_prototypeWidget = new QtPrototypeWidget(); QDockWidget* prototypeDockWidget = new QDockWidget("Script entities", this); prototypeDockWidget->setWidget(m_prototypeWidget); prototypeDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); addDockWidget(Qt::RightDockWidgetArea, prototypeDockWidget); m_prototypeEditor = new QtPrototypeEditor(m_worker); m_prototypeEditor->setEditorEventDispatcher(m_editorEventDispatcher); m_editorWidget = m_prototypeEditor; connect(m_prototypeEditor, SIGNAL(instanceCreated()), this, SLOT(onEditorInstanceCreated())); ui->centralTabWidget->addTab(m_prototypeEditor, "Actor"); m_vsgWidget = new QtVSGWidget(); ui->centralTabWidget->addTab(m_vsgWidget, "Graph"); connect(m_prototypeWidget, SIGNAL(entityChanged(RJNode)), m_vsgWidget, SLOT(onEntityChanged(RJNode))); connect(m_actorDefaultsWidget, SIGNAL(executeRequest(ObjectRequest&)), this, SLOT(executeRequest(ObjectRequest&))); connect(m_vsgWidget, SIGNAL(selectionChanged()), this, SLOT(nodeSelectionChanged())); connect(m_nodeSettingsWidget->m_propertyView, SIGNAL(valueChanged(std::list<int>&, RJNode&, bool&)), m_vsgWidget, SLOT(applyModelDataChange(std::list<int>&, RJNode&, bool&))); connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(onActionSaveTriggered())); connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(onActionExitTriggered())); connect(m_componentsWidget, SIGNAL(executeRequest(ObjectRequest&)), this, SLOT(executeRequest(ObjectRequest&))); connect(m_componentsWidget, SIGNAL(selectionChanged(std::string)), this, SLOT(componentSelectionChanged(std::string))); setWindowTitle(QString("R2 Prototype editor : ") + m_assetFilePath.c_str()); }