{"id":207,"date":"2014-09-03T10:08:00","date_gmt":"2014-09-03T00:08:00","guid":{"rendered":"http:\/\/alrichardson.com\/?p=207"},"modified":"2014-09-03T10:08:36","modified_gmt":"2014-09-03T00:08:36","slug":"set-project-button","status":"publish","type":"post","link":"https:\/\/alrichardson.com\/?p=207","title":{"rendered":"Set project button!"},"content":{"rendered":"<p>Nice little tool which looks for you &#8216;scenes&#8217; folder and sets the project to that location: <\/p>\n<pre class=\"lang:python decode:true \" >\r\n\r\nimport maya.cmds as cmds\r\nimport maya.mel as mel\r\nimport maya.OpenMaya as om\r\n \r\ndef setProj():\r\n    # find directory\r\n    currentDir = cmds.file( query = True, location = True )\r\n    # dicect directory and set project\r\n    try:\r\n        projectDir,garbage = currentDir.split( 'scenes' )\r\n    except:\r\n        return om.MGlobal.displayError( 'You need to have you file in a project folder structurte first' )\r\n    mel.eval( 'setProject ' + '\"' + projectDir + '\"' )\r\n    om.MGlobal.displayInfo( 'current project set to : ' + projectDir )\r\n    del projectDir\r\n    del garbage\r\nsetProj()<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Nice little tool which looks for you &#8216;scenes&#8217; folder and sets the project to that location: import maya.cmds as cmds import maya.mel as mel import maya.OpenMaya as om def setProj(): # find directory currentDir = cmds.file( query = True, location = True ) # dicect directory and set project try: projectDir,garbage = currentDir.split( &#8216;scenes&#8217; ) [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5,7],"tags":[],"class_list":["post-207","post","type-post","status-publish","format-standard","hentry","category-maya","category-python","category-tools"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/alrichardson.com\/index.php?rest_route=\/wp\/v2\/posts\/207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alrichardson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alrichardson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alrichardson.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alrichardson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=207"}],"version-history":[{"count":2,"href":"https:\/\/alrichardson.com\/index.php?rest_route=\/wp\/v2\/posts\/207\/revisions"}],"predecessor-version":[{"id":209,"href":"https:\/\/alrichardson.com\/index.php?rest_route=\/wp\/v2\/posts\/207\/revisions\/209"}],"wp:attachment":[{"href":"https:\/\/alrichardson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alrichardson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alrichardson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}