You are on page 1of 20

global proc shelf_PJC_Viewport_Overlay () {

global string $gBuffStr;


global string $gBuffStr0;
global string $gBuffStr1;

shelfButton
-enableCommandRepeat 1
-enable 1
-width 35
-height 35
-manage 1
-visible 1
-preventOverride 0
-annotation "Create Golden Spiral for camera"
-enableBackground 0
-align "center"
-label "Golden"
-labelOffset 0
-font "plainLabelFont"
-imageOverlayLabel "Golden"
-overlayLabelColor 0.8 0.8 0.8
-overlayLabelBackColor 0 0 0 0.2
-image "menuIconAnimCurves.png"
-image1 "menuIconAnimCurves.png"
-style "iconOnly"
-marginWidth 1
-marginHeight 1
-command "\"\"\"PJC - Camera Overlay for Maya 2015\n\
n#====================================================\n#\tPJC - Camera Overlay for
Maya 2015\n#\n#\tThis allows users to create a Golden Spiral or\n#\tRule of Thirds
overlay for thier viewport within\n#\tMaya 2015.\n#\n#\tVersion 0.4\n#\
n#====================================================\n\"\"\"\n__author__
= \"PeJayCee\"\n__version__ = \"0.4\"\n\
n#====================================================\n#\tImports\
n#====================================================\n\nimport maya.cmds as cmds\
nimport math\n\n#====================================================\n#\tClass for
creating Camera Overlays\n#====================================================\n\
nclass Overlay_Function(object):\n\tdef __init__(self):\n\t\tprint \"running
overlay\"\n\t\tself.currentOverlay = \"\"\n\n\
t#====================================================\n\t#\tMethod for getting
camera data\n\t#====================================================\n\n\tdef
cameraQuery(self, **kwargs):\n\t\treturn cmds.camera(self.camera, query=True,
**kwargs)\n\n\t#====================================================\n\t#\tMethod
for defining camera properties\n\
t#====================================================\n\t\n\tdef
cameraProperties(self): ###Code from Chris Zurbrigg (http://zurbrigg.com), Shot
Mask\n\t\tself.camera = Overlay_Function.active_camera()\n\t\tself.near_clip =
self.cameraQuery(nearClipPlane=True)\n\t\tif self.near_clip < 0.1:\n\t\t\
tself.near_clip = 0.1\n\t\tself.nearClipOffset = self.near_clip + (self.near_clip *
0.2)###Mulitpled by 0.2 as that worked with orthogrphic cameras\t\t\n\t\
tself.film_fit = self.cameraQuery(filmFit=True)\n\t\tself.aspect_ratio =
cmds.getAttr(\"defaultResolution.deviceAspectRatio\")\n\t\tself.camera_aspect_ratio
= self.cameraQuery(aspectRatio=True)\n\t\t\n\t\tif
self.cameraQuery(orthographic=True):\n\t\t\tself.width =
self.cameraQuery(orthographicWidth=True)\n\t\t\tself.height = self.width /
self.aspect_ratio\n\t\t\tself.label_plane_width = self.width\n\t\t\
tself.label_plane_height = self.height\t\t\t\n\t\telse:\n\t\t\tscale = 1.0\n\t\t\
tif self.film_fit == \"horizontal\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\telif
self.film_fit == \"vertical\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(verticalFieldOfView=True))\n\t\t\telif self.film_fit
== \"fill\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio > self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\n\t\t\telif self.film_fit
== \"overscan\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio < self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\t\n\n\t\t\tif self.film_fit
== \"vertical\":\n\t\t\t\tself.height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.width = self.height * self.aspect_ratio\
t\t\t\t\n\t\t\t\tself.label_plane_height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.label_plane_width =
self.label_plane_height * self.aspect_ratio\n\t\t\telse:\n\t\t\t\tself.width = 2 *
math.tan(fov * 0.5) * self.nearClipOffset * scale\n\t\t\t\tself.height = self.width
/ self.aspect_ratio\t\t\t\t\n\t\t\t\tself.label_plane_width = 2 * math.tan(fov *
0.5) * self.nearClipOffset * scale\n\t\t\t\tself.label_plane_height =
self.label_plane_width / self.aspect_ratio\n\n\
t#====================================================\n\t#\tMethod for creating
Rule of Thirds Grid\n\t#====================================================\n\t\t\
n\tdef createThirdsGrid(self):\n\t\tself.cameraProperties()\n\t\tgroupName =
self.camera + \"_thirds_Grid\" ###Names based on cameras so each camera cna have
its own overlay\n\t\tself.currentOverlay = groupName\n\t\tif
cmds.objExists(groupName): cmds.delete(groupName)\n\t\tself.plane_Name =
self.camera + \"_Plane_Test_001\"\n\t\tself.planeTopH = self.camera
+ \"_H_Top_Line_001\"\n\t\tself.planeBaseH = self.camera + \"_H_Base_Line_001\"\n\
t\tself.planeLeftV = self.camera + \"_V_Left_Line_001\"\n\t\tself.planeRightV =
self.camera + \"_V_Right_Line_001\"\n\t\tself.lines = (self.planeTopH,
self.planeBaseH, self.planeLeftV, self.planeRightV)\n\t\
tcmds.createNode(\"transform\", name = groupName)\n\t\tself.widthPixels =
cmds.getAttr(\"defaultResolution.width\")\n\t\tself.heightPixels =
cmds.getAttr(\"defaultResolution.height\")\n\n\t\tfor line in self.lines:\n\t\t\tif
\"_H_\" in line:\n\t\t\t\tcmds.curve(ep=[(self.width/2, 0, 0), (-self.width/2, 0,
0)], name = line)\n\t\t\telif \"_V_\" in line:\n\t\t\t\tcmds.curve(ep=[(0, 0,
self.height/2), (0, 0, -self.height/2)], name = line)\n\t\t\tcmds.parent(line,
groupName)\n\t\t\theightSixth = self.height/6\n\t\t\twidthSixth = self.width/6\n\t\
t\tif \"_Top_Line_001\" in line: \n\t\t\t\tcmds.move(0, 0, -heightSixth, line)\n\t\
t\telif \"_Base_Line_001\" in line:\n\t\t\t\tcmds.move(0, 0, heightSixth, line)\n\
t\t\telif \"_Left_Line_001\" in line:\n\t\t\t\tcmds.move(-widthSixth, 0, 0, line)\
n\t\t\telif \"_Right_Line_001\" in line:\n\t\t\t\tcmds.move(widthSixth, 0, 0,
line)\n\n\t\tcmds.parentConstraint(self.camera, groupName,
name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.move(0, -self.nearClipOffset,
0, groupName, relative=True, objectSpace=True)\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\
t#====================================================\n\t#\tMethod for creating
Golden Spiral\n\t#====================================================\t\n\n\tdef
createGoldenSprial(self, position = \"topRight\"):\n\t\t###Technocally it's the
fibonacci spiral, but it makes little difference \n\t\tself.cameraProperties()\n\t\
tlineName = self.camera + \"_goldenSpiral\"\n\t\tgroupName = self.camera
+ \"_goldenSpiral_GRP\"\n\t\trectName = self.camera + \"_rectGuide\"\n\t\
tself.currentOverlay = groupName\n\t\tif cmds.objExists(groupName):
cmds.delete(groupName)\n\t\tspiral = [[24.0, 0.0, 105.0], [18.18431634044607, 0.0,
105.0], [6.520717642368542, 0.0, 103.85257921630085], [-10.27721821557151, 0.0,
98.75531247827209], [-25.76479766304041, 0.0, 90.47784123163812], [-
39.338095564734445, 0.0, 79.33809556473445], [-50.47784123163818, 0.0,
65.76479766304038], [-58.75531247827203, 0.0, 50.27721821557151], [-
63.85257921630085, 0.0, 33.47928235763141], [-65.0, 0.0, 16.0], [-65.0, 0.0,
12.406038187916112], [-64.29091974041066, 0.0, 5.1981962958457295], [-
61.1409234416288, 0.0, -5.182550582656557], [-56.02563222179889, 0.0, -
14.753526645699132], [-49.141519731015684, 0.0, -23.141519731015677], [-
40.75352664569914, 0.0, -30.025632221798872], [-31.18255058265658, 0.0, -
35.14092344162877], [-20.801803704154278, 0.0, -38.29091974041066], [-10.0, 0.0, -
39.0], [-7.77827815252996, 0.0, -39.0], [-3.322521346522819, 0.0, -
38.56165947589022], [3.0946676329149643, 0.0, -36.61438903664323],
[9.011271017341269, 0.0, -33.452209009839294], [14.196575833718772, 0.0, -
29.196575833718782], [18.452209009839294, 0.0, -24.011271017341272],
[21.61438903664324, 0.0, -18.094667632914962], [23.561659475890206, 0.0, -
11.677478653477182], [24.0, 0.0, -5.0], [24.005876601429442, 0.0, -
3.706886690924809], [23.777412722891853, 0.0, -1.1132035754530578],
[22.725648103755358, 0.0, 2.6428499013860374], [21.00074561066001, 0.0,
6.142702307822074], [18.661528357191525, 0.0, 9.265192323173274],
[15.787950237524708, 0.0, 11.904212983392663], [12.477613553125305, 0.0,
13.969624931029786], [8.845207686558368, 0.0, 15.390812517336583], [5.0, 0.0,
16.0], [4.072031773535475, 0.0, 16.14455275501771], [2.178234471274524, 0.0,
16.23193299826233], [-0.6188927288192801, 0.0, 15.747973105934456], [-
3.2474216220209264, 0.0, 14.672714373118492], [-5.582182864322244, 0.0,
13.056364843448742], [-7.513966991581316, 0.0, 10.97504171949949], [-
8.95190740736182, 0.0, 8.526027051197591], [-9.828515227699702, 0.0,
5.826083259151342], [-10.0, 0.0, 3.0], [-10.0, 0.0, 2.4772419182423433], [-
9.89686105315064, 0.0, 1.428828552123016], [-9.438679773327824, 0.0, -
0.08109826656822744], [-8.694637414079837, 0.0, -1.4732402393744184], [-
7.693311960875005, 0.0, -2.6933119608750067], [-6.47324023937442, 0.0, -
3.694637414079835], [-5.081098266568228, 0.0, -4.438679773327824], [-
3.571171447876985, 0.0, -4.896861053150637], [-2.0, 0.0, -5.000000000000001], [-
1.6732761989014646, 0.0, -5.0], [-1.0180178450768846, 0.0, -4.935538158219152], [-
0.07431358339485825, 0.0, -4.649174858329889], [0.7957751496090115, 0.0, -
4.184148383799899], [1.55831997554688, 0.0, -3.558319975546878],
[2.1841483837998963, 0.0, -2.7957751496090113], [2.6491748583298893, 0.0, -
1.925686416605141], [2.935538158219149, 0.0, -0.9819821549231146], [3.0, 0.0, 0.0],
[3.0, 0.0, 0.19603428065912115], [2.96132289493149, 0.0, 0.5891892929538691],
[2.7895049149979334, 0.0, 1.1554118499630852], [2.5104890302799383, 0.0,
1.6774650897654066], [2.134991985328128, 0.0, 2.1349919853281283],
[1.6774650897654064, 0.0, 2.510489030279938], [1.1554118499630845, 0.0,
2.7895049149979334], [0.5891892929538686, 0.0, 2.961322894931488]]\n\t\trectangle =
[[24, 0, 105], [-65, 0, 105], [-65, 0, -39], [24, 0, -39], [24, 0, 105]]\n\t\
tshapes = [spiral, rectangle]\n\t\tfor shape in shapes:\n\t\t\tscaledShape=[]\n\t\
t\tfor coords in shape:\n\t\t\t\tif self.aspect_ratio > 1.6180339887:###If greater
than golden Ratio\n\t\t\t\t\tmultiplied = tuple([x*self.height*0.011236 for x in
coords]) ###Then match to height\n\t\t\t\telse:\n\t\t\t\t\tmultiplied =
tuple([x*self.width*0.0069444 for x
in coords]) ###Else match to width\n\t\t\t\tscaledShape.append(multiplied)\n\n\t\
t\tif cmds.objExists(lineName):\n\t\t\t\tcmds.curve(p = scaledShape, d = 1, name =
rectName)\n\t\t\telse:\n\t\t\t\tcmds.curve(p = scaledShape, d = 3, name =
lineName)\n\n\t\tcmds.xform(lineName, centerPivots = True)\n\t\
tcmds.xform(rectName, centerPivots = True)\n\t\tcmds.createNode(\"transform\", name
= groupName)\n\t\tcmds.addAttr(longName = \"position\", dataType = \"string\")\n\t\
tcmds.parent(lineName, groupName)\n\t\tcmds.parent(rectName, groupName)\n\t\
tcmds.xform(groupName, centerPivots = True)\n\t\tcmds.parentConstraint(self.camera,
groupName, name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(-90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.rotate(0, -90, 0, groupName,
relative=True, objectSpace=True)\n\t\tcmds.move(0, self.nearClipOffset, 0,
groupName, relative=True, objectSpace=True)\n\n\t\tif position == \"topRight\":\n\
t\t\tcmds.setAttr(groupName + \".position\", \"topRight\", type = \"string\")\n\t\
telif position == \"topLeft\":\n\t\t\tcmds.scale(1, 1, -1, groupName,
relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"topLeft\", type = \"string\")\n\t\telif position
== \"bottomRight\":\n\t\t\tcmds.scale(-1, 1, 1, groupName, relative=True,
objectSpace=True)\n\t\t\tcmds.setAttr(groupName + \".position\", \"bottomRight\",
type = \"string\")\n\t\telif position == \"bottomLeft\":\n\t\t\tcmds.scale(-1, 1, -
1, groupName, relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"bottomLeft\", type = \"string\")\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\
t#====================================================\n\t#\tMethod for Toggling
Rule of Thirds Grid\n\t#====================================================\t\n\n\
tdef toggleThirdsGrid(self):\n\t\tif Overlay_Function.active_camera() == None:\n\t\
t\traise Exception(\"No active camera viewport\")\n\t\
tcmds.undoInfo(stateWithoutFlush = False)\n\t\tself.cameraProperties()\n\t\
tself.checkCurrentOverlay()\n\t\tgroupName = self.camera + \"_thirds_Grid\"\n\t\tif
self.currentOverlay == groupName:\n\t\t\tcmds.delete(groupName)\n\t\telse:\n\t\t\
ttry:\n\t\t\t\tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\
tself.createThirdsGrid()\n\t\tcmds.undoInfo(stateWithoutFlush = True)\n\n\
t#====================================================\n\t#\tMethods for Toggling
Golden Spiral\n\t#====================================================\t\n\n\tdef
toggleGoldenSprial(self, position = \"None\"):\n\t\tif
Overlay_Function.active_camera() == None:\n\t\t\traise Exception(\"No active camera
viewport\")\n\t\tcmds.undoInfo(stateWithoutFlush = False)\n\t\
tself.cameraProperties()\n\t\tself.checkCurrentOverlay()\n\t\tgroupName =
self.camera + \"_goldenSpiral_GRP\"\n\t\ttry:\n\t\t\tpositionAttr = groupName
+ \".position\"\n\t\t\tpositionValue = cmds.getAttr(positionAttr)\n\n\t\t\tif
self.currentOverlay == groupName:\n\t\t\t\tif position == \"None\":\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telif position == positionValue:\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telse:\n\t\t\t\t\
tself.createGoldenSprial(position)\n\n\t\t\telse:\n\t\t\t\ttry:\n\t\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\t\texcept:\n\t\t\t\t\tpass\n\t\t\t\
tself.createGoldenSprial(position = \"topRight\")\n\t\texcept:\n\t\t\ttry:\n\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\tif position
== \"None\":\n\t\t\t\tself.createGoldenSprial(position = \"topRight\")\n\t\t\
telse:\n\t\t\t\tself.createGoldenSprial(position)\n\t\
tcmds.undoInfo(stateWithoutFlush = True)\n\n\n\tdef
toggleGoldenSprialTopRight(self):\n\t\tself.toggleGoldenSprial(position
= \"topRight\")\n\n\tdef toggleGoldenSprialTopLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"topLeft\")\n\n\tdef
toggleGoldenSprialBottomRight(self):\n\t\tself.toggleGoldenSprial(position
= \"bottomRight\")\n\n\tdef toggleGoldenSprialBottomLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"bottomLeft\")\n\n\n\
t#====================================================\n\t#\tMethod for Checking
for existing Overlays\n\t#====================================================\t\n\
n\n\tdef checkCurrentOverlay(self):\n\t\t###Provided the names haven't been
changed\n\t\tgoldenName = self.camera + \"_goldenSpiral_GRP\"\n\t\tgridName =
self.camera + \"_thirds_Grid\"\n\t\tif cmds.objExists(goldenName):\n\t\t\
tself.currentOverlay = goldenName\n\t\telif cmds.objExists(gridName):\n\t\t\
tself.currentOverlay = gridName\n\n\t@classmethod\n\tdef active_camera(cls):\n\t\
tpanel = cmds.getPanel(withFocus=True)\n\t\tif (cmds.getPanel(typeOf=panel)
== \"modelPanel\"):\n\t\t\tcamera = cmds.modelEditor(panel, q=True, camera=True)\n\
t\telse:\n\t\t\treturn None\t\t\n\t\treturn camera\n\
n#====================================================\n#\tFunction for Toggelling
Camera Overlay\n#====================================================\n\
nOverlay_Function().toggleGoldenSprialTopRight()"
-sourceType "python"
-commandRepeatable 1
-flat 1
-mi "Top Right" ( "import maya.cmds as cmds\nimport math\n\nclass
overlay_Function(object):\n\tdef __init__(self):\n\t\tprint \"running overlay\"\n\
t\tself.currentOverlay = \"\"\n\n\tdef cameraQuery(self, **kwargs):\n\t\treturn
cmds.camera(self.camera, query=True, **kwargs)\n\t\n\tdef cameraProperties(self):\
n\t\tif overlay_Function.active_camera() == None:\n\t\t\traise Exception(\"No
active camera viewport\")\n\n\t\tself.camera = overlay_Function.active_camera()\n\
t\tself.near_clip = self.cameraQuery(nearClipPlane=True)\n\t\tif self.near_clip <
0.1:\n\t\t\tself.near_clip = 0.1\n\t\tself.nearClipOffset = self.near_clip +
(self.near_clip * 0.2)\t\t\t\n\t\tself.film_fit = self.cameraQuery(filmFit=True)\n\
t\tself.aspect_ratio = cmds.getAttr(\"defaultResolution.deviceAspectRatio\")\n\t\
tself.camera_aspect_ratio = self.cameraQuery(aspectRatio=True)\n\t\t\n\t\tif
self.cameraQuery(orthographic=True):\n\t\t\tself.width =
self.cameraQuery(orthographicWidth=True)\n\t\t\tself.height = self.width /
self.aspect_ratio\n\t\t\tself.label_plane_width = self.width\n\t\t\
tself.label_plane_height = self.height\t\t\t\n\t\telse:\n\t\t\tscale = 1.0\n\t\t\
tif self.film_fit == \"horizontal\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\telif
self.film_fit == \"vertical\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(verticalFieldOfView=True))\n\t\t\telif self.film_fit
== \"fill\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio > self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\n\t\t\telif self.film_fit
== \"overscan\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio < self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\t\n\n\t\t\tif self.film_fit
== \"vertical\":\n\t\t\t\tself.height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.width = self.height * self.aspect_ratio\
t\t\t\t\n\t\t\t\tself.label_plane_height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.label_plane_width =
self.label_plane_height * self.aspect_ratio\n\t\t\telse:\n\t\t\t\tself.width = 2 *
math.tan(fov * 0.5) * self.nearClipOffset * scale\n\t\t\t\tself.height = self.width
/ self.aspect_ratio\t\t\t\t\n\t\t\t\tself.label_plane_width = 2 * math.tan(fov *
0.5) * self.nearClipOffset * scale\n\t\t\t\tself.label_plane_height =
self.label_plane_width / self.aspect_ratio\n\t\t\n\tdef createThirdsGrid(self):\n\
t\tself.cameraProperties()\n\t\tgroupName = self.camera + \"_thirds_Grid\"\n\t\
tself.currentOverlay = groupName\n\t\tif cmds.objExists(groupName):
cmds.delete(groupName)\n\t\tself.plane_Name = self.camera + \"_Plane_Test_001\"\n\
t\tself.planeTopH = self.camera + \"_H_Top_Line_001\"\n\t\tself.planeBaseH =
self.camera + \"_H_Base_Line_001\"\n\t\tself.planeLeftV = self.camera
+ \"_V_Left_Line_001\"\n\t\tself.planeRightV = self.camera + \"_V_Right_Line_001\"\
n\t\tself.lines = (self.planeTopH, self.planeBaseH, self.planeLeftV,
self.planeRightV)\n\t\tcmds.createNode(\"transform\", name = groupName)\n\t\
tself.widthPixels = cmds.getAttr(\"defaultResolution.width\")\n\t\
tself.heightPixels = cmds.getAttr(\"defaultResolution.height\")\n\n\t\tfor line in
self.lines:\n\t\t\tif \"_H_\" in line:\n\t\t\t\tcmds.curve(ep=[(self.width/2, 0,
0), (-self.width/2, 0, 0)], name = line)\n\t\t\telif \"_V_\" in line:\n\t\t\t\
tcmds.curve(ep=[(0, 0, self.height/2), (0, 0, -self.height/2)], name = line)\n\t\t\
tcmds.parent(line, groupName)\n\t\t\theightSixth = self.height/6\n\t\t\twidthSixth
= self.width/6\n\t\t\tif \"_Top_Line_001\" in line: \n\t\t\t\tcmds.move(0, 0, -
heightSixth, line)\n\t\t\telif \"_Base_Line_001\" in line:\n\t\t\t\tcmds.move(0, 0,
heightSixth, line)\n\t\t\telif \"_Left_Line_001\" in line:\n\t\t\t\tcmds.move(-
widthSixth, 0, 0, line)\n\t\t\telif \"_Right_Line_001\" in line:\n\t\t\t\
tcmds.move(widthSixth, 0, 0, line)\n\n\t\tcmds.parentConstraint(self.camera,
groupName, name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.move(0, -self.nearClipOffset,
0, groupName, relative=True, objectSpace=True)\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\tdef createGoldenSprial(self, position
= \"topRight\"):\n\t\tself.cameraProperties()\n\t\tlineName = self.camera
+ \"_goldenSpiral\"\n\t\tgroupName = self.camera + \"_goldenSpiral_GRP\"\n\t\
trectName = self.camera + \"_rectGuide\"\n\t\tself.currentOverlay = groupName\n\t\
tif cmds.objExists(groupName): cmds.delete(groupName)\n\t\tspiral = [[24.0, 0.0,
105.0], [18.18431634044607, 0.0, 105.0], [6.520717642368542, 0.0,
103.85257921630085], [-10.27721821557151, 0.0, 98.75531247827209], [-
25.76479766304041, 0.0, 90.47784123163812], [-39.338095564734445, 0.0,
79.33809556473445], [-50.47784123163818, 0.0, 65.76479766304038], [-
58.75531247827203, 0.0, 50.27721821557151], [-63.85257921630085, 0.0,
33.47928235763141], [-65.0, 0.0, 16.0], [-65.0, 0.0, 12.406038187916112], [-
64.29091974041066, 0.0, 5.1981962958457295], [-61.1409234416288, 0.0, -
5.182550582656557], [-56.02563222179889, 0.0, -14.753526645699132], [-
49.141519731015684, 0.0, -23.141519731015677], [-40.75352664569914, 0.0, -
30.025632221798872], [-31.18255058265658, 0.0, -35.14092344162877], [-
20.801803704154278, 0.0, -38.29091974041066], [-10.0, 0.0, -39.0], [-
7.77827815252996, 0.0, -39.0], [-3.322521346522819, 0.0, -38.56165947589022],
[3.0946676329149643, 0.0, -36.61438903664323], [9.011271017341269, 0.0, -
33.452209009839294], [14.196575833718772, 0.0, -29.196575833718782],
[18.452209009839294, 0.0, -24.011271017341272], [21.61438903664324, 0.0, -
18.094667632914962], [23.561659475890206, 0.0, -11.677478653477182], [24.0, 0.0, -
5.0], [24.005876601429442, 0.0, -3.706886690924809], [23.777412722891853, 0.0, -
1.1132035754530578], [22.725648103755358, 0.0, 2.6428499013860374],
[21.00074561066001, 0.0, 6.142702307822074], [18.661528357191525, 0.0,
9.265192323173274], [15.787950237524708, 0.0, 11.904212983392663],
[12.477613553125305, 0.0, 13.969624931029786], [8.845207686558368, 0.0,
15.390812517336583], [5.0, 0.0, 16.0], [4.072031773535475, 0.0, 16.14455275501771],
[2.178234471274524, 0.0, 16.23193299826233], [-0.6188927288192801, 0.0,
15.747973105934456], [-3.2474216220209264, 0.0, 14.672714373118492], [-
5.582182864322244, 0.0, 13.056364843448742], [-7.513966991581316, 0.0,
10.97504171949949], [-8.95190740736182, 0.0, 8.526027051197591], [-
9.828515227699702, 0.0, 5.826083259151342], [-10.0, 0.0, 3.0], [-10.0, 0.0,
2.4772419182423433], [-9.89686105315064, 0.0, 1.428828552123016], [-
9.438679773327824, 0.0, -0.08109826656822744], [-8.694637414079837, 0.0, -
1.4732402393744184], [-7.693311960875005, 0.0, -2.6933119608750067], [-
6.47324023937442, 0.0, -3.694637414079835], [-5.081098266568228, 0.0, -
4.438679773327824], [-3.571171447876985, 0.0, -4.896861053150637], [-2.0, 0.0, -
5.000000000000001], [-1.6732761989014646, 0.0, -5.0], [-1.0180178450768846, 0.0, -
4.935538158219152], [-0.07431358339485825, 0.0, -4.649174858329889],
[0.7957751496090115, 0.0, -4.184148383799899], [1.55831997554688, 0.0, -
3.558319975546878], [2.1841483837998963, 0.0, -2.7957751496090113],
[2.6491748583298893, 0.0, -1.925686416605141], [2.935538158219149, 0.0, -
0.9819821549231146], [3.0, 0.0, 0.0], [3.0, 0.0, 0.19603428065912115],
[2.96132289493149, 0.0, 0.5891892929538691], [2.7895049149979334, 0.0,
1.1554118499630852], [2.5104890302799383, 0.0, 1.6774650897654066],
[2.134991985328128, 0.0, 2.1349919853281283], [1.6774650897654064, 0.0,
2.510489030279938], [1.1554118499630845, 0.0, 2.7895049149979334],
[0.5891892929538686, 0.0, 2.961322894931488]]\n\t\trectangle = [[24, 0, 105], [-65,
0, 105], [-65, 0, -39], [24, 0, -39], [24, 0, 105]]\n\t\tshapes = [spiral,
rectangle]\n\t\tfor shape in shapes:\n\t\t\tscaledShape=[]\n\t\t\tfor coords in
shape:\n\t\t\t\tif self.aspect_ratio > 1.6180339887:\n\t\t\t\t\tmultiplied =
tuple([x*self.height*0.011236 for x in coords])\n\t\t\t\telse:\n\t\t\t\t\
tmultiplied = tuple([x*self.width*0.0069444 for x in coords])\n\t\t\t\
tscaledShape.append(multiplied)\n\n\t\t\tif cmds.objExists(lineName):\n\t\t\t\
tcmds.curve(p = scaledShape, d = 1, name = rectName)\n\t\t\telse:\n\t\t\t\
tcmds.curve(p = scaledShape, d = 3, name = lineName)\n\n\t\tcmds.xform(lineName,
centerPivots = True)\n\t\tcmds.xform(rectName, centerPivots = True)\n\t\
tcmds.createNode(\"transform\", name = groupName)\n\t\tcmds.addAttr(longName
= \"position\", dataType = \"string\")\n\t\tcmds.parent(lineName, groupName)\n\t\
tcmds.parent(rectName, groupName)\n\t\tcmds.xform(groupName, centerPivots = True)\
n\t\tcmds.parentConstraint(self.camera, groupName,
name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(-90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.rotate(0, -90, 0, groupName,
relative=True, objectSpace=True)\n\t\tcmds.move(0, self.nearClipOffset, 0,
groupName, relative=True, objectSpace=True)\n\t\tif position == \"topRight\":\n\t\
t\tcmds.setAttr(groupName + \".position\", \"topRight\", type = \"string\")\n\t\
telif position == \"topLeft\":\n\t\t\tcmds.scale(1, 1, -1, groupName,
relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"topLeft\", type = \"string\")\n\t\telif position
== \"bottomRight\":\n\t\t\tcmds.scale(-1, 1, 1, groupName, relative=True,
objectSpace=True)\n\t\t\tcmds.setAttr(groupName + \".position\", \"bottomRight\",
type = \"string\")\n\t\telif position == \"bottomLeft\":\n\t\t\tcmds.scale(-1, 1, -
1, groupName,
relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"bottomLeft\", type = \"string\")\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\n\n\tdef toggleThirdsGrid(self):\n\t\
tself.cameraProperties()\n\t\tself.checkCurrentOverlay()\n\t\tgroupName =
self.camera + \"_thirds_Grid\"\n\t\tif self.currentOverlay == groupName:\n\t\t\
tcmds.delete(groupName)\n\t\telse:\n\t\t\ttry:\n\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\
tself.createThirdsGrid()\n\n\tdef toggleGoldenSprial(self, position = \"None\"):\n\
t\tself.cameraProperties()\n\t\tself.checkCurrentOverlay()\n\t\tgroupName =
self.camera + \"_goldenSpiral_GRP\"\n\t\ttry:\n\t\t\tpositionAttr = groupName
+ \".position\"\n\t\t\tpositionValue = cmds.getAttr(positionAttr)\n\n\t\t\tif
self.currentOverlay == groupName:\n\t\t\t\tif position == \"None\":\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telif position == positionValue:\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telse:\n\t\t\t\t\
tself.createGoldenSprial(position)\n\n\t\t\telse:\n\t\t\t\ttry:\n\t\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\t\texcept:\n\t\t\t\t\tpass\n\t\t\t\
tself.createGoldenSprial(position = \"topRight\")\n\t\texcept:\n\t\t\ttry:\n\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\tif position
== \"None\":\n\t\t\t\tself.createGoldenSprial(position = \"topRight\")\n\t\t\
telse:\n\t\t\t\tself.createGoldenSprial(position)\n\n\n\tdef
toggleGoldenSprialTopRight(self):\n\t\tself.toggleGoldenSprial(position
= \"topRight\")\n\n\tdef toggleGoldenSprialTopLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"topLeft\")\n\n\tdef
toggleGoldenSprialBottomRight(self):\n\t\tself.toggleGoldenSprial(position
= \"bottomRight\")\n\n\tdef toggleGoldenSprialBottomLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"bottomLeft\")\n\n\n\tdef
checkCurrentOverlay(self):\n\t\tgoldenName = self.camera + \"_goldenSpiral_GRP\"\n\
t\tgridName = self.camera + \"_thirds_Grid\"\n\t\tif cmds.objExists(goldenName):\n\
t\t\tself.currentOverlay = goldenName\n\t\telif cmds.objExists(gridName):\n\t\t\
tself.currentOverlay = gridName\n\n\t@classmethod\n\tdef active_camera(cls):\n\t\
tpanel = cmds.getPanel(withFocus=True)\n\t\tif (cmds.getPanel(typeOf=panel)
== \"modelPanel\"):\n\t\t\tcamera = cmds.modelEditor(panel, q=True, camera=True)\n\
t\telse:\n\t\t\treturn None\t\t\n\t\treturn camera\n\
noverlay_Function().toggleGoldenSprialTopRight()" )
-mip 0
-mi "Top Left" ( "import maya.cmds as cmds\nimport math\n\nclass
overlay_Function(object):\n\tdef __init__(self):\n\t\tprint \"running overlay\"\n\
t\tself.currentOverlay = \"\"\n\n\tdef cameraQuery(self, **kwargs):\n\t\treturn
cmds.camera(self.camera, query=True, **kwargs)\n\t\n\tdef cameraProperties(self):\
n\t\tif overlay_Function.active_camera() == None:\n\t\t\traise Exception(\"No
active camera viewport\")\n\n\t\tself.camera = overlay_Function.active_camera()\n\
t\tself.near_clip = self.cameraQuery(nearClipPlane=True)\n\t\tif self.near_clip <
0.1:\n\t\t\tself.near_clip = 0.1\n\t\tself.nearClipOffset = self.near_clip +
(self.near_clip * 0.2)\t\t\t\n\t\tself.film_fit = self.cameraQuery(filmFit=True)\n\
t\tself.aspect_ratio = cmds.getAttr(\"defaultResolution.deviceAspectRatio\")\n\t\
tself.camera_aspect_ratio = self.cameraQuery(aspectRatio=True)\n\t\t\n\t\tif
self.cameraQuery(orthographic=True):\n\t\t\tself.width =
self.cameraQuery(orthographicWidth=True)\n\t\t\tself.height = self.width /
self.aspect_ratio\n\t\t\tself.label_plane_width = self.width\n\t\t\
tself.label_plane_height = self.height\t\t\t\n\t\telse:\n\t\t\tscale = 1.0\n\t\t\
tif self.film_fit == \"horizontal\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\telif
self.film_fit == \"vertical\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(verticalFieldOfView=True))\n\t\t\telif self.film_fit
== \"fill\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio > self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\n\t\t\telif self.film_fit
== \"overscan\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio < self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\t\n\n\t\t\tif self.film_fit
== \"vertical\":\n\t\t\t\tself.height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.width = self.height * self.aspect_ratio\
t\t\t\t\n\t\t\t\tself.label_plane_height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.label_plane_width =
self.label_plane_height * self.aspect_ratio\n\t\t\telse:\n\t\t\t\tself.width = 2 *
math.tan(fov * 0.5) * self.nearClipOffset * scale\n\t\t\t\tself.height = self.width
/ self.aspect_ratio\t\t\t\t\n\t\t\t\tself.label_plane_width = 2 * math.tan(fov *
0.5) * self.nearClipOffset * scale\n\t\t\t\tself.label_plane_height =
self.label_plane_width / self.aspect_ratio\n\t\t\n\tdef createThirdsGrid(self):\n\
t\tself.cameraProperties()\n\t\tgroupName = self.camera + \"_thirds_Grid\"\n\t\
tself.currentOverlay = groupName\n\t\tif cmds.objExists(groupName):
cmds.delete(groupName)\n\t\tself.plane_Name = self.camera + \"_Plane_Test_001\"\n\
t\tself.planeTopH = self.camera + \"_H_Top_Line_001\"\n\t\tself.planeBaseH =
self.camera + \"_H_Base_Line_001\"\n\t\tself.planeLeftV = self.camera
+ \"_V_Left_Line_001\"\n\t\tself.planeRightV = self.camera + \"_V_Right_Line_001\"\
n\t\tself.lines = (self.planeTopH, self.planeBaseH, self.planeLeftV,
self.planeRightV)\n\t\tcmds.createNode(\"transform\", name = groupName)\n\t\
tself.widthPixels = cmds.getAttr(\"defaultResolution.width\")\n\t\
tself.heightPixels = cmds.getAttr(\"defaultResolution.height\")\n\n\t\tfor line in
self.lines:\n\t\t\tif \"_H_\" in line:\n\t\t\t\tcmds.curve(ep=[(self.width/2, 0,
0), (-self.width/2, 0, 0)], name = line)\n\t\t\telif \"_V_\" in line:\n\t\t\t\
tcmds.curve(ep=[(0, 0, self.height/2), (0, 0, -self.height/2)], name = line)\n\t\t\
tcmds.parent(line, groupName)\n\t\t\theightSixth = self.height/6\n\t\t\twidthSixth
= self.width/6\n\t\t\tif \"_Top_Line_001\" in line: \n\t\t\t\tcmds.move(0, 0, -
heightSixth, line)\n\t\t\telif \"_Base_Line_001\" in line:\n\t\t\t\tcmds.move(0, 0,
heightSixth, line)\n\t\t\telif \"_Left_Line_001\" in line:\n\t\t\t\tcmds.move(-
widthSixth, 0, 0, line)\n\t\t\telif \"_Right_Line_001\" in line:\n\t\t\t\
tcmds.move(widthSixth, 0, 0, line)\n\n\t\tcmds.parentConstraint(self.camera,
groupName, name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.move(0, -self.nearClipOffset,
0, groupName, relative=True, objectSpace=True)\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\tdef createGoldenSprial(self, position
= \"topRight\"):\n\t\tself.cameraProperties()\n\t\tlineName = self.camera
+ \"_goldenSpiral\"\n\t\tgroupName = self.camera + \"_goldenSpiral_GRP\"\n\t\
trectName = self.camera + \"_rectGuide\"\n\t\tself.currentOverlay = groupName\n\t\
tif cmds.objExists(groupName): cmds.delete(groupName)\n\t\tspiral = [[24.0, 0.0,
105.0], [18.18431634044607, 0.0, 105.0], [6.520717642368542, 0.0,
103.85257921630085], [-10.27721821557151, 0.0, 98.75531247827209], [-
25.76479766304041, 0.0, 90.47784123163812], [-39.338095564734445, 0.0,
79.33809556473445], [-50.47784123163818, 0.0, 65.76479766304038], [-
58.75531247827203, 0.0, 50.27721821557151], [-63.85257921630085, 0.0,
33.47928235763141], [-65.0, 0.0, 16.0], [-65.0, 0.0, 12.406038187916112], [-
64.29091974041066, 0.0, 5.1981962958457295], [-61.1409234416288, 0.0, -
5.182550582656557], [-56.02563222179889, 0.0, -14.753526645699132], [-
49.141519731015684, 0.0, -23.141519731015677], [-40.75352664569914, 0.0, -
30.025632221798872], [-31.18255058265658, 0.0, -35.14092344162877], [-
20.801803704154278, 0.0, -38.29091974041066], [-10.0, 0.0, -39.0], [-
7.77827815252996, 0.0, -39.0], [-3.322521346522819, 0.0, -38.56165947589022],
[3.0946676329149643, 0.0, -36.61438903664323], [9.011271017341269, 0.0, -
33.452209009839294], [14.196575833718772, 0.0, -29.196575833718782],
[18.452209009839294, 0.0, -24.011271017341272], [21.61438903664324, 0.0, -
18.094667632914962], [23.561659475890206, 0.0, -11.677478653477182], [24.0, 0.0, -
5.0], [24.005876601429442, 0.0, -3.706886690924809], [23.777412722891853, 0.0, -
1.1132035754530578], [22.725648103755358, 0.0, 2.6428499013860374],
[21.00074561066001, 0.0, 6.142702307822074], [18.661528357191525, 0.0,
9.265192323173274], [15.787950237524708, 0.0, 11.904212983392663],
[12.477613553125305, 0.0, 13.969624931029786], [8.845207686558368, 0.0,
15.390812517336583], [5.0, 0.0, 16.0], [4.072031773535475, 0.0, 16.14455275501771],
[2.178234471274524, 0.0, 16.23193299826233], [-0.6188927288192801, 0.0,
15.747973105934456], [-3.2474216220209264, 0.0, 14.672714373118492], [-
5.582182864322244, 0.0, 13.056364843448742], [-7.513966991581316, 0.0,
10.97504171949949], [-8.95190740736182, 0.0, 8.526027051197591], [-
9.828515227699702, 0.0, 5.826083259151342], [-10.0, 0.0, 3.0], [-10.0, 0.0,
2.4772419182423433], [-9.89686105315064, 0.0, 1.428828552123016], [-
9.438679773327824, 0.0, -0.08109826656822744], [-8.694637414079837, 0.0, -
1.4732402393744184], [-7.693311960875005, 0.0, -2.6933119608750067], [-
6.47324023937442, 0.0, -3.694637414079835], [-5.081098266568228, 0.0, -
4.438679773327824], [-3.571171447876985, 0.0, -4.896861053150637], [-2.0, 0.0, -
5.000000000000001], [-1.6732761989014646, 0.0, -5.0], [-1.0180178450768846, 0.0, -
4.935538158219152], [-0.07431358339485825, 0.0, -4.649174858329889],
[0.7957751496090115, 0.0, -4.184148383799899], [1.55831997554688, 0.0, -
3.558319975546878], [2.1841483837998963, 0.0, -2.7957751496090113],
[2.6491748583298893, 0.0, -1.925686416605141], [2.935538158219149, 0.0, -
0.9819821549231146], [3.0, 0.0, 0.0], [3.0, 0.0, 0.19603428065912115],
[2.96132289493149, 0.0, 0.5891892929538691], [2.7895049149979334, 0.0,
1.1554118499630852], [2.5104890302799383, 0.0, 1.6774650897654066],
[2.134991985328128, 0.0, 2.1349919853281283], [1.6774650897654064, 0.0,
2.510489030279938], [1.1554118499630845, 0.0, 2.7895049149979334],
[0.5891892929538686, 0.0, 2.961322894931488]]\n\t\trectangle = [[24, 0, 105], [-65,
0, 105], [-65, 0, -39], [24, 0, -39], [24, 0, 105]]\n\t\tshapes = [spiral,
rectangle]\n\t\tfor shape in shapes:\n\t\t\tscaledShape=[]\n\t\t\tfor coords in
shape:\n\t\t\t\tif self.aspect_ratio > 1.6180339887:\n\t\t\t\t\tmultiplied =
tuple([x*self.height*0.011236 for x in coords])\n\t\t\t\telse:\n\t\t\t\t\
tmultiplied = tuple([x*self.width*0.0069444 for x in coords])\n\t\t\t\
tscaledShape.append(multiplied)\n\n\t\t\tif cmds.objExists(lineName):\n\t\t\t\
tcmds.curve(p = scaledShape, d = 1, name = rectName)\n\t\t\telse:\n\t\t\t\
tcmds.curve(p = scaledShape, d = 3, name = lineName)\n\n\t\tcmds.xform(lineName,
centerPivots = True)\n\t\tcmds.xform(rectName, centerPivots = True)\n\t\
tcmds.createNode(\"transform\", name = groupName)\n\t\tcmds.addAttr(longName
= \"position\", dataType = \"string\")\n\t\tcmds.parent(lineName, groupName)\n\t\
tcmds.parent(rectName, groupName)\n\t\tcmds.xform(groupName, centerPivots = True)\
n\t\tcmds.parentConstraint(self.camera, groupName,
name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(-90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.rotate(0, -90, 0, groupName,
relative=True, objectSpace=True)\n\t\tcmds.move(0, self.nearClipOffset, 0,
groupName, relative=True, objectSpace=True)\n\t\tif position == \"topRight\":\n\t\
t\tcmds.setAttr(groupName + \".position\", \"topRight\", type = \"string\")\n\t\
telif position == \"topLeft\":\n\t\t\tcmds.scale(1, 1, -1, groupName,
relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"topLeft\", type = \"string\")\n\t\telif position
== \"bottomRight\":\n\t\t\tcmds.scale(-1, 1, 1, groupName, relative=True,
objectSpace=True)\n\t\t\tcmds.setAttr(groupName + \".position\", \"bottomRight\",
type = \"string\")\n\t\telif position == \"bottomLeft\":\n\t\t\tcmds.scale(-1, 1, -
1, groupName,
relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"bottomLeft\", type = \"string\")\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\n\n\tdef toggleThirdsGrid(self):\n\t\
tself.cameraProperties()\n\t\tself.checkCurrentOverlay()\n\t\tgroupName =
self.camera + \"_thirds_Grid\"\n\t\tif self.currentOverlay == groupName:\n\t\t\
tcmds.delete(groupName)\n\t\telse:\n\t\t\ttry:\n\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\
tself.createThirdsGrid()\n\n\tdef toggleGoldenSprial(self, position = \"None\"):\n\
t\tself.cameraProperties()\n\t\tself.checkCurrentOverlay()\n\t\tgroupName =
self.camera + \"_goldenSpiral_GRP\"\n\t\ttry:\n\t\t\tpositionAttr = groupName
+ \".position\"\n\t\t\tpositionValue = cmds.getAttr(positionAttr)\n\n\t\t\tif
self.currentOverlay == groupName:\n\t\t\t\tif position == \"None\":\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telif position == positionValue:\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telse:\n\t\t\t\t\
tself.createGoldenSprial(position)\n\n\t\t\telse:\n\t\t\t\ttry:\n\t\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\t\texcept:\n\t\t\t\t\tpass\n\t\t\t\
tself.createGoldenSprial(position = \"topRight\")\n\t\texcept:\n\t\t\ttry:\n\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\tif position
== \"None\":\n\t\t\t\tself.createGoldenSprial(position = \"topRight\")\n\t\t\
telse:\n\t\t\t\tself.createGoldenSprial(position)\n\n\n\tdef
toggleGoldenSprialTopRight(self):\n\t\tself.toggleGoldenSprial(position
= \"topRight\")\n\n\tdef toggleGoldenSprialTopLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"topLeft\")\n\n\tdef
toggleGoldenSprialBottomRight(self):\n\t\tself.toggleGoldenSprial(position
= \"bottomRight\")\n\n\tdef toggleGoldenSprialBottomLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"bottomLeft\")\n\n\n\tdef
checkCurrentOverlay(self):\n\t\tgoldenName = self.camera + \"_goldenSpiral_GRP\"\n\
t\tgridName = self.camera + \"_thirds_Grid\"\n\t\tif cmds.objExists(goldenName):\n\
t\t\tself.currentOverlay = goldenName\n\t\telif cmds.objExists(gridName):\n\t\t\
tself.currentOverlay = gridName\n\n\t@classmethod\n\tdef active_camera(cls):\n\t\
tpanel = cmds.getPanel(withFocus=True)\n\t\tif (cmds.getPanel(typeOf=panel)
== \"modelPanel\"):\n\t\t\tcamera = cmds.modelEditor(panel, q=True, camera=True)\n\
t\telse:\n\t\t\treturn None\t\t\n\t\treturn camera\n\
noverlay_Function().toggleGoldenSprialTopLeft()" )
-mip 1
-mi "Bottom Right" ( "import maya.cmds as cmds\nimport math\n\nclass
overlay_Function(object):\n\tdef __init__(self):\n\t\tprint \"running overlay\"\n\
t\tself.currentOverlay = \"\"\n\n\tdef cameraQuery(self, **kwargs):\n\t\treturn
cmds.camera(self.camera, query=True, **kwargs)\n\t\n\tdef cameraProperties(self):\
n\t\tif overlay_Function.active_camera() == None:\n\t\t\traise Exception(\"No
active camera viewport\")\n\n\t\tself.camera = overlay_Function.active_camera()\n\
t\tself.near_clip = self.cameraQuery(nearClipPlane=True)\n\t\tif self.near_clip <
0.1:\n\t\t\tself.near_clip = 0.1\n\t\tself.nearClipOffset = self.near_clip +
(self.near_clip * 0.2)\t\t\t\n\t\tself.film_fit = self.cameraQuery(filmFit=True)\n\
t\tself.aspect_ratio = cmds.getAttr(\"defaultResolution.deviceAspectRatio\")\n\t\
tself.camera_aspect_ratio = self.cameraQuery(aspectRatio=True)\n\t\t\n\t\tif
self.cameraQuery(orthographic=True):\n\t\t\tself.width =
self.cameraQuery(orthographicWidth=True)\n\t\t\tself.height = self.width /
self.aspect_ratio\n\t\t\tself.label_plane_width = self.width\n\t\t\
tself.label_plane_height = self.height\t\t\t\n\t\telse:\n\t\t\tscale = 1.0\n\t\t\
tif self.film_fit == \"horizontal\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\telif
self.film_fit == \"vertical\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(verticalFieldOfView=True))\n\t\t\telif self.film_fit
== \"fill\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio > self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\n\t\t\telif self.film_fit
== \"overscan\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio < self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\t\n\n\t\t\tif self.film_fit
== \"vertical\":\n\t\t\t\tself.height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.width = self.height * self.aspect_ratio\
t\t\t\t\n\t\t\t\tself.label_plane_height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.label_plane_width =
self.label_plane_height * self.aspect_ratio\n\t\t\telse:\n\t\t\t\tself.width = 2 *
math.tan(fov * 0.5) * self.nearClipOffset * scale\n\t\t\t\tself.height = self.width
/ self.aspect_ratio\t\t\t\t\n\t\t\t\tself.label_plane_width = 2 * math.tan(fov *
0.5) * self.nearClipOffset * scale\n\t\t\t\tself.label_plane_height =
self.label_plane_width / self.aspect_ratio\n\t\t\n\tdef createThirdsGrid(self):\n\
t\tself.cameraProperties()\n\t\tgroupName = self.camera + \"_thirds_Grid\"\n\t\
tself.currentOverlay = groupName\n\t\tif cmds.objExists(groupName):
cmds.delete(groupName)\n\t\tself.plane_Name = self.camera + \"_Plane_Test_001\"\n\
t\tself.planeTopH = self.camera + \"_H_Top_Line_001\"\n\t\tself.planeBaseH =
self.camera + \"_H_Base_Line_001\"\n\t\tself.planeLeftV = self.camera
+ \"_V_Left_Line_001\"\n\t\tself.planeRightV = self.camera + \"_V_Right_Line_001\"\
n\t\tself.lines = (self.planeTopH, self.planeBaseH, self.planeLeftV,
self.planeRightV)\n\t\tcmds.createNode(\"transform\", name = groupName)\n\t\
tself.widthPixels = cmds.getAttr(\"defaultResolution.width\")\n\t\
tself.heightPixels = cmds.getAttr(\"defaultResolution.height\")\n\n\t\tfor line in
self.lines:\n\t\t\tif \"_H_\" in line:\n\t\t\t\tcmds.curve(ep=[(self.width/2, 0,
0), (-self.width/2, 0, 0)], name = line)\n\t\t\telif \"_V_\" in line:\n\t\t\t\
tcmds.curve(ep=[(0, 0, self.height/2), (0, 0, -self.height/2)], name = line)\n\t\t\
tcmds.parent(line, groupName)\n\t\t\theightSixth = self.height/6\n\t\t\twidthSixth
= self.width/6\n\t\t\tif \"_Top_Line_001\" in line: \n\t\t\t\tcmds.move(0, 0, -
heightSixth, line)\n\t\t\telif \"_Base_Line_001\" in line:\n\t\t\t\tcmds.move(0, 0,
heightSixth, line)\n\t\t\telif \"_Left_Line_001\" in line:\n\t\t\t\tcmds.move(-
widthSixth, 0, 0, line)\n\t\t\telif \"_Right_Line_001\" in line:\n\t\t\t\
tcmds.move(widthSixth, 0, 0, line)\n\n\t\tcmds.parentConstraint(self.camera,
groupName, name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.move(0, -self.nearClipOffset,
0, groupName, relative=True, objectSpace=True)\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\tdef createGoldenSprial(self, position
= \"topRight\"):\n\t\tself.cameraProperties()\n\t\tlineName = self.camera
+ \"_goldenSpiral\"\n\t\tgroupName = self.camera + \"_goldenSpiral_GRP\"\n\t\
trectName = self.camera + \"_rectGuide\"\n\t\tself.currentOverlay = groupName\n\t\
tif cmds.objExists(groupName): cmds.delete(groupName)\n\t\tspiral = [[24.0, 0.0,
105.0], [18.18431634044607, 0.0, 105.0], [6.520717642368542, 0.0,
103.85257921630085], [-10.27721821557151, 0.0, 98.75531247827209], [-
25.76479766304041, 0.0, 90.47784123163812], [-39.338095564734445, 0.0,
79.33809556473445], [-50.47784123163818, 0.0, 65.76479766304038], [-
58.75531247827203, 0.0, 50.27721821557151], [-63.85257921630085, 0.0,
33.47928235763141], [-65.0, 0.0, 16.0], [-65.0, 0.0, 12.406038187916112], [-
64.29091974041066, 0.0, 5.1981962958457295], [-61.1409234416288, 0.0, -
5.182550582656557], [-56.02563222179889, 0.0, -14.753526645699132], [-
49.141519731015684, 0.0, -23.141519731015677], [-40.75352664569914, 0.0, -
30.025632221798872], [-31.18255058265658, 0.0, -35.14092344162877], [-
20.801803704154278, 0.0, -38.29091974041066], [-10.0, 0.0, -39.0], [-
7.77827815252996, 0.0, -39.0], [-3.322521346522819, 0.0, -38.56165947589022],
[3.0946676329149643, 0.0, -36.61438903664323], [9.011271017341269, 0.0, -
33.452209009839294], [14.196575833718772, 0.0, -29.196575833718782],
[18.452209009839294, 0.0, -24.011271017341272], [21.61438903664324, 0.0, -
18.094667632914962], [23.561659475890206, 0.0, -11.677478653477182], [24.0, 0.0, -
5.0], [24.005876601429442, 0.0, -3.706886690924809], [23.777412722891853, 0.0, -
1.1132035754530578], [22.725648103755358, 0.0, 2.6428499013860374],
[21.00074561066001, 0.0, 6.142702307822074], [18.661528357191525, 0.0,
9.265192323173274], [15.787950237524708, 0.0, 11.904212983392663],
[12.477613553125305, 0.0, 13.969624931029786], [8.845207686558368, 0.0,
15.390812517336583], [5.0, 0.0, 16.0], [4.072031773535475, 0.0, 16.14455275501771],
[2.178234471274524, 0.0, 16.23193299826233], [-0.6188927288192801, 0.0,
15.747973105934456], [-3.2474216220209264, 0.0, 14.672714373118492], [-
5.582182864322244, 0.0, 13.056364843448742], [-7.513966991581316, 0.0,
10.97504171949949], [-8.95190740736182, 0.0, 8.526027051197591], [-
9.828515227699702, 0.0, 5.826083259151342], [-10.0, 0.0, 3.0], [-10.0, 0.0,
2.4772419182423433], [-9.89686105315064, 0.0, 1.428828552123016], [-
9.438679773327824, 0.0, -0.08109826656822744], [-8.694637414079837, 0.0, -
1.4732402393744184], [-7.693311960875005, 0.0, -2.6933119608750067], [-
6.47324023937442, 0.0, -3.694637414079835], [-5.081098266568228, 0.0, -
4.438679773327824], [-3.571171447876985, 0.0, -4.896861053150637], [-2.0, 0.0, -
5.000000000000001], [-1.6732761989014646, 0.0, -5.0], [-1.0180178450768846, 0.0, -
4.935538158219152], [-0.07431358339485825, 0.0, -4.649174858329889],
[0.7957751496090115, 0.0, -4.184148383799899], [1.55831997554688, 0.0, -
3.558319975546878], [2.1841483837998963, 0.0, -2.7957751496090113],
[2.6491748583298893, 0.0, -1.925686416605141], [2.935538158219149, 0.0, -
0.9819821549231146], [3.0, 0.0, 0.0], [3.0, 0.0, 0.19603428065912115],
[2.96132289493149, 0.0, 0.5891892929538691], [2.7895049149979334, 0.0,
1.1554118499630852], [2.5104890302799383, 0.0, 1.6774650897654066],
[2.134991985328128, 0.0, 2.1349919853281283], [1.6774650897654064, 0.0,
2.510489030279938], [1.1554118499630845, 0.0, 2.7895049149979334],
[0.5891892929538686, 0.0, 2.961322894931488]]\n\t\trectangle = [[24, 0, 105], [-65,
0, 105], [-65, 0, -39], [24, 0, -39], [24, 0, 105]]\n\t\tshapes = [spiral,
rectangle]\n\t\tfor shape in shapes:\n\t\t\tscaledShape=[]\n\t\t\tfor coords in
shape:\n\t\t\t\tif self.aspect_ratio > 1.6180339887:\n\t\t\t\t\tmultiplied =
tuple([x*self.height*0.011236 for x in coords])\n\t\t\t\telse:\n\t\t\t\t\
tmultiplied = tuple([x*self.width*0.0069444 for x in coords])\n\t\t\t\
tscaledShape.append(multiplied)\n\n\t\t\tif cmds.objExists(lineName):\n\t\t\t\
tcmds.curve(p = scaledShape, d = 1, name = rectName)\n\t\t\telse:\n\t\t\t\
tcmds.curve(p = scaledShape, d = 3, name = lineName)\n\n\t\tcmds.xform(lineName,
centerPivots = True)\n\t\tcmds.xform(rectName, centerPivots = True)\n\t\
tcmds.createNode(\"transform\", name = groupName)\n\t\tcmds.addAttr(longName
= \"position\", dataType = \"string\")\n\t\tcmds.parent(lineName, groupName)\n\t\
tcmds.parent(rectName, groupName)\n\t\tcmds.xform(groupName, centerPivots = True)\
n\t\tcmds.parentConstraint(self.camera, groupName,
name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(-90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.rotate(0, -90, 0, groupName,
relative=True, objectSpace=True)\n\t\tcmds.move(0, self.nearClipOffset, 0,
groupName, relative=True, objectSpace=True)\n\t\tif position == \"topRight\":\n\t\
t\tcmds.setAttr(groupName + \".position\", \"topRight\", type = \"string\")\n\t\
telif position == \"topLeft\":\n\t\t\tcmds.scale(1, 1, -1, groupName,
relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"topLeft\", type = \"string\")\n\t\telif position
== \"bottomRight\":\n\t\t\tcmds.scale(-1, 1, 1, groupName, relative=True,
objectSpace=True)\n\t\t\tcmds.setAttr(groupName + \".position\", \"bottomRight\",
type = \"string\")\n\t\telif position == \"bottomLeft\":\n\t\t\tcmds.scale(-1, 1, -
1, groupName,
relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"bottomLeft\", type = \"string\")\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\n\n\tdef toggleThirdsGrid(self):\n\t\
tself.cameraProperties()\n\t\tself.checkCurrentOverlay()\n\t\tgroupName =
self.camera + \"_thirds_Grid\"\n\t\tif self.currentOverlay == groupName:\n\t\t\
tcmds.delete(groupName)\n\t\telse:\n\t\t\ttry:\n\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\
tself.createThirdsGrid()\n\n\tdef toggleGoldenSprial(self, position = \"None\"):\n\
t\tself.cameraProperties()\n\t\tself.checkCurrentOverlay()\n\t\tgroupName =
self.camera + \"_goldenSpiral_GRP\"\n\t\ttry:\n\t\t\tpositionAttr = groupName
+ \".position\"\n\t\t\tpositionValue = cmds.getAttr(positionAttr)\n\n\t\t\tif
self.currentOverlay == groupName:\n\t\t\t\tif position == \"None\":\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telif position == positionValue:\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telse:\n\t\t\t\t\
tself.createGoldenSprial(position)\n\n\t\t\telse:\n\t\t\t\ttry:\n\t\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\t\texcept:\n\t\t\t\t\tpass\n\t\t\t\
tself.createGoldenSprial(position = \"topRight\")\n\t\texcept:\n\t\t\ttry:\n\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\tif position
== \"None\":\n\t\t\t\tself.createGoldenSprial(position = \"topRight\")\n\t\t\
telse:\n\t\t\t\tself.createGoldenSprial(position)\n\n\n\tdef
toggleGoldenSprialTopRight(self):\n\t\tself.toggleGoldenSprial(position
= \"topRight\")\n\n\tdef toggleGoldenSprialTopLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"topLeft\")\n\n\tdef
toggleGoldenSprialBottomRight(self):\n\t\tself.toggleGoldenSprial(position
= \"bottomRight\")\n\n\tdef toggleGoldenSprialBottomLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"bottomLeft\")\n\n\n\tdef
checkCurrentOverlay(self):\n\t\tgoldenName = self.camera + \"_goldenSpiral_GRP\"\n\
t\tgridName = self.camera + \"_thirds_Grid\"\n\t\tif cmds.objExists(goldenName):\n\
t\t\tself.currentOverlay = goldenName\n\t\telif cmds.objExists(gridName):\n\t\t\
tself.currentOverlay = gridName\n\n\t@classmethod\n\tdef active_camera(cls):\n\t\
tpanel = cmds.getPanel(withFocus=True)\n\t\tif (cmds.getPanel(typeOf=panel)
== \"modelPanel\"):\n\t\t\tcamera = cmds.modelEditor(panel, q=True, camera=True)\n\
t\telse:\n\t\t\treturn None\t\t\n\t\treturn camera\n\n\
noverlay_Function().toggleGoldenSprialBottomRight()" )
-mip 2
-mi "Bottom Left" ( "import maya.cmds as cmds\nimport math\n\nclass
overlay_Function(object):\n\tdef __init__(self):\n\t\tprint \"running overlay\"\n\
t\tself.currentOverlay = \"\"\n\n\tdef cameraQuery(self, **kwargs):\n\t\treturn
cmds.camera(self.camera, query=True, **kwargs)\n\t\n\tdef cameraProperties(self):\
n\t\tif overlay_Function.active_camera() == None:\n\t\t\traise Exception(\"No
active camera viewport\")\n\n\t\tself.camera = overlay_Function.active_camera()\n\
t\tself.near_clip = self.cameraQuery(nearClipPlane=True)\n\t\tif self.near_clip <
0.1:\n\t\t\tself.near_clip = 0.1\n\t\tself.nearClipOffset = self.near_clip +
(self.near_clip * 0.2)\t\t\t\n\t\tself.film_fit = self.cameraQuery(filmFit=True)\n\
t\tself.aspect_ratio = cmds.getAttr(\"defaultResolution.deviceAspectRatio\")\n\t\
tself.camera_aspect_ratio = self.cameraQuery(aspectRatio=True)\n\t\t\n\t\tif
self.cameraQuery(orthographic=True):\n\t\t\tself.width =
self.cameraQuery(orthographicWidth=True)\n\t\t\tself.height = self.width /
self.aspect_ratio\n\t\t\tself.label_plane_width = self.width\n\t\t\
tself.label_plane_height = self.height\t\t\t\n\t\telse:\n\t\t\tscale = 1.0\n\t\t\
tif self.film_fit == \"horizontal\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\telif
self.film_fit == \"vertical\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(verticalFieldOfView=True))\n\t\t\telif self.film_fit
== \"fill\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio > self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\n\t\t\telif self.film_fit
== \"overscan\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio < self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\t\n\n\t\t\tif self.film_fit
== \"vertical\":\n\t\t\t\tself.height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.width = self.height * self.aspect_ratio\
t\t\t\t\n\t\t\t\tself.label_plane_height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.label_plane_width =
self.label_plane_height * self.aspect_ratio\n\t\t\telse:\n\t\t\t\tself.width = 2 *
math.tan(fov * 0.5) * self.nearClipOffset * scale\n\t\t\t\tself.height = self.width
/ self.aspect_ratio\t\t\t\t\n\t\t\t\tself.label_plane_width = 2 * math.tan(fov *
0.5) * self.nearClipOffset * scale\n\t\t\t\tself.label_plane_height =
self.label_plane_width / self.aspect_ratio\n\t\t\n\tdef createThirdsGrid(self):\n\
t\tself.cameraProperties()\n\t\tgroupName = self.camera + \"_thirds_Grid\"\n\t\
tself.currentOverlay = groupName\n\t\tif cmds.objExists(groupName):
cmds.delete(groupName)\n\t\tself.plane_Name = self.camera + \"_Plane_Test_001\"\n\
t\tself.planeTopH = self.camera + \"_H_Top_Line_001\"\n\t\tself.planeBaseH =
self.camera + \"_H_Base_Line_001\"\n\t\tself.planeLeftV = self.camera
+ \"_V_Left_Line_001\"\n\t\tself.planeRightV = self.camera + \"_V_Right_Line_001\"\
n\t\tself.lines = (self.planeTopH, self.planeBaseH, self.planeLeftV,
self.planeRightV)\n\t\tcmds.createNode(\"transform\", name = groupName)\n\t\
tself.widthPixels = cmds.getAttr(\"defaultResolution.width\")\n\t\
tself.heightPixels = cmds.getAttr(\"defaultResolution.height\")\n\n\t\tfor line in
self.lines:\n\t\t\tif \"_H_\" in line:\n\t\t\t\tcmds.curve(ep=[(self.width/2, 0,
0), (-self.width/2, 0, 0)], name = line)\n\t\t\telif \"_V_\" in line:\n\t\t\t\
tcmds.curve(ep=[(0, 0, self.height/2), (0, 0, -self.height/2)], name = line)\n\t\t\
tcmds.parent(line, groupName)\n\t\t\theightSixth = self.height/6\n\t\t\twidthSixth
= self.width/6\n\t\t\tif \"_Top_Line_001\" in line: \n\t\t\t\tcmds.move(0, 0, -
heightSixth, line)\n\t\t\telif \"_Base_Line_001\" in line:\n\t\t\t\tcmds.move(0, 0,
heightSixth, line)\n\t\t\telif \"_Left_Line_001\" in line:\n\t\t\t\tcmds.move(-
widthSixth, 0, 0, line)\n\t\t\telif \"_Right_Line_001\" in line:\n\t\t\t\
tcmds.move(widthSixth, 0, 0, line)\n\n\t\tcmds.parentConstraint(self.camera,
groupName, name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.move(0, -self.nearClipOffset,
0, groupName, relative=True, objectSpace=True)\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\tdef createGoldenSprial(self, position
= \"topRight\"):\n\t\tself.cameraProperties()\n\t\tlineName = self.camera
+ \"_goldenSpiral\"\n\t\tgroupName = self.camera + \"_goldenSpiral_GRP\"\n\t\
trectName = self.camera + \"_rectGuide\"\n\t\tself.currentOverlay = groupName\n\t\
tif cmds.objExists(groupName): cmds.delete(groupName)\n\t\tspiral = [[24.0, 0.0,
105.0], [18.18431634044607, 0.0, 105.0], [6.520717642368542, 0.0,
103.85257921630085], [-10.27721821557151, 0.0, 98.75531247827209], [-
25.76479766304041, 0.0, 90.47784123163812], [-39.338095564734445, 0.0,
79.33809556473445], [-50.47784123163818, 0.0, 65.76479766304038], [-
58.75531247827203, 0.0, 50.27721821557151], [-63.85257921630085, 0.0,
33.47928235763141], [-65.0, 0.0, 16.0], [-65.0, 0.0, 12.406038187916112], [-
64.29091974041066, 0.0, 5.1981962958457295], [-61.1409234416288, 0.0, -
5.182550582656557], [-56.02563222179889, 0.0, -14.753526645699132], [-
49.141519731015684, 0.0, -23.141519731015677], [-40.75352664569914, 0.0, -
30.025632221798872], [-31.18255058265658, 0.0, -35.14092344162877], [-
20.801803704154278, 0.0, -38.29091974041066], [-10.0, 0.0, -39.0], [-
7.77827815252996, 0.0, -39.0], [-3.322521346522819, 0.0, -38.56165947589022],
[3.0946676329149643, 0.0, -36.61438903664323], [9.011271017341269, 0.0, -
33.452209009839294], [14.196575833718772, 0.0, -29.196575833718782],
[18.452209009839294, 0.0, -24.011271017341272], [21.61438903664324, 0.0, -
18.094667632914962], [23.561659475890206, 0.0, -11.677478653477182], [24.0, 0.0, -
5.0], [24.005876601429442, 0.0, -3.706886690924809], [23.777412722891853, 0.0, -
1.1132035754530578], [22.725648103755358, 0.0, 2.6428499013860374],
[21.00074561066001, 0.0, 6.142702307822074], [18.661528357191525, 0.0,
9.265192323173274], [15.787950237524708, 0.0, 11.904212983392663],
[12.477613553125305, 0.0, 13.969624931029786], [8.845207686558368, 0.0,
15.390812517336583], [5.0, 0.0, 16.0], [4.072031773535475, 0.0, 16.14455275501771],
[2.178234471274524, 0.0, 16.23193299826233], [-0.6188927288192801, 0.0,
15.747973105934456], [-3.2474216220209264, 0.0, 14.672714373118492], [-
5.582182864322244, 0.0, 13.056364843448742], [-7.513966991581316, 0.0,
10.97504171949949], [-8.95190740736182, 0.0, 8.526027051197591], [-
9.828515227699702, 0.0, 5.826083259151342], [-10.0, 0.0, 3.0], [-10.0, 0.0,
2.4772419182423433], [-9.89686105315064, 0.0, 1.428828552123016], [-
9.438679773327824, 0.0, -0.08109826656822744], [-8.694637414079837, 0.0, -
1.4732402393744184], [-7.693311960875005, 0.0, -2.6933119608750067], [-
6.47324023937442, 0.0, -3.694637414079835], [-5.081098266568228, 0.0, -
4.438679773327824], [-3.571171447876985, 0.0, -4.896861053150637], [-2.0, 0.0, -
5.000000000000001], [-1.6732761989014646, 0.0, -5.0], [-1.0180178450768846, 0.0, -
4.935538158219152], [-0.07431358339485825, 0.0, -4.649174858329889],
[0.7957751496090115, 0.0, -4.184148383799899], [1.55831997554688, 0.0, -
3.558319975546878], [2.1841483837998963, 0.0, -2.7957751496090113],
[2.6491748583298893, 0.0, -1.925686416605141], [2.935538158219149, 0.0, -
0.9819821549231146], [3.0, 0.0, 0.0], [3.0, 0.0, 0.19603428065912115],
[2.96132289493149, 0.0, 0.5891892929538691], [2.7895049149979334, 0.0,
1.1554118499630852], [2.5104890302799383, 0.0, 1.6774650897654066],
[2.134991985328128, 0.0, 2.1349919853281283], [1.6774650897654064, 0.0,
2.510489030279938], [1.1554118499630845, 0.0, 2.7895049149979334],
[0.5891892929538686, 0.0, 2.961322894931488]]\n\t\trectangle = [[24, 0, 105], [-65,
0, 105], [-65, 0, -39], [24, 0, -39], [24, 0, 105]]\n\t\tshapes = [spiral,
rectangle]\n\t\tfor shape in shapes:\n\t\t\tscaledShape=[]\n\t\t\tfor coords in
shape:\n\t\t\t\tif self.aspect_ratio > 1.6180339887:\n\t\t\t\t\tmultiplied =
tuple([x*self.height*0.011236 for x in coords])\n\t\t\t\telse:\n\t\t\t\t\
tmultiplied = tuple([x*self.width*0.0069444 for x in coords])\n\t\t\t\
tscaledShape.append(multiplied)\n\n\t\t\tif cmds.objExists(lineName):\n\t\t\t\
tcmds.curve(p = scaledShape, d = 1, name = rectName)\n\t\t\telse:\n\t\t\t\
tcmds.curve(p = scaledShape, d = 3, name = lineName)\n\n\t\tcmds.xform(lineName,
centerPivots = True)\n\t\tcmds.xform(rectName, centerPivots = True)\n\t\
tcmds.createNode(\"transform\", name = groupName)\n\t\tcmds.addAttr(longName
= \"position\", dataType = \"string\")\n\t\tcmds.parent(lineName, groupName)\n\t\
tcmds.parent(rectName, groupName)\n\t\tcmds.xform(groupName, centerPivots = True)\
n\t\tcmds.parentConstraint(self.camera, groupName,
name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(-90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.rotate(0, -90, 0, groupName,
relative=True, objectSpace=True)\n\t\tcmds.move(0, self.nearClipOffset, 0,
groupName, relative=True, objectSpace=True)\n\t\tif position == \"topRight\":\n\t\
t\tcmds.setAttr(groupName + \".position\", \"topRight\", type = \"string\")\n\t\
telif position == \"topLeft\":\n\t\t\tcmds.scale(1, 1, -1, groupName,
relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"topLeft\", type = \"string\")\n\t\telif position
== \"bottomRight\":\n\t\t\tcmds.scale(-1, 1, 1, groupName, relative=True,
objectSpace=True)\n\t\t\tcmds.setAttr(groupName + \".position\", \"bottomRight\",
type = \"string\")\n\t\telif position == \"bottomLeft\":\n\t\t\tcmds.scale(-1, 1, -
1, groupName,
relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"bottomLeft\", type = \"string\")\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\n\n\tdef toggleThirdsGrid(self):\n\t\
tself.cameraProperties()\n\t\tself.checkCurrentOverlay()\n\t\tgroupName =
self.camera + \"_thirds_Grid\"\n\t\tif self.currentOverlay == groupName:\n\t\t\
tcmds.delete(groupName)\n\t\telse:\n\t\t\ttry:\n\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\
tself.createThirdsGrid()\n\n\tdef toggleGoldenSprial(self, position = \"None\"):\n\
t\tself.cameraProperties()\n\t\tself.checkCurrentOverlay()\n\t\tgroupName =
self.camera + \"_goldenSpiral_GRP\"\n\t\ttry:\n\t\t\tpositionAttr = groupName
+ \".position\"\n\t\t\tpositionValue = cmds.getAttr(positionAttr)\n\n\t\t\tif
self.currentOverlay == groupName:\n\t\t\t\tif position == \"None\":\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telif position == positionValue:\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telse:\n\t\t\t\t\
tself.createGoldenSprial(position)\n\n\t\t\telse:\n\t\t\t\ttry:\n\t\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\t\texcept:\n\t\t\t\t\tpass\n\t\t\t\
tself.createGoldenSprial(position = \"topRight\")\n\t\texcept:\n\t\t\ttry:\n\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\tif position
== \"None\":\n\t\t\t\tself.createGoldenSprial(position = \"topRight\")\n\t\t\
telse:\n\t\t\t\tself.createGoldenSprial(position)\n\n\n\tdef
toggleGoldenSprialTopRight(self):\n\t\tself.toggleGoldenSprial(position
= \"topRight\")\n\n\tdef toggleGoldenSprialTopLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"topLeft\")\n\n\tdef
toggleGoldenSprialBottomRight(self):\n\t\tself.toggleGoldenSprial(position
= \"bottomRight\")\n\n\tdef toggleGoldenSprialBottomLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"bottomLeft\")\n\n\n\tdef
checkCurrentOverlay(self):\n\t\tgoldenName = self.camera + \"_goldenSpiral_GRP\"\n\
t\tgridName = self.camera + \"_thirds_Grid\"\n\t\tif cmds.objExists(goldenName):\n\
t\t\tself.currentOverlay = goldenName\n\t\telif cmds.objExists(gridName):\n\t\t\
tself.currentOverlay = gridName\n\n\t@classmethod\n\tdef active_camera(cls):\n\t\
tpanel = cmds.getPanel(withFocus=True)\n\t\tif (cmds.getPanel(typeOf=panel)
== \"modelPanel\"):\n\t\t\tcamera = cmds.modelEditor(panel, q=True, camera=True)\n\
t\telse:\n\t\t\treturn None\t\t\n\t\treturn camera\n\
noverlay_Function().toggleGoldenSprialBottomLeft()" )
-mip 3
;
shelfButton
-enableCommandRepeat 1
-enable 1
-width 35
-height 35
-manage 1
-visible 1
-preventOverride 0
-annotation "Create Rue of Thirds for camera"
-enableBackground 0
-align "center"
-label "Thirds"
-labelOffset 0
-font "plainLabelFont"
-imageOverlayLabel "Thirds"
-overlayLabelColor 0.8 0.8 0.8
-overlayLabelBackColor 0 0 0 0.7
-image "defaultThreeStackedLayout.png"
-image1 "defaultThreeStackedLayout.png"
-style "iconOnly"
-marginWidth 1
-marginHeight 1
-command "\"\"\"PJC - Camera Overlay for Maya 2015\n\
n#====================================================\n#\tPJC - Camera Overlay for
Maya 2015\n#\n#\tThis allows users to create a Golden Spiral or\n#\tRule of Thirds
overlay for thier viewport within\n#\tMaya 2015.\n#\n#\tVersion 0.4\n#\
n#====================================================\n\"\"\"\n__author__
= \"PeJayCee\"\n__version__ = \"0.4\"\n\
n#====================================================\n#\tImports\
n#====================================================\n\nimport maya.cmds as cmds\
nimport math\n\n#====================================================\n#\tClass for
creating Camera Overlays\n#====================================================\n\
nclass Overlay_Function(object):\n\tdef __init__(self):\n\t\tprint \"running
overlay\"\n\t\tself.currentOverlay = \"\"\n\n\
t#====================================================\n\t#\tMethod for getting
camera data\n\t#====================================================\n\n\tdef
cameraQuery(self, **kwargs):\n\t\treturn cmds.camera(self.camera, query=True,
**kwargs)\n\n\t#====================================================\n\t#\tMethod
for defining camera properties\n\
t#====================================================\n\t\n\tdef
cameraProperties(self): ###Code from Chris Zurbrigg (http://zurbrigg.com), Shot
Mask\n\t\tself.camera = Overlay_Function.active_camera()\n\t\tself.near_clip =
self.cameraQuery(nearClipPlane=True)\n\t\tif self.near_clip < 0.1:\n\t\t\
tself.near_clip = 0.1\n\t\tself.nearClipOffset = self.near_clip + (self.near_clip *
0.2)###Mulitpled by 0.2 as that worked with orthogrphic cameras\t\t\n\t\
tself.film_fit = self.cameraQuery(filmFit=True)\n\t\tself.aspect_ratio =
cmds.getAttr(\"defaultResolution.deviceAspectRatio\")\n\t\tself.camera_aspect_ratio
= self.cameraQuery(aspectRatio=True)\n\t\t\n\t\tif
self.cameraQuery(orthographic=True):\n\t\t\tself.width =
self.cameraQuery(orthographicWidth=True)\n\t\t\tself.height = self.width /
self.aspect_ratio\n\t\t\tself.label_plane_width = self.width\n\t\t\
tself.label_plane_height = self.height\t\t\t\n\t\telse:\n\t\t\tscale = 1.0\n\t\t\
tif self.film_fit == \"horizontal\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\telif
self.film_fit == \"vertical\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(verticalFieldOfView=True))\n\t\t\telif self.film_fit
== \"fill\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio > self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\n\t\t\telif self.film_fit
== \"overscan\":\n\t\t\t\tfov =
math.radians(self.cameraQuery(horizontalFieldOfView=True))\n\t\t\t\tif
self.camera_aspect_ratio < self.aspect_ratio:\n\t\t\t\t\tscale =
self.aspect_ratio / self.camera_aspect_ratio\t\n\n\t\t\tif self.film_fit
== \"vertical\":\n\t\t\t\tself.height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.width = self.height * self.aspect_ratio\
t\t\t\t\n\t\t\t\tself.label_plane_height = 2 * math.tan(fov * 0.5) *
self.nearClipOffset * scale\n\t\t\t\tself.label_plane_width =
self.label_plane_height * self.aspect_ratio\n\t\t\telse:\n\t\t\t\tself.width = 2 *
math.tan(fov * 0.5) * self.nearClipOffset * scale\n\t\t\t\tself.height = self.width
/ self.aspect_ratio\t\t\t\t\n\t\t\t\tself.label_plane_width = 2 * math.tan(fov *
0.5) * self.nearClipOffset * scale\n\t\t\t\tself.label_plane_height =
self.label_plane_width / self.aspect_ratio\n\n\
t#====================================================\n\t#\tMethod for creating
Rule of Thirds Grid\n\t#====================================================\n\t\t\
n\tdef createThirdsGrid(self):\n\t\tself.cameraProperties()\n\t\tgroupName =
self.camera + \"_thirds_Grid\" ###Names based on cameras so each camera cna have
its own overlay\n\t\tself.currentOverlay = groupName\n\t\tif
cmds.objExists(groupName): cmds.delete(groupName)\n\t\tself.plane_Name =
self.camera + \"_Plane_Test_001\"\n\t\tself.planeTopH = self.camera
+ \"_H_Top_Line_001\"\n\t\tself.planeBaseH = self.camera + \"_H_Base_Line_001\"\n\
t\tself.planeLeftV = self.camera + \"_V_Left_Line_001\"\n\t\tself.planeRightV =
self.camera + \"_V_Right_Line_001\"\n\t\tself.lines = (self.planeTopH,
self.planeBaseH, self.planeLeftV, self.planeRightV)\n\t\
tcmds.createNode(\"transform\", name = groupName)\n\t\tself.widthPixels =
cmds.getAttr(\"defaultResolution.width\")\n\t\tself.heightPixels =
cmds.getAttr(\"defaultResolution.height\")\n\n\t\tfor line in self.lines:\n\t\t\tif
\"_H_\" in line:\n\t\t\t\tcmds.curve(ep=[(self.width/2, 0, 0), (-self.width/2, 0,
0)], name = line)\n\t\t\telif \"_V_\" in line:\n\t\t\t\tcmds.curve(ep=[(0, 0,
self.height/2), (0, 0, -self.height/2)], name = line)\n\t\t\tcmds.parent(line,
groupName)\n\t\t\theightSixth = self.height/6\n\t\t\twidthSixth = self.width/6\n\t\
t\tif \"_Top_Line_001\" in line: \n\t\t\t\tcmds.move(0, 0, -heightSixth, line)\n\t\
t\telif \"_Base_Line_001\" in line:\n\t\t\t\tcmds.move(0, 0, heightSixth, line)\n\
t\t\telif \"_Left_Line_001\" in line:\n\t\t\t\tcmds.move(-widthSixth, 0, 0, line)\
n\t\t\telif \"_Right_Line_001\" in line:\n\t\t\t\tcmds.move(widthSixth, 0, 0,
line)\n\n\t\tcmds.parentConstraint(self.camera, groupName,
name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.move(0, -self.nearClipOffset,
0, groupName, relative=True, objectSpace=True)\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\
t#====================================================\n\t#\tMethod for creating
Golden Spiral\n\t#====================================================\t\n\n\tdef
createGoldenSprial(self, position = \"topRight\"):\n\t\t###Technocally it's the
fibonacci spiral, but it makes little difference \n\t\tself.cameraProperties()\n\t\
tlineName = self.camera + \"_goldenSpiral\"\n\t\tgroupName = self.camera
+ \"_goldenSpiral_GRP\"\n\t\trectName = self.camera + \"_rectGuide\"\n\t\
tself.currentOverlay = groupName\n\t\tif cmds.objExists(groupName):
cmds.delete(groupName)\n\t\tspiral = [[24.0, 0.0, 105.0], [18.18431634044607, 0.0,
105.0], [6.520717642368542, 0.0, 103.85257921630085], [-10.27721821557151, 0.0,
98.75531247827209], [-25.76479766304041, 0.0, 90.47784123163812], [-
39.338095564734445, 0.0, 79.33809556473445], [-50.47784123163818, 0.0,
65.76479766304038], [-58.75531247827203, 0.0, 50.27721821557151], [-
63.85257921630085, 0.0, 33.47928235763141], [-65.0, 0.0, 16.0], [-65.0, 0.0,
12.406038187916112], [-64.29091974041066, 0.0, 5.1981962958457295], [-
61.1409234416288, 0.0, -5.182550582656557], [-56.02563222179889, 0.0, -
14.753526645699132], [-49.141519731015684, 0.0, -23.141519731015677], [-
40.75352664569914, 0.0, -30.025632221798872], [-31.18255058265658, 0.0, -
35.14092344162877], [-20.801803704154278, 0.0, -38.29091974041066], [-10.0, 0.0, -
39.0], [-7.77827815252996, 0.0, -39.0], [-3.322521346522819, 0.0, -
38.56165947589022], [3.0946676329149643, 0.0, -36.61438903664323],
[9.011271017341269, 0.0, -33.452209009839294], [14.196575833718772, 0.0, -
29.196575833718782], [18.452209009839294, 0.0, -24.011271017341272],
[21.61438903664324, 0.0, -18.094667632914962], [23.561659475890206, 0.0, -
11.677478653477182], [24.0, 0.0, -5.0], [24.005876601429442, 0.0, -
3.706886690924809], [23.777412722891853, 0.0, -1.1132035754530578],
[22.725648103755358, 0.0, 2.6428499013860374], [21.00074561066001, 0.0,
6.142702307822074], [18.661528357191525, 0.0, 9.265192323173274],
[15.787950237524708, 0.0, 11.904212983392663], [12.477613553125305, 0.0,
13.969624931029786], [8.845207686558368, 0.0, 15.390812517336583], [5.0, 0.0,
16.0], [4.072031773535475, 0.0, 16.14455275501771], [2.178234471274524, 0.0,
16.23193299826233], [-0.6188927288192801, 0.0, 15.747973105934456], [-
3.2474216220209264, 0.0, 14.672714373118492], [-5.582182864322244, 0.0,
13.056364843448742], [-7.513966991581316, 0.0, 10.97504171949949], [-
8.95190740736182, 0.0, 8.526027051197591], [-9.828515227699702, 0.0,
5.826083259151342], [-10.0, 0.0, 3.0], [-10.0, 0.0, 2.4772419182423433], [-
9.89686105315064, 0.0, 1.428828552123016], [-9.438679773327824, 0.0, -
0.08109826656822744], [-8.694637414079837, 0.0, -1.4732402393744184], [-
7.693311960875005, 0.0, -2.6933119608750067], [-6.47324023937442, 0.0, -
3.694637414079835], [-5.081098266568228, 0.0, -4.438679773327824], [-
3.571171447876985, 0.0, -4.896861053150637], [-2.0, 0.0, -5.000000000000001], [-
1.6732761989014646, 0.0, -5.0], [-1.0180178450768846, 0.0, -4.935538158219152], [-
0.07431358339485825, 0.0, -4.649174858329889], [0.7957751496090115, 0.0, -
4.184148383799899], [1.55831997554688, 0.0, -3.558319975546878],
[2.1841483837998963, 0.0, -2.7957751496090113], [2.6491748583298893, 0.0, -
1.925686416605141], [2.935538158219149, 0.0, -0.9819821549231146], [3.0, 0.0, 0.0],
[3.0, 0.0, 0.19603428065912115], [2.96132289493149, 0.0, 0.5891892929538691],
[2.7895049149979334, 0.0, 1.1554118499630852], [2.5104890302799383, 0.0,
1.6774650897654066], [2.134991985328128, 0.0, 2.1349919853281283],
[1.6774650897654064, 0.0, 2.510489030279938], [1.1554118499630845, 0.0,
2.7895049149979334], [0.5891892929538686, 0.0, 2.961322894931488]]\n\t\trectangle =
[[24, 0, 105], [-65, 0, 105], [-65, 0, -39], [24, 0, -39], [24, 0, 105]]\n\t\
tshapes = [spiral, rectangle]\n\t\tfor shape in shapes:\n\t\t\tscaledShape=[]\n\t\
t\tfor coords in shape:\n\t\t\t\tif self.aspect_ratio > 1.6180339887:###If greater
than golden Ratio\n\t\t\t\t\tmultiplied = tuple([x*self.height*0.011236 for x in
coords]) ###Then match to height\n\t\t\t\telse:\n\t\t\t\t\tmultiplied =
tuple([x*self.width*0.0069444 for x
in coords]) ###Else match to width\n\t\t\t\tscaledShape.append(multiplied)\n\n\t\
t\tif cmds.objExists(lineName):\n\t\t\t\tcmds.curve(p = scaledShape, d = 1, name =
rectName)\n\t\t\telse:\n\t\t\t\tcmds.curve(p = scaledShape, d = 3, name =
lineName)\n\n\t\tcmds.xform(lineName, centerPivots = True)\n\t\
tcmds.xform(rectName, centerPivots = True)\n\t\tcmds.createNode(\"transform\", name
= groupName)\n\t\tcmds.addAttr(longName = \"position\", dataType = \"string\")\n\t\
tcmds.parent(lineName, groupName)\n\t\tcmds.parent(rectName, groupName)\n\t\
tcmds.xform(groupName, centerPivots = True)\n\t\tcmds.parentConstraint(self.camera,
groupName, name=\"positionMatch_parentConstraint\")\n\t\
tcmds.delete(\"positionMatch_parentConstraint\")\n\t\tcmds.rotate(-90, 0, 0,
groupName, relative=True, objectSpace=True)\n\t\tcmds.rotate(0, -90, 0, groupName,
relative=True, objectSpace=True)\n\t\tcmds.move(0, self.nearClipOffset, 0,
groupName, relative=True, objectSpace=True)\n\n\t\tif position == \"topRight\":\n\
t\t\tcmds.setAttr(groupName + \".position\", \"topRight\", type = \"string\")\n\t\
telif position == \"topLeft\":\n\t\t\tcmds.scale(1, 1, -1, groupName,
relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"topLeft\", type = \"string\")\n\t\telif position
== \"bottomRight\":\n\t\t\tcmds.scale(-1, 1, 1, groupName, relative=True,
objectSpace=True)\n\t\t\tcmds.setAttr(groupName + \".position\", \"bottomRight\",
type = \"string\")\n\t\telif position == \"bottomLeft\":\n\t\t\tcmds.scale(-1, 1, -
1, groupName, relative=True, objectSpace=True)\n\t\t\tcmds.setAttr(groupName
+ \".position\", \"bottomLeft\", type = \"string\")\n\t\
tcmds.parentConstraint(self.camera, groupName, maintainOffset=True)\n\t\
tcmds.setAttr(groupName + \".overrideEnabled\", 1)\n\t\tcmds.setAttr(groupName
+ \".overrideDisplayType\", 2)\n\t\tcmds.setAttr(groupName + \".hiddenInOutliner\",
True)\n\t\tcmds.select(clear=True)\n\n\
t#====================================================\n\t#\tMethod for Toggling
Rule of Thirds Grid\n\t#====================================================\t\n\n\
tdef toggleThirdsGrid(self):\n\t\tif Overlay_Function.active_camera() == None:\n\t\
t\traise Exception(\"No active camera viewport\")\n\t\
tcmds.undoInfo(stateWithoutFlush = False)\n\t\tself.cameraProperties()\n\t\
tself.checkCurrentOverlay()\n\t\tgroupName = self.camera + \"_thirds_Grid\"\n\t\tif
self.currentOverlay == groupName:\n\t\t\tcmds.delete(groupName)\n\t\telse:\n\t\t\
ttry:\n\t\t\t\tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\
tself.createThirdsGrid()\n\t\tcmds.undoInfo(stateWithoutFlush = True)\n\n\
t#====================================================\n\t#\tMethods for Toggling
Golden Spiral\n\t#====================================================\t\n\n\tdef
toggleGoldenSprial(self, position = \"None\"):\n\t\tif
Overlay_Function.active_camera() == None:\n\t\t\traise Exception(\"No active camera
viewport\")\n\t\tcmds.undoInfo(stateWithoutFlush = False)\n\t\
tself.cameraProperties()\n\t\tself.checkCurrentOverlay()\n\t\tgroupName =
self.camera + \"_goldenSpiral_GRP\"\n\t\ttry:\n\t\t\tpositionAttr = groupName
+ \".position\"\n\t\t\tpositionValue = cmds.getAttr(positionAttr)\n\n\t\t\tif
self.currentOverlay == groupName:\n\t\t\t\tif position == \"None\":\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telif position == positionValue:\n\t\t\t\t\
tcmds.delete(groupName)\n\t\t\t\telse:\n\t\t\t\t\
tself.createGoldenSprial(position)\n\n\t\t\telse:\n\t\t\t\ttry:\n\t\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\t\texcept:\n\t\t\t\t\tpass\n\t\t\t\
tself.createGoldenSprial(position = \"topRight\")\n\t\texcept:\n\t\t\ttry:\n\t\t\t\
tcmds.delete(self.currentOverlay)\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\tif position
== \"None\":\n\t\t\t\tself.createGoldenSprial(position = \"topRight\")\n\t\t\
telse:\n\t\t\t\tself.createGoldenSprial(position)\n\t\
tcmds.undoInfo(stateWithoutFlush = True)\n\n\n\tdef
toggleGoldenSprialTopRight(self):\n\t\tself.toggleGoldenSprial(position
= \"topRight\")\n\n\tdef toggleGoldenSprialTopLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"topLeft\")\n\n\tdef
toggleGoldenSprialBottomRight(self):\n\t\tself.toggleGoldenSprial(position
= \"bottomRight\")\n\n\tdef toggleGoldenSprialBottomLeft(self):\n\t\
tself.toggleGoldenSprial(position = \"bottomLeft\")\n\n\n\
t#====================================================\n\t#\tMethod for Checking
for existing Overlays\n\t#====================================================\t\n\
n\n\tdef checkCurrentOverlay(self):\n\t\t###Provided the names haven't been
changed\n\t\tgoldenName = self.camera + \"_goldenSpiral_GRP\"\n\t\tgridName =
self.camera + \"_thirds_Grid\"\n\t\tif cmds.objExists(goldenName):\n\t\t\
tself.currentOverlay = goldenName\n\t\telif cmds.objExists(gridName):\n\t\t\
tself.currentOverlay = gridName\n\n\t@classmethod\n\tdef active_camera(cls):\n\t\
tpanel = cmds.getPanel(withFocus=True)\n\t\tif (cmds.getPanel(typeOf=panel)
== \"modelPanel\"):\n\t\t\tcamera = cmds.modelEditor(panel, q=True, camera=True)\n\
t\telse:\n\t\t\treturn None\t\t\n\t\treturn camera\n\
n#====================================================\n#\tFunction for Toggelling
Camera Overlay\n#====================================================\n\
nOverlay_Function().toggleThirdsGrid()\n"
-sourceType "python"
-commandRepeatable 1
-flat 1
;

You might also like