Exemple #1
0
void CMeshNodePanel::ShowNodeInfo(u32 id)
{
	EditorScene* scene = EditorScene::getInstance();
	SNodeInfo* nodeinfo = scene->GetNodeInfoById(id);

	mNodeInfoWindow.UpdateShowing(nodeinfo);
}
Exemple #2
0
void CMeshNodePanel::MouseLeftButtonDown(int sx, int sy)
{
	EditorScene* scene = EditorScene::getInstance();
	EditorWindow* window = EditorWindow::getInstance();
	if (!scene)
		return;

	E_MOUSE_STATE mouseState = window->GetMouseState();

	if (mouseState == EMS_ADD_OBJECT)
	{
		char text[256];
		mCreateMeshNodeWindow.GetNodeName(text);

		u32 id = scene->AddObject(text);
		window->SetMouseState(EMS_PICKING);
		mCreateMeshNodeWindow.EnableControl(IDC_NEW_MODEL_NDOE_BTN, TRUE);
		mCreateMeshNodeWindow.AddListItem(id);
		mCreateMeshNodeWindow.SelectListItem(id);
		scene->SelectObject(id);
	}
	else if (mouseState == EMS_ADD_INSTANCE)
	{
		u32 id = scene->AddInstanceNode();
		window->SetMouseState(EMS_PICKING);
		mInstanceNodeWindow.AddListBoxItem(id);
		mInstanceNodeWindow.EnableControl(IDC_INSTANCE_CREATE_BTN, TRUE);
		mInstanceNodeWindow.SelectListItem(id);
		scene->SelectObject(id);
	}
	else if (mouseState == EMS_PICKING)
	{
		int id = scene->SelectObject(sx, sy);
		if (id != -1)
		{
			SNodeInfo* info = scene->GetNodeInfoById(id);
			if (info->Category == MESH_CATEGORY)
			{
				ShowNodeInfo(id);
				mCreateMeshNodeWindow.SelectListItem(id);
				mInstanceNodeWindow.SetVisible(false);
			}
			else if (info->Category == INSTANCE_CATEGORY)
			{
				ShowNodeInfo(id);
				mCreateMeshNodeWindow.SelectListItem(info->CollectionId);
				mInstanceNodeWindow.SetVisible(true);
				mInstanceNodeWindow.UpdateListBoxItems(info->CollectionId);
				mInstanceNodeWindow.SelectListItem(id);
			}
		}
	}
}
void CInstanceInfoWindow::OnClickListItem()
{
	int itemIndex = ListBox_GetCurSel(mInstancesListBox);
	if (itemIndex != LB_ERR)
	{
		u32 id = ListBox_GetItemData(mInstancesListBox, itemIndex);
		EditorScene* scene = EditorScene::getInstance();
		EditorWindow* window = EditorWindow::getInstance();
		SNodeInfo* info = scene->GetNodeInfoById(id);
		scene->SelectObject(id);
		window->ShowNodeInfo(id);
		SetFocus(mParentHwnd);
	}
}