Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    use OBJECT_MODIFIER to affect op with deformer

    Scheduled Pinned Locked Moved PYTHON Development
    9 Posts 0 Posters 1.1k Views
    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 Offline
      Helper
      last edited by

      On 12/01/2018 at 07:00, xxxxxxxx wrote:

      is it possible to use OBJECT_MODIFIER to affect op with another deformer?

          def ModifyObject(self, mod, doc, op, op_mg, mod_mg, lod, flags, thread) :
        
              reduction = c4d.BaseObject(c4d.Obend) #Bend Deforemer
              reduction[c4d.DEFORMOBJECT_STRENGTH] = c4d.utils.Rad(90) #Strenght = 90 degrees
              reduction.InsertUnder(op) #Insert bend under op
              
      	op.Message(c4d.MSG_UPDATE)
      	
      	return True
      

      This code display deformer but it has no effect on the geometry.

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

        On 12/01/2018 at 07:01, xxxxxxxx wrote:

        I registered this plugin as a MODIFIER

          
        info = c4d.OBJECT_MODIFIER 
        

        Do I have to include other flags, in order to make it work with other deformers?

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

          On 12/01/2018 at 07:36, xxxxxxxx wrote:

          Seems like it's working but not in the viewport. 
          What could cause such behavior?

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

            On 12/01/2018 at 14:11, xxxxxxxx wrote:

            Well... I used CSTO command but now I see 2 objects in my viewport. in the rendered image, this base object is hidden and only modified geometry is displayed.

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

              On 13/01/2018 at 15:30, xxxxxxxx wrote:

              Where can I find more information about OBJECT_MODIFIER **plugins? 🙂

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

                On 15/01/2018 at 05:44, xxxxxxxx wrote:

                Is it possible to show only modified object and hide the original one?

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

                  On 15/01/2018 at 05:47, xxxxxxxx wrote:

                  Hi,

                  the issue is actually not so much OBJECT_MODIFIER related.
                  You are not allowed to modify the scene from within the scene evaluation pipeline. This includes ObjectData's GetVirtualObjects(), ModifyObjects(), GetContour() and Execute() functions, also similar functions from other NodeData derived plugin types.

                  Actually a modifier usually modifies the geometry directly, using existing deformers is at least a bit unusual, see example Py-SpherifyModifier.

                  But if you really have to use existing deformers to get the job done, you can still do so, even if it may be not the fastest route to go. In this case you'd clone the object, you want to modify, insert it into a temporary document, add the modifier there, execute the temporary document and then transfer the result to the object being modified in ModifyObject().

                  Maybe you can let us know a bit more about your final intention, then we could discuss here, what's the best way to get there.

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

                    On 15/01/2018 at 05:58, xxxxxxxx wrote:

                    Originally posted by xxxxxxxx

                    Maybe you can let us know a bit more about your final intention, then we could discuss here, what's the best way to get there.

                    I want to perform several modeling operations on the desired object but before this, I would like to use poly reduction, in order to simplify its geometry and then execute modeling commands. 🙂

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

                      On 17/01/2018 at 05:50, xxxxxxxx wrote:

                      Hi,

                      since R19 we have a PolyReduction class. Here's some more information in the PolygonReduction manual.
                      Not only will this be way easier to implement, than the above described deformer approach, but it should also perform way better.

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