curve ramp attribute with dynamic output arrays

by denilson020898 posted 421 days ago | 1 comment

I am currently trying to get this behavior :

myNode has a curve ramp attribute which gets created with MRampAttribute class. I create 3 output for the curveRamp at position 0.0f, 0.5f, and 1.0f. then these attributes are passed on to 3 numeric attributes.

let's say, the compute algorithm is fairly simple. it takes each individual value and divides it by the number of curve points.

What I want is when I create a new curve point. it will add one more output attr, then divide each value by 4.

I can't get it worked with nummericAttr.setArrays(true).

and also, is there any example plug in in devkit that related to ramp attribute?

Probably using a class variable to keep track on variables is the efficient way.


by vshotarov posted 418 days ago

In terms of class variables, I saw that they are discouraged in the using parallel in maya paper. Alternatively, they advise to store an actual attribute on the node and update that one instead.

In terms of running changes on points being added to the ramp curve, I'd say you will probably need an attributeChangedCallback, which will update your values and output array.

This is the first example that came up when I searched for it

In terms of the .setArrays(true) bit, you will need to provide a bit more info about what doesn't work, as I am not exactly sure what your expected outcome is.

I hope that helps!