Autodesk / Autodesk/maya-usd

mayaLock tag on xformOpOrder changes the selection after MMB drag

Open
#3,062 2 comments 0 reactions 1 assignee Claimed by @santosg87 View on GitHub
bug
Dominant language
Wolfram Language
Stars
905
Forks
223
Avg merge
2d 9h
Merged PRs (30d)
17

Description

**Describe the bug**

Middle mouse button drag with the move tool active changes the selection.

Additionally, the `Error: Cannot edit [xformOpOrder] attribute because its lock metadata is [on].` error message is printed numerous times during drag now, instead of once per drag as it was before.

**Steps to reproduce**

Steps to reproduce the behavior:

1. Open Maya
2. Run the snippet below to generate a simple scene
3. Select the cube
4. Activate the move tool using `w`
5. Middle mouse drag to try to move the cube
6. You should see a large number of error messages
7. Refresh the viewport, for example by moving the camera view slightly
8. You should have the plane selected too

Scene snippet

```python
import maya.cmds
import pxr.Sdf

maya.cmds.file(new=True, force=True)

layer = pxr.Sdf.Layer.CreateAnonymous(".usd")
layer.ImportFromString("""#usda 1.0
(
defaultPrim = "group"
metersPerUnit = 0.01
upAxis = "Y"
)

def Xform "group" (
kind = "component"
)
{
# Plane didn't work for me for some reason, maybe it's not available in our
# version of USD yet.
def Mesh "plane"
{
uniform bool doubleSided = 1
float3[] extent = [(-5, -1.110223e-15, -5), (5, 1.110223e-15, 5)]
int[] faceVertexCounts = [4]
int[] faceVertexIndices = [0, 1, 3, 2]
point3f[] points = [(-5, -1.110223e-15, 5), (5, -1.110223e-15, 5), (-5, 1.110223e-15, -5), (5, 1.110223e-15, -5)]
uniform token[] xformOpOrder (
mayaLock = "on"
)
}

def Cube "cube"
{
uniform token[] xformOpOrder (
mayaLock = "on"
)
}
}""")

# Render the stage using maya-usd proxShape
maya.cmds.loadPlugin("mayaUsdPlugin", quiet=True)
proxyShape = maya.cmds.createNode("mayaUsdProxyShape")
maya.cmds.setAttr(".filePath", layer.identifier, type="string")
```

**Expected behavior**

Previously, the middle mouse button drag did not update the selection, nor did it print many error messages (just the one, at the start of the drag operation).

**Attachments**

Here is the step by step procedure in 0.23:

![mayaLock-on-mmb-drag-0.23-behavior](https://user-images.githubusercontent.com/7030542/236444063-ecf0781a-2c5a-48e8-86a3-a1f770ac6474.gif)

Here is the 0.18 behavior:

![mayaLock-on-mmb-drag-0 18-behavior](https://user-images.githubusercontent.com/7030542/236445923-54f3faf9-f94b-4c7f-9aa2-926b2f029c91.gif)

**Specs (if applicable):**
- OS & version: Linux CentOS
- Maya version: Maya 2022.3
- Maya USD version: v0.23
- Pixar USD version: v21.11

**Additional context**

This is not really breaking anything, but makes interacting with the scene really tedious when using the mayaLock tag.

Maybe there is a better way to lock prims than this tag now ?

We updated from v0.18 to v0.23 and started having the bug at that point.

I noticed this PR changed the behavior of the mayaLock tag: #2928

The selection update may not always occur, maybe it's dependent on the scene. To me, it's like if I didn't have any selection at all: in that case, the MMB drag defaults to a marquee selection.

![mayaLock-on-mmb-drag-marquee-select](https://user-images.githubusercontent.com/7030542/236446368-f850a787-b7d7-4fa3-8e83-649b90403e03.gif)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.