Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2016-12-04 20:01:00 +01:00
commit 0beab678ac
12 changed files with 116 additions and 25 deletions

View file

@ -185,7 +185,7 @@ void CExportNel::addSSSTrack(CSSSBuild &ssBuilder, INode& node)
if(note) if(note)
{ {
CSSSBuild::CKey ks; CSSSBuild::CKey ks;
ks.Value = std::string(note->note); ks.Value = note->note.ToUTF8();
ks.Time= CExportNel::convertTime (note->time); ks.Time= CExportNel::convertTime (note->time);
bs.Track.push_back(ks); bs.Track.push_back(ks);
} }
@ -224,7 +224,7 @@ NL3D::CTrackKeyFramerConstString* CExportNel::buildFromNoteTrack(INode& node)
{ {
firstDate = CExportNel::convertTime (note->time); firstDate = CExportNel::convertTime (note->time);
} }
ks.Value = std::string(note->note); ks.Value = note->note.ToUTF8();
lastDate = CExportNel::convertTime (note->time); lastDate = CExportNel::convertTime (note->time);
st->addKey(ks , lastDate ); st->addKey(ks , lastDate );

View file

@ -768,7 +768,7 @@ void CExportNel::buildAMaterial (NL3D::CMaterial& material, CMaxMaterialInfo& ma
// Set material name // Set material name
TSTR name=mtl.GetName(); TSTR name=mtl.GetName();
materialInfo.MaterialName = (const char*)name; materialInfo.MaterialName = name.ToUTF8();
} }
else else
{ {
@ -1120,7 +1120,7 @@ void CExportNel::buildAMaterial (NL3D::CMaterial& material, CMaxMaterialInfo& ma
// Set material name // Set material name
TSTR name=mtl.GetName(); TSTR name=mtl.GetName();
materialInfo.MaterialName = (const char*)name; materialInfo.MaterialName = name.ToUTF8();
} }
} }

View file

