{"id":15989,"date":"2021-10-11T14:16:08","date_gmt":"2021-10-11T12:16:08","guid":{"rendered":"https:\/\/manual.keyshot.com\/keyshot11\/?post_type=manual_documentation&#038;p=15989"},"modified":"2022-02-10T11:34:23","modified_gmt":"2022-02-10T10:34:23","slug":"scripting-transforming-scene-nodes","status":"publish","type":"manual_documentation","link":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-transforming-scene-nodes\/","title":{"rendered":"Scripting: Transforming scene nodes"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"transforming-scene-nodes-gui-and-headless\">Transforming scene nodes <sup>(GUI and Headless)<\/sup><\/h2>\n\n\n\n<p>Nodes can be translated, scaled, rotated etc. via scripting. It is possible by using 4&#215;4 transformation matrices of type <em>luxmath.Matrix<\/em>. There are two ways to transform: relative or absolute. A relative transform means to apply the transform locally, i.e. it is multiplied last in the chain of existing transforms. That means that if you relatively translate by (1,0,0) then it will simply move the node one by the x-axis according to its position. In contrast, absolute transforms are not chained in the same fashion and absolutely translating by (1,0,0) will always position the node at (1,0,0).<\/p>\n\n\n\n<p>When doing transforms it is important that an identity matrix (1s on the diagonal) is used as the base matrix. It is obtained in the following way:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">&gt;&gt;&gt; M = luxmath.Matrix().makeIdentity()\n&gt;&gt;&gt; print(M.dump())\n| 1.00  0.00  0.00  0.00 |\n| 0.00  1.00  0.00  0.00 |\n| 0.00  0.00  1.00  0.00 |\n| 0.00  0.00  0.00  1.00 |<\/code><\/pre>\n\n\n\n<p>To translate a node by (5,0,1):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">&gt;&gt;&gt; M = luxmath.Matrix().makeIdentity().translate(luxmath.Vector((5, 0, 3)))\n&gt;&gt;&gt; node.applyTransform(M)\n&gt;&gt;&gt; print(M.dump()) # Let's have a look at the matrix.\n| 1.00  0.00  0.00  0.00 |\n| 0.00  1.00  0.00  0.00 |\n| 0.00  0.00  1.00  0.00 |\n| 5.00  0.00  3.00  1.00 |<\/code><\/pre>\n\n\n\n<p>If instead an absolute position adjustment is intended, then do the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">&gt;&gt;&gt; M = luxmath.Matrix().makeIdentity().translate(luxmath.Vector((5, 0, 3)))\n&gt;&gt;&gt; node.applyTransform(M, absolute = True)<\/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>Only object nodes can have absolute transforms applied!<\/p>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p>For further information about what transforms are possible have a look at the documentation for <em>luxmath.Matrix<\/em>.<\/p>\n","protected":false},"author":29916,"featured_media":0,"parent":15964,"menu_order":40,"template":"","manualdocumentationcategory":[13],"manual_doc_tag":[],"class_list":["post-15989","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: Transforming 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-transforming-scene-nodes\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Scripting: Transforming scene nodes - KeyShot 11 Manual\" \/>\n<meta property=\"og:description\" content=\"Transforming scene nodes (GUI and Headless) Nodes can be translated, scaled, rotated etc. via scripting. It is possible by using 4&#215;4 transformation matrices of type luxmath.Matrix. There are two ways to transform: relative or absolute. A relative transform means to apply the transform locally, i.e. it is multiplied last in the chain of existing transforms. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-transforming-scene-nodes\/\" \/>\n<meta property=\"og:site_name\" content=\"KeyShot 11 Manual\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-10T10:34:23+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-transforming-scene-nodes\\\/\",\"url\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/manual\\\/scripting\\\/quick-start-scripting\\\/scripting-transforming-scene-nodes\\\/\",\"name\":\"Scripting: Transforming scene nodes - KeyShot 11 Manual\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/#website\"},\"datePublished\":\"2021-10-11T12:16:08+00:00\",\"dateModified\":\"2022-02-10T10:34:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/manual\\\/scripting\\\/quick-start-scripting\\\/scripting-transforming-scene-nodes\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/manual\\\/scripting\\\/quick-start-scripting\\\/scripting-transforming-scene-nodes\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/manual.keyshot.com\\\/keyshot11\\\/manual\\\/scripting\\\/quick-start-scripting\\\/scripting-transforming-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: Transforming 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: Transforming 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-transforming-scene-nodes\/","og_locale":"en_US","og_type":"article","og_title":"Scripting: Transforming scene nodes - KeyShot 11 Manual","og_description":"Transforming scene nodes (GUI and Headless) Nodes can be translated, scaled, rotated etc. via scripting. It is possible by using 4&#215;4 transformation matrices of type luxmath.Matrix. There are two ways to transform: relative or absolute. A relative transform means to apply the transform locally, i.e. it is multiplied last in the chain of existing transforms. [&hellip;]","og_url":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-transforming-scene-nodes\/","og_site_name":"KeyShot 11 Manual","article_modified_time":"2022-02-10T10:34:23+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-transforming-scene-nodes\/","url":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-transforming-scene-nodes\/","name":"Scripting: Transforming scene nodes - KeyShot 11 Manual","isPartOf":{"@id":"https:\/\/manual.keyshot.com\/keyshot11\/#website"},"datePublished":"2021-10-11T12:16:08+00:00","dateModified":"2022-02-10T10:34:23+00:00","breadcrumb":{"@id":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-transforming-scene-nodes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-transforming-scene-nodes\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/manual.keyshot.com\/keyshot11\/manual\/scripting\/quick-start-scripting\/scripting-transforming-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: Transforming 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\/15989","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\/15989\/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=15989"}],"wp:term":[{"taxonomy":"manualdocumentationcategory","embeddable":true,"href":"https:\/\/manual.keyshot.com\/keyshot11\/wp-json\/wp\/v2\/manualdocumentationcategory?post=15989"},{"taxonomy":"manual_doc_tag","embeddable":true,"href":"https:\/\/manual.keyshot.com\/keyshot11\/wp-json\/wp\/v2\/manual_doc_tag?post=15989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}