{"id":15988,"date":"2021-10-11T13:57:53","date_gmt":"2021-10-11T11:57:53","guid":{"rendered":"https:\/\/manual.keyshot.com\/keyshot11\/?post_type=manual_documentation&#038;p=15988"},"modified":"2022-02-10T11:34:04","modified_gmt":"2022-02-10T10:34:04","slug":"scripting-accessing-scene-nodes","status":"publish","type":"manual_documentation","link":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-accessing-scene-nodes\/","title":{"rendered":"Scripting: Accessing scene nodes"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"accessing-scene-nodes-gui-and-headless\">Accessing scene nodes <sup>(GUI and Headless)<\/sup><\/h2>\n\n\n\n<p>The elements of the scene can be accessed via <em>lux.getSceneTree()<\/em> with each scene tree node being of the type <em>lux.SceneNode<\/em>. It is useful because for each node you can hide\/show, lock\/unlock, select\/deselect, change material, apply transformations, duplicate, move and more. Try <em>help(lux.SceneNode)<\/em> for more information.<\/p>\n\n\n\n<p>Let&#8217;s say you wanted to hide all nodes having &#8220;Cord&#8221; as part of their name:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">&gt;&gt;&gt; root = lux.getSceneTree()\n&gt;&gt;&gt; for node in root.find(name = \"Cord\"):\n        node.hide()<\/code><\/pre>\n\n\n\n<p>Another example could be that you wanted to access all groups called &#8220;Padding&#8221; and selecting all child nodes (in the scene with outline) whose name is &#8220;Ear Pad&#8221;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">&gt;&gt;&gt; for node in root.find(name = \"Padding\", types = lux.NODE_TYPE_GROUP):\n        for ch in node.getChildren():\n            if ch.getName() == \"Ear Pad\":\n                ch.select()<\/code><\/pre>\n\n\n\n<p>If you have hidden some parts and want to simply show everything again:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">&gt;&gt;&gt; root.show()<\/code><\/pre>\n\n\n\n<div class=\"wp-block-genesis-blocks-gb-columns gb-layout-columns-1 one-column\"><div class=\"gb-layout-column-wrap gb-block-layout-column-gap-2 gb-is-responsive-column\">\n<div class=\"wp-block-genesis-blocks-gb-column info-box gb-block-layout-column\"><div class=\"gb-block-layout-column-inner\">\n<h6 class=\"wp-block-heading\" id=\"note\">Note<\/h6>\n\n\n\n<p>The root node itself is a lux.SceneNode so the same functions can be invoked on it as with child nodes.<\/p>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p>It is also possible to change materials. To simulate ambient occlusion you could do the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">&gt;&gt;&gt; for node in root.find(\"\"):\n        node.setMaterial(\"Matte White\")<\/code><\/pre>\n\n\n\n<div class=\"wp-block-genesis-blocks-gb-columns gb-layout-columns-1 one-column\"><div class=\"gb-layout-column-wrap gb-block-layout-column-gap-2 gb-is-responsive-column\">\n<div class=\"wp-block-genesis-blocks-gb-column tip-box gb-block-layout-column\"><div class=\"gb-block-layout-column-inner\">\n<h6 class=\"wp-block-heading\" id=\"tip\">Tip<\/h6>\n\n\n\n<p> Use lux.SceneNode.find(&#8220;&#8221;) to simply find everything. <\/p>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p>Nodes can be moved to other groups, just like in the scene tree with drag-and-drop. In the following we find the group &#8220;Headphone #1&#8221; and move all nodes to it that are using a material with &#8220;Padding&#8221; in it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">&gt;&gt;&gt; grp = root.find(name = \"Headphone #1\")[0] # Take first node of set.\n&gt;&gt;&gt; for node in root.find(mat = \"Padding\"):\n        node.moveToGroup(grp)\nTrue<\/code><\/pre>\n","protected":false},"author":29916,"featured_media":0,"parent":15964,"menu_order":35,"template":"","manualdocumentationcategory":[13],"manual_doc_tag":[],"class_list":["post-15988","manual_documentation","type-manual_documentation","status-publish","hentry","manualdocumentationcategory-keyshot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Scripting: Accessing scene nodes - KeyShot 11 Manual<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-accessing-scene-nodes\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Scripting: Accessing scene nodes - KeyShot 11 Manual\" \/>\n<meta property=\"og:description\" content=\"Accessing scene nodes (GUI and Headless) The elements of the scene can be accessed via lux.getSceneTree() with each scene tree node being of the type lux.SceneNode. It is useful because for each node you can hide\/show, lock\/unlock, select\/deselect, change material, apply transformations, duplicate, move and more. Try help(lux.SceneNode) for more information. Let&#8217;s say you wanted [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-accessing-scene-nodes\/\" \/>\n<meta property=\"og:site_name\" content=\"KeyShot 11 Manual\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-10T10:34:04+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/manual\\\/scripting\\\/quick-start-scripting\\\/scripting-accessing-scene-nodes\\\/\",\"url\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/manual\\\/scripting\\\/quick-start-scripting\\\/scripting-accessing-scene-nodes\\\/\",\"name\":\"Scripting: Accessing scene nodes - KeyShot 11 Manual\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/#website\"},\"datePublished\":\"2021-10-11T11:57:53+00:00\",\"dateModified\":\"2022-02-10T10:34:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/manual\\\/scripting\\\/quick-start-scripting\\\/scripting-accessing-scene-nodes\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/manual\\\/scripting\\\/quick-start-scripting\\\/scripting-accessing-scene-nodes\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/manual\\\/scripting\\\/quick-start-scripting\\\/scripting-accessing-scene-nodes\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Scripting\",\"item\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/manual\\\/scripting\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Quick Start Scripting\",\"item\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/manual\\\/scripting\\\/quick-start-scripting\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Scripting: Accessing scene nodes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/#website\",\"url\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/\",\"name\":\"KeyShot 11 Manual\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Scripting: Accessing scene nodes - KeyShot 11 Manual","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-accessing-scene-nodes\/","og_locale":"en_US","og_type":"article","og_title":"Scripting: Accessing scene nodes - KeyShot 11 Manual","og_description":"Accessing scene nodes (GUI and Headless) The elements of the scene can be accessed via lux.getSceneTree() with each scene tree node being of the type lux.SceneNode. It is useful because for each node you can hide\/show, lock\/unlock, select\/deselect, change material, apply transformations, duplicate, move and more. Try help(lux.SceneNode) for more information. Let&#8217;s say you wanted [&hellip;]","og_url":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-accessing-scene-nodes\/","og_site_name":"KeyShot 11 Manual","article_modified_time":"2022-02-10T10:34:04+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-accessing-scene-nodes\/","url":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-accessing-scene-nodes\/","name":"Scripting: Accessing scene nodes - KeyShot 11 Manual","isPartOf":{"@id":"https:\/\/manual.keyshot.com\/keyshot11\/#website"},"datePublished":"2021-10-11T11:57:53+00:00","dateModified":"2022-02-10T10:34:04+00:00","breadcrumb":{"@id":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-accessing-scene-nodes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-accessing-scene-nodes\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-accessing-scene-nodes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/manual.keyshot.com\/keyshot11\/"},{"@type":"ListItem","position":2,"name":"Scripting","item":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/"},{"@type":"ListItem","position":3,"name":"Quick Start Scripting","item":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/"},{"@type":"ListItem","position":4,"name":"Scripting: Accessing scene nodes"}]},{"@type":"WebSite","@id":"https:\/\/manual.keyshot.com\/keyshot11\/#website","url":"https:\/\/manual.keyshot.com\/keyshot11\/","name":"KeyShot 11 Manual","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/manual.keyshot.com\/keyshot11\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/manual.keyshot.com\/keyshot11\/wp-json\/wp\/v2\/manual_documentation\/15988","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/manual.keyshot.com\/keyshot11\/wp-json\/wp\/v2\/manual_documentation"}],"about":[{"href":"https:\/\/manual.keyshot.com\/keyshot11\/wp-json\/wp\/v2\/types\/manual_documentation"}],"author":[{"embeddable":true,"href":"https:\/\/manual.keyshot.com\/keyshot11\/wp-json\/wp\/v2\/users\/29916"}],"version-history":[{"count":0,"href":"https:\/\/manual.keyshot.com\/keyshot11\/wp-json\/wp\/v2\/manual_documentation\/15988\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/manual.keyshot.com\/keyshot11\/wp-json\/wp\/v2\/manual_documentation\/15964"}],"wp:attachment":[{"href":"https:\/\/manual.keyshot.com\/keyshot11\/wp-json\/wp\/v2\/media?parent=15988"}],"wp:term":[{"taxonomy":"manualdocumentationcategory","embeddable":true,"href":"https:\/\/manual.keyshot.com\/keyshot11\/wp-json\/wp\/v2\/manualdocumentationcategory?post=15988"},{"taxonomy":"manual_doc_tag","embeddable":true,"href":"https:\/\/manual.keyshot.com\/keyshot11\/wp-json\/wp\/v2\/manual_doc_tag?post=15988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}