@@ -95,14 +95,15 @@ def CreateLocatorProjectedToMesh(mesh, createInsideOutsideLogic=False, *args):
9595 ### Variables
9696 _nameLocatorOriginal = "locOriginal"
9797 _nameLocatorProjected = "locProjected"
98+ _nameLambertMaterialProjection = "matGEToolsProjection"
9899 _borderOffset = 0.01
99100
100101 ### Get shape of mesh
101102 meshShape = cmds .listRelatives (mesh , shapes = True , fullPath = False )[0 ]
102103
103104 ### Create locators
104- locatorOriginal = cmds .spaceLocator (name = _nameLocatorOriginal )[0 ]
105- locatorProjected = cmds .spaceLocator (name = _nameLocatorProjected )[0 ]
105+ locatorOriginal = cmds .spaceLocator (name = Text . SetUniqueFromText ( _nameLocatorOriginal ) )[0 ]
106+ locatorProjected = cmds .spaceLocator (name = Text . SetUniqueFromText ( _nameLocatorProjected ) )[0 ]
106107
107108 ### Create closestPointOnMesh node
108109 closestPointOnMeshNode = cmds .createNode ("closestPointOnMesh" )
@@ -190,8 +191,8 @@ def CreateLocatorProjectedToMesh(mesh, createInsideOutsideLogic=False, *args):
190191 cmds .connectAttr (colorConditionNode + ".outColor" , mesh + ".outlinerColor" )
191192
192193 # Create Lambert and shading group
193- material = cmds .shadingNode ("lambert" , asShader = True , name = "lambertMaterialProjection" )
194- shadingGroup = cmds .sets (renderable = True , noSurfaceShader = True , empty = True , name = material + "SG" )
194+ material = cmds .shadingNode ("lambert" , asShader = True , name = Text . SetUniqueFromText ( _nameLambertMaterialProjection ) )
195+ shadingGroup = cmds .sets (renderable = True , noSurfaceShader = True , empty = True , name = Text . SetUniqueFromText ( material + "SG" ) )
195196 cmds .connectAttr (material + ".outColor" , shadingGroup + ".surfaceShader" , force = True )
196197 cmds .sets (mesh , edit = True , forceElement = shadingGroup )
197198 cmds .connectAttr (colorConditionNode + ".outColor" , material + ".color" )
0 commit comments