Freeing CurrentStateToObject



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/08/2005 at 06:57, xxxxxxxx wrote:

    My first question, since my goof above, is are you adding the object resulting from SendModelingCommand() to the document? Again, no matter about my goof, Cinema 4D owns the object if you insert it into the document. Free()ing it while inserted would be a good cause for the crash.

    I'm not certain of the dynamics of using SendModelingCommand() within ModifyObject(). Personally, although the docs don't seem to forbid it, it sounds like a tricky prospect. David? :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/08/2005 at 07:21, xxxxxxxx wrote:

    Robert,
    i don't need to add the object but only i get the current state to work with it.

    I use currentstate to get the real poly from a nurbs generator and it's deformed state.

    Cheers
    Renato T.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/08/2005 at 12:13, xxxxxxxx wrote:

    Two thing you could try.
    First, simplify your code down to just calling the modeling command and see if it still crashes. If it doesn't then start putting back your code until it does. If it does not crash then try inserting the currentstate call into one of the sdk examples (say spherify as that uses modifyobject, replace its code with the modeling command call). This will help locate what is wrong and give more info about the problem.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/08/2005 at 18:00, xxxxxxxx wrote:

    David:

    all is working, CurrentStateToObject is working good.
    When i free the resc i got no memory leak.
    The only prolem is if i render in a 3D viewport.... crash.

    thanks for now
    Renato T.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/08/2005 at 23:46, xxxxxxxx wrote:

    I had a quick mo so I wrote a test and can confirm it causes a crash rendering into the viewport if you have the "Use Render LOD" enabled for the editor. Do you also have this option enabled? does it work if you do not have that enabled? Next chance I get I'll do some investigating.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/08/2005 at 05:48, xxxxxxxx wrote:

    David:

    i don't have "use render lod" enabled and it crash.
    When i enable it the deformer seem to not work but C4D is not crashing...

    Cheers :)
    Renato T.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/08/2005 at 09:17, xxxxxxxx wrote:

    Bad news I'm afraid. Calling the CurrentStateToObject is illegal, this function causes the internal caches to become invalid and since this is happening during the cache build it leads to unpredictable results (i.e. it can crash for any number of reasons).
    The suggested solution is to clone the object+hierarchy that you want a polygon version of and insert it into a dummy document, calling CurrentStateToObject for this. This is not great as it has overheads from the cloning plus will not work with a complex setup (think of dependencies etc.).
    You might (this is just an idea, not tested) be able to use Execute just before the cache is built (GENERATORS-1), if you then call CurrentStateToObject here it is allowed (as you are not within the cache building), you could then store this result (when you need it, maybe you will need your own dirty check to speed it up so you don't call this for every Execute) for use in ModifyObject. This way (if it works) you will not have the hierarchy problem or add much overhead (just your own dirty check).



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/08/2005 at 19:40, xxxxxxxx wrote:

    Hi David,

    i'll try.. but i've fear about this :)

    Thanks for now
    Renato T.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/08/2005 at 01:45, xxxxxxxx wrote:

    Hi David,

    this explains why my former experiments also failed.

    But tell me, how does Maxon implement the Instance object. ( perhaps the document trick ?! ) I think it would be very educational for the general public as well.

    It is exactly the same problem as we have to solve. We just don't need to clone the referenced object(s), but instead we use them for a mapping from uv space to the object.

    Meanwhile i've tried to access the caches of the linked objects directly. But this doesn't work because the BIT_CONTROLOBJECT flag is not avaiable if the generator is executed before the referenced objects. So i can't determine what objects i should use.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/08/2005 at 02:20, xxxxxxxx wrote:

    The instance object is not requesting a polygon/deformed version, it just clones the linked object. The only places MAXON have done something similar afaik is in Sky, and that uses the mentioned clone+makeeditable.
    As you mentioned, you can't grab the cache as you are within the building so some may not be available, plus some may be invalid too!



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/08/2005 at 06:43, xxxxxxxx wrote:

    Aww.. i see.
    Thanks anyway for your help :) Untill i read your post, i didn't even know about the problem with CurrentstateToObject.

    best regards
    Michael


Log in to reply