Skip to content

Commit a8a187d

Browse files
committed
Create Projection.py
1 parent 9e6a242 commit a8a187d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import maya.cmds as cmds
2+
3+
### Names
4+
nameLocatorOriginal = "locOriginal"
5+
nameLocatorProjected = "locProjected"
6+
7+
8+
### TODO Get objects
9+
selectedMesh = "pPlane1"
10+
selectedMeshShape = cmds.listRelatives(selectedMesh, shapes = True, fullPath = False)[0]
11+
12+
13+
### Create locators
14+
locatorOriginal = cmds.spaceLocator(name = nameLocatorOriginal)[0]
15+
locatorProjected = cmds.spaceLocator(name = nameLocatorProjected)[0]
16+
17+
### Create closestPointOnMesh node
18+
closestPointOnMeshNode = cmds.createNode("closestPointOnMesh")
19+
20+
### Connect locators to closestPointOnMesh node
21+
cmds.connectAttr(selectedMeshShape + ".worldMesh[0]", closestPointOnMeshNode + ".inMesh")
22+
cmds.connectAttr(selectedMeshShape + ".worldMatrix[0]", closestPointOnMeshNode + ".inputMatrix")
23+
cmds.connectAttr(locatorOriginal + ".translate", closestPointOnMeshNode + ".inPosition")
24+
cmds.connectAttr(closestPointOnMeshNode + ".position", locatorProjected + ".translate")
25+
26+
### Create inside/outside logic
27+
# floatConstantNode = cmds.createNode("floatConstant")
28+
# floatMathNode = cmds.createNode("floatMath")
29+
# floatLogicNode = cmds.createNode("floatLogic")
30+
# colorConditionNode = cmds.createNode("colorCondition")
31+

0 commit comments

Comments
 (0)