Пример #1
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);
			}
		}
	}
}
Пример #2
0
void CMeshNodePanel::SetActive(bool bActive)
{
	mCreateMeshNodeWindow.SetVisible(bActive);
	mNodeInfoWindow.SetVisible(bActive);
	mInstanceNodeWindow.SetVisible(bActive);

	EditorScene* scene = EditorScene::getInstance();

	if (bActive)
	{
		SNodeInfo* info = mCreateMeshNodeWindow.GetSelectedItemNodeInfo();
		if (!info)
			return;

		if (info->Category == COLLECTION_CATEGORY)
			mInstanceNodeWindow.SetVisible(true);
		else {
			mInstanceNodeWindow.SetVisible(false);
			scene->SelectObject(info->Id);
		}
			
		ShowNodeInfo(info);
	}
	else
	{
		scene->CancelSelectObject();
	}
}
Пример #3
0
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);
	}
}
Пример #4
0
void CInstanceInfoWindow::OnDoubleClickListItem()
{
	int itemIndex = ListBox_GetCurSel(mInstancesListBox);
	if (itemIndex != LB_ERR)
	{
		u32 id = ListBox_GetItemData(mInstancesListBox, itemIndex);
		EditorScene* scene = EditorScene::getInstance();
		EditorWindow* window = EditorWindow::getInstance();

		if (scene->SelectObject(id))
		{
			scene->FocusSelectedObject();
			window->ShowNodeInfo(id);
		}
		SetFocus(mParentHwnd);
	}
}
Пример #5
0
void CMeshNodePanel::MouseDoubleClicked(int sx, int sy)
{
	EditorScene* scene = EditorScene::getInstance();
	EditorWindow* window = EditorWindow::getInstance();
	if (!scene)
		return;

	E_MOUSE_STATE mouseState = window->GetMouseState();
	if (mouseState == EMS_PICKING)
	{
		int id = scene->SelectObject(sx, sy);
		if (id != -1)
		{
			scene->FocusSelectedObject();
			mCreateMeshNodeWindow.SelectListItem(id);
		}
	}
}