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

    No Attributes

    PYTHON Development
    0
    21
    12.0k
    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 09/03/2012 at 12:20, xxxxxxxx wrote:

      i know this is hijacking and i'm sorry, but :

      Originally posted by xxxxxxxx

      And op.Cache() 🙂

      where is Cache() located ? i can only find BaseObject.GetCache() and BaseObject.GetDeformCache().
      is Cache readonly ?

      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 09/03/2012 at 12:28, xxxxxxxx wrote:

        @Lennart:

        c4d.BaseObject.GetCache() does not work while rendering, yet. If you can find a way to get the cache while rendering, I'd really appreciate sharing it.
        @t tuuz:

        Please use the code formatting options the forum provides.

        I assume you'd like to have some correction and tips.

        1. Your coding style is crap, sorry. 🙂 Proper indentation and margins as well as a strict naming convention makes reading code more easy. The general convention is to use CamelCase on class-names. In Java, the preferred way to name variables and methods is using mixedCase, and in Python underscore_seperated_names.

        2. Starting at Line 244: Calling the object to subscript it is not necessary. Use subscripting directly on the object.

        3. Using ResEdit makes life easier when using dialogs.

        4. You don't have to call c4d.GeDialog.LayoutChanged() at the end of c4d.GeDialog.CreateLayout()

        5. Starting with line 210: You call c4d.EventAdd() multiple times. Don't do that. You won't recognize these changes anyway before the method returned. Only update where necessary, i.e. at the end of the function, and only if things have changed.

        6. Line 193: c4d.BaseDocument.GetObjects() does not return the selected objects.

        7. Line 207: Use constants defined in the c4d module instead of the constants value directly. "Constants" might change from Cinema 4D Release to Release and your way will make your plugin "release-independant". c4d.Onull is the ID corresponding to a Null-Objec, c4d.Ofractal is the type-constant for the landscape primitve, c4d.Oinstance

        8. Line 256: Well, you can use c4d.CallCommand(12236) (note: there are no ids for commands..) and it makes your object editable, but you Landscape variable still refers to the old object. You'd need to get the new object by calling c4d.BaseDocument.GetActiveObject() (after the command, the object that was modified is selected), but that is still very dirty. A better way would be to use c4d.BaseObject.SendModelingCommand() or c4d.GetCache() (as noted above, this method does not work while rendering, but in a script it's fine).

        9. Line 357: os.path.join was made for platform independently concatenating paths. You are using a platform dependend partial path which makes using the function quite senseless. 🙂 os.path.join(path, "res", icons", "None") is the correct way to use it. (Why would you name a file None?)

        The point from the ones that answers your question is #8.

        @littledevil:

        He means c4d.BaseObject.GetCache() 🙂

        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 09/03/2012 at 12:44, xxxxxxxx wrote:

          Thanks for the reply im only 7 days into writeing python so im picking things up the best way i can in the time ive been doing it so all pointers are welcome cheers.
           
            Ray.

          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 09/03/2012 at 12:58, xxxxxxxx wrote:

            You're doing very well for your 7th day, by the way. 🙂 You should've seen how I started .. lol

            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 09/03/2012 at 14:13, xxxxxxxx wrote:

              @ Niklas. GetCache() and GetDeformCache() are read only but works
              fine for my renderings (getting info) so I don't know what you mean
              that they shouldn't work for rendering?

              To actually make a polygon object, using SendModelingCommand()
              and insert the first index returned would be my recommendation.

                
                  pointobj   = c4d.utils.SendModelingCommand(   
                      command = c4d.MCOMMAND_CURRENTSTATETOOBJECT,   
                      list    = [op.GetClone()],   
                      mode    = c4d.MODELINGCOMMANDMODE_ALL,   
                      doc     = doc)   
                     
                  newobj = pointobj[0]   
                  newobj.InsertAfter(op)   
                  c4d.EventAdd()   
              

              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 09/03/2012 at 14:28, xxxxxxxx wrote:

                @Lennart:

                Sorry, I wasn't clear enough. You can't use GetCache() while rendering in the PictureViewer, i.e. using it on a PythonTag or -Generator does not work.

                Create a PythonTag on a Cube and insert that code onto it, hit "Render to PictureViewer" and you'll see that the return of GetCache() is None.

                def main() :
                    og = op.GetOrigin()
                    print og, og.GetCache()
                

                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 09/03/2012 at 15:10, xxxxxxxx wrote:

                  It works fine here.
                  Keep in mind that the PictureViewer scans from
                  first frame up to the frame to be rendered.
                  So that's when "None" is returned.

                  Try to render at first frame or add a "if".

                    
                  import c4d   
                    
                  def main() :   
                      obj = op.GetOrigin()   
                      cobj = obj.GetCache()   
                      if cobj is not None:   
                          print obj, cobj   
                  

                  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 09/03/2012 at 15:17, xxxxxxxx wrote:

                    I am confused, once again. It works for me when rendering an animation, but rendering a single frame doesn't.

                    This is what I get when rendering an animation from Frame 0 to 10, 10 lines, but it should be 11!

                    <c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0D3A21A0> <c4d.PolygonObject object called 'Cube/Polygon' with ID 5100 at 0x0D596E40>  
                    <c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0D3A2160> <c4d.PolygonObject object called 'Cube/Polygon' with ID 5100 at 0x0D596D60>  
                    <c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0D3A21C0> <c4d.PolygonObject object called 'Cube/Polygon' with ID 5100 at 0x0D596E40>  
                    <c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0D3A21B0> <c4d.PolygonObject object called 'Cube/Polygon' with ID 5100 at 0x0D596D60>  
                    <c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0D3A21A0> <c4d.PolygonObject object called 'Cube/Polygon' with ID 5100 at 0x0D596E40>  
                    <c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0D3A2160> <c4d.PolygonObject object called 'Cube/Polygon' with ID 5100 at 0x0D596D60>  
                    <c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0D3A21C0> <c4d.PolygonObject object called 'Cube/Polygon' with ID 5100 at 0x0D596E40>  
                    <c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0D3A21B0> <c4d.PolygonObject object called 'Cube/Polygon' with ID 5100 at 0x0D596D60>  
                    <c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0D3A21A0> <c4d.PolygonObject object called 'Cube/Polygon' with ID 5100 at 0x0D596E40>  
                    <c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0D3A2160> <c4d.PolygonObject object called 'Cube/Polygon' with ID 5100 at 0x0D596D60>
                    

                    Same when I render from frame 0 to 1, I only get one line but it should be two lines (2 frames actually rendered). I don't get a single line when rendering a single frame.

                    So the cache isn't available at the first frame? That's senseless actually .. 🤢

                    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 09/03/2012 at 15:30, xxxxxxxx wrote:

                      Prints the correct pointcount here at frame zero.

                        
                      import c4d   
                        
                      def main() :   
                          obj = op.GetOrigin()   
                          cobj = obj.GetCache()   
                          if cobj is not None:   
                              print cobj.GetPointCount()   
                      

                      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 09/03/2012 at 15:35, xxxxxxxx wrote:

                        And to print corresponding frame:

                          
                        import c4d   
                          
                        def main() :   
                            obj = op.GetOrigin()   
                            cobj = obj.GetCache()   
                            if cobj is not None:   
                                frame = doc.GetTime().GetFrame(doc.GetFps())   
                                print frame,' <> ',cobj.GetPointCount()   
                        

                        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/03/2012 at 02:50, xxxxxxxx wrote:

                          On what C4D Version are you working on? Could you please test this scene? Just open it, clear the console and hit render?

                          What I get is

                          <c4d.BaseObject object at 0x07764080> None
                          

                          Thanks,
                          -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 10/03/2012 at 05:50, xxxxxxxx wrote:

                            For f** sake Niklas, don't use that linking of yours, I got all sorts of exe and porn install links and pop ups
                            and no dload.

                            Try to find a safer dload please.

                            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/03/2012 at 06:16, xxxxxxxx wrote:

                              I don't see any of these, Lennart. Sorry. I've uploaded it on my server. tcastudios_cachetest.c4d

                              -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 10/03/2012 at 06:45, xxxxxxxx wrote:

                                You need to let the Generator build the cache before the expression,
                                so set the priority of the tag to "Generators".

                                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/03/2012 at 08:27, xxxxxxxx wrote:

                                  OH MY GOD! YOU'RE MY HERO! :hugging:
                                  Thanks, Lennart! I never really "used" priorities in C4D.. And I didn't think of it.

                                  That lets me continue my work on a number of projects! Thanks!

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