@ -579,7 +579,7 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector<CMeshInter
{ {
// Rename the material // Rename the material
string newName = "NelAutoMergeRenamedTmp" + toString (i); string newName = "NelAutoMergeRenamedTmp" + toString (i);
string originalName = (*lib)[i]->GetName (); string originalName = (*lib)[i]->GetName ().ToUTF8();
renameMap.insert (map<string, string>::value_type (newName, originalName)); renameMap.insert (map<string, string>::value_type (newName, originalName));
(*lib)[i]->SetName (utf8ToTStr(newName)); (*lib)[i]->SetName (utf8ToTStr(newName));
} }
@ -604,7 +604,7 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector<CMeshInter
for (i=0; i<size; i++) for (i=0; i<size; i++)
{ {
// Find the name in the map ? // Find the name in the map ?
string key = (*lib)[i]->GetName (); string key = (*lib)[i]->GetName ().ToUTF8();
map<string, string>::iterator ite = renameMap.find (key); map<string, string>::iterator ite = renameMap.find (key);
// Not found ? This is a merged material // Not found ? This is a merged material
@ -612,7 +612,7 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector<CMeshInter
{ {
// Rename the material // Rename the material
string newName = "NelAutoMergeRenamed" + toString (i); string newName = "NelAutoMergeRenamed" + toString (i);
string originalName = (*lib)[i]->GetName (); string originalName = (*lib)[i]->GetName ().ToUTF8();
renameMap.insert (map<string, string>::value_type (newName, originalName)); renameMap.insert (map<string, string>::value_type (newName, originalName));
(*lib)[i]->SetName (utf8ToTStr(newName)); (*lib)[i]->SetName (utf8ToTStr(newName));
} }
@ -622,7 +622,7 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector<CMeshInter
for (i=0; i<size; i++) for (i=0; i<size; i++)
{ {
// Find the name // Find the name
string key = (*lib)[i]->GetName (); string key = (*lib)[i]->GetName ().ToUTF8();
map<string, string>::iterator ite = renameMap.find (key); map<string, string>::iterator ite = renameMap.find (key);
if (ite != renameMap.end ()) if (ite != renameMap.end ())
{ {

View file

@ -223,7 +223,7 @@ Animatable* CExportNel::getSubAnimByName (Animatable& node, const char* sName)
TSTR sSubName=node.SubAnimName(nSub); TSTR sSubName=node.SubAnimName(nSub);
// Good name? // Good name?
if (strcmp (sSubName, sName)==0) if (strcmp (sSubName.ToUTF8(), sName)==0)
{ {
// ok, return this subanim // ok, return this subanim
return node.SubAnim(nSub); return node.SubAnim(nSub);
@ -288,7 +288,7 @@ Control* CExportNel::getControlerByName (Animatable& node, const char* sName)
{ {
// Sub anim name // Sub anim name
TSTR name=node.SubAnimName (s); TSTR name=node.SubAnimName (s);
if (strcmp (name, sName)==0) if (strcmp (name.ToUTF8(), sName)==0)
{ {
// Get the controller pointer of this sub anim // Get the controller pointer of this sub anim
Control* c=GetControlInterface (node.SubAnim(s)); Control* c=GetControlInterface (node.SubAnim(s));
@ -502,7 +502,7 @@ std::string CExportNel::getName (MtlBase& mtl)
// Return its name // Return its name
TSTR name; TSTR name;
name=mtl.GetName(); name=mtl.GetName();
return std::string (name); return std::string((const char*)name.ToUTF8());
} }
// -------------------------------------------------- // --------------------------------------------------

View file

@ -38,9 +38,17 @@ bool CExportNel::scriptEvaluate (const char *script, void *out, TNelScriptValueT
vl.parser = new Parser; vl.parser = new Parser;
vl.source = new StringStream (utf8ToTStr(script)); vl.source = new StringStream (utf8ToTStr(script));
vl.source->log_to(NULL); vl.source->log_to(NULL);
#if MAX_VERSION_MAJOR < 19
save_current_frames(); save_current_frames();
#endif
try try
{ {
#if MAX_VERSION_MAJOR >= 19
ScopedSaveCurrentFrames currentFrames;
#endif
vl.source->flush_whitespace(); vl.source->flush_whitespace();
vl.code = vl.parser->compile_all(vl.source); vl.code = vl.parser->compile_all(vl.source);
vl.result = vl.code->eval(); vl.result = vl.code->eval();
@ -66,11 +74,16 @@ bool CExportNel::scriptEvaluate (const char *script, void *out, TNelScriptValueT
} }
catch (...) catch (...)
{ {
#if MAX_VERSION_MAJOR < 19
restore_current_frames(); restore_current_frames();
#endif
result=FALSE; result=FALSE;
vl.source->close(); vl.source->close();
} }
#if MAX_VERSION_MAJOR < 19
pop_value_locals(); pop_value_locals();
#endif
return (result!=FALSE); return (result!=FALSE);
} }

View file

@ -12,8 +12,12 @@
// ------------------------------------------------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------------------------------------------------
int EPM_BevelMouseProc::proc(HWND hwnd, int msg, int point, int flags, IPoint2 m) int EPM_BevelMouseProc::proc(HWND hwnd, int msg, int point, int flags, IPoint2 m)
{ {
#if MAX_VERSION_MAJOR >= 19
ViewExp *vpt = &ip->GetViewExp(hwnd);
#else
ViewExp *vpt = ip->GetViewport(hwnd); ViewExp *vpt = ip->GetViewport(hwnd);
#endif
Point3 p0, p1; Point3 p0, p1;
ISpinnerControl *spin; ISpinnerControl *spin;
int ln, ln2; int ln, ln2;
@ -48,11 +52,13 @@ int EPM_BevelMouseProc::proc(HWND hwnd, int msg, int point, int flags, IPoint2 m
case MOUSE_MOVE: case MOUSE_MOVE:
if (point == 1) if (point == 1)
{ {
p0 = vpt->MapScreenToView(om, float(-200)); p0 = vpt->MapScreenToView(om, -200.f);
// sca 1999.02.24: find worldspace point with om's x value and m's y value // sca 1999.02.24: find worldspace point with om's x value and m's y value
m2.x = om.x; m2.x = om.x;
m2.y = m.y; m2.y = m.y;
p1 = vpt->MapScreenToView(m2, float(-200)); p1 = vpt->MapScreenToView(m2, -200.f);
amount = Length(p1 - p0); amount = Length(p1 - p0);
ln = IsDlgButtonChecked(po->hOpsPanel, IDC_EM_EXTYPE_B); ln = IsDlgButtonChecked(po->hOpsPanel, IDC_EM_EXTYPE_B);
if (om.y < m.y) if (om.y < m.y)
@ -66,14 +72,16 @@ int EPM_BevelMouseProc::proc(HWND hwnd, int msg, int point, int flags, IPoint2 m
ReleaseISpinner(spin); ReleaseISpinner(spin);
} }
ip->RedrawViews(ip->GetTime(), REDRAW_INTERACTIVE); ip->RedrawViews(ip->GetTime(), REDRAW_INTERACTIVE);
} }
else if (point == 2) else if (point == 2)
{ {
p0 = vpt->MapScreenToView(om, float(-200)); p0 = vpt->MapScreenToView(om, -200.f);
// sca 1999.02.24: find worldspace point with om's x value and m's y value // sca 1999.02.24: find worldspace point with om's x value and m's y value
m2.x = om.x; m2.x = om.x;
m2.y = m.y; m2.y = m.y;
p1 = vpt->MapScreenToView(m2, float(-200)); p1 = vpt->MapScreenToView(m2, -200.f);
if (IsDlgButtonChecked(po->hOpsPanel, IDC_EP_SM_SMOOTH)) if (IsDlgButtonChecked(po->hOpsPanel, IDC_EP_SM_SMOOTH))
ln = 0; ln = 0;
else if (IsDlgButtonChecked(po->hOpsPanel, IDC_EP_SM_SMOOTH2)) else if (IsDlgButtonChecked(po->hOpsPanel, IDC_EP_SM_SMOOTH2))
@ -114,8 +122,11 @@ int EPM_BevelMouseProc::proc(HWND hwnd, int msg, int point, int flags, IPoint2 m
break; break;
} }
#if MAX_VERSION_MAJOR < 19
if (vpt) if (vpt)
ip->ReleaseViewport(vpt); ip->ReleaseViewport(vpt);
#endif
return TRUE; return TRUE;
} }

View file

@ -13,7 +13,11 @@
int EPM_ExtrudeMouseProc::proc(HWND hwnd, int msg, int point, int flags, IPoint2 m) int EPM_ExtrudeMouseProc::proc(HWND hwnd, int msg, int point, int flags, IPoint2 m)
{ {
#if MAX_VERSION_MAJOR >= 19
ViewExp *vpt = &ip->GetViewExp(hwnd);
#else
ViewExp *vpt = ip->GetViewport(hwnd); ViewExp *vpt = ip->GetViewport(hwnd);
#endif
Point3 p0, p1; Point3 p0, p1;
ISpinnerControl *spin; ISpinnerControl *spin;
BOOL ln; BOOL ln;
@ -39,11 +43,13 @@ int EPM_ExtrudeMouseProc::proc(HWND hwnd, int msg, int point, int flags, IPoint2
break; break;
case MOUSE_MOVE: case MOUSE_MOVE:
p0 = vpt->MapScreenToView(om, float(-200)); p0 = vpt->MapScreenToView(om, -200.f);
// sca 1999.02.24: Find m's projection in om's vertical axis: // sca 1999.02.24: Find m's projection in om's vertical axis:
m2.x = om.x; m2.x = om.x;
m2.y = m.y; m2.y = m.y;
p1 = vpt->MapScreenToView(m2, float(-200)); p1 = vpt->MapScreenToView(m2, -200.f);
amount = Length(p1 - p0); amount = Length(p1 - p0);
if (m.y > om.y) if (m.y > om.y)
amount *= -1.0f; amount *= -1.0f;
@ -66,8 +72,11 @@ int EPM_ExtrudeMouseProc::proc(HWND hwnd, int msg, int point, int flags, IPoint2
break; break;
} }
#if MAX_VERSION_MAJOR < 19
if (vpt) if (vpt)
ip->ReleaseViewport(vpt); ip->ReleaseViewport(vpt);
#endif
return TRUE; return TRUE;
} }

View file

@ -35,8 +35,13 @@ int EditPatchMod::RememberPatchThere(HWND hWnd, IPoint2 m)
ClearPatchDataFlag(mcList, EPD_BEENDONE); ClearPatchDataFlag(mcList, EPD_BEENDONE);
// See if we're over a patch // See if we're over a patch
#if MAX_VERSION_MAJOR >= 19
ViewExp *vpt = &ip->GetViewExp(hWnd);
#else
ViewExp *vpt = ip->GetViewport(hWnd); ViewExp *vpt = ip->GetViewport(hWnd);
#endif
GraphicsWindow *gw = vpt->getGW(); GraphicsWindow *gw = vpt->getGW();
HitRegion hr; HitRegion hr;
MakeHitRegion(hr, HITTYPE_POINT, 1, 4, &m); MakeHitRegion(hr, HITTYPE_POINT, 1, 4, &m);
gw->setHitRegion(&hr); gw->setHitRegion(&hr);
@ -110,8 +115,12 @@ int EditPatchMod::RememberPatchThere(HWND hWnd, IPoint2 m)
finish: finish:
nodes.DisposeTemporary(); nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE); ClearPatchDataFlag(mcList, EPD_BEENDONE);
#if MAX_VERSION_MAJOR < 19
if (vpt) if (vpt)
ip->ReleaseViewport(vpt); ip->ReleaseViewport(vpt);
#endif
return result; return result;
} }
@ -185,8 +194,13 @@ int EditPatchMod::RememberVertThere(HWND hWnd, IPoint2 m)
ClearPatchDataFlag(mcList, EPD_BEENDONE); ClearPatchDataFlag(mcList, EPD_BEENDONE);
// See if we're over a vertex // See if we're over a vertex
#if MAX_VERSION_MAJOR >= 19
ViewExp *vpt = &ip->GetViewExp(hWnd);
#else
ViewExp *vpt = ip->GetViewport(hWnd); ViewExp *vpt = ip->GetViewport(hWnd);
#endif
GraphicsWindow *gw = vpt->getGW(); GraphicsWindow *gw = vpt->getGW();
HitRegion hr; HitRegion hr;
MakeHitRegion(hr, HITTYPE_POINT, 1, 4, &m); MakeHitRegion(hr, HITTYPE_POINT, 1, 4, &m);
gw->setHitRegion(&hr); gw->setHitRegion(&hr);
@ -260,8 +274,11 @@ int EditPatchMod::RememberVertThere(HWND hWnd, IPoint2 m)
finish: finish:
nodes.DisposeTemporary(); nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE); ClearPatchDataFlag(mcList, EPD_BEENDONE);
#if MAX_VERSION_MAJOR < 19
if (vpt) if (vpt)
ip->ReleaseViewport(vpt); ip->ReleaseViewport(vpt);
#endif
return result; return result;
} }

View file

@ -2261,9 +2261,18 @@ BOOL RPatchMesh::SubObjectHitTest (GraphicsWindow *gw, Material *ma, HitRegion *
gw->setRndLimits(gw->getRndLimits() & ~GW_BACKCULL); gw->setRndLimits(gw->getRndLimits() & ~GW_BACKCULL);
bRet=mesh.SubObjectHitTest (gw, ma, hr, nFlags, list); bRet=mesh.SubObjectHitTest (gw, ma, hr, nFlags, list);
#if MAX_VERSION_MAJOR < 19
MeshSubHitRec *rec=list.First(); MeshSubHitRec *rec=list.First();
while (rec) while (rec)
{ {
#else
MeshSubHitRec::Iterator it = list.begin(), iend = list.end();
while(it != iend)
{
MeshSubHitRec *rec = &*it;
#endif
if (flags&SUBHIT_PATCH_SELONLY) if (flags&SUBHIT_PATCH_SELONLY)
{ {
int otot=0; int otot=0;
@ -2284,7 +2293,11 @@ BOOL RPatchMesh::SubObjectHitTest (GraphicsWindow *gw, Material *ma, HitRegion *
hitList.AddHit (rec->dist, &patch, nRemapedIndex, PATCH_HIT_TILE); hitList.AddHit (rec->dist, &patch, nRemapedIndex, PATCH_HIT_TILE);
// Next hit // Next hit
rec=rec->Next(); #if MAX_VERSION_MAJOR < 19
rec = rec->Next();
#else
++it;
#endif
} }
} }

View file

@ -4095,10 +4095,13 @@ DWORD WINAPI myThread (LPVOID vData)
nlassert (pData->eproc->ip); nlassert (pData->eproc->ip);
// Viewport parameters // Viewport parameters
ViewExp* vp;
Matrix3 affineTM; Matrix3 affineTM;
float minx,maxx,miny,maxy; float minx,maxx,miny,maxy;
vp=pData->eproc->ip->GetActiveViewport(); #if MAX_VERSION_MAJOR >= 19
ViewExp *vp = &pData->eproc->ip->GetActiveViewExp();
#else
ViewExp *vp = pData->eproc->ip->GetActiveViewport();
#endif
vp->GetAffineTM(affineTM); vp->GetAffineTM(affineTM);
if ( vp->IsPerspView() ) if ( vp->IsPerspView() )
{ {
@ -4357,7 +4360,7 @@ DWORD WINAPI myThread (LPVOID vData)
//======== //========
CNELU::release(); CNELU::release();
} }
catch (EDru& druExcept) catch (const EDru& druExcept)
{ {
MessageBox (NULL, utf8ToTStr(druExcept.what()), _T("NeL driver utility"), MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, utf8ToTStr(druExcept.what()), _T("NeL driver utility"), MB_OK|MB_ICONEXCLAMATION);
} }
@ -4584,7 +4587,11 @@ int EPM_PaintMouseProc::proc(
int flags, int flags,
IPoint2 m) IPoint2 m)
{ {
ViewExp *vpt = ip->GetViewport(hwnd); #if MAX_VERSION_MAJOR >= 19
ViewExp *vpt = &ip->GetViewExp(hwnd);
#else
ViewExp *vpt = ip->GetViewport(hwnd);
#endif
int res = TRUE; int res = TRUE;
static PatchMesh *shape1 = NULL; static PatchMesh *shape1 = NULL;
static int poly1, tile1, tile2, mesh1, mesh2, seg1; static int poly1, tile1, tile2, mesh1, mesh2, seg1;
@ -4613,8 +4620,10 @@ int EPM_PaintMouseProc::proc(
break; break;
} }
#if MAX_VERSION_MAJOR < 19
if (vpt) if (vpt)
ip->ReleaseViewport(vpt); ip->ReleaseViewport(vpt);
#endif
return res; return res;
} }

View file

@ -103,7 +103,11 @@ void PaintMouseProc::DoPainting(HWND hWnd, IPoint2 m)
} }
VertexPaintData* d = (VertexPaintData*)mc->localData; VertexPaintData* d = (VertexPaintData*)mc->localData;
#if MAX_VERSION_MAJOR >= 19
ViewExp* pView = &GetCOREInterface()->GetViewExp(hWnd);
#else
ViewExp* pView = GetCOREInterface()->GetViewport(hWnd); ViewExp* pView = GetCOREInterface()->GetViewport(hWnd);
#endif
Mesh* mesh = d->GetMesh(); Mesh* mesh = d->GetMesh();
if (mesh) { if (mesh) {
@ -158,7 +162,9 @@ void PaintMouseProc::DoPainting(HWND hWnd, IPoint2 m)
} }
} }
#if MAX_VERSION_MAJOR < 19
GetCOREInterface()->ReleaseViewport(pView); GetCOREInterface()->ReleaseViewport(pView);
#endif
} }
else { else {
SetCursor(hNoPaintCursor); SetCursor(hNoPaintCursor);
@ -186,7 +192,11 @@ void PaintMouseProc::DoPickColor(HWND hWnd, IPoint2 m)
SetCursor(hDropperCursor); SetCursor(hDropperCursor);
TriObject *pTri = (TriObject *) os.obj; TriObject *pTri = (TriObject *) os.obj;
#if MAX_VERSION_MAJOR >= 19
ViewExp* pView = &GetCOREInterface()->GetViewExp(hWnd);
#else
ViewExp* pView = GetCOREInterface()->GetViewport(hWnd); ViewExp* pView = GetCOREInterface()->GetViewport(hWnd);
#endif
Mesh* mesh = &pTri->mesh; Mesh* mesh = &pTri->mesh;
if (mesh) { if (mesh) {
@ -234,7 +244,9 @@ void PaintMouseProc::DoPickColor(HWND hWnd, IPoint2 m)
} }
} }
#if MAX_VERSION_MAJOR < 19
GetCOREInterface()->ReleaseViewport(pView); GetCOREInterface()->ReleaseViewport(pView);
#endif
} }
} }
else { else {

View file

@ -854,10 +854,17 @@ void VertexPaint::fillSelectionGradientColor()
// Get Matrix to viewport. // Get Matrix to viewport.
Matrix3 viewMat; Matrix3 viewMat;
{ {
#if MAX_VERSION_MAJOR >= 19
ViewExp *ve = &GetCOREInterface()->GetActiveViewExp();
#else
ViewExp *ve = GetCOREInterface()->GetActiveViewport(); ViewExp *ve = GetCOREInterface()->GetActiveViewport();
#endif
// The affine TM transforms from world coords to view coords // The affine TM transforms from world coords to view coords
ve->GetAffineTM(viewMat); ve->GetAffineTM(viewMat);
#if MAX_VERSION_MAJOR < 19
GetCOREInterface()->ReleaseViewport(ve); GetCOREInterface()->ReleaseViewport(ve);
#endif
} }