Skip to content

[Bug]: simplexDelete attr already has an incoming connection #136

@cemccabe77

Description

@cemccabe77

Summary

When using 'Connect From Scene Selection', _reparentDeltaShapes() tries to connect the message attr to the simplexDelete attr on the parent transform node. This connection already exists and throws a RuntimeError that kills the process.

# Traceback (most recent call last):
#   File "D:\Working\dev\git\simplex\simplexPy3\scripts\simplexui\simplexDialog.py", line 846, in shapeConnectScene
#     c.connectShape(pair.shape, delete=True)
#   File "D:\Working\dev\git\simplex\simplexPy3\scripts\simplexui\items\combo.py", line 686, in connectShape
#     self.DCC.connectComboShape(self, shape, mesh, live, delete)
#   File "D:\Working\dev\git\simplex\simplexPy3\scripts\simplexui\interface\mayaInterface.py", line 115, in stacker
#     return f(*args, **kwargs)
#   File "D:\Working\dev\git\simplex\simplexPy3\scripts\simplexui\interface\mayaInterface.py", line 2517, in connectComboShape
#     delta = self._createComboDelta(combo, mesh, tVal)
#   File "D:\Working\dev\git\simplex\simplexPy3\scripts\simplexui\interface\mayaInterface.py", line 2442, in _createComboDelta
#     repDict = self._reparentDeltaShapes(target, nodeDict, bs, [rest, base])
#   File "D:\Working\dev\git\simplex\simplexPy3\scripts\simplexui\interface\mayaInterface.py", line 2196, in _reparentDeltaShapes
#     cmds.connectAttr(bsNode + ".message", sdNode)
# RuntimeError: 'jawOpen_mouthCornerPull_X_Extract.simplexDelete' already has an incoming connection from 'jawOpen_mouthCornerPull_X_DeltaBS.message'.

Expected Behavior

Check to see if the connection already exists before trying to make the connection.

Steps to Reproduce Behavior

Extract Shape from simplexUI. Connect from Scene Selection from simplexUI

Solution

To resolve, I check to see if the connection exists on line 2196 in mayaInterface.py

Going from this:

# Use the simplexDelete message attribute to keep track of what nodes
# will need to be delete-linked when the file is reopened
sdNode = par + ".simplexDelete"
if not cmds.ls(sdNode):
    cmds.addAttr(par, longName="simplexDelete", attributeType="message")
cmds.connectAttr(bsNode + ".message", sdNode)

To this:

# Use the simplexDelete message attribute to keep track of what nodes
# will need to be delete-linked when the file is reopened
sdNode = par + ".simplexDelete"
if not cmds.ls(sdNode):
    cmds.addAttr(par, longName="simplexDelete", attributeType="message")
if cmds.listConnections(sdNode, s=True, p=True) == None:
    cmds.connectAttr(bsNode + ".message", sdNode)

Environment

SimplexUI: 3.0
OS: Windows 10
Python: 3.7.7

Additional Context

I have used this solution in previous versions. I recently upgraded Simplex to the latest version, and had to apply the fix again. I thought I would report the issue. Please let me know if there is a better solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions