Problem summary
Locator/Object Transforms set via Python do not persist.
This seems to happen because when using the setTransform() function instead of the Transform Selected Object tool, the Locator/Object's following Metadata fields aren't updated to the new values:
- LocatorScale
- LocatorTranslation
- LocatorRotation
Which means that as soon as the user transforms the Locator/Object using the Transform Selected Object tool after transforming it through Python, the python changes are forgotten in favour of using the old Metadata.
Customer reported version
Mari 4.8v1
Customer reported platform
Windows 10
Steps to reproduce
1) Open any project
2) Create a Projection node and view the Output
3) Assign any image, change Clip to Both and Projection to Planar
4) Click + to make a new Locator
5) Click P to switch to the new Locator
6) Transform the Locator so that it is no longer in the default position/rotation/scale
7) Run the following snippet it the Python Console, which resets the Locator to default transformation:
defaultMatrix = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]locator = mari.geo.currentLocator()mariMatrix = mari.Matrix(defaultMatrix)locator.setTransform(mariMatrix)
8) Manipulate the Transform tool handles
Expected behaviour
The Locator should be transformed according to the movement of the Transformation handles.
Actual behaviour
Attempting to transform the Locator causes it to revert back to its position/rotation/scale before step 7.
Workaround
As this issue occurs due to the Locator/Object's Metadata not updating, one way to prevent it is by deleting that Metadata via Python after using setTransform(). That way, when the user tries to move the Locator/Object using the Transform Selected Object tool, the Metadata will be regenerated using the values defined by setTransform().
Reproduced by support
This bug has been reproduced in:
Mari 7.0v2 - Windows 10 - Rocky 9
Mari 7.0v1 - Windows 10 - Rocky 9
Mari 5.0v1 - Windows 10 - CentOS 7.9
Mari 4.8v1 - Windows 10
Mari 4.7v1 - Windows 10
Mari 4.6v1 - Windows 10 - CentOS 7.9
Earliest version tested
Mari 4.5v1 - This version does not have nodes containing Locator List attributes