On Sat, Jun 6, 2009 at 03:44, sunny<[email protected]> wrote: > > i have created a deformer , but i want to set some attributes to > certain values on that deformer( ie. before deformer start working).
If you want to *create* some attributes then just do it in the deformer node's initialize() method, same as you would for a normal node. If you already have the attributes and you want to set them, then the question is what information is required to set them? Are you just initializing them to a fixed value? If so then do that using a default value when you construct the attribute. If that won't work then do it in your node's postConstructor() method. If you need information from the geometry which it is deforming then you might be able to do that in your deformer's accessoryNodeSetup() method, but I'm not sure if that gets called before or after the geometry has been connected. If that doesn't work then use your node's connectionMade() method to tell you whenever new geometry is connected and then set the attribute value from that. > I figure out( through some plugins calls) that it would be best if i > create a MPxCommand to call my deformer. For a normal node, that would be the way to go. However, plug-in deformer nodes are normally created using Maya's built-in 'deformer' command which does all the work of connecting the geometry up properly. If you were to create your own command then you would have to supply similar functionality in your own command. It's doable, but can be a bunch of extra work. Also, there's nothing to stop a user from going ahead and using the 'deformer' command instead of your custom command. For these reasons you should try to avoid providing your own command to create your deformer node. However, there's no problem in creating a command which allows the user to edit various parameters of your deformer, if that's what you're after. > also can > i connect some object to deformer node when i call MPxDeformerNode. It depends. If by "some object" you mean the geometry which is to be deformed, then you should leave that up to Maya's 'deformer' command. If you're talking about some other node that you want to connect to your deformer whenever geometry is attached to it, then you can do so in your deformer's accessoryNodeSetup() method. -- -deane --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
