Changed: Minor changes

--HG--
branch : develop
feature/pipeline-tools
kervala 8 years ago
parent 5f5483a672
commit b17da91efd

@ -1120,8 +1120,6 @@ void CPSConstraintMesh::getShapesNames(std::string *shapesNames) const
#endif #endif
} }
//==================================================================================== //====================================================================================
void CPSConstraintMesh::setShape(uint index, const std::string &shapeName) void CPSConstraintMesh::setShape(uint index, const std::string &shapeName)
{ {
@ -1132,7 +1130,6 @@ void CPSConstraintMesh::setShape(uint index, const std::string &shapeName)
_ValidBuild = 0; _ValidBuild = 0;
} }
//==================================================================================== //====================================================================================
const std::string &CPSConstraintMesh::getShape(uint index) const const std::string &CPSConstraintMesh::getShape(uint index) const
{ {

@ -4,17 +4,17 @@ ADD_LIBRARY(ligoscape_utility SHARED ligoscape_utility.rc ${SRC} ligoscape_utili
INCLUDE_DIRECTORIES(${MAXSDK_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${MAXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(ligoscape_utility TARGET_LINK_LIBRARIES(ligoscape_utility
nelmisc nelmisc
nelligo nelligo
nel3d nel3d
nelpacs nelpacs
${MAXSDK_LIBRARIES} ${MAXSDK_LIBRARIES}
nel_patch_lib nel_patch_lib
nel_mesh_lib nel_mesh_lib
nel_3dsmax_shared nel_3dsmax_shared
comctl32) comctl32)
SET_TARGET_PROPERTIES(ligoscape_utility PROPERTIES SUFFIX ".dlx") SET_TARGET_PROPERTIES(ligoscape_utility PROPERTIES SUFFIX ".dlx")
NL_DEFAULT_PROPS(ligoscape_utility "MAX Plugin: Ligoscape Utility") NL_DEFAULT_PROPS(ligoscape_utility "MAX Plugin: Ligoscape Utility")
NL_ADD_RUNTIME_FLAGS(ligoscape_utility) NL_ADD_RUNTIME_FLAGS(ligoscape_utility)

@ -88,7 +88,7 @@ BOOL CAboutDialog::OnInitDialog()
} }
} }
} }
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE // EXCEPTION: OCX Property Pages should return FALSE
} }

@ -287,6 +287,7 @@ void CAnimationSetDlg::refresh (BOOL update)
// Keyframer ? // Keyframer ?
UTrackKeyframer *keyTrack=dynamic_cast<UTrackKeyframer *>(track); UTrackKeyframer *keyTrack=dynamic_cast<UTrackKeyframer *>(track);
if (keyTrack) if (keyTrack)
{ {
// Get number of keys // Get number of keys
@ -316,7 +317,7 @@ void CAnimationSetDlg::refresh (BOOL update)
std::string name = NLMISC::CFile::getFilenameWithoutExtension(object->Saved.SWTFileName[i]); std::string name = NLMISC::CFile::getFilenameWithoutExtension(object->Saved.SWTFileName[i]);
// Get the animation pointer // 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 // Insert an intem
HTREEITEM item=SkelTree.InsertItem(utf8ToTStr(name)); HTREEITEM item=SkelTree.InsertItem(utf8ToTStr(name));

@ -104,8 +104,8 @@ public:
// SchemeWrapper[k].S reference the atriobute maker being edited // SchemeWrapper[k].S reference the atriobute maker being edited
if (_EditedScheme->supportOp( (NL3D::CPSBinOp::BinOp) k)) if (_EditedScheme->supportOp( (NL3D::CPSBinOp::BinOp) k))
{ {
sint index = m_BinOp.AddString(ops[k]) ; sint index = m_BinOp.AddString(ops[k]);
m_BinOp.SetItemData(index, k) ; m_BinOp.SetItemData(index, k);
if ((uint) _EditedScheme->getOp() == k) if ((uint) _EditedScheme->getOp() == k)
{ {
m_BinOp.SetCurSel(k) ; m_BinOp.SetCurSel(k) ;

@ -185,7 +185,6 @@ BOOL CLocatedTargetDlg::OnInitDialog()
} }
} }
const sint posX = 5; const sint posX = 5;
sint posY = 180; sint posY = 180;

@ -111,8 +111,10 @@ void CMeshDlg::OnBrowseShape()
{ {
MessageBox(utf8ToTStr(e.what()), _T("shape loading error")); MessageBox(utf8ToTStr(e.what()), _T("shape loading error"));
} }
updateMeshErrorString(); updateMeshErrorString();
} }
UpdateData(FALSE); UpdateData(FALSE);
} }

