1. When saving:
2. What gets stored in the ascii file:
setAttr -s 2 ".falloff[1]" 1 1 1;
3. After opening the scene again:
I recently noticed in Maya 2018 that custom Python API 1.0 node ramp attribute elements with position/value/interpolation : 0.0/0.0/linear do not get saved with the Maya scene (if their index is the lowest). I guess this is a bug. Some debug infos I gathered:
- Probably bug source: By default Maya does not save attribute default values
- Does not happen with default Maya nodes like remapValue
- MPxNode.shouldSave documentation explains why this should not happen (but it is not true): "This method is not called for ramp attributes since they should always be written."
- Since shouldSave gets wrongfully called it has to be overwritten to fix the problem
- Only returning 'unknown' will not save the attribute. OpenMayaMPx.MPxNode.shouldSave(...) does exactly that.
- The Python devkit example of shouldSave pyApiMeshShape.py is a bit misleading: From what I have tested all these return values seem to force save: True, False, None
Implementations of this workaround can be found in prClosestPoint:
https://github.com/parzival-roethlein/prmaya
Update 2020-03-31:
Another situation with the same problem was with a float array attribute in Python API 2.0. The fix is in my /plugins/prUpCurveSpline.py:
https://github.com/parzival-roethlein/prmaya
Update 2020-03-31:
Another situation with the same problem was with a float array attribute in Python API 2.0. The fix is in my /plugins/prUpCurveSpline.py:
https://github.com/parzival-roethlein/prmaya