Ejemplo n.º 1
0
INode* FindNodeRef(ReferenceTarget *Rt) 
{
	DependentIterator Di(Rt);
	ReferenceMaker	*Rm;
	INode	*Nd = NULL;

	while (Rm = Di.Next()) 
	{	
		if(Rm->SuperClassID() == BASENODE_CLASS_ID) 
		{
			return (INode *)Rm;
		}

		Nd = FindNodeRef((ReferenceTarget *)Rm);

		if(Nd)
		{
			 return(Nd);
		}
	}

	return(NULL);
}
Ejemplo n.º 2
0
void OnDlgCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
	bool load=false;
	if (id == IDC_BUTTON_REBUILD)
	{
		QString embeddedFile =MeshObject::meshObject->embeddedFile;
		int yy=0;

		if (embeddedFile!="" && MeshObject::meshObject->animaPath!="")
		{
			clearObject();

			//MeshObject *obj  = (MeshObject*)CreateInstance(GEOMOBJECT_CLASS_ID, MeshObject_CLASS_ID);
			//assert(obj);
			//INode *node = CreateRootNode(importInt,globalInt);
			//if (!node) return ;

			MeshObject::meshObject->Load(MeshObject::meshObject->animaPath,FindNodeRef(MeshObject::meshObject),false,true);
		}

	}
    else if (id == IDC_BUTTON_FILE_BROWSE)
	{
		load=true;
	}
	else if (id == IDC_BUTTON_RELOAD)
	{
		try
		{
			
		//MeshObject::meshObject->LoadFromGUI(MeshObject::meshObject->animaPath,FindNodeRef(MeshObject::meshObject));
			Anima::_LogDebug(QString("Reload %1").arg(MeshObject::meshObject->animaPath),__FUNCTION__,__LINE__);

			if (QFile(MeshObject::meshObject->animaPath).exists())
			{
				clearObject();
				MeshObject::meshObject->Load(MeshObject::meshObject->animaPath,FindNodeRef(MeshObject::meshObject),true,true);
			}
			else
			{
				Anima::_LogDebug("File not found",__FUNCTION__,__LINE__);
				MessageBox(NULL, _T(QString("The path to the original .ani scene has changed (%1) .\r\n\ Please use the Browser window to navigate and locate the new file.").arg(MeshObject::meshObject->animaPath).toAscii().data()), _T("WARNING!"), MB_OK);
				load=true;
			}
			UpdateLabelInfo();
		}
		catch(Anima::CoreException &e)
		{
			MessageBox(NULL, _T(QString("The path to the original .ani scene has changed (%1) .\r\n\ Please use the Browser window to navigate and locate the new file.").arg(MeshObject::meshObject->animaPath).toAscii().data()), _T("WARNING!"), MB_OK);

			Anima::_LogDebug(e.Message(),__FUNCTION__,__LINE__);
			load=true;
		}
	
	//	Anima::CommandManager::Singleton.Load(fileName);
	}

	if (load)
	{
		OPENFILENAME ofn;
		char szFileName[MAX_PATH] = "";

		ZeroMemory(&ofn, sizeof(ofn));

		strcpy(szFileName,MeshObject::meshObject->animaPath.toAscii().data());
		ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
		ofn.hwndOwner = hwnd;
		ofn.lpstrFilter = "AXYZ Anima Files (*.ani)\0*.ani\0All Files (*.*)\0*.*\0";
		ofn.lpstrFile = szFileName;
		ofn.nMaxFile = MAX_PATH;
		ofn.lpstrTitle		= "Load a 'Anima' File";
		ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY ;//|OFN_ALLOWMULTISELECT;
		ofn.lpstrDefExt = "ani";

		if(GetOpenFileName(&ofn))
		{
			// Do something usefull with the filename stored in szFileName 
			clearObject();
			//MeshObject::meshObject->LoadFromGUI(szFileName,FindNodeRef(MeshObject::meshObject));
			MeshObject::meshObject->Load(szFileName,FindNodeRef(MeshObject::meshObject),true,true);

			UpdateFileNameInfo();
			UpdateLabelInfo();
		}

		//QString path = QFileDialog::getOpenFileName(NULL  ,"Load a 'Anima' File","","Anima (*.ani)");
		//if (path!="")
		{
			//MeshObject::meshObject->Clear();
		//	MeshObject::meshObject->Load(path,FindNodeRef(MeshObject::meshObject));

		/*	QString name = QFileInfo(path).fileName();
			HWND hwndLbl = GetDlgItem(hwnd, IDC_FILE_NAME);
			LPARAM a = (LPARAM)name.toAscii().data();
			SendMessage(hwndLbl, WM_SETTEXT, 0, (LPARAM) a);*/
		}
	}
}