<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="/feed.php">
        <title>Documentation Center public:software:dazstudio:4:referenceguide:scripting:api_reference:samples:nodes:create_instance</title>
        <description></description>
        <link>/</link>
        <image rdf:resource="/lib/tpl/dazdoccenter/images/favicon.ico" />
       <dc:date>2026-04-10T17:26:39+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/nodes/create_instance/start"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="/lib/tpl/dazdoccenter/images/favicon.ico">
        <title>Documentation Center</title>
        <link>/</link>
        <url>/lib/tpl/dazdoccenter/images/favicon.ico</url>
    </image>
    <item rdf:about="/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/nodes/create_instance/start">
        <dc:format>text/html</dc:format>
        <dc:date>2016-03-17T14:37:09+00:00</dc:date>
        <title>Create Instance</title>
        <link>/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/nodes/create_instance/start</link>
        <description>
&lt;h1 id=&quot;create_instance&quot;&gt;Create Instance&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
Below is an example demonstrating how you can create a node instance, via script.
&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&quot;api_areas_of_interest&quot;&gt;API Areas of Interest&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/object_q&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:object_q&quot;&gt;QObject&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/base_dz&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:base_dz&quot;&gt;DzBase&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level3&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/scene_dz&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:scene_dz&quot;&gt;DzScene&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level3 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/element_dz&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:element_dz&quot;&gt;DzElement&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level4 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/node_dz&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:node_dz&quot;&gt;DzNode&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level5&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/skeleton_dz&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:skeleton_dz&quot;&gt;DzSkeleton&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level5&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/bone_dz&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:bone_dz&quot;&gt;DzBone&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level5&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/instancenode_dz&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:instancenode_dz&quot;&gt;DzInstanceNode&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level3 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/property_dz&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:property_dz&quot;&gt;DzProperty&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level4&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/nodeproperty_dz&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:nodeproperty_dz&quot;&gt;DzNodeProperty&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/object&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:object&quot;&gt;Object&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/function&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:function&quot;&gt;Function&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/number&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:number&quot;&gt;Number&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/boolean&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:boolean&quot;&gt;Boolean&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/string&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:string&quot;&gt;String&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/global&quot; class=&quot;wikilink1&quot; title=&quot;public:software:dazstudio:4:referenceguide:scripting:api_reference:object_index:global&quot;&gt;Global&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;

