Some notes from me.
def compute (self, plug, data):
if plug == myNode.output:
# Best not to override reserved keywords like input()
input_ = data.inputValue(myNode.input).asVector()
output = data.inputValue(myNode.output)
didSomething = False
for n in input:
if n >= 0.0:
didSomething = True
# do something
# send my output
if didSomething:
data.setClean(plug)
else:
return OpenMaya.kUnknownParameter
1. Assuming setClean isn’t aggregated and optimised by Maya under the
hood like Qt does with signals (unlikely) then it’s probably best to defer
calling it, and call it as few times as possible. In your snippet, it’d be
called for every n in input.
2. I think the return value should be something along these lines, as
least that’s what I’m reading here
<http://help.autodesk.com/view/MAYAUL/2015/ENU/?guid=__cpp_ref_class_m_px_node_html>
but could be wrong, or it could only apply to API 1.0 or 2.0.
--
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/CAFRtmOAqZ_HMehJh%3DgGctff6Do7gZca4S6Tf8_qov%2B47umr0qQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.