Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    GetContour() refresh or uncache? How?

    PYTHON Development
    0
    21
    16.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      On 03/02/2012 at 08:00, xxxxxxxx wrote:

      Any news? Still waiting ...

      Cheers,
      maxx

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 03/02/2012 at 08:44, xxxxxxxx wrote:

        Hi maxx,

        this seems to work well. However, it is not really satisfying using that hack..

        http://www.file-upload.net/download-4083773/GetContour.zip.html

        Cheers, Niklas!

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

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

          Originally posted by xxxxxxxx

          Hi maxx,

          this seems to work well. However, it is not really satisfying using that hack..

          http://www.file-upload.net/download-4083773/GetContour.zip.html

          Cheers, Niklas!

          Hy nux, thanx for Code. But as you say, its not really satisfying. As tcastudios wrote, doing this will have severe performance drawbacks ...

          Cheers,
          André

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            On 04/04/2012 at 05:41, xxxxxxxx wrote:

            So we have reason to believe that there is no Cache to release for GetContour()
            in a similar manner as one can do with GetVirtualObjects() by not returning
            a HierarchyHelp ?

            Cheers
            Lennart

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

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

              On 04/04/2012 at 07:23, xxxxxxxx wrote:

              Hi,

              I contacted the developers on this issue.

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

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

                On 04/04/2012 at 08:47, xxxxxxxx wrote:

                Great, thanks Yannick.

                Cheers
                Lennart

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

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

                  On 10/04/2012 at 07:27, xxxxxxxx wrote:

                  Here's the information I got from the developers.

                  Splines created though GetContour() are cached. To make this frame dependent CheckDirty() can be overloaded to set the object dirty if a certain condition has changed:

                  class TestSplineData(plugins.ObjectData) :
                      
                      def __init__(self) :
                          doc = documents.GetActiveDocument()
                          self.lastFrame = doc.GetTime().GetFrame(doc.GetFps())
                      
                      def CheckDirty(self, op, doc) :
                          print "CheckDirty()"
                          
                          frame = doc.GetTime().GetFrame(doc.GetFps())
                          if frame != self.lastFrame:
                              self.lastFrame = frame
                              op.SetDirty(c4d.DIRTYFLAGS_DATA)
                      
                      def GetContour(self, op, doc, lod, bt) :
                          print "GetContour()"
                          
                          return c4d.BaseObject(c4d.Ospline)
                  

                  This should only be done if absolutely necessary though, otherwise the spline (and all depending objects) will be rebuilt for every single view-redraw.

                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

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

                    On 10/04/2012 at 08:13, xxxxxxxx wrote:

                    Thank you very much,Yannick! That is a big step in the right direction.
                    I will try to get all In/Excl objects within the CheckDirty() because that is
                    the "core" issue I have. The generator should update on the list's object's
                    dirty status.
                    I'll report how a get (or don't get! it working.

                    Cheers
                    Lennart

                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

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

                      On 10/04/2012 at 10:46, xxxxxxxx wrote:

                      YES YES! I'm so happy that this is solved, thanks a lot.
                      I've posted the important parts of one plugin I'm working with.
                      It needs to get dirty info from objects in a In/Excl List so I
                      simply could loop them and check the sum against the stored dirty sum.
                      Then to bypass the potential problems using GetActiveDocument() (for not active document)
                      I simply treat the current frame as a dirty (Long) value and include it in
                      the dirty sum!

                      Could not be happier!

                      Cheers
                      Lennart

                      """   
                      splineGLIDE   
                      Copyright: tcastudios 2012   
                      Written for CINEMA 4D R13.+   
                        
                      Modified Date: 2012xxxx   
                      """   
                        
                      import c4d   
                      import os   
                      import webbrowser as w   
                      from c4d import plugins, utils as u, bitmaps, Vector as v, documents   
                      from c4d.utils import SplineHelp, SplineLengthData   
                        
                      PLUGIN_ID = 1028358 # PLUGIN ID registered by tcastudios. IF YOU MAKE ANY EDITS YOU MUST GET A NEW PLUGIN ID FROM plugincafe.com!!   
                      DIRTYSUM = 1027373 # Unique ID from plugincafe.com registered by tcastudios.com (PCLUSTER_MEMO)   
                        
                      class sGLIDE(plugins.ObjectData) :   
                           """splineGLIDE Generator"""   
                              
                           def Init(self, sglide) :   
                                data = sglide.GetDataInstance()   
                                data.SetReal(c4d.SG_MIX,1.0) # Mix Float   
                                data.Set etc……   
                                return True   
                        
                           def CheckDirty(self,op,doc) :   
                                obc        = op.GetDataInstance()   
                                dirtysumbc = obc.GetContainer(DIRTYSUM)   
                                dlist      = obc.GetData(c4d.SG_SOURCES) #InExclude List objects to get dirty from   
                                lcount     = dlist.GetObjectCount()   
                                   
                                checksum = doc.GetTime().GetFrame(doc.GetFps()) # Use frame as a dirty integer (Long)   
                                for d in xrange(lcount) :   
                                     checksum += dlist.ObjectFromIndex(None ,d ).GetDirty(c4d.DIRTY_DATA|c4d.DIRTY_MATRIX |c4d.DIRTY_CHILDREN|c4d.DIRTY_CACHE|c4d.DIRTY_SELECT)   
                        
                                if (checksum != dirtysumbc.GetLLong(0)) :   
                                     dirtysumbc.SetLLong(0,checksum)   
                                     obc.SetData(DIRTYSUM,dirtysumbc)        # Store new checksum into Container   
                        
                           def Construct(self,sglide) :   
                                sbc        = sglide.GetDataInstance()   
                                myfader    = sbc.GetReal(c4d.SG_MIX)   
                                myetc      = sbc.Get etc etc   
                                myspline   =   
                                myspline   = c4d.BaseObject(c4d.Ospline)   
                                # code that do things with spline from In/Excl List objects   
                                return     myspline   
                        
                           def GetContour(self, sglide, doc, lod, bt) :   
                                return self.Construct(sglide)   
                        
                      if __name__ == "__main__":   
                          path, file = os.path.split(__file__)   
                          bmp = bitmaps.BaseBitmap()   
                          bmp.InitWith(os.path.join(path, "res", "splineGLIDE.tif"))   
                          splineGLIDELoaded = plugins.RegisterObjectPlugin(id=PLUGIN_ID,   
                                          str="splineGLIDE",   
                                                      g=sGLIDE,   
                                                      description="splineGLIDE",   
                                                      icon=bmp,   
                                                      info=c4d.OBJECT_GENERATOR | c4d.OBJECT_ISSPLINE )   
                                                         
                          if splineGLIDELoaded:   
                              print 'splineGLIDE v1 Loaded'   
                      

                      edit: Don't need to set checksum again for the op.

                      1 Reply Last reply Reply Quote 0
                      • H
                        Helper
                        last edited by

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

                        On 06/09/2012 at 09:37, xxxxxxxx wrote:

                        I've been struggling with this in C++ just a few seconds ago. I'm so happy I remembered this thread. 🙂
                        I couldn't find this information in the C++ docs as well. Especially because CheckDirty() is listed under methods for Modifier objects, it didn't appear to me that I need to override this method.

                        -NIklas

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post