Instant GetDirty



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

    On 28/07/2012 at 05:11, xxxxxxxx wrote:

    I'm using the code:

    import c4d
    prev_state = -1

    def main() :
        global prev_state
        state = op.GetDirty(c4d.DIRTY_DATA)
        if state != prev_state:
            # parameters have changed!
        prev_state = state

    ...to check for the change of a polygonal object inside a Message method.
    It works fine except for the fact that, if I move the vertexes of the polygonal object, I only get a notification of it being "dirty" after I release the vertexes in the new position.
    Is it possible to be able to check in realtime if a polygonal object is being changed?



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

    On 28/07/2012 at 05:17, xxxxxxxx wrote:

    Have you tried checking for c4d.DIRTY_CACHE ?



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

    On 28/07/2012 at 05:59, xxxxxxxx wrote:

    Yes, and it is not working :-(

    Let me explain in general, what I'm trying to do.
    I created an ObjectData object.
    I want to update it whenever another object (a polygonal object) changes.
    This means that if I move the points of the polygonal object or if I move the polygonal object or if I deform the polygonal object, my ObjectData object gets updated.
    I placed the code that updates the ObjectData object inside the GetVirtualObjects method.
    It works fine but it is constantly updating the object, and that will eventually slow down the editor if I have many ObjectData objects in my scene.
    So, I just want them to update when that polygonal object changes.
    Is that possible?



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

    On 28/07/2012 at 06:05, xxxxxxxx wrote:

    Ok, I found out that what I really need is the c4d.DIRTY_DATA
    The problem resides in the fact that the Message method is not being called in real time.
    Could that be changed?



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

    On 28/07/2012 at 07:14, xxxxxxxx wrote:

    What you may need to do is poll the polygonal object in your GVO routine. If the object has changed, update your generated object. If it hasn't then don't.

    Unfortunately this does meand that you will have to keep track of the state of the polygonal object so you can see if it has changed.



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

    On 28/07/2012 at 07:26, xxxxxxxx wrote:

    Well, if I make the verification of c4d.DIRTY_DATA inside GetVirtualObjects, it is checked in realtime.
    However, I can't return with None if there wasn't any change because that would make my ObjectData object disappear.
    So, I must ALWAYS return something from GetVirtualObjects, in order to show something in the editor, right?



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

    On 28/07/2012 at 11:59, xxxxxxxx wrote:

    In the grand scheme of things, we are supposed to use GetCache(hierarchyhelp)
    for PyObject Generators (GetVirtualObject()) when "making" anything but true splines.
    For True Splines we are supposed to use GetContour() and CheckDirty().

    This actually works for sources that actually -do- return a Cache.
    However, it all fall flat on its face as undeformed point objects in Py
    - do not return any form of Cache - ! , and hence always are "dirty" forcing our
    beloved Python Object Generators depending on extarnal sources do constantly update.

    So until we have a -complete working example- to build from, we are out of luck.

    Cheers
    Lennart


Log in to reply