what i am trying to achieve is to implement this Python script with this math node,
I put here the parenthesis of (a) , (b), (c ) and (result), so these are the equivelant to MathNodes variables and result
Thank you for your reply i remove the xtra parenthesis now the expression is like this:
(b / 60. + 10 ** -6) * 60., b + (c - a) * 60. / 55.
but i have this erros now:
// Error: TypeError: file C:/ProgramData/Autodesk/ApplicationPlugins/MathNode/Contents/plug-ins/asdkMathNode.py line 88: in method 'MDataHandle_setFloat', argument 2 of type 'float' //
Yes i know
now i get this:
// Error: SyntaxError: file C:/ProgramData/Autodesk/ApplicationPlugins/MathNode/Contents/plug-
ins/asdkMathNode.py line 82: invalid syntax //
Expression import math max(math.floor(b / 60. + 10 ** -6) * 60., b + (c - a) * 60. / 55.) failed
No its not on another line,
it doesnt allow me to press enter in the math node expression slot.
everything is in one line import math max(math.floor(b / 60. + 10 ** -6) * 60., b + (c - a) * 60. / 55.)
If that’s the case you can use semi-colon. import math;max(math.floor(b / 60. + 10 ** -6) * 60., b + (c - a) * 60. / 55.)
Although I’m not sure this is a good idea. Not at a computer ATM so I can’t suggest an alternative.
No worries,
although i still have this error: Expression import math;max(math.floor(b / 60. + 10 ** -6) * 60., b + (c - a) * 60. / 55.) failed// Error: SyntaxError: file C:/ProgramData/Autodesk/ApplicationPlugins/MathNode/Contents/plug-ins/asdkMathNode.py line 82: invalid syntax //
At the beginning with a fresh node everything works fine.
i even put manually numbers on c attr, (no error).
But, when i connect the result output to a rotate Z of a group lets say, then i have the error syntax.
My mistake, this line is working: max(((b / 60.+ 10 ** -6) // 1) * 60., b + (c - a) * 60. / 55.)
but when i want to complete the first python script by adding these two lines:
previous_driver_angle = next_driver_angle
previous_driven_angle = next_driven_angle
The python script and a mel expression are very different things, so you can’t often have a direct translation.
I didn’t pay as much attention to what you were actually trying to solve as I should have, leading to this long thread.
Writing it as an expression should be possible.
I would suggest taking a look at some learning material for writing expressions in Maya otherwise I imagine a significantly longer thread unless the answer is posted
You should be able to find the previous value through caching, or perhaps getAttr frame -1 (not recommended during expressions as it’ll affect performance).
You should also be able to use the frameCache node to get attr value from a previous frame.
Using the frameCache node, you should be able to implement with nodes instead of an expression I think?
Once I’m at a computer I’ll be in a much better position to provide something other than semi-thought out advice.
That being said, there are generally much smarter and more experienced people than myself around who might point you in a better direction whilst you wait