How to set array attribute at once?

How to set array attribute at once?

TA_jylee
Explorer Explorer
279 Views
1 Reply
Message 1 of 2

How to set array attribute at once?

TA_jylee
Explorer
Explorer

Hi everyone. A newbie Maya developer here.

 

Previously, configured the CUDA compiler for Maya C++ API build for some specific reason. (Run 6000+ blocks at once! CPU takes a lot more time to calculate those.)

 

Before asking a question, let me describe the situation.
First, I have 2 arrays1. an input float attribute array2. an output compound attribute array. the compound attribute has 2 double3 children.3. The number of elements of both arrays is not the same. 4. when an element of the input attribute array is changed, every element of the output attribute array should be changed.
therefore, tried this
...in compute method

if(plug == outputAttr){   

    if(plug.isArray){

         //compute everything here.

         // setAllClean   

    }

}

//clean whatever the plug is.

 

but this try failed because the plug for the array itself (or array only, not an element) was only set dirty once, and I must set it dirty manually. Whenever I change a single element of the input array, all leaf output attributes (child of each compound attribute array element.) plug is set to dirty but calculating those per every element is a big waste of computing power and impossible for this case. (Because an input element affects every output element, setting a single output plug is not working.)

 

One thing I tried is this.  Making dummy node to set dirty bit.

compondArray.png

but it does not work too. It only work once.


Best Regard.

0 Likes
280 Views
1 Reply
Reply (1)
Message 2 of 2

TA_jylee
Explorer
Explorer

I configured.

check the logical index of every plug that sent to compute method, and run code when if the index is 0.

0 Likes