THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/07/2011 at 06:45, xxxxxxxx wrote:
Cinema 4D Version: 12
Platform: Windows ; Mac ;
Language(s) : C++ ;
According to the docs :
**If a tool is not using the modeling library's own UNDO option and_<_span title="bool modeling::commitc4datom op=null, lOng flags=0 , cobj = null"_>_Commit () fails, the tool MUST undo the changes made to the object before exiting the tool. If this does not happen and _LL">Commit() fails in a crucial place (usually triangulation) then the object will have been partly modified and the object will be invalid, which means that CINEMA 4D then crashes for many reasons since it's corrupt.
So in summary: If Modeling::_= NULL">Commit() returns FALSE, a tool MUST undo any changes made to that object unless the modeling library is handling UNDO itself (i.e. you passed MODELING_COMMIT_ADDUNDO).**
So they way I interpret this is:
//Commit Modeling Changes
if (!mod->Commit(polyObj, MODELING_COMMIT_NO_NGONS, NULL))
for(int i = 0; i < pointCount; i++)
So in my head (which is sometimes a dusty place... lol) I see this as if commit didn't work, undo all changes made from a loop above this one where all the points were checked...
but I still get errors sometimes that say Invalid Kernel State..... I am assuming it is because the number of undos done above do not necessarily match the changes that were made.. Is there a way to get the number of undos in the undo list that was started with doc->StartUndo().
Or... Is there a better way to ensure that if the Kernel fails that the object goes back to it's original state?
On 04/07/2011 at 20:06, xxxxxxxx wrote:
Any thoughts on this?