Once you implement the node, its property sheet, data interfaces, and a scripted create command, you are ready to install the create command in the interface and begin testing.
The first step is to write a scripted create command.
This is what your script looks like:
/*----------------------------------------------------------------------------*/
/* My Company Create Scripts */
/* */
/* Copyright (c) 2007 My Company. All Rights Reserved. */
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* AddNode Function */
/*----------------------------------------------------------------------------*/
function int AddNode( Node new_node, Group parentNode )
{
Model.AddNode( new_node, parentNode, -1 );
Model.Deselect( parentNode );
return 1;
}
/*----------------------------------------------------------------------------*/
/* CreateMyNode */
/*----------------------------------------------------------------------------*/
macro CreateMyNode()
[Category="Create Commands", Guid="{1F91F915-F612-46D4-A453-4B81096121A9}", Image=".\\icons\\generic_script_icon.bmp"]
{
for( int i = 0; i < Model.GetSelectCount(); ++i )
{
Node selNode = Model.GetSelectedNode( i ).GetNode();
if( selNode.IsDerived( Group ) )
{
MYCLASSNAME myNode = new MYCLASSNAME;
myNode.Name = "MyNode";
AddNode( myNode, (Group)selNode );
}
}
}
You need to create a command menu as well. This is very easy.
<contextmenu name="MYNODENAME" class="MYCLASSNAME">
<item name="&Delete" guid="{1F91F9D2-F612-46D4-A453-4B81096121A9}" text="true" image="true"/>
<separator/>
<item name="&Properties..." guid="{1F91F85C-F612-46D4-A453-4B81096121A9}" text="true" image="true"/>
</contextmenu>
If you implement additional commands that modify the new node you should add a new category to the Modify Menu and place those commands in the new menu. You should also add those commands to the command menu.