Exemplo n.º 1
0
void Triggerable::setDecalType(std::string decalType_) {
	this->decalType = decalType_;

	GameObject* gameObjectRef = (GameObject*)this->GetObject();
	ASSERT(gameObjectRef->GetClassType() & CLASS_TYPE_GAMEOBJECT, "Object is a game object");

	this->decalRef = DecalGenerator::GetDecalFromDecalType(this->decalType, gameObjectRef->GetParentSceneGraph());
	gameObjectRef->AddChild(this->decalRef->GetId());
}
Exemplo n.º 2
0
void GameObjectTreeWidget::dropEvent(QDropEvent* dEvent)
{
	if(!m_IsReady)
	{
		dEvent->ignore();
		return;
	}

	AEAssert(m_EngineViewer != nullptr);
	if (m_EngineViewer == nullptr)
	{
		dEvent->ignore();
		return;
	}

	////////////////////////////////
	//Get Current Index
	QList<QTreeWidgetItem*> selectedItems = this->selectedItems();

	if(selectedItems.count() == 0)
	{
		dEvent->ignore();
		return;
	}

	////////////////////////////////
	//Accept Drops continue with internal move
	QTreeWidget::dropEvent(dEvent);

	////////////////////////////////////////////
	//Get Scope Lock and lock Game App Loop
	GameAppScopedLock appLock = m_EngineViewer->GetGameAppScopedLock();
	appLock.StartLock();

	QTreeWidgetItem* childItem = selectedItems[0];
	uint64_t gameObjectID = static_cast<uint64_t>(childItem->data(0, AE_QT_ITEM_DATA_ROLE_UNIQUE_ID).toULongLong());

	GameObject* childGameObject = m_EngineViewer->GetGameObjectManager()->GetGameObject(gameObjectID);

	QTreeWidgetItem* parentItem = childItem->parent();

	if(parentItem != nullptr)
	{
		uint64_t parentGameObjectID = static_cast<uint64_t>(parentItem->data(0, AE_QT_ITEM_DATA_ROLE_UNIQUE_ID).toULongLong());

		GameObject* parentGameObject = m_EngineViewer->GetGameObjectManager()->GetGameObject(parentGameObjectID);

		AETODO("Check return");
		parentGameObject->AddChild(childGameObject);
	}
	else
	{
		AETODO("Check return");
		m_EngineViewer->GetGameObjectManager()->AddGameObject(childGameObject);
	}
}