If you want to add attributes to a certain node type, you can do it through
the API, using MNodeClass:

MNodeClass nc("camera");
MFnNumericAttribute attrFn;
MObject attrHandle = attrFn.create("attribute", "attr",
MFnNumericData::kInt);
nc.addExtensionAttribute(attrHandle);

Now all the cameras in the scene will have this attribute. This is
available from Python too, so you don't have to make a C++ plug-in for it.

If you want to customize the AE, you can use a hook:

callbacks -addCallback "yourCameraAECustomContent" -hook
"AETemplateCustomContent" -owner "you";

global proc yourCameraAECustomContent(string $nodeName)
{
    editorTemplate -beginLayout "Your Section";
  editorTemplate -l "Your Attribute" -addControl "attribute";
        // Or, go crazy here with editorTemplate -callCustom.
    editorTemplate -endLayout;
}

If you don't want to do this for a certain type, but only for some objects,
you can add the attributes dynamically to those objects, and still use the
AETemplateCustomContent hook to customize the AE, so you don't have to
resort to things like using enums as separators (and you can also do state
management, validation and all the other nice things which come with being
able to run code when values change). If you really want to package all the
attributes into an object you can instantiate, register a new node type
with all those attributes and attach it under the relevant nodes. If your
nodes are transforms, parent the object to them. If they are shapes or
other node kinds, use the built-in message attribute to connect your
attributes node. You can still make the attributes show up in the AE of the
target nodes with the above hook, you just have to hide or disable them if
your attributes node is not present for a given node. If your targets are
transforms, the attributes should also show up in the channel box if the
channel box flag is set to true for them when you register the custom node
type (but I think your custom node needs to be a shape for that to work).
Anyway, I wouldn't go this far, since dynamic attributes should be
sufficient in your case, if I understand the problem correctly.



On Thu, May 14, 2015 at 6:20 AM, Raffaele Fragapane <
[email protected]> wrote:

> There is nothing like what you need, the closest thing however is to use
> dummy shapes to host attributes, and instancing those shapes if you want to
> "proxy" that set of attributes elsewhere.
> The channel box will aggregate and interval attributes on all shapes for
> the selected transform just fine as long as the attributes are keyable
>
> On Thu, May 14, 2015 at 4:53 AM, Eric Thivierge <[email protected]>
> wrote:
>
>> Thanks Joey. Unless it's OOTB I'm not touching it. :)
>>
>> I'll survive without it for now.
>>
>> Eric T.
>>
>

Reply via email to