@ -220,6 +220,7 @@ void CParticleSystemEdit::updateDieOnEventParams()
{ {
ew = FALSE; ew = FALSE;
} }
GetDlgItem(IDC_APPLY_AFTER_DELAY)->EnableWindow(ew); GetDlgItem(IDC_APPLY_AFTER_DELAY)->EnableWindow(ew);
CString out; CString out;
@ -232,6 +233,7 @@ void CParticleSystemEdit::updateDieOnEventParams()
{ {
out = _T("???"); out = _T("???");
} }
GetDlgItem(IDC_APPLY_AFTER_DELAY)->SetWindowText(out); GetDlgItem(IDC_APPLY_AFTER_DELAY)->SetWindowText(out);
((CButton *) GetDlgItem(IDC_AUTO_DELAY))->SetCheck(autoDelay ? 1 : 0); ((CButton *) GetDlgItem(IDC_AUTO_DELAY))->SetCheck(autoDelay ? 1 : 0);
} }

@ -386,6 +386,7 @@ CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filena
{ {
relativePath = resultPath; relativePath = resultPath;
} }
if (relativePath.size() >= 2) if (relativePath.size() >= 2)
{ {
if (relativePath[0] == '\\' && relativePath[1] != '\\') if (relativePath[0] == '\\' && relativePath[1] != '\\')
@ -393,6 +394,7 @@ CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filena
relativePath = relativePath.substr(1); relativePath = relativePath.substr(1);
} }
} }
CNode *newNode = new CNode; CNode *newNode = new CNode;
newNode->init(this); newNode->init(this);
newNode->setRelativePath(relativePath); newNode->setRelativePath(relativePath);

