Thanks I did the change suggested, althought I shouldve mentionned that im using the API 2.0
and I can't get the return OpenMaya.kUnknownParameter with maya.api.OpenMaya. It return me an error saying 'module' object has no attribute 'kUnknownParameter'. Which is strange because the python api 2.0 example here explicitly use it: http://help.autodesk.com/view/MAYAUL/2016/ENU/?guid=__files_GUID_4F1D2DC9_D544_432B_A103_7A32D47757C4_htm Im a bit confused... and tbh I don't even know why I used return None, I guess I saw this somewhere and used it. Le vendredi 24 novembre 2017 08:41:43 UTC-5, Marcus Ottosson a écrit : > > 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/94631170-c7ec-4830-be0d-ffd40989547c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
