{"id":444,"date":"2013-07-28T08:51:20","date_gmt":"2013-07-28T08:51:20","guid":{"rendered":"http:\/\/faulknermano.com\/blog\/?p=444"},"modified":"2015-07-29T02:17:24","modified_gmt":"2015-07-29T02:17:24","slug":"user-functions-ftw","status":"publish","type":"post","link":"http:\/\/faulknermano.com\/blog\/user-functions-ftw\/","title":{"rendered":"User functions FTW"},"content":{"rendered":"<p>Here I am, few days later talking about user functions in Janus again. Why not? It&#8217;s been giving me results and it&#8217;s fun to play with &#8212; as a TD, I mean.<\/p>\n<p>Back at work I wanted to output an RGB matte for multiple instanced object. LW doesn&#8217;t have a way to do a scene-based surface override on an object (perhaps <a href=\"http:\/\/www.db-w.com\/products\/shadermeister\/about\" target=\"_blank\">shaderMeister<\/a>?&#8211; though I don&#8217;t know if it the Spot Instance node will work with it). Basically, I wanted an easy way of assigning RGB colours to items in a particular group.<\/p>\n<p>Before, Janus&#8217;s item processing was strictly group-oriented, where group settings were simply propagated to the items. There was no way to individually and programmatically affect certain items within the group. So in the latest rev, I changed that. But the important bit was that I tied it (again) to user functions, and I embedded a new context &#8212; the group item context &#8212; through populating two constant variables relating to the group item&#8217;s index and name. In this way, the user function can be created that references the group item&#8217;s index, and based on that value, the command parameters can be changed on that particular item as it is being processed. It&#8217;s basically a &#8216;last minute&#8217; change in the render pass settings just before the group item is applied its parent group settings.<\/p>\n<p>Since user functions are basically string replacements from within the cmd line, there&#8217;s a lot of flexibility (but can also end up a heaping mess if the Janus user doesn&#8217;t watch it), so that I can dynamically various bits of settings; I&#8217;m not limited to adding one parameter, for example, because I can just concatenate the new subcommands in the return string; so as along as the final resulting cmd line is syntactically valid, Janus will grok it.<\/p>\n<p style=\"text-align: justify;\">\n","protected":false},"excerpt":{"rendered":"<p>Here I am, few days later talking about user functions in Janus again. Why not? It&#8217;s been giving me results and it&#8217;s fun to play with &#8212; as a TD, I mean. Back at work I wanted to output an RGB matte for multiple instanced object. LW doesn&#8217;t have a way to do a scene-based [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[54,1],"tags":[28,15,29,36],"class_list":["post-444","post","type-post","status-publish","format-standard","hentry","category-janus","category-uncategorized","tag-janus","tag-lightwave","tag-scripting","tag-user-functions"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1gtd2-7a","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/posts\/444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/comments?post=444"}],"version-history":[{"count":6,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/posts\/444\/revisions"}],"predecessor-version":[{"id":455,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/posts\/444\/revisions\/455"}],"wp:attachment":[{"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/media?parent=444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/categories?post=444"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/tags?post=444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}