resetxform does not take effect immediately in C++

resetxform does not take effect immediately in C++

xiesansi
Enthusiast Enthusiast
434 Views
5 Replies
Message 1 of 6

resetxform does not take effect immediately in C++

xiesansi
Enthusiast
Enthusiast

Hi again,

 

https://forums.autodesk.com/t5/3ds-max-programming/how-can-i-use-the-resettransform-in-maxscript/td-...

 

As said in the above thread, the method resetxform works perfectly when triggered in the max listener. But when I call the resetxform maxcript in C++ using ExecuteMAXScriptScript method, the value does not update (mesh data getting by method TriObject->GetRenderMesh) until I make some operation by hand in the modifier plane.

 

How to force it to take effect immediately?

 

thank you in advance

 

 

 

 

0 Likes
435 Views
5 Replies
Replies (5)
Message 2 of 6

denisT.MaxDoctor
Advisor
Advisor

I don't understand why use MXS in c++ code?

search ResetXForm in max sdk samples and get how to do it c++ way

0 Likes
Message 3 of 6

xiesansi
Enthusiast
Enthusiast

because we do not want to change the users' file

we change it, get the value, and undo the operation (with undo on in Maxscript)

and all of these are done by Maxscript😅

0 Likes
Message 4 of 6

denisT.MaxDoctor
Advisor
Advisor

try to call notifydependence ... call completeredraw ... set modify mode before resetxform ... do resetxform for selected object ... maybe something will help

0 Likes
Message 5 of 6

Swordslayer
Advisor
Advisor
0 Likes
Message 6 of 6

klvnk
Collaborator
Collaborator

because we do not want to change the users' file

we change it, get the value, and undo the operation (with undo on in Maxscript)

and all of these are done by Maxscript

 

eh ? use c++ to reset xform and do the export then close the file without saving ! no undo required though you can handle the undo using the sdk in various ways.

 

the easiest way using the sdk is use the code in samples to add the xform modifier

grab the result of the stack with  ObjectState Object::Eval(TimeValue t) do what you need too with the result then

delete the modifier and nothing has changed.

 

 

0 Likes