51 import maya.api.OpenMaya
as OpenMaya
52 import maya.api.OpenMayaUI
as OpenMayaUI
53 import maya.OpenMayaRender
as OpenMayaRender
56 import maya.cmds
as cmds
58 glRenderer = OpenMayaRender.MHardwareRenderer.theRenderer()
59 glFT = glRenderer.glFunctionTable()
64 kSwissArmyLocator2Name =
"spSwissArmyLocator2"
66 kSwissArmyLocator2ManipName =
"spSwissArmyLocator2Manip"
75 centre = [ [ 0.10, 0.0, 0.10 ],
77 [ -0.10, 0.0, -0.10 ],
80 state1 = [ [ 1.00, 0.0, 1.00 ],
85 state2 = [ [ 1.00, 0.0, -1.00 ],
89 [ 1.00, 0.0, -1.00 ] ]
90 state3 = [ [ -1.00, 0.0, -1.00 ],
91 [ -1.00, 0.0, -0.50 ],
92 [ -0.50, 0.0, -0.50 ],
93 [ -0.50, 0.0, -1.00 ],
94 [ -1.00, 0.0, -1.00 ] ]
95 state4 = [ [ -1.00, 0.0, 1.00 ],
99 [ -1.00, 0.0, 1.00 ] ]
100 arrow1 = [ [ 0.00, 0.0, 1.00 ],
102 [ -0.10, 0.0, 0.20 ],
103 [ 0.00, 0.0, 1.00 ] ]
104 arrow2 = [ [ 1.00, 0.0, 0.00 ],
106 [ 0.20, 0.0, -0.10 ],
107 [ 1.00, 0.0, 0.00 ] ]
108 arrow3 = [ [ 0.00, 0.0, -1.00 ],
109 [ 0.10, 0.0, -0.20 ],
110 [ -0.10, 0.0, -0.20 ],
111 [ 0.00, 0.0, -1.00 ] ]
112 arrow4 = [ [ -1.00, 0.0, 0.00 ],
113 [ -0.20, 0.0, 0.10 ],
114 [ -0.20, 0.0, -0.10 ],
115 [ -1.00, 0.0, 0.00 ] ]
116 perimeter=[ [ 1.10, 0.0, 1.10 ],
117 [ 1.10, 0.0, -1.10 ],
118 [ -1.10, 0.0, -1.10 ],
119 [ -1.10, 0.0, 1.10 ],
120 [ 1.10, 0.0, 1.10 ] ]
155 def createChildren(self):
157 self.fFreePointTriadManip = self.addFreePointTriadManip(
"freePointTriadManip",
"point")
161 self.fDirectionManip = self.addDirectionManip(
"directionManip",
"direction")
163 self._DirectionDirectionIndex = directionManipFn.directionIndex()
164 self._DirectionStartPointIndex = directionManipFn.startPointIndex()
167 self.fToggleManip = self.addToggleManip(
"toggleManip",
"toggle")
169 self._ToggleLengthIndex = toggleManipFn.lengthIndex()
170 self._ToggleStartPointIndex = toggleManipFn.startPointIndex()
173 self.fStateManip = self.addStateManip(
"stateManip",
"state")
175 self._StatePositionIndex = stateManipFn.positionIndex()
178 self.fDiscManip = self.addDiscManip(
"discManip",
"angle")
180 self._DiscCenterIndex = discManipFn.centerIndex()
183 self.fCircleSweepManip = self.addCircleSweepManip(
"circleSweepManip",
"angle")
187 circleSweepManipFn.setRadius(2.0)
188 circleSweepManipFn.setDrawAsArc(
True)
189 self._CircleSweepCenterIndex = circleSweepManipFn.centerIndex()
192 self.fDistanceManip = self.addDistanceManip(
"distanceManip",
"distance")
196 self._DistanceStartPointIndex = distanceManipFn.startPointIndex()
199 self.fRotateManip = self.addRotateManip(
"RotateManip",
"rotation")
203 self.fScaleManip = self.addScaleManip(
"scaleManip",
"scale")
206 def connectToDependNode(self, node):
209 self.fNodePath = dagNodeFn.getPath()
210 parentNode = dagNodeFn.parent(0)
212 parentPath = parentNodeFn.getPath()
216 nodeFn.setObject(node)
217 self._plugDoubleIndex = -1
218 self._plugMPointIndex = -1
219 self._plugMVectorIndex = -1
224 translationPlug = parentNodeFn.findPlug(
"t",
True)
225 freePointTriadManipFn.connectToPointPlug(translationPlug)
231 directionManipFn.setObject(self.fDirectionManip)
234 directionPlug = nodeFn.findPlug(
"arrow2Direction",
True)
235 directionManipFn.connectToDirectionPlug(directionPlug)
236 self.addPlugToManipConversion(self._DirectionStartPointIndex)
241 self.addPlugToManipConversion(self._DirectionDirectionIndex)
247 distanceManipFn.setObject(self.fDistanceManip)
249 sizePlug = nodeFn.findPlug(
"size",
True)
250 distanceManipFn.connectToDistancePlug(sizePlug)
251 self.addPlugToManipConversion(self._DistanceStartPointIndex)
258 arrow1AnglePlug = nodeFn.findPlug(
"arrow1Angle",
True)
259 circleSweepManipFn.connectToAnglePlug(arrow1AnglePlug)
260 self.addPlugToManipConversion(self._CircleSweepCenterIndex)
267 arrow3AnglePlug = nodeFn.findPlug(
"arrow3Angle",
True)
268 discManipFn.connectToAnglePlug(arrow3AnglePlug)
269 self.addPlugToManipConversion(self._DiscCenterIndex)
276 statePlug = nodeFn.findPlug(
"state",
True)
277 stateManipFn.connectToStatePlug(statePlug)
278 self.addPlugToManipConversion(self._StatePositionIndex)
284 toggleManipFn.length = 3.14
286 togglePlug = nodeFn.findPlug(
"toggle",
True)
287 toggleManipFn.connectToTogglePlug(togglePlug)
288 self.addPlugToManipConversion(self._ToggleStartPointIndex)
293 self.addPlugToManipConversion(self._ToggleLengthIndex)
306 rotatePlug = transformNode.findPlug(
"rotate",
True)
307 rotateManipFn.connectToRotationPlug(rotatePlug)
308 rotateManipFn.displayWithNode(node)
315 scalePlug = transformNode.findPlug(
"scale",
True)
316 scaleManipFn.connectToScalePlug(scalePlug)
317 scaleManipFn.displayWithNode(node)
322 mVectorPlug = nodeFn.findPlug(
"inPlugMVector",
True)
323 tmpIndex = self.addManipToPlugConversion(mVectorPlug)
324 self._plugMVectorIndex = tmpIndex
329 mPointPlug = nodeFn.findPlug(
"inPlugMPoint",
True)
330 tmpIndex = self.addManipToPlugConversion(mPointPlug)
331 self._plugMPointIndex = tmpIndex
336 doublePlug = nodeFn.findPlug(
"inPlugDouble",
True)
337 tmpIndex = self.addManipToPlugConversion(doublePlug)
338 self._plugDoubleIndex = tmpIndex
342 self.finishAddingManips()
346 def draw(self, view, path, style, status):
350 view.drawText(
"Swiss Army Manipulator 2", textPos, OpenMayaUI.M3dView.kLeft)
354 def plugToManipConversion(self, theIndex):
356 manipVec = self.getConverterManipMVectorValue(theIndex)
358 numDataObj = numData.create(OpenMaya.MFnNumericData.k3Float)
359 numData.setData(manipVec)
364 if theIndex == self._CircleSweepCenterIndex:
366 self._CircleSweepCenterIndex = -1
367 manipMPoint = self.getConverterManipMPointValue(theIndex)
372 cmds.setAttr(
"%s.outManipMPoint"%(self.fNodePath), x, y, z, a )
374 if theIndex == self._DirectionDirectionIndex:
376 self._DirectionDirectionIndex = -1
377 manipMVector = self.getConverterManipMVectorValue(theIndex)
381 cmds.setAttr(
"%s.outManipMVector"%(self.fNodePath), x, y, z )
383 if theIndex == self._ToggleLengthIndex:
385 self._ToggleLengthIndex = -1
386 manipDouble = self.getConverterManipDoubleValue(theIndex)
387 cmds.setAttr(
"%s.outManipDouble"%(self.fNodePath), manipDouble )
393 def manipToPlugConversion(self, plugIndex):
395 plugVec = self.getConverterPlugMVectorValue(plugIndex)
397 numDataObj = numData.create(OpenMaya.MFnNumericData.k3Double)
398 numData.setData(plugVec)
403 if plugIndex == self._plugMPointIndex:
404 plugMPoint = self.getConverterPlugMPointValue(self._plugMPointIndex)
409 cmds.setAttr(
"%s.outPlugMPoint"%(self.fNodePath), x, y, z, a )
411 if plugIndex == self._plugMVectorIndex:
412 plugMVector = self.getConverterPlugMVectorValue(self._plugMVectorIndex)
416 cmds.setAttr(
"%s.outPlugMVector"%(self.fNodePath), x, y, z )
418 if plugIndex == self._plugDoubleIndex:
419 plugDouble = self.getConverterPlugDoubleValue(self._plugDoubleIndex)
420 cmds.setAttr(
"%s.outPlugDouble"%(self.fNodePath), plugDouble )
427 def nodeTranslation(self):
430 path = dagFn.getPath()
433 return transformFn.translation(OpenMaya.MSpace.kWorld)
506 def compute(self, plug, data):
510 def draw(self, view, path, style, status):
513 thisNode = self.thisMObject()
516 sizeVal = plug.asMDistance()
518 arrow1AnglePlug =
OpenMaya.MPlug(thisNode, swissArmyLocator2.aArrow1Angle)
519 arrow1Angle = arrow1AnglePlug.asMAngle()
520 angle1 = -arrow1Angle.asRadians() - 3.1415927/2.0
522 arrow3AnglePlug =
OpenMaya.MPlug(thisNode, swissArmyLocator2.aArrow3Angle)
523 arrow3Angle = arrow3AnglePlug.asMAngle()
524 angle3 = arrow3Angle.asRadians()
527 state = statePlug.asInt()
530 toggle = togglePlug.asBool()
532 directionXPlug =
OpenMaya.MPlug(thisNode, swissArmyLocator2.aArrow2DirectionX)
533 directionYPlug =
OpenMaya.MPlug(thisNode, swissArmyLocator2.aArrow2DirectionY)
534 directionZPlug =
OpenMaya.MPlug(thisNode, swissArmyLocator2.aArrow2DirectionZ)
535 dirX = directionXPlug.asDouble()
536 dirY = directionYPlug.asDouble()
537 dirZ = directionZPlug.asDouble()
539 angle2 = math.atan2(dirZ, dirX)
542 multiplier = sizeVal.asCentimeters()
546 if ((style == OpenMayaUI.M3dView.kFlatShaded)
or
547 (style == OpenMayaUI.M3dView.kGouraudShaded)):
549 glFT.glPushAttrib(OpenMayaRender.MGL_CURRENT_BIT)
551 if (status == OpenMayaUI.M3dView.kActive):
552 view.setDrawColor(13, OpenMayaUI.M3dView.kActiveColors)
554 view.setDrawColor(13, OpenMayaUI.M3dView.kDormantColors)
557 if (status == OpenMayaUI.M3dView.kActive):
558 view.setDrawColor(15, OpenMayaUI.M3dView.kActiveColors)
560 view.setDrawColor(15, OpenMayaUI.M3dView.kDormantColors)
561 glFT.glBegin(OpenMayaRender.MGL_TRIANGLE_FAN)
562 last = kCentreCount - 1
563 for i
in range(last):
564 glFT.glVertex3f(centre[i][0] * multiplier,
565 centre[i][1] * multiplier,
566 centre[i][2] * multiplier)
570 if (status == OpenMayaUI.M3dView.kActive):
571 view.setDrawColor(19, OpenMayaUI.M3dView.kActiveColors)
573 view.setDrawColor(19, OpenMayaUI.M3dView.kDormantColors)
574 glFT.glBegin(OpenMayaRender.MGL_TRIANGLE_FAN)
575 last = kState1Count - 1
576 for i
in range(last):
577 glFT.glVertex3f(state1[i][0] * multiplier,
578 state1[i][1] * multiplier,
579 state1[i][2] * multiplier)
583 if (status == OpenMayaUI.M3dView.kActive):
584 view.setDrawColor(21, OpenMayaUI.M3dView.kActiveColors)
586 view.setDrawColor(21, OpenMayaUI.M3dView.kDormantColors)
587 glFT.glBegin(OpenMayaRender.MGL_TRIANGLE_FAN)
588 last = kState2Count - 1
589 for i
in range(last):
590 glFT.glVertex3f(state2[i][0] * multiplier,
591 state2[i][1] * multiplier,
592 state2[i][2] * multiplier)
596 if (status == OpenMayaUI.M3dView.kActive):
597 view.setDrawColor(18, OpenMayaUI.M3dView.kActiveColors)
599 view.setDrawColor(18, OpenMayaUI.M3dView.kDormantColors)
600 glFT.glBegin(OpenMayaRender.MGL_TRIANGLE_FAN)
601 last = kState3Count - 1
602 for i
in range(last):
603 glFT.glVertex3f(state3[i][0] * multiplier,
604 state3[i][1] * multiplier,
605 state3[i][2] * multiplier)
609 if (status == OpenMayaUI.M3dView.kActive):
610 view.setDrawColor(17, OpenMayaUI.M3dView.kActiveColors)
612 view.setDrawColor(17, OpenMayaUI.M3dView.kDormantColors)
613 glFT.glBegin(OpenMayaRender.MGL_TRIANGLE_FAN)
614 last = kState4Count - 1
615 for i
in range(last):
616 glFT.glVertex3f(state4[i][0] * multiplier,
617 state4[i][1] * multiplier,
618 state4[i][2] * multiplier)
621 if (status == OpenMayaUI.M3dView.kActive):
622 view.setDrawColor(12, OpenMayaUI.M3dView.kActiveColors)
624 view.setDrawColor(12, OpenMayaUI.M3dView.kDormantColors)
625 glFT.glBegin(OpenMayaRender.MGL_TRIANGLE_FAN)
626 last = kArrow1Count - 1
627 for i
in range(last):
628 glFT.glVertex3f((-arrow1[i][0] * multiplier * math.cos(angle1) - arrow1[i][2] * multiplier * math.sin(angle1)),
629 (arrow1[i][1] * multiplier + delta1),
630 (arrow1[i][2] * multiplier * math.cos(angle1) - arrow1[i][0] * multiplier * math.sin(angle1)))
633 if (status == OpenMayaUI.M3dView.kActive):
634 view.setDrawColor(16, OpenMayaUI.M3dView.kActiveColors)
636 view.setDrawColor(16, OpenMayaUI.M3dView.kDormantColors)
637 glFT.glBegin(OpenMayaRender.MGL_TRIANGLE_FAN)
638 last = kArrow2Count - 1
639 for i
in range(last):
640 glFT.glVertex3f((-arrow2[i][0] * multiplier * math.cos(angle2) - arrow2[i][2] * multiplier * math.sin(angle2)),
641 (arrow2[i][1] * multiplier + delta2),
642 (arrow2[i][2] * multiplier * math.cos(angle2) - arrow2[i][0] * multiplier * math.sin(angle2)))
645 if (status == OpenMayaUI.M3dView.kActive):
646 view.setDrawColor(13, OpenMayaUI.M3dView.kActiveColors)
648 view.setDrawColor(13, OpenMayaUI.M3dView.kDormantColors)
649 glFT.glBegin(OpenMayaRender.MGL_TRIANGLE_FAN)
650 last = kArrow3Count - 1
651 for i
in range(last):
652 glFT.glVertex3f((-arrow3[i][0] * multiplier * math.cos(angle3) - arrow3[i][2] * multiplier * math.sin(angle3)),
653 (arrow3[i][1] * multiplier + delta3),
654 (arrow3[i][2] * multiplier * math.cos(angle3) - arrow3[i][0] * multiplier * math.sin(angle3)))
657 if (status == OpenMayaUI.M3dView.kActive):
658 view.setDrawColor(5, OpenMayaUI.M3dView.kActiveColors)
660 view.setDrawColor(5, OpenMayaUI.M3dView.kDormantColors)
661 glFT.glBegin(OpenMayaRender.MGL_TRIANGLE_FAN)
662 last = kArrow4Count - 1
663 for i
in range(last):
664 glFT.glVertex3f((arrow4[i][0] * multiplier),
665 (arrow4[i][1] * multiplier + delta4),
666 (arrow4[i][2] * multiplier))
672 glFT.glBegin(OpenMayaRender.MGL_LINES)
675 last = kCentreCount - 1
676 for i
in range(last):
677 glFT.glVertex3f(centre[i][0] * multiplier,
678 centre[i][1] * multiplier,
679 centre[i][2] * multiplier)
680 glFT.glVertex3f(centre[i+1][0] * multiplier,
681 centre[i+1][1] * multiplier,
682 centre[i+1][2] * multiplier)
685 last = kState1Count - 1
686 for i
in range(last):
687 glFT.glVertex3f(state1[i][0] * multiplier,
688 state1[i][1] * multiplier,
689 state1[i][2] * multiplier)
690 glFT.glVertex3f(state1[i+1][0] * multiplier,
691 state1[i+1][1] * multiplier,
692 state1[i+1][2] * multiplier)
695 last = kState2Count - 1
696 for i
in range(last):
697 glFT.glVertex3f(state2[i][0] * multiplier,
698 state2[i][1] * multiplier,
699 state2[i][2] * multiplier)
700 glFT.glVertex3f(state2[i+1][0] * multiplier,
701 state2[i+1][1] * multiplier,
702 state2[i+1][2] * multiplier)
705 last = kState3Count - 1
706 for i
in range(last):
707 glFT.glVertex3f(state3[i][0] * multiplier,
708 state3[i][1] * multiplier,
709 state3[i][2] * multiplier)
710 glFT.glVertex3f(state3[i+1][0] * multiplier,
711 state3[i+1][1] * multiplier,
712 state3[i+1][2] * multiplier)
715 last = kState4Count - 1
716 for i
in range(last):
717 glFT.glVertex3f(state4[i][0] * multiplier,
718 state4[i][1] * multiplier,
719 state4[i][2] * multiplier)
720 glFT.glVertex3f(state4[i+1][0] * multiplier,
721 state4[i+1][1] * multiplier,
722 state4[i+1][2] * multiplier)
724 last = kArrow1Count - 1
725 for i
in range(last):
726 glFT.glVertex3f((-arrow1[i][0] * multiplier * math.cos(angle1) - arrow1[i][2] * multiplier * math.sin(angle1)),
727 (arrow1[i][1] * multiplier + delta1),
728 (arrow1[i][2] * multiplier * math.cos(angle1) - arrow1[i][0] * multiplier * math.sin(angle1)))
729 glFT.glVertex3f((-arrow1[i+1][0] * multiplier * math.cos(angle1) - arrow1[i+1][2] * multiplier * math.sin(angle1)),
730 (arrow1[i+1][1] * multiplier + delta1),
731 (arrow1[i+1][2] * multiplier * math.cos(angle1) - arrow1[i+1][0] * multiplier * math.sin(angle1)))
733 last = kArrow2Count - 1
734 for i
in range(last):
735 glFT.glVertex3f((-arrow2[i][0] * multiplier * math.cos(angle2) - arrow2[i][2] * multiplier * math.sin(angle2)),
736 (arrow2[i][1] * multiplier + delta2),
737 (arrow2[i][2] * multiplier * math.cos(angle2) - arrow2[i][0] * multiplier * math.sin(angle2)))
738 glFT.glVertex3f((-arrow2[i+1][0] * multiplier * math.cos(angle2) - arrow2[i+1][2] * multiplier * math.sin(angle2)),
739 (arrow2[i+1][1] * multiplier + delta2),
740 (arrow2[i+1][2] * multiplier * math.cos(angle2) - arrow2[i+1][0] * multiplier * math.sin(angle2)))
742 last = kArrow3Count - 1
743 for i
in range(last):
744 glFT.glVertex3f((-arrow3[i][0] * multiplier * math.cos(angle3) - arrow3[i][2] * multiplier * math.sin(angle3)),
745 (arrow3[i][1] * multiplier + delta3),
746 (arrow3[i][2] * multiplier * math.cos(angle3) - arrow3[i][0] * multiplier * math.sin(angle3)))
747 glFT.glVertex3f((-arrow3[i+1][0] * multiplier * math.cos(angle3) - arrow3[i+1][2] * multiplier * math.sin(angle3)),
748 (arrow3[i+1][1] * multiplier + delta3),
749 (arrow3[i+1][2] * multiplier * math.cos(angle3) - arrow3[i+1][0] * multiplier * math.sin(angle3)))
751 last = kArrow4Count - 1
752 for i
in range(last):
753 glFT.glVertex3f((arrow4[i][0] * multiplier),
754 (arrow4[i][1] * multiplier + delta4),
755 (arrow4[i][2] * multiplier))
756 glFT.glVertex3f((arrow4[i+1][0] * multiplier),
757 (arrow4[i+1][1] * multiplier + delta4),
758 (arrow4[i+1][2] * multiplier))
760 last = kPerimeterCount - 1
761 for i
in range(last):
762 glFT.glVertex3f(perimeter[i][0] * multiplier,
763 perimeter[i][1] * multiplier,
764 perimeter[i][2] * multiplier)
765 glFT.glVertex3f(perimeter[i+1][0] * multiplier,
766 perimeter[i+1][1] * multiplier,
767 perimeter[i+1][2] * multiplier)
778 def boundingBox(self):
779 thisNode = self.thisMObject()
781 sizeVal = plug.asMDistance()
783 multiplier = sizeVal.asCentimeters()
788 corner1 = corner1 * multiplier
789 corner2 = corner2 * multiplier
799 def locatorCreator():
800 return swissArmyLocator2()
808 swissArmyLocator2.aSize = unitFn.create(
"size",
"sz", OpenMaya.MFnUnitAttribute.kDistance, 10.0)
811 swissArmyLocator2.aPointX = numericFn.create(
"pointX",
"ptx", OpenMaya.MFnNumericData.kDouble, 0.0)
812 swissArmyLocator2.aPointY = numericFn.create(
"pointY",
"pty", OpenMaya.MFnNumericData.kDouble, 0.0)
813 swissArmyLocator2.aPointZ = numericFn.create(
"pointZ",
"ptz", OpenMaya.MFnNumericData.kDouble, 0.0)
814 swissArmyLocator2.aPoint = numericFn.create(
"point",
"pt", swissArmyLocator2.aPointX, swissArmyLocator2.aPointY, swissArmyLocator2.aPointZ)
817 swissArmyLocator2.aArrow1Angle = unitFn.create(
"arrow1Angle",
"a1a", OpenMaya.MFnUnitAttribute.kAngle, 0.0)
820 swissArmyLocator2.aArrow2DirectionX = numericFn.create(
"arrow2DirectionX",
"a2x", OpenMaya.MFnNumericData.kDouble, 3.0)
821 swissArmyLocator2.aArrow2DirectionY = numericFn.create(
"arrow2DirectionY",
"a2y", OpenMaya.MFnNumericData.kDouble, 1.0)
822 swissArmyLocator2.aArrow2DirectionZ = numericFn.create(
"arrow2DirectionZ",
"a2z", OpenMaya.MFnNumericData.kDouble, 4.0)
823 swissArmyLocator2.aArrow2Direction = numericFn.create(
"arrow2Direction",
"dir", swissArmyLocator2.aArrow2DirectionX, swissArmyLocator2.aArrow2DirectionY, swissArmyLocator2.aArrow2DirectionZ)
827 swissArmyLocator2.aArrow3Angle = unitFn.create(
"arrow3Angle",
"a3a", OpenMaya.MFnUnitAttribute.kAngle, 0.0)
829 swissArmyLocator2.aArrow4Distance = unitFn.create(
"arrow2Distance",
"dis", OpenMaya.MFnUnitAttribute.kDistance, 0.0)
832 swissArmyLocator2.aState = numericFn.create(
"state",
"s", OpenMaya.MFnNumericData.kLong, 0)
835 swissArmyLocator2.aToggle = numericFn.create(
"toggle",
"t", OpenMaya.MFnNumericData.kBoolean,
False)
841 swissArmyLocator2.aInManipDouble = numericFn.create(
"inManipDouble",
"imd", OpenMaya.MFnNumericData.kDouble, 3.14)
844 swissArmyLocator2.aInManipMPointX = numericFn.create(
"inManipMPointX",
"ima", OpenMaya.MFnNumericData.kDouble, 2.0)
845 swissArmyLocator2.aInManipMPointY = numericFn.create(
"inManipMPointY",
"imb", OpenMaya.MFnNumericData.kDouble, 7.0)
846 swissArmyLocator2.aInManipMPointZ = numericFn.create(
"inManipMPointZ",
"imc", OpenMaya.MFnNumericData.kDouble, 2.0)
847 swissArmyLocator2.aInManipMPoint = numericFn.create(
"inManipMPoint",
"imp", swissArmyLocator2.aInManipMPointX, swissArmyLocator2.aInManipMPointY, swissArmyLocator2.aInManipMPointZ)
850 swissArmyLocator2.aInManipMVectorX = numericFn.create(
"inManipMVectorX",
"imx", OpenMaya.MFnNumericData.kDouble, 3.0)
851 swissArmyLocator2.aInManipMVectorY = numericFn.create(
"inManipMVectorY",
"imy", OpenMaya.MFnNumericData.kDouble, 1.0)
852 swissArmyLocator2.aInManipMVectorZ = numericFn.create(
"inManipMVectorZ",
"imz", OpenMaya.MFnNumericData.kDouble, 4.0)
853 swissArmyLocator2.aInManipMVector = numericFn.create(
"inManipMVector",
"imv", swissArmyLocator2.aInManipMVectorX, swissArmyLocator2.aInManipMVectorY, swissArmyLocator2.aInManipMVectorZ)
856 swissArmyLocator2.aInPlugDouble = numericFn.create(
"inPlugDouble",
"ipd", OpenMaya.MFnNumericData.kDouble, 2.718)
859 swissArmyLocator2.aInPlugMPointX = numericFn.create(
"inPlugMPointX",
"ipa", OpenMaya.MFnNumericData.kDouble, 1.0)
860 swissArmyLocator2.aInPlugMPointY = numericFn.create(
"inPlugMPointY",
"ipb", OpenMaya.MFnNumericData.kDouble, 4.0)
861 swissArmyLocator2.aInPlugMPointZ = numericFn.create(
"inPlugMPointZ",
"ipc", OpenMaya.MFnNumericData.kDouble, 1.0)
862 swissArmyLocator2.aInPlugMPoint = numericFn.create(
"inPlugMPoint",
"ipp", swissArmyLocator2.aInPlugMPointX, swissArmyLocator2.aInPlugMPointY, swissArmyLocator2.aInPlugMPointZ)
865 swissArmyLocator2.aInPlugMVectorX = numericFn.create(
"inPlugMVectorX",
"ipx", OpenMaya.MFnNumericData.kDouble, 1.0)
866 swissArmyLocator2.aInPlugMVectorY = numericFn.create(
"inPlugMVectorY",
"ipy", OpenMaya.MFnNumericData.kDouble, 5.0)
867 swissArmyLocator2.aInPlugMVectorZ = numericFn.create(
"inPlugMVectorZ",
"ipz", OpenMaya.MFnNumericData.kDouble, 9.0)
868 swissArmyLocator2.aInPlugMVector = numericFn.create(
"inPlugMVector",
"ipv", swissArmyLocator2.aInPlugMVectorX, swissArmyLocator2.aInPlugMVectorY, swissArmyLocator2.aInPlugMVectorZ)
871 swissArmyLocator2.aOutManipDouble = numericFn.create(
"outManipDouble",
"omd", OpenMaya.MFnNumericData.kDouble, 0.0)
874 swissArmyLocator2.aOutManipMPointX = numericFn.create(
"outManipMPointX",
"oma", OpenMaya.MFnNumericData.kDouble, 0.0)
875 swissArmyLocator2.aOutManipMPointY = numericFn.create(
"outManipMPointY",
"omb", OpenMaya.MFnNumericData.kDouble, 0.0)
876 swissArmyLocator2.aOutManipMPointZ = numericFn.create(
"outManipMPointZ",
"omc", OpenMaya.MFnNumericData.kDouble, 0.0)
877 swissArmyLocator2.aOutManipMPoint = numericFn.create(
"outManipMPoint",
"omp", swissArmyLocator2.aOutManipMPointX, swissArmyLocator2.aOutManipMPointY, swissArmyLocator2.aOutManipMPointZ)
880 swissArmyLocator2.aOutManipMVectorX = numericFn.create(
"outManipMVectorX",
"omx", OpenMaya.MFnNumericData.kDouble, 0.0)
881 swissArmyLocator2.aOutManipMVectorY = numericFn.create(
"outManipMVectorY",
"omy", OpenMaya.MFnNumericData.kDouble, 0.0)
882 swissArmyLocator2.aOutManipMVectorZ = numericFn.create(
"outManipMVectorZ",
"omz", OpenMaya.MFnNumericData.kDouble, 0.0)
883 swissArmyLocator2.aOutManipMVector = numericFn.create(
"outManipMVector",
"omv", swissArmyLocator2.aOutManipMVectorX, swissArmyLocator2.aOutManipMVectorY, swissArmyLocator2.aOutManipMVectorZ)
886 swissArmyLocator2.aOutPlugDouble = numericFn.create(
"outPlugDouble",
"opd", OpenMaya.MFnNumericData.kDouble, 0.0)
889 swissArmyLocator2.aOutPlugMPointX = numericFn.create(
"outPlugMPointX",
"opa", OpenMaya.MFnNumericData.kDouble, 0.0)
890 swissArmyLocator2.aOutPlugMPointY = numericFn.create(
"outPlugMPointY",
"opb", OpenMaya.MFnNumericData.kDouble, 0.0)
891 swissArmyLocator2.aOutPlugMPointZ = numericFn.create(
"outPlugMPointZ",
"opc", OpenMaya.MFnNumericData.kDouble, 0.0)
892 swissArmyLocator2.aOutPlugMPoint = numericFn.create(
"outPlugMPoint",
"opp", swissArmyLocator2.aOutPlugMPointX, swissArmyLocator2.aOutPlugMPointY, swissArmyLocator2.aOutPlugMPointZ)
895 swissArmyLocator2.aOutPlugMVectorX = numericFn.create(
"outPlugMVectorX",
"opx", OpenMaya.MFnNumericData.kDouble, 0.0)
896 swissArmyLocator2.aOutPlugMVectorY = numericFn.create(
"outPlugMVectorY",
"opy", OpenMaya.MFnNumericData.kDouble, 0.0)
897 swissArmyLocator2.aOutPlugMVectorZ = numericFn.create(
"outPlugMVectorZ",
"opz", OpenMaya.MFnNumericData.kDouble, 0.0)
898 swissArmyLocator2.aOutPlugMVector = numericFn.create(
"outPlugMVector",
"opv", swissArmyLocator2.aOutPlugMVectorX, swissArmyLocator2.aOutPlugMVectorY, swissArmyLocator2.aOutPlugMVectorZ)
900 swissArmyLocator2.addAttribute(swissArmyLocator2.aPoint)
901 swissArmyLocator2.addAttribute(swissArmyLocator2.aArrow1Angle)
902 swissArmyLocator2.addAttribute(swissArmyLocator2.aArrow2Direction)
903 swissArmyLocator2.addAttribute(swissArmyLocator2.aArrow3Angle)
904 swissArmyLocator2.addAttribute(swissArmyLocator2.aArrow4Distance)
905 swissArmyLocator2.addAttribute(swissArmyLocator2.aState)
906 swissArmyLocator2.addAttribute(swissArmyLocator2.aToggle)
907 swissArmyLocator2.addAttribute(swissArmyLocator2.aSize)
908 swissArmyLocator2.addAttribute(swissArmyLocator2.aInManipDouble)
909 swissArmyLocator2.addAttribute(swissArmyLocator2.aInManipMPoint)
910 swissArmyLocator2.addAttribute(swissArmyLocator2.aInManipMVector)
911 swissArmyLocator2.addAttribute(swissArmyLocator2.aInPlugDouble)
912 swissArmyLocator2.addAttribute(swissArmyLocator2.aInPlugMPoint)
913 swissArmyLocator2.addAttribute(swissArmyLocator2.aInPlugMVector)
914 swissArmyLocator2.addAttribute(swissArmyLocator2.aOutManipDouble)
915 swissArmyLocator2.addAttribute(swissArmyLocator2.aOutManipMPoint)
916 swissArmyLocator2.addAttribute(swissArmyLocator2.aOutManipMVector)
917 swissArmyLocator2.addAttribute(swissArmyLocator2.aOutPlugDouble)
918 swissArmyLocator2.addAttribute(swissArmyLocator2.aOutPlugMPoint)
919 swissArmyLocator2.addAttribute(swissArmyLocator2.aOutPlugMVector)
924 def locatorManipCreator():
925 return swissArmyLocator2Manip()
928 def locatorManipInit():
933 def initializePlugin(mobject):
937 mplugin.registerNode(kSwissArmyLocator2Name,
938 kSwissArmyLocator2Id,
941 OpenMaya.MPxNode.kLocatorNode)
943 print (
"Failed to register context command:", kSwissArmyLocator2Name)
947 mplugin.registerNode(kSwissArmyLocator2ManipName,
948 kSwissArmyLocator2ManipId,
951 OpenMaya.MPxNode.kManipContainer)
953 print (
"Failed to register node:", kSwissArmyLocator2ManipName)
958 def uninitializePlugin(mobject):
963 mplugin.deregisterNode(kSwissArmyLocator2Id)
965 print (
"Failed to deregister context command:", kSwissArmyLocator2Name)
969 mplugin.deregisterNode(kSwissArmyLocator2ManipId)
971 print (
"Failed to deregister node:", kSwissArmyLocator2ManipName)