Can't detect is a spline is Dirty



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

    On 18/09/2012 at 17:13, xxxxxxxx wrote:

    I have a plugin generating a mesh. That mesh is based on a spline object.
    To make it faster, I check for changes and, if there aren't any, I return a cached version with this code:

      
    def GetVirtualObjects(self, op, hierarchyhelp) :   
         path=op[FRM_PATH]   
         dt=False   
         if path is not None: dt=path.IsDirty(c4d.DIRTY_DATA)   
         dirty = op.CheckCache(hierarchyhelp) or op.IsDirty(c4d.DIRTY_DATA) or dt   
         if dirty is False: return op.GetCache(hierarchyhelp)   
    return Calculate_Mesh(op)   
    

    The first three lines are to check if the required spline was changed.
    But dt is ALWAYS False, even if I change any parameter of the spline.
    How can I check for the dirtyness of the spline?



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

    On 19/09/2012 at 02:33, xxxxxxxx wrote:

    Are you sure GetVirtualObjects() is called when you change the spline? Do you call self.SetOptimizeCache(True) in your object plugin?



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

    On 19/09/2012 at 02:47, xxxxxxxx wrote:

    Yes, I placed a print "Recalculating" at the end of the GetVirtualObjects() method and it is output to the console, so, the GetVirtualObjects() is being called.

    I don't call self.SetOptimizeCache(True) anywhere in my plugin. Should I?

    Rui Batista



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

    On 19/09/2012 at 03:07, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Yes, I placed a print "Recalculating" at the end of the GetVirtualObjects() method and it is output to the console, so, the GetVirtualObjects() is being called.

    I don't call self.SetOptimizeCache(True) anywhere in my plugin. Should I?

    No you shouldn't.

    I tested this and it's working as expected. Could you post a simplified version of your plugin?



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

    On 19/09/2012 at 03:23, xxxxxxxx wrote:

    Well, its not that I'm not willing to post a simplified version. It is just that is tremendously hard to create a simplified version ;-)

    I will try to explain to see if I'm doing something wrong.

    I have a Spline Generator plugin. It creates a spline in the GetContour method.
    I overrided the CheckDirty method with this code:

      
    def CheckDirty(self, op, doc) :   
         v1=op[FR_STARTPOINT]   
         v2=op[FR_ENDPOINT]   
         d1=d2=False   
         if v1 is not None: d1=v1.IsDirty(c4d.DIRTY_DATA)   
         if v2 is not None: d2=v2.IsDirty(c4d.DIRTY_DATA)   
         if d1 or d2: op.SetDirty(c4d.DIRTYFLAGS_DATA)   
    

    and it works fine.

    Besides, I have a Mesh Generator that creates a mesh based on the spline created by the Spline Generator object. The code that I have in the GetVirtualObjects is the one shown in the first post.
    The op[FRM_PATH] is a Link field that contains a link to the Spline Generator object (only accepts those objects).
    So, path=op[FRM_PATH] sets the path variable to the Spline Generator object, right?
    However, path.IsDirty(c4d.DIRTY_DATA) always returns False, no matter what parameters I change in the Spline Generator object :-(



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

    On 19/09/2012 at 04:04, xxxxxxxx wrote:

    Thanks for the explanation. I don't really see where's the problem because it's working fine for me with my tests. Have you tried with a standard Cinema spline object?



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

    On 19/09/2012 at 04:09, xxxxxxxx wrote:

    Yes. One of my Mesh generators (I have two) works with two splines.
    One is the path (my Spline Generator object) and the other is a profile (it generates a SweepNURBS).
    I also tried to test for the profile being dirty and, although the profile is a standard Circle spline, even if I adjust its parameters (radius, spline interpolation, etc), the IsDirty always returns False :-(



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

    On 19/09/2012 at 04:37, xxxxxxxx wrote:

    Is it possible to send to sdk_support@maxon.net the generator plugins and an example scene? This is an issue hard to reproduce because of the complex setup.



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

    On 19/09/2012 at 05:06, xxxxxxxx wrote:

    Sure Yannick.
    I will write the mail explaining what is happening and I will send both generators (the spline and the mesh). Included will be an example scene showing the problem.



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

    On 19/09/2012 at 06:55, xxxxxxxx wrote:

    I already sent the required information to maxon.
    However, I still made another experiment:

    I created two Nulls. In each Null I attached a python tag with the following code:

    import c4d
    #Welcome to the world of Python

    def main() :
        obj=op.GetObject()
        print obj.GetName()
        print obj.IsDirty(c4d.DIRTY_DATA) or obj.IsDirty(c4d.DIRTY_MATRIX)

    And in my plugin I placed similar code:

    print obj.GetName()+" in Forkroot"
        print obj.IsDirty(c4d.DIRTY_DATA) or obj.IsDirty(c4d.DIRTY_MATRIX)

    The weirdest thing happens as I move or, in any way, edit the Nulls.
    The python tag prints out "True" to the Console when the Null in fact changes.
    But the printout from the plugin is always False.
    What could be happening?!?


Log in to reply