Custom Transform Node

I’m trying to make something that basically blends between 2 transforms/matrices and transforms itself to the result. Not sure about a couple of things…

  1. MayaPy or PyMel?
    I’m plugging transforms and wouldn’t want linking by name. I suppose I could just plug world transforms directly so leaning more toward PyMel for OOP.

  2. In PyMel, where’s the validate and set value call when the inputs change value?

For PyMel stuff I’ve been reading on these two articles:
http://www.jason-parks.com/artoftech/?p=225
http://www.jason-parks.com/artoftech/?p=520

Sure attributes are there… You can store and plug stuff in and not do anything with it when values change or did I miss anything?:?:

Are you interested in creating your own transform node (API) or adding additional functionality to the PyMel transform class by subclassing (PyMel)?

[QUOTE=capper;21144]Are you interested in creating your own transform node (API) or adding additional functionality to the PyMel transform class by subclassing (PyMel)?[/QUOTE]

I also tried subclassing the transform node through PyMel but I’d like to add attributes that update when something changes like API plugs through something like validateAndSetValue.

Correct me if I’m wrong, but it sounds like you’re looking to make a custom transform node with built-in parent constraint style blending? i.e. it updates based on DG evaluation rather than a user triggered script execution? If that’s the case then I’d have thought that writing it as an API (plugin) node rather than a pymel transform subclass would be more appropriate.

Yeah I thought there’d be a quicker way to prototype first but after reverting back to my PyAPI code it makes sense to just do it in C++ directly. I was just wondering if there was a virtual function I could override to do that from Python.

There might actually already be a node for that already. Its called wtAddMatrix. It takes an arbitrary amount of matrices and an associated weight value and outputs the results as another matrix. You can get transform, scale and rotation back by “decomposing” the outcoming matrix with a decomposeMatrix node. Both are bundled with maya since way back, altough decomposeMatrix might not be loaded by default in the plugin manager. Look for “matrixNodes” under maya 2013-2014 and a “decomposeMatrix” for anything below.

Yeah I’ve seen those and thought about it but I thought I’d go for something contained so it’s fast and efficient since I’ll need a few dozen of those. It’ll decompose and recompose matrices then go through each plug in real-time.

[QUOTE=nevilos;21228]Yeah I’ve seen those and thought about it but I thought I’d go for something contained so it’s fast and efficient since I’ll need a few dozen of those. It’ll decompose and recompose matrices then go through each plug in real-time.[/QUOTE]

Not sure about the amount of computation that goes on within those nodes, but I’ve used hundreds if not thousands of decomposeMatrix nodes without noticing any performance hit. As for containment, you could bundle them up with a “dagContainer” so as to give the appearance of one node performing the calculations. That way, you wouldn’t have to supply an external plugin to others who you intend on using your technique.

Thanks! I’ll try that for a quick proto and optimize if I get a performance hit.