Create Panel

The startObjectCreation() method is used to simulate the user finding a Create Panel button for a given object class and pressing that button, putting 3ds Max into create mode for that object class.

The form is:

startObjectCreation <maxobjclass> [        returnNewNodes:<flag>] [        newNodeCallback:<fn>]      

This method simply opens up the Create Panel at the right tab and category and depresses the appropriate object button.

EXAMPLE:

   startObjectCreation box
   startObjectCreation targetSpot

This method is primarily intended for use in macroScripts, but can be used in generalized scripts. Script execution will continue immediately after entering the create mode, and you must ensure that the script does not interfere with the object creation.

The values that can be supplied to the optional returnNewNodes: keyword argument are true , false (the default) or #first . If true is supplied, all of the nodes created, up until the current create mode is exited, will be returned in an array. If #first is supplied, only the first node created is returned, immediately after it is created. The function doesn’t wait for the create mode to be exited by the user.

The optional newNodeCallback: keyword argument can supply a scripted function of one argument to the create mode that is started, such that the function will be called each time a node is created with the new node as its argument. This is similar to supplying pickObject() filter functions, although the return value of the newNodeCallback: function is ignored.

Note: The callback function is invoked immediately upon new node creation, *before* any base object is installed in it, so only node-related properties can be accessed and changed during this callback.

FOR EXAMPLE:

   fn setColor n = n.wireColor= red
   startObjectCreation box newNodeCallback:setColor

would cause all new boxes created in the started create mode to have red wire color.

The returnNewNodes: and newNodeCallback: can both be supplied on the same call; the callback will be called on each node, and they will be returned in an array as the result of the startObjectCreation() function.

okToCreate <maxclass> 

Returns true if the specified maxclass can be created in the UI, false otherwise. If the argument is undefined, also returns false .

FOR EXAMPLE:

   okToCreate terrain

will return false unless at least one shape is selected, or if any non-shape is selected. This corresponds to whether the button for the object is enabled.

isCreatingObject [ <maxclass> ] 

Returns true if the specified maxclass is currently being created in the UI, false otherwise.

If called without an argument returns true if ANY object is being created in the UI, false otherwise.

In 3ds Max 2010 and higher, also returns false if the argument is undefined for consistency with okToCreate() .

Available in 3ds Max 9 and higher.

FOR EXAMPLE:

   --go to Create panel, click the Box button and evaluate:
   isCreatingObject Box
   true
   --in the Create panel, click on the Cone button and evaluate:
   isCreatingObject Box
   false
   isCreatingObject Cone
   true
   isCreatingObject()
   true