1. When saving:
2. What gets stored in the ascii file:
setAttr -s 2 ".falloff" 1 1 1;
3. After opening the scene again:
I recently noticed 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: