Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set array attribute at once?

1 REPLY 1
Reply
Message 1 of 2
TA_jylee
149 Views, 1 Reply

How to set array attribute at once?

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.

1 REPLY 1
Message 2 of 2
TA_jylee
in reply to: TA_jylee

I configured.

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report