&lt;h2 id=&quot;example&quot;&gt;Example&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;div class=&quot;wrap_center wrap_round wrap_download plugin_wrap&quot; style=&quot;width: 90%;&quot;&gt;&lt;ul&gt;&lt;li&gt;License: &lt;a href=&quot;http://creativecommons.org/licenses/by/3.0/&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;http://creativecommons.org/licenses/by/3.0/&quot; rel=&quot;nofollow noopener&quot;&gt;CC Attribution 3.0 Unported&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Click the name of the example below to save it as a file&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style=&quot;-webkit-user-select: none;-webkit-touch-callout: none;-moz-user-select: none;-ms-user-select: none;user-select: none;&quot;&gt;&lt;dl class=&quot;code&quot;&gt;
&lt;dt&gt;&lt;a href=&quot;/_export/code/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/nodes/create_instance/start?codeblock=0&quot; title=&quot;Download Snippet&quot; class=&quot;mediafile mf_dsa&quot;&gt;Create_Instance.dsa&lt;/a&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;pre class=&quot;code ecmascript&quot;&gt;&lt;span class=&quot;co1&quot;&gt;// Define an anonymous function;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;// serves as our main loop,&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;// limits the scope of variables&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
&amp;nbsp;
	&lt;span class=&quot;coMULTI&quot;&gt;/*********************************************************************/&lt;/span&gt;
	&lt;span class=&quot;co1&quot;&gt;// String : A function for retrieving a translation if one exists&lt;/span&gt;
	&lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; text&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sText &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
	&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span class=&quot;co1&quot;&gt;// If the version of the application supports qsTr()&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; qsTr &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;undefined&amp;quot;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span class=&quot;co1&quot;&gt;// Return the translated (if any) text&lt;/span&gt;
			&lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; qsTr&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sText &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Return the original text&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; sText&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span class=&quot;coMULTI&quot;&gt;/*********************************************************************/&lt;/span&gt;
	&lt;span class=&quot;co1&quot;&gt;// Boolean : A function for testing whether or not a QObject instance&lt;/span&gt;
	&lt;span class=&quot;co1&quot;&gt;// inherits one of a list of types&lt;/span&gt;
	&lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; inheritsType&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oObject&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; aTypeNames &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
	&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span class=&quot;co1&quot;&gt;// If the object does not define the 'inherits' function&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;oObject &lt;span class=&quot;sy0&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oObject&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;inherits&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;function&amp;quot;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span class=&quot;co1&quot;&gt;// We are done... it is not a QObject&lt;/span&gt;
			&lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Iterate over the list of type names&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;var&lt;/span&gt; i &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; nTypes &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; aTypeNames&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt; nTypes&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy0&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span class=&quot;co1&quot;&gt;// If the object does not inherit the 'current' type&lt;/span&gt;
			&lt;span class=&quot;kw2&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;oObject&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;inherits&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; aTypeNames&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
				&lt;span class=&quot;co1&quot;&gt;// Next!!&lt;/span&gt;
				&lt;span class=&quot;kw2&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
			&lt;span class=&quot;co1&quot;&gt;// Return the result&lt;/span&gt;
			&lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Return the result&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span class=&quot;coMULTI&quot;&gt;/*********************************************************************/&lt;/span&gt;
	&lt;span class=&quot;co1&quot;&gt;// DzNode : A function for getting the root of a node&lt;/span&gt;
	&lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; getRootNode&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oNode &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
	&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span class=&quot;co1&quot;&gt;// If we have a node and it is a bone&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oNode &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; inheritsType&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oNode&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;DzBone&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span class=&quot;co1&quot;&gt;// We want the skeleton&lt;/span&gt;
			&lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; oNode&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getSkeleton&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Return the original node&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; oNode&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span class=&quot;coMULTI&quot;&gt;/*********************************************************************/&lt;/span&gt;
	&lt;span class=&quot;co1&quot;&gt;// DzInstanceNode : A function for creating a node instance&lt;/span&gt;
	&lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt; createInstance&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oNode &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
	&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span class=&quot;co1&quot;&gt;// If we do not have a node&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;oNode &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span class=&quot;co1&quot;&gt;// We are done...&lt;/span&gt;
			&lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kw6&quot;&gt;undefined&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Get the root of the node&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;var&lt;/span&gt; oSrcNode &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; getRootNode&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oNode &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Create a new instance node&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;var&lt;/span&gt; oInstanceNode &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;new&lt;/span&gt; DzInstanceNode&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Get the target property of the instance&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;var&lt;/span&gt; oProperty &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; oInstanceNode&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getTargetControl&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Exclude the instance node from the&lt;/span&gt;
		&lt;span class=&quot;co1&quot;&gt;// list of nodes that can be targeted&lt;/span&gt;
		oProperty&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;exclude&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oInstanceNode &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Set the instance target to the source node&lt;/span&gt;
		oProperty&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setValue&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oSrcNode &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Set the name of the instance&lt;/span&gt;
		oInstanceNode&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setName&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw5&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;%1_instance&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oSrcNode&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;objectName&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Get the label of the source node&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;var&lt;/span&gt; sLabel &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; oSrcNode&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getLabel&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;co1&quot;&gt;// Strip the number from the label&lt;/span&gt;
		sLabel &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; Scene&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;stripLabelNumber&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sLabel &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;co1&quot;&gt;// Get a unique label&lt;/span&gt;
		sLabel &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; Scene&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getUniqueTopLevelLabel&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw5&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;%1 Instance&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;arg&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sLabel &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;co1&quot;&gt;// Set the label of the instance node&lt;/span&gt;
		oInstanceNode&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;setLabel&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sLabel &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Add the node to the scene&lt;/span&gt;
		Scene&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;addNode&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oInstanceNode &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Return the node instance&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; oInstanceNode&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span class=&quot;coMULTI&quot;&gt;/*********************************************************************/&lt;/span&gt;
	&lt;span class=&quot;co1&quot;&gt;// Declare working variables&lt;/span&gt;
	&lt;span class=&quot;kw2&quot;&gt;var&lt;/span&gt; sTitle&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; sMessage&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span class=&quot;co1&quot;&gt;// Define common strings&lt;/span&gt;
	&lt;span class=&quot;kw2&quot;&gt;var&lt;/span&gt; sButton &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; text&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;&amp;amp;OK&amp;quot;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span class=&quot;co1&quot;&gt;// Get the primary selection&lt;/span&gt;
	&lt;span class=&quot;kw2&quot;&gt;var&lt;/span&gt; oNode &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; Scene&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;getPrimarySelection&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span class=&quot;co1&quot;&gt;// If nothing is selected&lt;/span&gt;
	&lt;span class=&quot;kw2&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;oNode &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span class=&quot;co1&quot;&gt;// Define text variables for the message&lt;/span&gt;
		sTitle &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; text&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;Selection Error&amp;quot;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
		sMessage &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; text&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;An object in the scene must be selected to continue.&amp;quot;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Inform the user&lt;/span&gt;
		MessageBox&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;information&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sMessage&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; sTitle&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; sButton &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// We are done..&lt;/span&gt;
		&lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
	&lt;span class=&quot;co1&quot;&gt;// Create an instance of the node&lt;/span&gt;
	&lt;span class=&quot;kw2&quot;&gt;var&lt;/span&gt; oInstanceNode &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; createInstance&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; oNode &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;co1&quot;&gt;// If an instance was not created&lt;/span&gt;
	&lt;span class=&quot;kw2&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;oInstanceNode &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span class=&quot;co1&quot;&gt;// Define text variables for the message&lt;/span&gt;
		sTitle &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; text&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;Selection Error&amp;quot;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
		sMessage &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; text&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;An Instance could not be created for the selected object.&amp;quot;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span class=&quot;co1&quot;&gt;// Inform the user&lt;/span&gt;
		MessageBox&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;information&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sMessage&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; sTitle&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; sButton &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;// Finalize the function and invoke&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/dd&gt;&lt;/dl&gt;
&lt;/div&gt;
&lt;/div&gt;
</description>
    </item>
</rdf:RDF>
