From b17da91efd19380f31877218f7dd10974186b6f2 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 25 Nov 2016 13:26:53 +0100 Subject: [PATCH] Changed: Minor changes --HG-- branch : develop --- code/nel/src/3d/ps_mesh.cpp | 3 - .../tools/3d/ligo/plugin_max/CMakeLists.txt | 10 +- .../tools/3d/object_viewer/about_dialog.cpp | 2 +- .../3d/object_viewer/animation_set_dlg.cpp | 3 +- code/nel/tools/3d/object_viewer/bin_op_dlg.h | 4 +- .../3d/object_viewer/located_target_dlg.cpp | 1 - code/nel/tools/3d/object_viewer/mesh_dlg.cpp | 2 + .../3d/object_viewer/particle_system_edit.cpp | 2 + .../3d/object_viewer/particle_workspace.cpp | 2 + .../3d/object_viewer/skeleton_scale_dlg.cpp | 13 ++- .../3d/object_viewer/snapshot_tool_dlg.cpp | 7 +- .../nel_export/nel_export_node_properties.cpp | 2 + .../nel_patch_converter.cpp | 34 +++--- .../plugin_max/nel_patch_lib/nel_patch_mesh.h | 1 + .../3d/plugin_max/tile_utility/rgbadd.cpp | 14 +-- .../plugin_max/tile_utility/tile_utility.cpp | 30 ++--- code/nel/tools/3d/tile_edit/View.cpp | 1 + .../graph_plugin.cpp | 105 +++++++++--------- .../mission_compiler_main_window.cpp | 4 +- 19 files changed, 128 insertions(+), 112 deletions(-) diff --git a/code/nel/src/3d/ps_mesh.cpp b/code/nel/src/3d/ps_mesh.cpp index e98dc801f..5b61168e5 100644 --- a/code/nel/src/3d/ps_mesh.cpp +++ b/code/nel/src/3d/ps_mesh.cpp @@ -1120,8 +1120,6 @@ void CPSConstraintMesh::getShapesNames(std::string *shapesNames) const #endif } - - //==================================================================================== void CPSConstraintMesh::setShape(uint index, const std::string &shapeName) { @@ -1132,7 +1130,6 @@ void CPSConstraintMesh::setShape(uint index, const std::string &shapeName) _ValidBuild = 0; } - //==================================================================================== const std::string &CPSConstraintMesh::getShape(uint index) const { diff --git a/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt b/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt index 6427c6b17..cd2539ee4 100644 --- a/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt +++ b/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt @@ -4,17 +4,17 @@ ADD_LIBRARY(ligoscape_utility SHARED ligoscape_utility.rc ${SRC} ligoscape_utili INCLUDE_DIRECTORIES(${MAXSDK_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(ligoscape_utility - nelmisc +TARGET_LINK_LIBRARIES(ligoscape_utility + nelmisc nelligo nel3d nelpacs - ${MAXSDK_LIBRARIES} - nel_patch_lib + ${MAXSDK_LIBRARIES} + nel_patch_lib nel_mesh_lib nel_3dsmax_shared comctl32) - + SET_TARGET_PROPERTIES(ligoscape_utility PROPERTIES SUFFIX ".dlx") NL_DEFAULT_PROPS(ligoscape_utility "MAX Plugin: Ligoscape Utility") NL_ADD_RUNTIME_FLAGS(ligoscape_utility) diff --git a/code/nel/tools/3d/object_viewer/about_dialog.cpp b/code/nel/tools/3d/object_viewer/about_dialog.cpp index 7aa2c5227..a2ea72e10 100644 --- a/code/nel/tools/3d/object_viewer/about_dialog.cpp +++ b/code/nel/tools/3d/object_viewer/about_dialog.cpp @@ -88,7 +88,7 @@ BOOL CAboutDialog::OnInitDialog() } } } - + return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } diff --git a/code/nel/tools/3d/object_viewer/animation_set_dlg.cpp b/code/nel/tools/3d/object_viewer/animation_set_dlg.cpp index aebe18f15..a815a83a6 100644 --- a/code/nel/tools/3d/object_viewer/animation_set_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/animation_set_dlg.cpp @@ -287,6 +287,7 @@ void CAnimationSetDlg::refresh (BOOL update) // Keyframer ? UTrackKeyframer *keyTrack=dynamic_cast(track); + if (keyTrack) { // Get number of keys @@ -316,7 +317,7 @@ void CAnimationSetDlg::refresh (BOOL update) std::string name = NLMISC::CFile::getFilenameWithoutExtension(object->Saved.SWTFileName[i]); // Get the animation pointer - CSkeletonWeight *swt = object->AnimationSet.getSkeletonWeight (object->AnimationSet.getSkeletonWeightIdByName (name)); + CSkeletonWeight *swt = object->AnimationSet.getSkeletonWeight(object->AnimationSet.getSkeletonWeightIdByName(name)); // Insert an intem HTREEITEM item=SkelTree.InsertItem(utf8ToTStr(name)); diff --git a/code/nel/tools/3d/object_viewer/bin_op_dlg.h b/code/nel/tools/3d/object_viewer/bin_op_dlg.h index c0080c866..1e54d7e98 100644 --- a/code/nel/tools/3d/object_viewer/bin_op_dlg.h +++ b/code/nel/tools/3d/object_viewer/bin_op_dlg.h @@ -104,8 +104,8 @@ public: // SchemeWrapper[k].S reference the atriobute maker being edited if (_EditedScheme->supportOp( (NL3D::CPSBinOp::BinOp) k)) { - sint index = m_BinOp.AddString(ops[k]) ; - m_BinOp.SetItemData(index, k) ; + sint index = m_BinOp.AddString(ops[k]); + m_BinOp.SetItemData(index, k); if ((uint) _EditedScheme->getOp() == k) { m_BinOp.SetCurSel(k) ; diff --git a/code/nel/tools/3d/object_viewer/located_target_dlg.cpp b/code/nel/tools/3d/object_viewer/located_target_dlg.cpp index 12c9de041..03fcb226c 100644 --- a/code/nel/tools/3d/object_viewer/located_target_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/located_target_dlg.cpp @@ -185,7 +185,6 @@ BOOL CLocatedTargetDlg::OnInitDialog() } } - const sint posX = 5; sint posY = 180; diff --git a/code/nel/tools/3d/object_viewer/mesh_dlg.cpp b/code/nel/tools/3d/object_viewer/mesh_dlg.cpp index c81a1d92a..a35b7fe71 100644 --- a/code/nel/tools/3d/object_viewer/mesh_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/mesh_dlg.cpp @@ -111,8 +111,10 @@ void CMeshDlg::OnBrowseShape() { MessageBox(utf8ToTStr(e.what()), _T("shape loading error")); } + updateMeshErrorString(); } + UpdateData(FALSE); } diff --git a/code/nel/tools/3d/object_viewer/particle_system_edit.cpp b/code/nel/tools/3d/object_viewer/particle_system_edit.cpp index 17b4892fe..6d833acdf 100644 --- a/code/nel/tools/3d/object_viewer/particle_system_edit.cpp +++ b/code/nel/tools/3d/object_viewer/particle_system_edit.cpp @@ -220,6 +220,7 @@ void CParticleSystemEdit::updateDieOnEventParams() { ew = FALSE; } + GetDlgItem(IDC_APPLY_AFTER_DELAY)->EnableWindow(ew); CString out; @@ -232,6 +233,7 @@ void CParticleSystemEdit::updateDieOnEventParams() { out = _T("???"); } + GetDlgItem(IDC_APPLY_AFTER_DELAY)->SetWindowText(out); ((CButton *) GetDlgItem(IDC_AUTO_DELAY))->SetCheck(autoDelay ? 1 : 0); } diff --git a/code/nel/tools/3d/object_viewer/particle_workspace.cpp b/code/nel/tools/3d/object_viewer/particle_workspace.cpp index c94948d71..5c62dcb0d 100644 --- a/code/nel/tools/3d/object_viewer/particle_workspace.cpp +++ b/code/nel/tools/3d/object_viewer/particle_workspace.cpp @@ -386,6 +386,7 @@ CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filena { relativePath = resultPath; } + if (relativePath.size() >= 2) { if (relativePath[0] == '\\' && relativePath[1] != '\\') @@ -393,6 +394,7 @@ CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filena relativePath = relativePath.substr(1); } } + CNode *newNode = new CNode; newNode->init(this); newNode->setRelativePath(relativePath); diff --git a/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp b/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp index 42839e933..f54c723df 100644 --- a/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp @@ -199,12 +199,15 @@ void CSkeletonScaleDlg::setSkeletonToEdit(NL3D::CSkeletonModel *skel, const std { for(uint i=0;i<_SkeletonModel->Bones.size();i++) { - const std::string tabStr= " "; - std::string name= _SkeletonModel->Bones[i].getBoneName(); + const std::string tabStr = " "; + std::string name = _SkeletonModel->Bones[i].getBoneName(); + // append a tab for easy hierarchy - uint boneId= i; + uint boneId = i; + while((boneId=_SkeletonModel->Bones[boneId].getFatherId())!=-1) - name= tabStr + name; + name = tabStr + name; + // append to the list _BoneList.AddString(utf8ToTStr(name)); } @@ -1222,7 +1225,7 @@ void CSkeletonScaleDlg::OnSsdButtonSaveScale() return; // choose the file - std::string defaultFileName= _SkeletonFileName; + std::string defaultFileName = _SkeletonFileName; NLMISC::strFindReplace(defaultFileName, ".skel", ".scale"); CFileDialog fd(FALSE, _T("scale"), utf8ToTStr(defaultFileName), OFN_OVERWRITEPROMPT, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this) ; diff --git a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp index a8125f43b..8cbb869de 100644 --- a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp @@ -114,6 +114,7 @@ void CSnapshotToolDlg::stringFromRegistry(HKEY hKey, const TCHAR *name, CString DWORD type; DWORD size; LONG result = RegQueryValueEx(hKey, name, NULL, &type, NULL, &size); + if (type != REG_SZ || result != ERROR_SUCCESS || size == 0) { dest = defaultStr; @@ -144,18 +145,22 @@ template void integralTypeFromRegistry(HKEY hKey, const TCHAR DWORD type; DWORD size; LONG result = RegQueryValueEx(hKey, name, NULL, &type, NULL, &size); + if (type != REG_DWORD || result != ERROR_SUCCESS || size == 0) { dest = (T) defaultValue; return; } + DWORD value; result = RegQueryValueEx(hKey, name, NULL, &type, LPBYTE(&value), &size); + if (result != ERROR_SUCCESS) { dest = defaultValue; return; } + dest = (T) value; } @@ -175,6 +180,7 @@ void CSnapshotToolDlg::fromRegistry() NLMISC::splitString(tStrToUtf8(filters), ",", filterList); m_Filters.ResetContent(); + for (uint k = 0; k < filterList.size(); ++k) { m_Filters.AddString(utf8ToTStr(filterList[k])); @@ -431,7 +437,6 @@ void CSnapshotToolDlg::OnGo() } } - // make sure that the screen can contains the window client area RECT desktopSize; ::GetClientRect(::GetDesktopWindow(), &desktopSize); diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp index e7a82c878..a6d68c4f5 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp @@ -2372,11 +2372,13 @@ INT_PTR CALLBACK MiscDialogCallback ( currentParam->RemanenceShiftingTexture = SendMessage (GetDlgItem (hwndDlg, IDC_REMANENCE_SHIFTING_TEXTURE), BM_GETCHECK, 0, 0); GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), tmp, 512); + uint rsn; if (NLMISC::fromString(tStrToUtf8(tmp), rsn)) { currentParam->RemanenceSliceNumber = rsn; } + GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SAMPLING_PERIOD), tmp, 512); toFloatMax(tmp, currentParam->RemanenceSamplingPeriod); GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), tmp, 512); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp b/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp index 3bf145d6f..61b8de8e8 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp @@ -35,8 +35,8 @@ enum { po2rpo_params }; //TODO: Add enums for various parameters enum { pb_spin,}; -static ParamBlockDesc2 po2rpo_param_blk ( po2rpo_params, _T("params"), 0, &PO2RPODesc, - P_AUTO_CONSTRUCT + P_AUTO_UI, PBLOCK_REF, +static ParamBlockDesc2 po2rpo_param_blk ( po2rpo_params, _T("params"), 0, &PO2RPODesc, + P_AUTO_CONSTRUCT + P_AUTO_UI, PBLOCK_REF, //rollout IDD_PANEL, IDS_PARAMS, 0, 0, NULL, // params @@ -67,11 +67,11 @@ PO2RPO::~PO2RPO() Interval PO2RPO::LocalValidity(TimeValue t) { - // if being edited, return NEVER forces a cache to be built + // if being edited, return NEVER forces a cache to be built // after previous modifier. if (TestAFlag(A_MOD_BEING_EDITED)) { - return NEVER; + return NEVER; } //TODO: Return the validity interval of the modifier return NEVER; @@ -81,7 +81,7 @@ Interval PO2RPO::LocalValidity(TimeValue t) RefTargetHandle PO2RPO::Clone(RemapDir& remap) { - PO2RPO* newmod = new PO2RPO(); + PO2RPO* newmod = new PO2RPO(); //TODO: Add the cloning code here newmod->ReplaceReference(0,pblock->Clone(remap)); return(newmod); @@ -90,7 +90,7 @@ RefTargetHandle PO2RPO::Clone(RemapDir& remap) // ----------------------------------------------------------------------------------------------------------------------------------------------------------- static int done=0; -void PO2RPO::ModifyObject(TimeValue t, ModContext &mc, ObjectState * os, INode *node) +void PO2RPO::ModifyObject(TimeValue t, ModContext &mc, ObjectState * os, INode *node) { /* if (!done) @@ -121,12 +121,12 @@ void PO2RPO::ModifyObject(TimeValue t, ModContext &mc, ObjectState * os, INode * // ----------------------------------------------------------------------------------------------------------------------------------------------------------- extern HINSTANCE hInstance; -INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - switch (message) + switch (message) { // ----- - case WM_INITDIALOG: + case WM_INITDIALOG: { // Get the module path HMODULE hModule = hInstance; @@ -214,7 +214,7 @@ void PO2RPO::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev ) void PO2RPO::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next) { //PO2RPODesc.EndEditParams(ip, this, flags, next); - ip->DeleteRollupPage(hRollup); + ip->DeleteRollupPage(hRollup); this->ip = NULL; } @@ -230,21 +230,21 @@ RefResult PO2RPO::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,P // ----------------------------------------------------------------------------------------------------------------------------------------------------------- //From Object -BOOL PO2RPO::HasUVW() -{ +BOOL PO2RPO::HasUVW() +{ //TODO: Return whether the object has UVW coordinates or not - return TRUE; + return TRUE; } // ----------------------------------------------------------------------------------------------------------------------------------------------------------- -void PO2RPO::SetGenUVW(BOOL sw) -{ - if (sw==HasUVW()) +void PO2RPO::SetGenUVW(BOOL sw) +{ + if (sw==HasUVW()) { return; } - //TODO: Set the plugin internal value to sw + //TODO: Set the plugin internal value to sw } // ----------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h index d6c4bb522..f0ed9601c 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h @@ -435,6 +435,7 @@ public: CBankManager () { } + const NL3D::CTileBank& getBank (std::string& path=GetBankPathName ()) { if (path!=_lastPath) diff --git a/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp b/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp index c798f83e2..a024c962c 100644 --- a/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp +++ b/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp @@ -371,19 +371,19 @@ RefResult RGBAdd::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, case REFMSG_CHANGE: ivalid.SetEmpty(); if (hTarget == pblock) - { - // see if this message came from a changing parameter in the pblock, - // if so, limit rollout update to the changing item and update any active viewport texture + { + // see if this message came from a changing parameter in the pblock, + // if so, limit rollout update to the changing item and update any active viewport texture ParamID changing_param = pblock->LastNotifyParamID(); RGBAdd_param_blk.InvalidateUI(changing_param); - // notify our dependents that we've changed + // notify our dependents that we've changed // NotifyChanged(); //DS this is redundant - } + } break; - } - return(REF_SUCCEED); } + return(REF_SUCCEED); +} #define MTL_HDR_CHUNK 0x4000 diff --git a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp index 9a65e158f..37dca5ac9 100644 --- a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp +++ b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp @@ -29,7 +29,7 @@ extern HINSTANCE hInstance; using namespace NLMISC; using namespace NL3D; -class Tile_utility : public UtilityObj +class Tile_utility : public UtilityObj { public: HWND hPanel; @@ -44,8 +44,8 @@ public: void Init(HWND hWnd); void Destroy(HWND hWnd); - - void DeleteThis() { } + + void DeleteThis() { } void Load (const std::string& path); void SetLand (sint land); @@ -55,7 +55,7 @@ public: //Constructor/Destructor Tile_utility(); - ~Tile_utility(); + ~Tile_utility(); }; CTileBank Tile_utility::Bank; @@ -64,11 +64,11 @@ std::string Tile_utility::Path; static Tile_utility theTile_utility; -class Tile_utilityClassDesc:public ClassDesc2 +class Tile_utilityClassDesc:public ClassDesc2 { public: int IsPublic() {return 1;} - void * Create(BOOL loading = FALSE) + void * Create(BOOL loading = FALSE) { return &theTile_utility; } @@ -85,7 +85,7 @@ ClassDesc2* GetTile_utilityDesc() {return &Tile_utilityDesc;} static INT_PTR CALLBACK Tile_utilityDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) + switch (msg) { case WM_INITDIALOG: { @@ -159,12 +159,12 @@ static INT_PTR CALLBACK Tile_utilityDlgProc(HWND hWnd, UINT msg, WPARAM wParam, case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_MOUSEMOVE: - theTile_utility.ip->RollupMouseMessage(hWnd,msg,wParam,lParam); + theTile_utility.ip->RollupMouseMessage(hWnd,msg,wParam,lParam); break; case WM_COMMAND: { int id = LOWORD(wParam); - switch (id) + switch (id) { case IDC_BANK_PATH: { @@ -240,7 +240,7 @@ static INT_PTR CALLBACK Tile_utilityDlgProc(HWND hWnd, UINT msg, WPARAM wParam, Tile_utility::Tile_utility() { iu = NULL; - ip = NULL; + ip = NULL; hPanel = NULL; Bank.clear(); Land=0; @@ -252,7 +252,7 @@ Tile_utility::~Tile_utility() } -void Tile_utility::BeginEditParams(Interface *ip,IUtil *iu) +void Tile_utility::BeginEditParams(Interface *ip,IUtil *iu) { this->iu = iu; this->ip = ip; @@ -264,8 +264,8 @@ void Tile_utility::BeginEditParams(Interface *ip,IUtil *iu) 0); SetupUI (); } - -void Tile_utility::EndEditParams(Interface *ip,IUtil *iu) + +void Tile_utility::EndEditParams(Interface *ip,IUtil *iu) { this->iu = NULL; this->ip = NULL; @@ -319,7 +319,7 @@ void Tile_utility::SetLand (sint land) Land=0; SetBankTileSetSet (Land); } - + void Tile_utility::SetupUI () { // Clear combo box @@ -333,7 +333,7 @@ void Tile_utility::SetupUI () // Enable combo box if (Bank.getLandCount()) EnableWindow (hCombo, TRUE); - else + else EnableWindow (hCombo, FALSE); } diff --git a/code/nel/tools/3d/tile_edit/View.cpp b/code/nel/tools/3d/tile_edit/View.cpp index 354f1e51d..db4c52828 100644 --- a/code/nel/tools/3d/tile_edit/View.cpp +++ b/code/nel/tools/3d/tile_edit/View.cpp @@ -1296,6 +1296,7 @@ void CTView::DrawTile(tilelist::iterator i,CDC *pDC,int clear, int n) { Name = NLMISC::toString("%d", i->id); } + rect_txt.top = pt.y + sizetile_y + spacing_tile_text; rect_txt.bottom += rect_txt.top + sizetext_y; rect_txt.left -= spacing_x; diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp index 3f4c5edc9..d42b14eb8 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp @@ -154,13 +154,13 @@ void CGraphPlugin::refreshPrimitives() // ok, we find a good node try { - + IPrimitive *rootNode = missionTreeRoot; while (rootNode->getParent()) rootNode = rootNode->getParent(); string fileName = _PluginAccess->getRootFileName(rootNode); - + CMissionCompiler mc; mc.compileMission(missionTreeRoot, NLMISC::CFile::getFilename(fileName)); TMissionDataPtr md = mc.getMission(0); @@ -189,7 +189,7 @@ void CGraphPlugin::refreshPrimitives() AfxMessageBox(_T("BEWARE: the image couldn't be loaded.")); } - while (missionTreeRoot->getParent()!=NULL) + while (missionTreeRoot->getParent()!=NULL) { missionTreeRoot=missionTreeRoot->getParent(); } @@ -201,10 +201,10 @@ void CGraphPlugin::refreshPrimitives() if (e.Primitive != NULL) { string primName; - + vectSel.push_back(e.Primitive); e.Primitive->getPropertyByName("name", primName); - + err = toString("%s : %s", primName.c_str(), e.Why.c_str()); } AfxMessageBox(utf8ToTStr(err)); @@ -216,7 +216,7 @@ void CGraphPlugin::refreshPrimitives() } else { - refreshMachine(); + refreshMachine(); } if(vectSel.size()>0) @@ -244,8 +244,8 @@ void CGraphPlugin::refreshMachine() if ((predFolder(missionTreeRoot))|| ((missionTreeRoot=getPrimitiveParent((*first),predFolder))!=NULL)) { - - + + string dot = generateDotScript(missionTreeRoot); string tmpPath = string(::getenv("TEMP")); @@ -270,17 +270,17 @@ void CGraphPlugin::refreshMachine() if(!createBitmap(tmpPath)) AfxMessageBox(_T("BEWARE: the image couldn't be loaded.")); } - - while (missionTreeRoot->getParent()!=NULL) + + while (missionTreeRoot->getParent()!=NULL) { missionTreeRoot=missionTreeRoot->getParent(); } _rootFileName=_PluginAccess->getRootFileName(missionTreeRoot); - + } - else + else { list::const_iterator first(selection.begin()), last(selection.end()),curIte; IPrimitive* missionTreeRoot=(*first); @@ -288,8 +288,8 @@ void CGraphPlugin::refreshMachine() if ((predManager(missionTreeRoot))|| ((missionTreeRoot=getPrimitiveParent((*first),predManager))!=NULL)) { - - + + string dot = generateDotScript(missionTreeRoot); string tmpPath = string(::getenv("TEMP")); @@ -315,7 +315,7 @@ void CGraphPlugin::refreshMachine() AfxMessageBox(_T("BEWARE: the image couldn't be loaded.")); } - while (missionTreeRoot->getParent()!=NULL) + while (missionTreeRoot->getParent()!=NULL) { missionTreeRoot=missionTreeRoot->getParent(); } @@ -327,10 +327,10 @@ void CGraphPlugin::refreshMachine() } } - - + + } ////////////////////////////////////////////////////////////////////////// @@ -342,7 +342,7 @@ string CGraphPlugin::spaceTo_(string strInput) explode(strInput,string(" "),strTmp); if (strTmp.size()>1) { - + for(uint i=0;i strTmpTmp; @@ -394,10 +394,10 @@ string CGraphPlugin::createNode(IPrimitive* managerNode,string strPredicate,uin ret += NL ; ret += "}" ; ret += NL; - + } - + numClusters+=resSet.size(); return ret; } @@ -433,13 +433,13 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica ret += parseStateMachine(resSet[i],spaceTo_(strName),string(""),string("_")+spaceTo_(strName)); ret += "}" ; ret += NL; - + } for (uint i=0; igetPropertyByName("name",strName); - + TPrimitiveClassPredicate predJump("npc_event_handler_action"); TPrimitiveSet resJump; offsprings.buildSet(resSet[i],predJump,resJump); @@ -460,7 +460,7 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica if(primTail) primTail->getPropertyByName("name", labelTail); } - + vector *jumpDest; resJump[j]->getPropertyByName("action",strAction); if (strAction.compare(string("begin_state"))==0) @@ -471,7 +471,7 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica ret +=spaceTo_(jumpDest->at(0)); ret +="[label="; ret +=spaceTo_(labelTail); - ret +="]"; + ret +="]"; ret += ";" ; ret += NL; } @@ -479,7 +479,7 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica { vector* jumpDest; string strTmpTmpName; - + resJump[j]->getPropertyByName("parameters",jumpDest); resJump[j]->getPropertyByName("name",strTmpTmpName); @@ -496,13 +496,13 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica ret +="_"; ret += spaceTo_(strName) ; ret +="->"; - + vector resJump; explode(jumpDest->at(k)," ",resJump); ret +=resJump[1]; ret+= ";"; ret+=NL; - + } }*/ if (strAction.compare(string("punctual_state"))==0) @@ -513,7 +513,7 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica ret +=spaceTo_(jumpDest->at(0)); ret +="[label="; ret +=spaceTo_(labelTail); - ret +="]"; + ret +="]"; ret += ";" ; ret += NL; ret +=spaceTo_(jumpDest->at(0)); @@ -521,12 +521,12 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica ret += strName ; ret +="[label="; ret +=spaceTo_(labelTail); - ret +="]"; + ret +="]"; ret += ";" ; ret += NL; } } - + } numClusters+=resSet.size(); return ret; @@ -573,17 +573,17 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em uint numChild=currentNode->getNumChildren(); for(uint i=0;igetChild(child,i); child->getPropertyByName("class",strClassName); child->getPropertyByName("name",strName); child->getPropertyByName("action",strAction); - + if (strClassName.compare(string("npc_group"))==0) { child->getPropertyByName("name",strName); - + ret+=spaceTo_(strName); ret+=tag; ret += " [URL=\""+buildPrimPath(child)+"\"];"+NL; @@ -670,7 +670,7 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em ret+=tag; first=true; } - + } ret+="}"; ret+='"'; @@ -704,7 +704,7 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em && (strClassName.compare("random_select_state")==0)) { vector* jumpDest; - child->getPropertyByName("parameters",jumpDest); + child->getPropertyByName("parameters",jumpDest); for(uint k=0;ksize();k++) { ret+=spaceTo_(strName); @@ -712,10 +712,10 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em ret+="->"; ret +=spaceTo_(jumpDest->at(k)); ret+= ";"; - ret+=NL; + ret+=NL; } } - + } ret+=NL; } @@ -745,7 +745,7 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em vector* jumpDest; bool first=true; child->getPropertyByName("parameters",jumpDest); - + ret += spaceTo_(strName) ; ret +="_"; ret += emiterNode; @@ -769,7 +769,7 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em ret +=resJump[1]; ret+= ";"; ret+=NL; - + } ret+=emiterNode; ret += "->"; @@ -782,11 +782,11 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em else { ret+=parseStateMachine(child,emiterNode,tailLabel,tag); - + } - - - } + + + } currentNode->getPropertyByName("class",strClassName); currentNode->getPropertyByName("name",strName); currentNode->getPropertyByName("action",strAction); @@ -816,7 +816,7 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em ret+=NL; } return ret; - + } bool CGraphPlugin::createBitmap (const string &tmpPath) @@ -831,10 +831,10 @@ bool CGraphPlugin::createBitmap (const string &tmpPath) } WORD retour; - - if(retour=bitmap.load(pngLocation)) - { - + + if(retour=bitmap.load(pngLocation)) + { + HBITMAP &_Hbmp=GraphDlg->_Hbmp; HBITMAP &_Hdib=GraphDlg->_Hdib; @@ -842,7 +842,7 @@ bool CGraphPlugin::createBitmap (const string &tmpPath) BITMAPINFO &_DibBitmapInfo=GraphDlg->_DibBitmapInfo;; uint8* &_DibBits=GraphDlg->_DibBits; - + _DibBitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFO); _DibBitmapInfo.bmiHeader.biWidth = bitmap.getWidth(); _DibBitmapInfo.bmiHeader.biHeight = bitmap.getHeight(); @@ -857,8 +857,8 @@ bool CGraphPlugin::createBitmap (const string &tmpPath) // Create the bitmap HWND desktop = ::GetDesktopWindow(); - HDC dc = ::GetDC (desktop); - + HDC dc = ::GetDC (desktop); + nlverify(_Hdib = CreateDIBSection(dc, &_DibBitmapInfo, DIB_RGB_COLORS, (void**)&_DibBits, NULL, 0)); @@ -920,7 +920,6 @@ void CGraphPlugin::unsetDlgGraph() _PluginActive=false; } - void CGraphPlugin::doSelection(const string& primPath) { IPrimitive *rootNode; @@ -930,7 +929,7 @@ void CGraphPlugin::doSelection(const string& primPath) if(_PluginAccess->getCurrentSelection().size()>0) { - + try { rootNode=(IPrimitive*)_PluginAccess->getRootNode(_rootFileName); diff --git a/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp index e7e9c99c0..a8088aded 100644 --- a/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp +++ b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp @@ -89,8 +89,10 @@ MissionCompilerMainWindow::MissionCompilerMainWindow(QWidget *parent) : settings->endGroup(); NLLIGO::Register(); + // TODO try/catch exception. Crashes if path invalid. - try{ + try + { m_ligoConfig.readPrimitiveClass(NLMISC::CPath::lookup("world_editor_classes.xml").c_str(), false); } catch(const NLMISC::Exception &e)