@ -213,7 +213,7 @@ HTREEITEM CParticleTreeCtrl::buildTreeFromPS(CParticleWorkspace::CNode &node, H
if ( node . isLoaded ( ) )
{
// bind particle system icon
HTREEITEM psRoot = InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT , u tf8ToTStr( computeCaption ( node ) ) , PSIconParticleSystem , PSIconParticleSystem , 0 , 0 , NULL , rootHandle , prevSibling ) ;
HTREEITEM psRoot = InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT , nlU tf8ToTStr( computeCaption ( node ) ) , PSIconParticleSystem , PSIconParticleSystem , 0 , 0 , NULL , rootHandle , prevSibling ) ;
// set the param (doesn't seems to work during first creation)
SetItemData ( psRoot , ( LPARAM ) nt ) ;
// now, create each located
@ -228,7 +228,7 @@ HTREEITEM CParticleTreeCtrl::buildTreeFromPS(CParticleWorkspace::CNode &node, H
else
{
// bind a bitmap that say that the PS hasn't been loaded
HTREEITEM psRoot = InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT , u tf8ToTStr( computeCaption ( node ) ) , PSIconParticleSystemNotLoaded , PSIconParticleSystemNotLoaded , 0 , 0 , NULL , rootHandle , prevSibling ) ;
HTREEITEM psRoot = InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT , nlU tf8ToTStr( computeCaption ( node ) ) , PSIconParticleSystemNotLoaded , PSIconParticleSystemNotLoaded , 0 , 0 , NULL , rootHandle , prevSibling ) ;
SetItemData ( psRoot , ( LPARAM ) nt ) ;
return psRoot ;
}
@ -242,7 +242,7 @@ void CParticleTreeCtrl::buildTreeFromWorkSpace(CParticleWorkspace &ws)
CNodeType * nt = new CNodeType ( & ws ) ;
_NodeTypes . push_back ( nt ) ;
// bind particle system icon
HTREEITEM rootHandle = InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT , u tf8ToTStr( computeCaption ( ws ) ) , PSIconWorkspace , PSIconWorkspace , 0 , 0 , NULL , NULL , TVI_LAST ) ;
HTREEITEM rootHandle = InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT , nlU tf8ToTStr( computeCaption ( ws ) ) , PSIconWorkspace , PSIconWorkspace , 0 , 0 , NULL , NULL , TVI_LAST ) ;
// set the param (doesn't seems to work during first creation)
SetItemData ( rootHandle , ( LPARAM ) nt ) ;
// now, create each particle system
@ -259,7 +259,7 @@ void CParticleTreeCtrl::createNodeFromLocated(NL3D::CPSLocated *loc, HTREEITEM
CNodeType * nt = new CNodeType ( loc ) ;
_NodeTypes . push_back ( nt ) ;
// bind located icon
HTREEITEM nodeHandle = InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , u tf8ToTStr( loc - > getName ( ) ) , PSIconLocated , PSIconLocated , 0 , 0 , ( LPARAM ) nt , rootHandle , TVI_LAST ) ;
HTREEITEM nodeHandle = InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , nlU tf8ToTStr( loc - > getName ( ) ) , PSIconLocated , PSIconLocated , 0 , 0 , ( LPARAM ) nt , rootHandle , TVI_LAST ) ;
// now, insert each object that is bound to the located
for ( uint l = 0 ; l < loc - > getNbBoundObjects ( ) ; + + l )
{
@ -273,7 +273,7 @@ void CParticleTreeCtrl::createNodeFromLocatedBindable(NL3D::CPSLocatedBindable *
// we ordered the image so that they match the type for a located bindable (force, particles, collision zones...)
CNodeType * nt = new CNodeType ( lb ) ;
_NodeTypes . push_back ( nt ) ;
InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , u tf8ToTStr( lb - > getName ( ) ) , lb - > getType ( ) , lb - > getType ( ) , PSIconForce , PSIconForce , ( LPARAM ) nt , rootHandle , TVI_LAST ) ;
InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , nlU tf8ToTStr( lb - > getName ( ) ) , lb - > getType ( ) , lb - > getType ( ) , PSIconForce , PSIconForce , ( LPARAM ) nt , rootHandle , TVI_LAST ) ;
}
@ -1004,7 +1004,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
nlassert ( ownerNode ) ;
// Add search path for the texture
NLMISC : : CPath : : addSearchPath ( NLMISC : : CFile : : getPath ( tStrToUtf8 ( fd . GetPathName ( ) ) ) ) ;
NLMISC : : CPath : : addSearchPath ( NLMISC : : CFile : : getPath ( NLMISC : : tStrToUtf8 ( fd . GetPathName ( ) ) ) ) ;
CUniquePtr < NL3D : : CShapeBank > sb ( new NL3D : : CShapeBank ) ;
CParticleSystemModel * psm = NULL ;
@ -1012,9 +1012,9 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
{
NL3D : : CShapeStream ss ;
NLMISC : : CIFile inputFile ;
inputFile . open ( tStrToUtf8 ( fd . GetPathName ( ) ) ) ;
inputFile . open ( NLMISC : : tStrToUtf8 ( fd . GetPathName ( ) ) ) ;
ss . serial ( inputFile ) ;
std : : string shapeName = NLMISC : : CFile : : getFilename ( tStrToUtf8 ( fd . GetPathName ( ) ) ) ;
std : : string shapeName = NLMISC : : CFile : : getFilename ( NLMISC : : tStrToUtf8 ( fd . GetPathName ( ) ) ) ;
sb - > add ( shapeName , ss . getShapePointer ( ) ) ;
NL3D : : CShapeBank * oldSB = CNELU : : Scene - > getShapeBank ( ) ;
CNELU : : Scene - > setShapeBank ( sb . get ( ) ) ;
@ -1039,7 +1039,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
}
catch ( const NLMISC : : EStream & e )
{
MessageBox ( u tf8ToTStr( e . what ( ) ) , getStrRsc ( IDS_ERROR ) , MB_OK | MB_ICONEXCLAMATION ) ;
MessageBox ( nlU tf8ToTStr( e . what ( ) ) , getStrRsc ( IDS_ERROR ) , MB_OK | MB_ICONEXCLAMATION ) ;
return TRUE ;
}
ownerNode - > setResetAutoCountFlag ( false ) ;
@ -1096,10 +1096,10 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
_ParticleDlg - > StartStopDlg - > stop ( ) ;
std : : string fileName = nt - > PS - > getFilename ( ) ;
static TCHAR BASED_CODE szFilter [ ] = _T ( " ps & shapes files(*.ps;*.shape)|*.ps; *.shape|| " ) ;
CFileDialog fd ( FALSE , _T ( " .ps " ) , u tf8ToTStr( fileName ) , OFN_OVERWRITEPROMPT , szFilter , this ) ;
CFileDialog fd ( FALSE , _T ( " .ps " ) , nlU tf8ToTStr( fileName ) , OFN_OVERWRITEPROMPT , szFilter , this ) ;
if ( fd . DoModal ( ) = = IDOK )
{
_ParticleDlg - > savePSAs ( * this , * nt - > PS , tStrToUtf8 ( fd . GetPathName ( ) ) , false ) ;
_ParticleDlg - > savePSAs ( * this , * nt - > PS , NLMISC : : tStrToUtf8 ( fd . GetPathName ( ) ) , false ) ;
}
}
}
@ -1249,7 +1249,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
}
getOwnerNode ( nt ) - > setModified ( true ) ;
// TODO : an enum for CPSLocatedBindable::getType would be better...
InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , u tf8ToTStr( toCreate - > getName ( ) ) , toCreate - > getType ( ) , toCreate - > getType ( ) , 0 , 0 , ( LPARAM ) newNt , father , lastSon ) ;
InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , nlU tf8ToTStr( toCreate - > getName ( ) ) , toCreate - > getType ( ) , toCreate - > getType ( ) , 0 , 0 , ( LPARAM ) newNt , father , lastSon ) ;
touchPSState ( nt ) ;
Invalidate ( ) ;
_ParticleDlg - > StartStopDlg - > resetAutoCount ( getOwnerNode ( nt ) ) ;
@ -1280,7 +1280,7 @@ std::pair<CParticleTreeCtrl::CNodeType *, HTREEITEM> CParticleTreeCtrl::createL
CNodeType * newNt = new CNodeType ( loc ) ;
_NodeTypes . push_back ( newNt ) ;
// insert item in tree
HTREEITEM insertedItem = InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , u tf8ToTStr( name ) , PSIconLocated , PSIconLocated , 0 , 0 , ( LPARAM ) newNt , headItem , TVI_LAST ) ;
HTREEITEM insertedItem = InsertItem ( TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , nlU tf8ToTStr( name ) , PSIconLocated , PSIconLocated , 0 , 0 , ( LPARAM ) newNt , headItem , TVI_LAST ) ;
touchPSState ( newNt ) ;
return std : : make_pair ( newNt , insertedItem ) ;
}
@ -1299,7 +1299,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
{
case CNodeType : : workspace :
{
nt - > WS - > setName ( tStrToUtf8 ( info - > item . pszText ) ) ;
nt - > WS - > setName ( NLMISC : : tStrToUtf8 ( info - > item . pszText ) ) ;
workspaceModifiedFlagChanged ( * nt - > WS ) ; // change name (this may be called twice because of the modification callback, but this doesn't matter)
}
break ;
@ -1311,10 +1311,10 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
}
else
{
nt - > PS - > getPSPointer ( ) - > setName ( tStrToUtf8( info - > item . pszText ) ) ;
nt - > PS - > getPSPointer ( ) - > setName ( NLMISC: : tStrToUtf8( info - > item . pszText ) ) ;
nt - > PS - > setModified ( true ) ;
}
this - > SetItemText ( info - > item . hItem , u tf8ToTStr( computeCaption ( * nt - > PS ) ) ) ;
this - > SetItemText ( info - > item . hItem , nlU tf8ToTStr( computeCaption ( * nt - > PS ) ) ) ;
}
break ;
case CNodeType : : located :
@ -1322,7 +1322,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
nlassert ( getOwnerNode ( nt ) ) ;
getOwnerNode ( nt ) - > setModified ( true ) ;
this - > SetItemText ( info - > item . hItem , info - > item . pszText ) ;
nt - > Loc - > setName ( tStrToUtf8 ( info - > item . pszText ) ) ;
nt - > Loc - > setName ( NLMISC : : tStrToUtf8 ( info - > item . pszText ) ) ;
}
break ;
case CNodeType : : locatedBindable :
@ -1330,7 +1330,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
nlassert ( getOwnerNode ( nt ) ) ;
getOwnerNode ( nt ) - > setModified ( true ) ;
this - > SetItemText ( info - > item . hItem , info - > item . pszText ) ;
nt - > Bind - > setName ( tStrToUtf8 ( info - > item . pszText ) ) ;
nt - > Bind - > setName ( NLMISC : : tStrToUtf8 ( info - > item . pszText ) ) ;
}
break ;
}
@ -1466,7 +1466,7 @@ void CParticleTreeCtrl::updateCaption(CParticleWorkspace::CNode &node)
HTREEITEM item = getTreeItem ( & node ) ;
if ( ! item ) return ;
// update name of ps to dipslay a star in front of it (this tells that the ps has been modified)
SetItemText ( item , u tf8ToTStr( computeCaption ( node ) ) ) ;
SetItemText ( item , nlU tf8ToTStr( computeCaption ( node ) ) ) ;
}
//****************************************************************************************************************
@ -1545,7 +1545,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws)
while ( pos )
{
CString path = fd . GetNextPathName ( pos ) ;
CParticleWorkspace : : CNode * node = pws . addNode ( tStrToUtf8( path ) ) ;
CParticleWorkspace : : CNode * node = pws . addNode ( NLMISC: : tStrToUtf8( path ) ) ;
if ( ! node )
{
if ( diplayNodeAlreadyInserted )
@ -1558,7 +1558,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws)
}
else
{
MessageBox ( CString ( u tf8ToTStr( NLMISC : : CFile : : getFilename ( tStrToUtf8 ( path ) ) ) ) + getStrRsc ( IDS_PS_ALREADY_INSERTED ) , getStrRsc ( IDS_ERROR ) , MB_OK | MB_ICONEXCLAMATION ) ;
MessageBox ( CString ( nlU tf8ToTStr( NLMISC : : CFile : : getFilename ( NLMISC : : tStrToUtf8 ( path ) ) ) ) + getStrRsc ( IDS_PS_ALREADY_INSERTED ) , getStrRsc ( IDS_ERROR ) , MB_OK | MB_ICONEXCLAMATION ) ;
}
}
continue ;
@ -1593,7 +1593,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws)
}
}
// update modified state
SetItemText ( GetRootItem ( ) , u tf8ToTStr( computeCaption ( pws ) ) ) ;
SetItemText ( GetRootItem ( ) , nlU tf8ToTStr( computeCaption ( pws ) ) ) ;
}
}
@ -1736,7 +1736,7 @@ void CParticleTreeCtrl::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
switch ( nt - > Type )
{
case CNodeType : : workspace :
pEdit - > SetWindowText ( u tf8ToTStr( nt - > WS - > getName ( ) ) ) ;
pEdit - > SetWindowText ( nlU tf8ToTStr( nt - > WS - > getName ( ) ) ) ;
break ;
case CNodeType : : particleSystem :
{
@ -1747,18 +1747,18 @@ void CParticleTreeCtrl::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
}
else
{
pEdit - > SetWindowText ( u tf8ToTStr( nt - > PS - > getPSPointer ( ) - > getName ( ) ) ) ;
pEdit - > SetWindowText ( nlU tf8ToTStr( nt - > PS - > getPSPointer ( ) - > getName ( ) ) ) ;
}
}
break ;
case CNodeType : : located :
{
pEdit - > SetWindowText ( u tf8ToTStr( nt - > Loc - > getName ( ) ) ) ;
pEdit - > SetWindowText ( nlU tf8ToTStr( nt - > Loc - > getName ( ) ) ) ;
}
break ;
case CNodeType : : locatedBindable :
{
pEdit - > SetWindowText ( u tf8ToTStr( nt - > Bind - > getName ( ) ) ) ;
pEdit - > SetWindowText ( nlU tf8ToTStr( nt - > Bind - > getName ( ) ) ) ;
}
break ;
}
@ -1855,10 +1855,10 @@ void CParticleTreeCtrl::updateAllCaptions()
switch ( nt - > Type )
{
case CNodeType : : particleSystem :
SetItemText ( curr , u tf8ToTStr( computeCaption ( * nt - > PS ) ) ) ;
SetItemText ( curr , nlU tf8ToTStr( computeCaption ( * nt - > PS ) ) ) ;
break ;
case CNodeType : : workspace :
SetItemText ( curr , u tf8ToTStr( computeCaption ( * nt - > WS ) ) ) ;
SetItemText ( curr , nlU tf8ToTStr( computeCaption ( * nt - > WS ) ) ) ;
break ;
case CNodeType : : located :
case CNodeType : : locatedBindable :