{"id":214,"date":"2016-08-09T20:37:19","date_gmt":"2016-08-09T10:37:19","guid":{"rendered":"http:\/\/alrichardson.com\/?p=214"},"modified":"2016-08-09T20:38:56","modified_gmt":"2016-08-09T10:38:56","slug":"removing-unknown-nodes-from-your-scene","status":"publish","type":"post","link":"https:\/\/alrichardson.com\/?p=214","title":{"rendered":"Removing unknown nodes from your scene"},"content":{"rendered":"<p>I&#8217;ve recently found myself working in files with which<br \/>\na co-worker has used a plugin which I don&#8217;t have.<br \/>\nSaid plugin has created nodes which my version of Maya<br \/>\ndoes not recognize, so on load I get the classic error raised :<\/p>\n<p><a href=\"https:\/\/alrichardson.com\/wp-content\/uploads\/2016\/08\/errors.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/alrichardson.com\/wp-content\/uploads\/2016\/08\/errors-300x97.png\" alt=\"errors\" width=\"300\" height=\"97\" class=\"alignnone size-medium wp-image-215\" srcset=\"https:\/\/alrichardson.com\/wp-content\/uploads\/2016\/08\/errors-300x97.png 300w, https:\/\/alrichardson.com\/wp-content\/uploads\/2016\/08\/errors.png 448w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Through dealing with this I&#8217;ve developed a solution:<br \/>\nFind and delete said nodes!&#8230;.. Brutal.<\/p>\n<p>Now we can find these nodes using<\/p>\n<pre class=\"lang:python decode:true \" >import maya.cmds as cmds\r\nunknownNodes = cmds.ls(type = 'unknown')\r\nprint unknownNodes <\/pre>\n<p>But if we try to delete them we get an error &#8220;#Error: Node is locked and cannot be deleted.&#8221;<\/p>\n<p>so we need to unlock them with:<\/p>\n<pre class=\"lang:python decode:true \" >\r\nfor node in unknownNodes:\r\n    cmds.lockNode(node, lock = False)\r\n<\/pre>\n<p>then we can delete them with:<\/p>\n<pre class=\"lang:python decode:true \" >\r\nfor node in unknownNodes:\r\n    cmds.delete(node)\r\n<\/pre>\n<p>No bringing it all together in one script:<\/p>\n<pre class=\"lang:python decode:true \" >import maya.cmds as cmds\r\nunknownNodes = cmds.ls(type = 'unknown')\r\nfor node in unknownNodes:\r\n    print 'deleting: ' + node\r\n    cmds.lockNode(node, lock = False)\r\n    cmds.delete(node)\r\n<\/pre>\n<p>And there you have it! No longer shall you be plagued by errors on boot up :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve recently found myself working in files with which a co-worker has used a plugin which I don&#8217;t have. Said plugin has created nodes which my version of Maya does not recognize, so on load I get the classic error raised : Through dealing with this I&#8217;ve developed a solution: Find and delete said nodes!&#8230;.. [&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],"tags":[],"class_list":["post-214","post","type-post","status-publish","format-standard","hentry","category-maya"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/alrichardson.com\/index.php?rest_route=\/wp\/v2\/posts\/214","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=214"}],"version-history":[{"count":2,"href":"https:\/\/alrichardson.com\/index.php?rest_route=\/wp\/v2\/posts\/214\/revisions"}],"predecessor-version":[{"id":217,"href":"https:\/\/alrichardson.com\/index.php?rest_route=\/wp\/v2\/posts\/214\/revisions\/217"}],"wp:attachment":[{"href":"https:\/\/alrichardson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alrichardson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alrichardson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}