Exemplo n.º 1
0
//----------------------------------------------------------------------------
void EditMap::AddModelActor (PX2::Movable *mov, PX2::APoint pos)
{
	if (!mov)
		return;

	PX2::Node *node = new0 PX2::Node();
	node->AttachChild(mov);
	node->SetName(mov->GetName()+"Par");

	PX2::Actor *actor = new0 Actor();
	actor->SetName("ModelActor");
	actor->SetMovable(node);
	actor->SetPosition(pos);
	actor->ComeInToEventWorld();

	AddActor(actor);
}
Exemplo n.º 2
0
//----------------------------------------------------------------------------
void EditMap::AddModelActor (PX2::Movable *mov, PX2::APoint pos)
{
	if (!mov)
		return;

	PX2::Node *node = new0 PX2::Node();
	node->AttachChild(mov);
	node->SetName(mov->GetName()+"Par");

	PX2::Actor *actor = new0 Actor();
	actor->SetName(mov->GetName());
	actor->SetMovable(node);
	actor->SetPosition(pos);
	actor->ComeInToEventWorld();
	AddActor(actor);

	Event *event = 0;
	event = EditorEventSpace::CreateEventX(EditorEventSpace::AddActor);
	event->SetData<Actor*>(actor);
	EventWorld::GetSingleton().BroadcastingLocalEvent(event);
}
Exemplo n.º 3
0
//-----------------------------------------------------------------------------
void ActorTree::DoExecute (Event *event)
{
	if (EditorEventSpace::IsEqual(event,
		EditorEventSpace::NewScene))
	{
		RefleshScene();
	}
	else if (EditorEventSpace::IsEqual(event,
		EditorEventSpace::LoadedScene))
	{
		RefleshScene();
	}

	if (EditorEventSpace::IsEqual(event,
		EditorEventSpace::CreateTerrainAndAddToScene))
	{
		RawTerrainActor *terrainActor = event->GetData<RawTerrainActor*>();
		AddActor(mTerrainItemId, terrainActor);
		ExpandAllChildren(mTerrainItemId);
	}
	else if (EditorEventSpace::IsEqual(event,
		EditorEventSpace::CreateLightActor))
	{
		LightActor *lightActor = event->GetData<LightActor*>();
		AddActor(mLightsItemId, lightActor);
		ExpandAllChildren(mLightsItemId);
	}
	else if (EditorEventSpace::IsEqual(event, EditorEventSpace::
		AddActor))
	{
		Actor *actor = event->GetData<Actor*>();
		AddActor(mObjectsItemId, actor);
		ExpandAllChildren(mObjectsItemId);
	}

	if (EditorEventSpace::IsEqual(event,
		EditorEventSpace::ObjectNamePropertyChanged))
	{
		Object *object = event->GetData<Object*>();

		if (object)
		{
			PX2::Actor *actor = DynamicCast<Actor>(object);

			if (actor)
			{
				ActorTreeItem *item = GetItem(actor);
				if (item)
				{
					item->SetName(actor->GetName());
				}
			}
		}
	}

	if (EditorEventSpace::IsEqual(event,
		EditorEventSpace::RemoveActor))
	{
		Actor *actor = event->GetData<Actor*>();
		RemoveActor(actor);
	}
}