Good morning ( it's 8 am for me :) )

I've been writing a custom node that only update the ouput on specific 
condition and I was wondering how I should handle it in the compute method 
to be the most effective and costless

this is approximately what I got with some pseudo code
def compute (self, plug, data):

if plug == myNode.output:

input = data.inputValue(myNode.input).asVector()
output = data.inputValue(myNode.output)

for n in input:

if n >= 0.0:

# do something

# send my output
data.setClean(plug)

else:
return None  

I know this code doesn't make much sense but what I want to know is:

   1. Should I put my data.setClean(plug) inside the if statement or it 
   doesnt matter.  What I want is once the if is True then use this value as 
   output and remove the dirty flag so I'm guessing this is the right way!?
   2. Should I use a return after my data.setClean(plug) or the rest of the 
   loop won't be evaluated anyway since the node isnt marked as dirty anymore?
   3. How can I effectively benchmark my compute method?

Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/88a1da49-2935-4d41-a239-74112644a59d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to