{"id":574,"date":"2011-10-05T10:26:41","date_gmt":"2011-10-05T10:26:41","guid":{"rendered":"http:\/\/www.kurianos.com\/wordpress\/?p=574"},"modified":"2011-10-05T10:26:41","modified_gmt":"2011-10-05T10:26:41","slug":"nuke-node-type-finder","status":"publish","type":"post","link":"https:\/\/www.kurianos.com\/wordpress\/?p=574","title":{"rendered":"Nuke Node Type Finder"},"content":{"rendered":"<p>A small helper function for finding the node type from tne nuke<\/p>\n<p>[Python]<br \/>\nimport nuke<\/p>\n<p>#~ node type finding small function<br \/>\ndef find_node_type(nodeList):<\/p>\n<p>\t&#8220;&#8221;&#8221;<br \/>\n\tSmall helper function for find the node type from nuke.<\/p>\n<p>\t:param nodeList: This should be a list<\/p>\n<p>\t:type nodeList: list<\/p>\n<p>\t:return: nodes and node type<\/p>\n<p>\t:rtype: dict<\/p>\n<p>\tExample<\/p>\n<p>\t\t>>> import find_node_type as fns<br \/>\n\t\t>>> node_to_find = [&#8220;roto_a&#8221;,&#8221;write_b&#8221;,&#8221;shuffle_mode&#8221;]<br \/>\n\t\t>>> node_found = fns.find_node_type(node_to_find)<br \/>\n\t\t>>> print node_found<br \/>\n\t\t>>> {&#8216;Roto&#8217;: [&#8216;roto_a&#8217;], &#8216;Write&#8217;: [&#8216;write_b&#8217;], &#8216;Shuffle&#8217;:[&#8216;shuffle_mode&#8217;]}<\/p>\n<p>\t&#8220;&#8221;&#8221;<\/p>\n<p>\t#~ return var and this is dict type<br \/>\n\tfound_nodes = {}<\/p>\n<p>\t#~ getting all available nodes from the nuke scene file<br \/>\n\tget_nuke_node_list = nuke.root().nodes()<\/p>\n<p>\t#~ looping throuh the list provided by user<br \/>\n\tfor each_node in nodeList:<\/p>\n<p>\t\t#~ loop throuh the nodes we found in the nuke scene file<br \/>\n\t\tfor each_nd in get_nuke_node_list:<\/p>\n<p>\t\t\t#~ getting node class type from node<br \/>\n\t\t\tnode_class = each_nd.Class()<br \/>\n\t\t\tif each_nd.name().find(each_node) != -1:<\/p>\n<p>\t\t\t\t#~ if the node is there in the dict then add to the list<br \/>\n\t\t\t\t#~ or create the key and add value<br \/>\n\t\t\t\tif found_nodes.has_key(node_class):<br \/>\n\t\t\t\t\tfound_nodes[node_class].append(each_nd.name())<br \/>\n\t\t\t\telse:<br \/>\n\t\t\t\t\tfound_nodes[node_class]=[]<br \/>\n\t\t\t\t\tfound_nodes[node_class].append(each_nd.name())<\/p>\n<p>\t#~ return what we found from the scene<br \/>\n\treturn(found_nodes)<\/p>\n<p>[\/Python]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A small helper function for finding the node type from tne nuke [Python] import nuke #~ node type finding small function def find_node_type(nodeList): &#8220;&#8221;&#8221; Small helper function for find the node type from nuke. :param nodeList: This should be a list :type nodeList: list :return: nodes and node type :rtype: dict Example >>> import find_node_type [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[15,23],"tags":[],"class_list":["post-574","post","type-post","status-publish","format-standard","hentry","category-linux","category-nuke"],"_links":{"self":[{"href":"https:\/\/www.kurianos.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kurianos.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kurianos.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kurianos.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kurianos.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=574"}],"version-history":[{"count":1,"href":"https:\/\/www.kurianos.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/574\/revisions"}],"predecessor-version":[{"id":575,"href":"https:\/\/www.kurianos.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/574\/revisions\/575"}],"wp:attachment":[{"href":"https:\/\/www.kurianos.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kurianos.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kurianos.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}