@ -199,12 +199,15 @@ void CSkeletonScaleDlg::setSkeletonToEdit(NL3D::CSkeletonModel *skel, const std
{ {
for(uint i=0;i<_SkeletonModel->Bones.size();i++) for(uint i=0;i<_SkeletonModel->Bones.size();i++)
{ {
const std::string tabStr= " "; const std::string tabStr = " ";
std::string name= _SkeletonModel->Bones[i].getBoneName(); std::string name = _SkeletonModel->Bones[i].getBoneName();
// append a tab for easy hierarchy // append a tab for easy hierarchy
uint boneId= i; uint boneId = i;
while((boneId=_SkeletonModel->Bones[boneId].getFatherId())!=-1) while((boneId=_SkeletonModel->Bones[boneId].getFatherId())!=-1)
name= tabStr + name; name = tabStr + name;
// append to the list // append to the list
_BoneList.AddString(utf8ToTStr(name)); _BoneList.AddString(utf8ToTStr(name));
} }
@ -1222,7 +1225,7 @@ void CSkeletonScaleDlg::OnSsdButtonSaveScale()
return; return;
// choose the file // choose the file
std::string defaultFileName= _SkeletonFileName; std::string defaultFileName = _SkeletonFileName;
NLMISC::strFindReplace(defaultFileName, ".skel", ".scale"); NLMISC::strFindReplace(defaultFileName, ".skel", ".scale");
CFileDialog fd(FALSE, _T("scale"), utf8ToTStr(defaultFileName), OFN_OVERWRITEPROMPT, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this) ; CFileDialog fd(FALSE, _T("scale"), utf8ToTStr(defaultFileName), OFN_OVERWRITEPROMPT, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this) ;

@ -114,6 +114,7 @@ void CSnapshotToolDlg::stringFromRegistry(HKEY hKey, const TCHAR *name, CString
DWORD type; DWORD type;
DWORD size; DWORD size;
LONG result = RegQueryValueEx(hKey, name, NULL, &type, NULL, &size); LONG result = RegQueryValueEx(hKey, name, NULL, &type, NULL, &size);
if (type != REG_SZ || result != ERROR_SUCCESS || size == 0) if (type != REG_SZ || result != ERROR_SUCCESS || size == 0)
{ {
dest = defaultStr; dest = defaultStr;
@ -144,18 +145,22 @@ template <class T, class U> void integralTypeFromRegistry(HKEY hKey, const TCHAR
DWORD type; DWORD type;
DWORD size; DWORD size;
LONG result = RegQueryValueEx(hKey, name, NULL, &type, NULL, &size); LONG result = RegQueryValueEx(hKey, name, NULL, &type, NULL, &size);
if (type != REG_DWORD || result != ERROR_SUCCESS || size == 0) if (type != REG_DWORD || result != ERROR_SUCCESS || size == 0)
{ {
dest = (T) defaultValue; dest = (T) defaultValue;
return; return;
} }
DWORD value; DWORD value;
result = RegQueryValueEx(hKey, name, NULL, &type, LPBYTE(&value), &size); result = RegQueryValueEx(hKey, name, NULL, &type, LPBYTE(&value), &size);
if (result != ERROR_SUCCESS) if (result != ERROR_SUCCESS)
{ {
dest = defaultValue; dest = defaultValue;
return; return;
} }
dest = (T) value; dest = (T) value;
} }
@ -175,6 +180,7 @@ void CSnapshotToolDlg::fromRegistry()
NLMISC::splitString(tStrToUtf8(filters), ",", filterList); NLMISC::splitString(tStrToUtf8(filters), ",", filterList);
m_Filters.ResetContent(); m_Filters.ResetContent();
for (uint k = 0; k < filterList.size(); ++k) for (uint k = 0; k < filterList.size(); ++k)
{ {
m_Filters.AddString(utf8ToTStr(filterList[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 // make sure that the screen can contains the window client area
RECT desktopSize; RECT desktopSize;
::GetClientRect(::GetDesktopWindow(), &desktopSize); ::GetClientRect(::GetDesktopWindow(), &desktopSize);

@ -2372,11 +2372,13 @@ INT_PTR CALLBACK MiscDialogCallback (
currentParam->RemanenceShiftingTexture = SendMessage (GetDlgItem (hwndDlg, IDC_REMANENCE_SHIFTING_TEXTURE), BM_GETCHECK, 0, 0); currentParam->RemanenceShiftingTexture = SendMessage (GetDlgItem (hwndDlg, IDC_REMANENCE_SHIFTING_TEXTURE), BM_GETCHECK, 0, 0);
GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), tmp, 512);
uint rsn; uint rsn;
if (NLMISC::fromString(tStrToUtf8(tmp), rsn)) if (NLMISC::fromString(tStrToUtf8(tmp), rsn))
{ {
currentParam->RemanenceSliceNumber = rsn; currentParam->RemanenceSliceNumber = rsn;
} }
GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SAMPLING_PERIOD), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SAMPLING_PERIOD), tmp, 512);
toFloatMax(tmp, currentParam->RemanenceSamplingPeriod); toFloatMax(tmp, currentParam->RemanenceSamplingPeriod);
GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), tmp, 512);

@ -35,8 +35,8 @@ enum { po2rpo_params };
//TODO: Add enums for various parameters //TODO: Add enums for various parameters
enum { pb_spin,}; enum { pb_spin,};
static ParamBlockDesc2 po2rpo_param_blk ( po2rpo_params, _T("params"), 0, &PO2RPODesc, static ParamBlockDesc2 po2rpo_param_blk ( po2rpo_params, _T("params"), 0, &PO2RPODesc,
P_AUTO_CONSTRUCT + P_AUTO_UI, PBLOCK_REF, P_AUTO_CONSTRUCT + P_AUTO_UI, PBLOCK_REF,
//rollout //rollout
IDD_PANEL, IDS_PARAMS, 0, 0, NULL, IDD_PANEL, IDS_PARAMS, 0, 0, NULL,
// params // params
@ -67,11 +67,11 @@ PO2RPO::~PO2RPO()
Interval PO2RPO::LocalValidity(TimeValue t) 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. // after previous modifier.
if (TestAFlag(A_MOD_BEING_EDITED)) if (TestAFlag(A_MOD_BEING_EDITED))
{ {
return NEVER; return NEVER;
} }
//TODO: Return the validity interval of the modifier //TODO: Return the validity interval of the modifier
return NEVER; return NEVER;
@ -81,7 +81,7 @@ Interval PO2RPO::LocalValidity(TimeValue t)
RefTargetHandle PO2RPO::Clone(RemapDir& remap) RefTargetHandle PO2RPO::Clone(RemapDir& remap)
{ {
PO2RPO* newmod = new PO2RPO(); PO2RPO* newmod = new PO2RPO();
//TODO: Add the cloning code here //TODO: Add the cloning code here
newmod->ReplaceReference(0,pblock->Clone(remap)); newmod->ReplaceReference(0,pblock->Clone(remap));
return(newmod); return(newmod);
@ -90,7 +90,7 @@ RefTargetHandle PO2RPO::Clone(RemapDir& remap)
// ----------------------------------------------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------------------------------------------
static int done=0; 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) if (!done)
@ -121,12 +121,12 @@ void PO2RPO::ModifyObject(TimeValue t, ModContext &mc, ObjectState * os, INode *
// ----------------------------------------------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------------------------------------------
extern HINSTANCE hInstance; 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 // Get the module path
HMODULE hModule = hInstance; 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) void PO2RPO::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next)
{ {
//PO2RPODesc.EndEditParams(ip, this, flags, next); //PO2RPODesc.EndEditParams(ip, this, flags, next);
ip->DeleteRollupPage(hRollup); ip->DeleteRollupPage(hRollup);
this->ip = NULL; this->ip = NULL;
} }
@ -230,21 +230,21 @@ RefResult PO2RPO::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,P
// ----------------------------------------------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------------------------------------------
//From Object //From Object
BOOL PO2RPO::HasUVW() BOOL PO2RPO::HasUVW()
{ {
//TODO: Return whether the object has UVW coordinates or not //TODO: Return whether the object has UVW coordinates or not
return TRUE; return TRUE;
} }
// ----------------------------------------------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------------------------------------------
void PO2RPO::SetGenUVW(BOOL sw) void PO2RPO::SetGenUVW(BOOL sw)
{ {
if (sw==HasUVW()) if (sw==HasUVW())
{ {
return; return;
} }
//TODO: Set the plugin internal value to sw //TODO: Set the plugin internal value to sw
} }
// ----------------------------------------------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------------------------------------------

@ -435,6 +435,7 @@ public:
CBankManager () CBankManager ()
{ {
} }
const NL3D::CTileBank& getBank (std::string& path=GetBankPathName ()) const NL3D::CTileBank& getBank (std::string& path=GetBankPathName ())
{ {
if (path!=_lastPath) if (path!=_lastPath)

@ -371,19 +371,19 @@ RefResult RGBAdd::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
case REFMSG_CHANGE: case REFMSG_CHANGE:
ivalid.SetEmpty(); ivalid.SetEmpty();
if (hTarget == pblock) if (hTarget == pblock)
{ {
// see if this message came from a changing parameter in the 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 // if so, limit rollout update to the changing item and update any active viewport texture
ParamID changing_param = pblock->LastNotifyParamID(); ParamID changing_param = pblock->LastNotifyParamID();
RGBAdd_param_blk.InvalidateUI(changing_param); 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 // NotifyChanged(); //DS this is redundant
} }
break; break;
}
return(REF_SUCCEED);
} }
return(REF_SUCCEED);
}
#define MTL_HDR_CHUNK 0x4000 #define MTL_HDR_CHUNK 0x4000

@ -29,7 +29,7 @@ extern HINSTANCE hInstance;
using namespace NLMISC; using namespace NLMISC;
using namespace NL3D; using namespace NL3D;
class Tile_utility : public UtilityObj class Tile_utility : public UtilityObj
{ {
public: public:
HWND hPanel; HWND hPanel;
@ -44,8 +44,8 @@ public:
void Init(HWND hWnd); void Init(HWND hWnd);
void Destroy(HWND hWnd); void Destroy(HWND hWnd);
void DeleteThis() { } void DeleteThis() { }
void Load (const std::string& path); void Load (const std::string& path);
void SetLand (sint land); void SetLand (sint land);
@ -55,7 +55,7 @@ public:
//Constructor/Destructor //Constructor/Destructor
Tile_utility(); Tile_utility();
~Tile_utility(); ~Tile_utility();
}; };
CTileBank Tile_utility::Bank; CTileBank Tile_utility::Bank;
@ -64,11 +64,11 @@ std::string Tile_utility::Path;
static Tile_utility theTile_utility; static Tile_utility theTile_utility;
class Tile_utilityClassDesc:public ClassDesc2 class Tile_utilityClassDesc:public ClassDesc2
{ {
public: public:
int IsPublic() {return 1;} int IsPublic() {return 1;}
void * Create(BOOL loading = FALSE) void * Create(BOOL loading = FALSE)
{ {
return &theTile_utility; 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) static INT_PTR CALLBACK Tile_utilityDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
switch (msg) switch (msg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
@ -159,12 +159,12 @@ static INT_PTR CALLBACK Tile_utilityDlgProc(HWND hWnd, UINT msg, WPARAM wParam,
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_LBUTTONUP: case WM_LBUTTONUP:
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
theTile_utility.ip->RollupMouseMessage(hWnd,msg,wParam,lParam); theTile_utility.ip->RollupMouseMessage(hWnd,msg,wParam,lParam);
break; break;
case WM_COMMAND: case WM_COMMAND:
{ {
int id = LOWORD(wParam); int id = LOWORD(wParam);
switch (id) switch (id)
{ {
case IDC_BANK_PATH: case IDC_BANK_PATH:
{ {
@ -240,7 +240,7 @@ static INT_PTR CALLBACK Tile_utilityDlgProc(HWND hWnd, UINT msg, WPARAM wParam,
Tile_utility::Tile_utility() Tile_utility::Tile_utility()
{ {
iu = NULL; iu = NULL;
ip = NULL; ip = NULL;
hPanel = NULL; hPanel = NULL;
Bank.clear(); Bank.clear();
Land=0; 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->iu = iu;
this->ip = ip; this->ip = ip;
@ -264,8 +264,8 @@ void Tile_utility::BeginEditParams(Interface *ip,IUtil *iu)
0); 0);
SetupUI (); SetupUI ();
} }
void Tile_utility::EndEditParams(Interface *ip,IUtil *iu) void Tile_utility::EndEditParams(Interface *ip,IUtil *iu)
{ {
this->iu = NULL; this->iu = NULL;
this->ip = NULL; this->ip = NULL;
@ -319,7 +319,7 @@ void Tile_utility::SetLand (sint land)
Land=0; Land=0;
SetBankTileSetSet (Land); SetBankTileSetSet (Land);
} }
void Tile_utility::SetupUI () void Tile_utility::SetupUI ()
{ {
// Clear combo box // Clear combo box
@ -333,7 +333,7 @@ void Tile_utility::SetupUI ()
// Enable combo box // Enable combo box
if (Bank.getLandCount()) if (Bank.getLandCount())
EnableWindow (hCombo, TRUE); EnableWindow (hCombo, TRUE);
else else
EnableWindow (hCombo, FALSE); EnableWindow (hCombo, FALSE);
} }

@ -1296,6 +1296,7 @@ void CTView::DrawTile(tilelist::iterator i,CDC *pDC,int clear, int n)
{ {
Name = NLMISC::toString("%d", i->id); Name = NLMISC::toString("%d", i->id);
} }
rect_txt.top = pt.y + sizetile_y + spacing_tile_text; rect_txt.top = pt.y + sizetile_y + spacing_tile_text;
rect_txt.bottom += rect_txt.top + sizetext_y; rect_txt.bottom += rect_txt.top + sizetext_y;
rect_txt.left -= spacing_x; rect_txt.left -= spacing_x;

@ -154,13 +154,13 @@ void CGraphPlugin::refreshPrimitives()
// ok, we find a good node // ok, we find a good node
try try
{ {
IPrimitive *rootNode = missionTreeRoot; IPrimitive *rootNode = missionTreeRoot;
while (rootNode->getParent()) while (rootNode->getParent())
rootNode = rootNode->getParent(); rootNode = rootNode->getParent();
string fileName = _PluginAccess->getRootFileName(rootNode); string fileName = _PluginAccess->getRootFileName(rootNode);
CMissionCompiler mc; CMissionCompiler mc;
mc.compileMission(missionTreeRoot, NLMISC::CFile::getFilename(fileName)); mc.compileMission(missionTreeRoot, NLMISC::CFile::getFilename(fileName));
TMissionDataPtr md = mc.getMission(0); TMissionDataPtr md = mc.getMission(0);
@ -189,7 +189,7 @@ void CGraphPlugin::refreshPrimitives()
AfxMessageBox(_T("BEWARE: the image couldn't be loaded.")); AfxMessageBox(_T("BEWARE: the image couldn't be loaded."));
} }
while (missionTreeRoot->getParent()!=NULL) while (missionTreeRoot->getParent()!=NULL)
{ {
missionTreeRoot=missionTreeRoot->getParent(); missionTreeRoot=missionTreeRoot->getParent();
} }
@ -201,10 +201,10 @@ void CGraphPlugin::refreshPrimitives()
if (e.Primitive != NULL) if (e.Primitive != NULL)
{ {
string primName; string primName;
vectSel.push_back(e.Primitive); vectSel.push_back(e.Primitive);
e.Primitive->getPropertyByName("name", primName); e.Primitive->getPropertyByName("name", primName);
err = toString("%s : %s", primName.c_str(), e.Why.c_str()); err = toString("%s : %s", primName.c_str(), e.Why.c_str());
} }
AfxMessageBox(utf8ToTStr(err)); AfxMessageBox(utf8ToTStr(err));
@ -216,7 +216,7 @@ void CGraphPlugin::refreshPrimitives()
} }
else else
{ {
refreshMachine(); refreshMachine();
} }
if(vectSel.size()>0) if(vectSel.size()>0)
@ -244,8 +244,8 @@ void CGraphPlugin::refreshMachine()
if ((predFolder(missionTreeRoot))|| if ((predFolder(missionTreeRoot))||
((missionTreeRoot=getPrimitiveParent((*first),predFolder))!=NULL)) ((missionTreeRoot=getPrimitiveParent((*first),predFolder))!=NULL))
{ {
string dot = generateDotScript(missionTreeRoot); string dot = generateDotScript(missionTreeRoot);
string tmpPath = string(::getenv("TEMP")); string tmpPath = string(::getenv("TEMP"));
@ -270,17 +270,17 @@ void CGraphPlugin::refreshMachine()
if(!createBitmap(tmpPath)) if(!createBitmap(tmpPath))
AfxMessageBox(_T("BEWARE: the image couldn't be loaded.")); AfxMessageBox(_T("BEWARE: the image couldn't be loaded."));
} }
while (missionTreeRoot->getParent()!=NULL) while (missionTreeRoot->getParent()!=NULL)
{ {
missionTreeRoot=missionTreeRoot->getParent(); missionTreeRoot=missionTreeRoot->getParent();
} }
_rootFileName=_PluginAccess->getRootFileName(missionTreeRoot); _rootFileName=_PluginAccess->getRootFileName(missionTreeRoot);
} }
else else
{ {
list<IPrimitive*>::const_iterator first(selection.begin()), last(selection.end()),curIte; list<IPrimitive*>::const_iterator first(selection.begin()), last(selection.end()),curIte;
IPrimitive* missionTreeRoot=(*first); IPrimitive* missionTreeRoot=(*first);
@ -288,8 +288,8 @@ void CGraphPlugin::refreshMachine()
if ((predManager(missionTreeRoot))|| if ((predManager(missionTreeRoot))||
((missionTreeRoot=getPrimitiveParent((*first),predManager))!=NULL)) ((missionTreeRoot=getPrimitiveParent((*first),predManager))!=NULL))
{ {
string dot = generateDotScript(missionTreeRoot); string dot = generateDotScript(missionTreeRoot);
string tmpPath = string(::getenv("TEMP")); string tmpPath = string(::getenv("TEMP"));
@ -315,7 +315,7 @@ void CGraphPlugin::refreshMachine()
AfxMessageBox(_T("BEWARE: the image couldn't be loaded.")); AfxMessageBox(_T("BEWARE: the image couldn't be loaded."));
} }
while (missionTreeRoot->getParent()!=NULL) while (missionTreeRoot->getParent()!=NULL)
{ {
missionTreeRoot=missionTreeRoot->getParent(); missionTreeRoot=missionTreeRoot->getParent();
} }
@ -327,10 +327,10 @@ void CGraphPlugin::refreshMachine()
} }
} }
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -342,7 +342,7 @@ string CGraphPlugin::spaceTo_(string strInput)
explode(strInput,string(" "),strTmp); explode(strInput,string(" "),strTmp);
if (strTmp.size()>1) if (strTmp.size()>1)
{ {
for(uint i=0;i<strTmp.size();i++) for(uint i=0;i<strTmp.size();i++)
{ {
vector<string> strTmpTmp; vector<string> strTmpTmp;
@ -394,10 +394,10 @@ string CGraphPlugin::createNode(IPrimitive* managerNode,string strPredicate,uin
ret += NL ; ret += NL ;
ret += "}" ; ret += "}" ;
ret += NL; ret += NL;
} }
numClusters+=resSet.size(); numClusters+=resSet.size();
return ret; return ret;
} }
@ -433,13 +433,13 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica
ret += parseStateMachine(resSet[i],spaceTo_(strName),string(""),string("_")+spaceTo_(strName)); ret += parseStateMachine(resSet[i],spaceTo_(strName),string(""),string("_")+spaceTo_(strName));
ret += "}" ; ret += "}" ;
ret += NL; ret += NL;
} }
for (uint i=0; i<resSet.size(); ++i) for (uint i=0; i<resSet.size(); ++i)
{ {
string strName; string strName;
resSet[i]->getPropertyByName("name",strName); resSet[i]->getPropertyByName("name",strName);
TPrimitiveClassPredicate predJump("npc_event_handler_action"); TPrimitiveClassPredicate predJump("npc_event_handler_action");
TPrimitiveSet resJump; TPrimitiveSet resJump;
offsprings.buildSet(resSet[i],predJump,resJump); offsprings.buildSet(resSet[i],predJump,resJump);
@ -460,7 +460,7 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica
if(primTail) if(primTail)
primTail->getPropertyByName("name", labelTail); primTail->getPropertyByName("name", labelTail);
} }
vector<string> *jumpDest; vector<string> *jumpDest;
resJump[j]->getPropertyByName("action",strAction); resJump[j]->getPropertyByName("action",strAction);
if (strAction.compare(string("begin_state"))==0) if (strAction.compare(string("begin_state"))==0)
@ -471,7 +471,7 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica
ret +=spaceTo_(jumpDest->at(0)); ret +=spaceTo_(jumpDest->at(0));
ret +="[label="; ret +="[label=";
ret +=spaceTo_(labelTail); ret +=spaceTo_(labelTail);
ret +="]"; ret +="]";
ret += ";" ; ret += ";" ;
ret += NL; ret += NL;
} }
@ -479,7 +479,7 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica
{ {
vector<string>* jumpDest; vector<string>* jumpDest;
string strTmpTmpName; string strTmpTmpName;
resJump[j]->getPropertyByName("parameters",jumpDest); resJump[j]->getPropertyByName("parameters",jumpDest);
resJump[j]->getPropertyByName("name",strTmpTmpName); resJump[j]->getPropertyByName("name",strTmpTmpName);
@ -496,13 +496,13 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica
ret +="_"; ret +="_";
ret += spaceTo_(strName) ; ret += spaceTo_(strName) ;
ret +="->"; ret +="->";
vector<string> resJump; vector<string> resJump;
explode(jumpDest->at(k)," ",resJump); explode(jumpDest->at(k)," ",resJump);
ret +=resJump[1]; ret +=resJump[1];
ret+= ";"; ret+= ";";
ret+=NL; ret+=NL;
} }
}*/ }*/
if (strAction.compare(string("punctual_state"))==0) if (strAction.compare(string("punctual_state"))==0)
@ -513,7 +513,7 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica
ret +=spaceTo_(jumpDest->at(0)); ret +=spaceTo_(jumpDest->at(0));
ret +="[label="; ret +="[label=";
ret +=spaceTo_(labelTail); ret +=spaceTo_(labelTail);
ret +="]"; ret +="]";
ret += ";" ; ret += ";" ;
ret += NL; ret += NL;
ret +=spaceTo_(jumpDest->at(0)); ret +=spaceTo_(jumpDest->at(0));
@ -521,12 +521,12 @@ string CGraphPlugin::createParsedNode(IPrimitive* managerNode,string strPredica
ret += strName ; ret += strName ;
ret +="[label="; ret +="[label=";
ret +=spaceTo_(labelTail); ret +=spaceTo_(labelTail);
ret +="]"; ret +="]";
ret += ";" ; ret += ";" ;
ret += NL; ret += NL;
} }
} }
} }
numClusters+=resSet.size(); numClusters+=resSet.size();
return ret; return ret;
@ -573,17 +573,17 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em
uint numChild=currentNode->getNumChildren(); uint numChild=currentNode->getNumChildren();
for(uint i=0;i<numChild;i++) for(uint i=0;i<numChild;i++)
{ {
IPrimitive* child; IPrimitive* child;
currentNode->getChild(child,i); currentNode->getChild(child,i);
child->getPropertyByName("class",strClassName); child->getPropertyByName("class",strClassName);
child->getPropertyByName("name",strName); child->getPropertyByName("name",strName);
child->getPropertyByName("action",strAction); child->getPropertyByName("action",strAction);
if (strClassName.compare(string("npc_group"))==0) if (strClassName.compare(string("npc_group"))==0)
{ {
child->getPropertyByName("name",strName); child->getPropertyByName("name",strName);
ret+=spaceTo_(strName); ret+=spaceTo_(strName);
ret+=tag; ret+=tag;
ret += " [URL=\""+buildPrimPath(child)+"\"];"+NL; ret += " [URL=\""+buildPrimPath(child)+"\"];"+NL;
@ -670,7 +670,7 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em
ret+=tag; ret+=tag;
first=true; first=true;
} }
} }
ret+="}"; ret+="}";
ret+='"'; ret+='"';
@ -704,7 +704,7 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em
&& (strClassName.compare("random_select_state")==0)) && (strClassName.compare("random_select_state")==0))
{ {
vector<string>* jumpDest; vector<string>* jumpDest;
child->getPropertyByName("parameters",jumpDest); child->getPropertyByName("parameters",jumpDest);
for(uint k=0;k<jumpDest->size();k++) for(uint k=0;k<jumpDest->size();k++)
{ {
ret+=spaceTo_(strName); ret+=spaceTo_(strName);
@ -712,10 +712,10 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em
ret+="->"; ret+="->";
ret +=spaceTo_(jumpDest->at(k)); ret +=spaceTo_(jumpDest->at(k));
ret+= ";"; ret+= ";";
ret+=NL; ret+=NL;
} }
} }
} }
ret+=NL; ret+=NL;
} }
@ -745,7 +745,7 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em
vector<string>* jumpDest; vector<string>* jumpDest;
bool first=true; bool first=true;
child->getPropertyByName("parameters",jumpDest); child->getPropertyByName("parameters",jumpDest);
ret += spaceTo_(strName) ; ret += spaceTo_(strName) ;
ret +="_"; ret +="_";
ret += emiterNode; ret += emiterNode;
@ -769,7 +769,7 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em
ret +=resJump[1]; ret +=resJump[1];
ret+= ";"; ret+= ";";
ret+=NL; ret+=NL;
} }
ret+=emiterNode; ret+=emiterNode;
ret += "->"; ret += "->";
@ -782,11 +782,11 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em
else else
{ {
ret+=parseStateMachine(child,emiterNode,tailLabel,tag); ret+=parseStateMachine(child,emiterNode,tailLabel,tag);
} }
} }
currentNode->getPropertyByName("class",strClassName); currentNode->getPropertyByName("class",strClassName);
currentNode->getPropertyByName("name",strName); currentNode->getPropertyByName("name",strName);
currentNode->getPropertyByName("action",strAction); currentNode->getPropertyByName("action",strAction);
@ -816,7 +816,7 @@ string CGraphPlugin::parseStateMachine(NLLIGO::IPrimitive* currentNode,string em
ret+=NL; ret+=NL;
} }
return ret; return ret;
} }
bool CGraphPlugin::createBitmap (const string &tmpPath) bool CGraphPlugin::createBitmap (const string &tmpPath)
@ -831,10 +831,10 @@ bool CGraphPlugin::createBitmap (const string &tmpPath)
} }
WORD retour; WORD retour;
if(retour=bitmap.load(pngLocation)) if(retour=bitmap.load(pngLocation))
{ {
HBITMAP &_Hbmp=GraphDlg->_Hbmp; HBITMAP &_Hbmp=GraphDlg->_Hbmp;
HBITMAP &_Hdib=GraphDlg->_Hdib; HBITMAP &_Hdib=GraphDlg->_Hdib;
@ -842,7 +842,7 @@ bool CGraphPlugin::createBitmap (const string &tmpPath)
BITMAPINFO &_DibBitmapInfo=GraphDlg->_DibBitmapInfo;; BITMAPINFO &_DibBitmapInfo=GraphDlg->_DibBitmapInfo;;
uint8* &_DibBits=GraphDlg->_DibBits; uint8* &_DibBits=GraphDlg->_DibBits;
_DibBitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFO); _DibBitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFO);
_DibBitmapInfo.bmiHeader.biWidth = bitmap.getWidth(); _DibBitmapInfo.bmiHeader.biWidth = bitmap.getWidth();
_DibBitmapInfo.bmiHeader.biHeight = bitmap.getHeight(); _DibBitmapInfo.bmiHeader.biHeight = bitmap.getHeight();
@ -857,8 +857,8 @@ bool CGraphPlugin::createBitmap (const string &tmpPath)
// Create the bitmap // Create the bitmap
HWND desktop = ::GetDesktopWindow(); HWND desktop = ::GetDesktopWindow();
HDC dc = ::GetDC (desktop); HDC dc = ::GetDC (desktop);
nlverify(_Hdib = CreateDIBSection(dc, &_DibBitmapInfo, DIB_RGB_COLORS, nlverify(_Hdib = CreateDIBSection(dc, &_DibBitmapInfo, DIB_RGB_COLORS,
(void**)&_DibBits, NULL, 0)); (void**)&_DibBits, NULL, 0));
@ -920,7 +920,6 @@ void CGraphPlugin::unsetDlgGraph()
_PluginActive=false; _PluginActive=false;
} }
void CGraphPlugin::doSelection(const string& primPath) void CGraphPlugin::doSelection(const string& primPath)
{ {
IPrimitive *rootNode; IPrimitive *rootNode;
@ -930,7 +929,7 @@ void CGraphPlugin::doSelection(const string& primPath)
if(_PluginAccess->getCurrentSelection().size()>0) if(_PluginAccess->getCurrentSelection().size()>0)
{ {
try try
{ {
rootNode=(IPrimitive*)_PluginAccess->getRootNode(_rootFileName); rootNode=(IPrimitive*)_PluginAccess->getRootNode(_rootFileName);

@ -89,8 +89,10 @@ MissionCompilerMainWindow::MissionCompilerMainWindow(QWidget *parent) :
settings->endGroup(); settings->endGroup();
NLLIGO::Register(); NLLIGO::Register();
// TODO try/catch exception. Crashes if path invalid. // TODO try/catch exception. Crashes if path invalid.
try{ try
{
m_ligoConfig.readPrimitiveClass(NLMISC::CPath::lookup("world_editor_classes.xml").c_str(), false); m_ligoConfig.readPrimitiveClass(NLMISC::CPath::lookup("world_editor_classes.xml").c_str(), false);
} }
catch(const NLMISC::Exception &e) catch(const NLMISC::Exception &e)

Loading…
Cancel
Save