use OBJECT_MODIFIER to affect op with deformer



  • 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.



  • 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?



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

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



  • 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.



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

    Where can I find more information about OBJECT_MODIFIER **plugins? :)



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

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



  • 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.



  • 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. :)



  • 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.


Log in to reply