Constructor/Plugins/Commands

From TDN

Contents


Introduction


On this page, you can find all the commands that are available to you when developing a plug-in for Constructor. A few of the commands are not yet implemented, but are close to be a part of the feature list. If you know of a feature that's been implemented, feel free to change this reference.



Scene


Scene manager object


SimGroup for a number of scenes as SimObjects.

scene.load(callback); Open a dialog for the user to load in a Map or Constructor file. If successful, calls the callback function with the single parameter of sceneID, otherwise callback receives -1. If is a Map, acts as a scene.new() but replaces the empty map with the user selected one. Notifies others of the scene change.
scene.load(callback [,filename]); Load in the given CSX or MAP file name. If no name is given then prompt the user for a file. If successful, calls the callback function with the single parameter of sceneID, otherwise callback receives -1. Notifies others of the scene change.
scene.newScene(); Create a new scene with one map and one detail level. Returns the sceneID. Notifies others of the scene change.
scene.save(); Save the scene as a CSX or MAP file depending on its current file name. If it has never been saved, prompt the user to choose a name and path.
scene.saveAs([filename] [,askuser]); Save the scene as a CSX or MAP file depending on the given file name. If no name is given then prompt the user to choose a name and path. If the optional 'askuser' parameter is given with the file name, then a Save As dialog will be opened and populated with the given file name. This allows the user to change the file name before being saved.
scene.saveCSX([filename] [,askuser]); Save the scene as a CSX file with the given file name. If no name is given then prompt the user to choose a name and path. If the optional 'askuser' parameter is given with the file name, then a Save As dialog will be opened and populated with the given file name. This allows the user to change the file name before being saved.
scene.saveMAP([filename] [,askuser]); Save the scene as a MAP file with the given name. If no name is given then prompt the user to choose a name and path. If the optional 'askuser' parameter is given with the file name then a Save As dialog will open populated with the given file name. This allows the user to change the file name before being saved. NOTE: MAP files do not support all the options a CSX does. If these extended features are used they will be lost when saved to a MAP file.
scene.importMAP([filename] [,where]);This feature is not yet implemented. Import a MAP file into the scene. If the optional file name is not provided the user will be prompted to choose one. The optional 'where' parameter indicates if the MAP should be placed in the existing detail level or imported as a new detail level. If this parameter is missing then a dialog window will open asking the user what to do.
scene.exportMAP(detail level [,filename] [,askuser]);This feature is not yet implemented. Save the scene's given detail level as a MAP file with the given file name. If the provided detail level is -1 then use the current detail level. If no name is given then prompt the user to choose a name and path. If the optional 'askuser' parameter is given with the file name then an Export As dialog will open populated with the given file name.
scene.exportAsLWO([filename] [,askuser]); Export the scene as a LightWave object. If no name is given, open a dialog. If the optional 'askuser' parameter is given with the filename, then a dialog will be opened and populated with the given filename. This allows the user to change the filename before being saved.
scene.revert(); Revert the scene back to what is saved on disk.
scene.close(); Close the current scene. Notifies others of the scene change.
scene.closeAll(); Close all scenes. Notifies others of the scene change.
scene.changed(); Sets the current scene as having been modified in some way. This will cause Constructor to ask the user before closing a file.
scene.getCurrent(); Returns the Id of the current scene. Returns -1 if no scene.
scene.setCurrent([sceneID,[listchange]]); Changes the current scene to the given one. Returns the sceneID if successful, or -1 if not. Notifies others of the scene change. If the optional parameter 'listchange' is set to true, then others are notified that the scene list has changed along with the change in current scene (scene deleted or added). If the sceneID is not provided, then the first scene is made the current one, if one exists -- otherwise none at all.
scene.getCurrentFileName(); Returns the file name of the current scene.
scene.getCurrentMap(); Returns the current map SimObjectID of the current detail level.
scene.addNewDetailLevel(); Adds a new detail level to the current scene and creates a new, blank map. Notifies others of the detail level change.
scene.deleteDetailLevel([detailnum]); Delete the given detail number from the current scene. If one is not given, delete the current detail level. If this is the last detail level, then nothing happens. Notifies others of the detail level change.
scene.getCurrentDetailLevel(); Returns the number of the current detail level of the current scene.
scene.setCurrentDetailLevel(detailnum); Sets the current detail level of the current scene. Returns the detail level number if successful, -1 otherwise. Notifies others of the detail level change.
scene.getDetailLevelCount();This feature is not yet implemented. Returns the number of detail levels in the current scene.
scene.swapDetailLevels(detail1, detail2);This feature is not yet implemented. Swaps the maps on the two given detail levels.
scene.relightCurrentDetailLevel();This feature is not yet implemented. Reruns the lightmap generator for the current detail level map.
scene.relightAll();This feature is not yet implemented. Reruns the lightmap generator for all detail level maps.
scene.openManageEntityWindow();This feature is not yet implemented. Opens the Manage Entities modal window for the current scene.
scene.getCurrentGameType(); Returns the name of the entity game type (ie: Torque) used in the current scene.
scene.getFirstValidPointEntityID(); Returns the first valid point entity ID for the current scene's entity game type. This is often only used by plug-ins that deal with creating point entities.
scene.isPointEntityValid(entityID); Checks that the given point entity ID is valid for the current scene. Usually only used by plug-ins to make sure that their stored point entity ID is still valid, and if not, usually they obtain a new one with getFirstValidPointEntityID().
scene.getShapePointEntityID(shapeID); Returns the entityID of the given shapeID.

Notification methods


The following are methods that are used to notify objects that something in the scene has changed (ie: updates the tree view display). Objects that wish to be notified need to listen to the MapItemChange message queue.

scene.notifyBrushAdd(map, brushID); Notifies others that a brush with the given brushID has been added to the given map.
scene.notifyBrushDelete(map, brushID); Notifies others that a brush with the given brushID has been deleted from the given map.
scene.notifyBrushRefresh(); Notifies others that the entire brush list should be refreshed for the current map.
scene.notifyShapeAdd(scene, shapeID); Notifies others that a shape with the given shapeID has been added to the given scene.
scene.notifyShapeDelete(scene, shapeID); Notifies others that a shape with the given shapeID has been deleted from the given scene.

Static shape and reference object methods


Methods used in dealing with non-modifiable 3D objects that may be used templates, references, etc.:

scene.importShape([filename]); Import a DTS file as a non-modifiable 3D object into the scene -- a reference shape. If no filename is given, then a file dialog will be presented.
scene.importStaticMesh([filename]); Import a DTS file as a static mesh. If no filename is given then a file dialog will be presented.
scene.replaceShapes([filename]); Replace all selected shapes with a new shape. If a filename is given then attempt to use it. Otherwise ask the user for a filename. This function returns false if there was a problem with no shapes being selected.

Scene class


Accessed with scene.getCurrent().

%scene.getNumShapes(); Returns the number of active scene shapes.
%scene.getShapeId(index); Returns the SimObject shapeID for the shape given its index in the scene.
%scene.addShape(shapeID); Adds the given scene shape to the scene. Normally a shape is added with scene.importShape()
%scene.deleteShape(shapeID); Deletes the given shape from the scene. Allows for undo.
%scene.removeShape(shapeID); Permanently removes a shape from the scene -- no undo.
%scene.selectShape(shapeID); Selects the given shape in the scene.
%scene.unselectShape(shapeID); Unselects the given shape from the scene.
%scene.unselectAllShapes(); Unselects all selected shapes in the scene.
%scene.getNumSelectedShapes(); Returns the number of selected shapes in the scene.
%scene.getSelectedShapes(); Returns a list of selected shapeID's. Use getWord() to retrieve each shapeID.
%scene.getUnselectedShapes(); Returns a list of unselected shapeID's. Use getWord() to retrieve each shapeID.
%scene.isShapeSelected(shapeID); Returns 'true' if the given shapeID is selected.
%scene.groupSelected([map]); Creates a new group and places any selected objects into the group. The map SimObjectID parameter is optional, and if not included the function assumes the current map.
%scene.ungroupSelected([map]); Removes all selected objects from any group. The map SimObjectID parameter is optional, and if not included the function assumes the current map.
%scene.lockSelected([map]); Locks the selected objects to prevent user manipulation and unselects them. The map SimObjectID parameter is optional, and if not included the function assumes the current map.
%scene.lockUnselected([map]); Locks the unselected objects to prevent user manipulation. The map SimObjectID parameter is optional, and if not included the function assumes the current map.
%scene.lockInverse([map]); Locks objects that are unlocked and unlocks those that are locked. The map SimObjectID parameter is optional, and if not included the function assumes the current map.
%scene.unlockAll([map]); Unlocks all objects. The map SimObjectID parameter is optional, and if not included the function assumes the current map.
%scene.hideSelected([map]); Hides the selected objects to get them out of the way and unselects them. The map SimObjectID parameter is optional, and if not included the function assumes the current map.
%scene.HideUnselected([map]); Hides the unselected objects to get them out of the way. The map SimObjectID parameter is optional, and if not included the function assumes the current map.
%scene.hideInverse([map]); Hides objects that are shown and shows those that are hidden. The map SimObjectID parameter is optional, and if not included the function assumes the current map.
%scene.showAll([map]); Shows all hidden objects. The map SimObjectID parameter is optional, and if not included the function assumes the current map.
%scene.storeAllShapeTransforms(); Stores all shape transforms in the scene in perparation for moving them. Usually this method is only called by the Tool Manager.
%scene.scratchMoveSelectedShapes( offset: "x y z"); Move all selected shapes by a given offset from the stored position.
%scene.scratchMoveAllShapes(offset: "x y z"); Move all shapes by a given offset from the stored position.
%scene.scratchRotateSelectedShapes( offset: "x y z", center: "x y z"); Rotate all selected shapes by a given offset at the given centroid from the stored rotation.
%scene.scratchRotateAllShapes(offset: "x y z", center: "x y z"); Rotate all shapes by a given offset at the given centroid from the stored rotation.

Shape class


Used for non-modifiable 3D objects as references, templates, etc.. Also, for Entity renderings.

%shape.setPosition("x y z");This feature is not yet implemented. Sets the position of the shape in world coordinates.
%shape.setRotation("x y z");This feature is not yet implemented. Sets the absolute rotation of the shape. In this case, the given values are rotation about the various axis, in degrees.
%shape.setScale("x y z");This feature is not yet implemented. Sets the absolute scale of the shape. In this case, the given values are the scale along the various axis. The default is 1.0 in x, y and z.



User action


User action manager


Tracks selection state and current tool.

userAction.getSelectionType(); Returns the current selection type as a string ie: SelectVertices, SelectEdges, SelectFaces, SelectPrimitives.
userAction.setSelectionType(seltype); Set the current selection type to the given seltype string.
userAction.getTool(); Returns the currently selected tool's name, or an empty string if there is none selected.
userAction.setTool(name); Sets the current tool based on the given tool name. Returns 'true' if the given tool has been made active.
userAction.dropTool([name]); If the optional parameter 'name' is given, drop the given tool if it is the currently active one. Otherwise, nothing happens (ie: the currently active tool remains). If no name is given, then force the drop the currently active tool.
userAction.routeLeftMouseDown( viewtype, raystart, rayend, modifier);This feature is not yet implemented. Routes a user's left mouse down to the current tool, or if there is no current tool, to the current selection. The viewtype references the type of view the mouse was clicked in (Front, Back, Perspective, etc.). raystart and rayend are 3D points in the world from where the mouse was pushed down. The modifier parameter indicates if any keyboard modifiers have been held down.
userAction.routeLeftMouseDrag( viewtype, raystart, rayend, modifier);This feature is not yet implemented. Similar to the above, but indicates that the left mouse button is still held down and has been dragged.
userAction.routeLeftMouseUp( viewtype, raystart, rayend, modifier);This feature is not yet implemented. Similar to the above, but indicates that the left mouse button has gone up.



Selection


Selection Manager


select.setSelectionType(seltype); Set the current selection type to the given seltype string.
select.getSelectionType(); Returns the current selection type as a string ie: SelectVertices, SelectEdges, SelectFaces, SelectPrimitives.
select.invert(); Inverts all items in the current scene, taking the appropriate selection type into account as applicable.
select.invertCurrentSelectionType(); Inverts all items appropriate for the current selection type.
select.invertEntityShapes(); Inverts all scene shapes that represent a map entity.
select.invertPureShapes(); Inverts all pure scene shapes ie: those that do not represent a map entity.
select.clear(); Clears all items in the current scene, taking the appropriate selection type into account as applicable.
select.clearCurrentSelectionType(); Clears all items appropriate for the current selection type.
select.clearEntityShapes(); Clears all currently selected shapes that represent a map entity.
select.clearPureShapes(); Clears all pure scene shapes ie: those that do not represent a map entity.
select.all(); Selects all items in the current scene, taking the appropriate selection type into account as applicable.
select.allCurrentSelectionType(); Selects all items appropriate for the current selection type.
select.allEntityShapes(); Selects all shapes that represent a map entity
select.allPureShapes(); Selects all pure scene shapes ie: do not represent a map entity
select.reselect(); Reselects all objects that were previously selected.
select.ray(start, end); Selects the first item found by the given ray. The 'start' and 'end' vectors are given in World coordinates.
select.addItem(itemID [, seltype]); Selects the given item given it's item specific ID. ie: brushID. If the optional seltype parameter is given, then the item is added to the appropriate selection types's list regardless if it is the current selection type or not. The seltype parameter is a text string matching the one used in setSelectionType(). To select Scene Shapes, the seltype must be given with a value of "SelectSceneShape".
select.removeItem(itemID [, seltype]); Removes the given item from the selection given it's item specific ID. Ie: brushID. If the optional seltype parameter is given, then the item is removed from the appropriate selection types's list regardless if it is the current selection type or not. The seltype parameter is a text string matching the one used in setSelectionType(). To remove a Scene Shape from selection, the seltype must be given with a value of "SelectSceneShape".
select.expand();This feature is not yet implemented. Expands the current selection as appropriate for the current selection type. If a vertex is selected, this will select all other vertices that share a common edge. If an edge is selected, this will select all other edges that share a common vertex. If a face is selected, this will select all other faces that share a common edge. Nothing will happen if a primitive is selected.
select.contract();This feature is not yet implemented. Attempts to do the opposite of the select.expand() command.
select.convertToType(seltype);This feature is not yet implemented. Converts the current selection into a new selection type and clears the destination type prior to the conversion. ie: with a face selected and the 'seltype' is set to SelectVertices, then all of the face's vertices will be selected. This command will not swtich the currently active selection type.
select.count(); Returns the number of selected items for the current type. Includes Scene Shapes regardless of the selection type.
select.countBrushes(); Returns the number of selected brushes for the current map without regard for the current selection type.
select.countFaces(); Returns the number of selected faces for the current map without regard for the current selection type.
select.countSceneShapes(); Returns the number of selected scene shapes for the current scene.
select.getItem(index); Returns the ID (ie: burshID) of the selected item given the item's index where 0>= index < select.count()
select.cut(); Will cut the currenly selected items from the map. With nothing selected, everything will be cut.
select.copy(); Will copy the currently selected items from the map. With nothing selected, everything will be copied.
select.paste(); Will paste the contents of the clipboard into the current map, and make the pasted items the currently selected items.
select.pasteUnselected(); Paste the primary clipboard into the current scene and/or map and don't change what is selected.
select.deleteSelection(); Will delete the currently selected items from the map. With nothing selected, everything will be deleted.
select.saveSelection(name, mode); Will save all selected items to the named selection set that is associated with the current detail level. The optional mode indicates what to do if the given name already exists: 0=Overwrite (default), 1=Add to selection, 2=Subtract from selection.
select.loadSelection(index, mode); Will load the given selection set given as an index into the current detail level's selection set list. The mode is one of the following: 0=New Selection, 1=Add to current selection, 2=Subtract from current selection.
select.sameEntityClassName(); Based on the entities that are currently selected, all other entities in the scene of the same class name(s) will also be selected. The game types must also match.
select.sameEntityGameType(); Based on the entities that are currently selected, all other entities in the scene of the same game type(s) will also be selected.
select.sameMaterial(); Based on the materials of what is currently selected for the current selection type, all other objects in the scene that share at least one material will be selected.
select.sameBrushFaces(); Based on the currently selected faces, select all faces that are on the same brushes.
select.selectBrushFaces(brushID); Select all faces on the given brush with the Face Selection Type.
select.sameBrushVertices(); Based on the currently selected vertices, select all vertices that are on the same brushes.
select.selectBrushVertices(brushID); Select all vertices on the given brush with the Vertex Selection Type.




Tools


Tool manager


Manages all tools and the current tool if any.

tool.register(name, type, [desc]); Registers a tool with the Tools Manager. The 'name' is the name of the tool's Package (ie: 'PrimitiveCube'). This must not contain spaces or use characters that are invalid for package names. The 'type' parameter defines the type of the tool and lets the system know what functions the tool supports. One of the tool.type*() functions should be used in place of this parameter. Please see below for a list of available type functions. The optional 'desc' parameter is a user friendly name for the tool, and may contain spaces and any other characters that are valid in a string. If this parameter is empty or not included, then the 'name' will be used where ever 'desc' would be.
tool.confirmRegistration(name); Confirms that the given 'name' tool has been registered with the Tool Manager.
tool.getRegisteredToolDescription(name); Returns the description of a registered tool, or an empty string if a registered tool is not found.
tool.setToolProperty(name, key, value); Sets a tool's key/value property pair.
tool.hasToolProperty(name, key); Does the given tool have the requested property?
tool.getToolPropertyValue(name, key); Returns the value of the given tool's property, or an empty string if a registered tool is not found.
tool.getNumConflicts(); Returns the number of naming conflicts that have occurred once all of the tools have been registered. When there is a conflict, the last tool that is registered will be the one to respond to the tool's name.
tool.getConflict(num); Returns a string with the given conflict number's tool name and tool type separated with a tab.
tool.reloadToolPlugins(); Used to reload all tool plug-in scripts. This is handy for testing changes to a script. It is usually activated from the System->Reload Tool Scripts menu item.
tool.activate(name); Makes the given tool the currently active one. If there was already an active tool, then first deactivate it.
tool.deactivate([apply]); Deactivate the currently active tool. If the optional 'apply' parameter is set to 'true', then perform a tool.apply() just before deactivating the tool.
tool.isActive(); Returns true if a tool is active.
tool.getActive(); Returns the name of the currently active tool, or an empty string if there is no active tool.
tool.userActivation(); Indicates that the user wishes the current tool to turn itself on using the current parameters. This is usually caused by the user clicking on an 'Activate' button in the Tool Attributes Form.
tool.apply([flags]); Applies the currently active tool. This usually involves making the tool's parameters (such as position and size for a primitive) permanent for the selected item and storing an undo point. The optional flags indicate if something special should be done during or after the apply(). See the 'tool.apply() Method Flags' section below.
tool.reset(); Resets the currently active tool's parameters to some default values.
tool.reject(); Rejects the currently active tool's settings, but doesn't deactivate the tool. For tools that build geometry, the geometry will not be added to the scene. For transformation tools, the transform is not performed. Etc.
tool.refresh(); Allows external callers to force a refresh of the currently active tool. The tool itself may also use this to force an update outside of the normal plug-in tool methods, such as from a callback.
tool.setParam(parameter, value);This feature is not yet implemented. Sets the given parameter (supplied as a string with the name of the parameter) to the given value for the currently active tool. Returns 'true' if successful.
tool.getParam(parameter);This feature is not yet implemented. Returns the value of the given parameter (supplied as a string with the name of the parameter) for the currently active tool.
tool.getType(); Returns the type of the currently active tool. The value returned may be compared against the type*() functions to determine the tool's actual type.
tool.getFlags(); Returns the registration flags for the currently active tool. The value returned may be bitwise compared against the RFLAG*() functions to determine the flags set.
tool.getInterfaceFlags(); Returns the interface flags for the currently active tool. The value returned may be bitwise comapared against the IFLAG*() functions to determine the flags set.
tool.getApplyFlags(); Returns the apply flags for the currently active tool. The value returned may be bitwise compared against the AFLAG*() functions to determine the flags set.
tool.savePreset(name, [type]);This feature is not yet implemented. Saves the parameters for the currently active tool into a preset. Returns 'true' if successful. If the optional parameter 'type' is set to 'tool', then the preset will show up in the GUI's tool list as an independent tool (usually in a popup under the main tools) -- allows for the preset to be selected directly. Otherwise the preset will likely show up in a popup with the rest of the tool's parameters -- requires select tool and then select preset.
tool.activatePreset(name);This feature is not yet implemented. Activate the given preset for the currently active tool. This will override all of the tool's parameters with those of the preset. Return 'true' on success.
tool.isMouseOverHandle(event); Allows for a plug-in to determine if the mouse is over one of its handles. This is usually called from the plug-in's own MouseDown() method to determine if it should pass mouse handling onto the handles, or deal with it directly. The required 'event' parameter is the same as that passed to a plug-in's MouseDown(). The return value is the handle's index under the mouse, or -1 if the mouse is not over a handle. NOTE: Use of this method will trigger a call into the plug-in's own HandleCount() and Handle() methods.
tool.setUndoEntryLabel(label); Sets a custom label used for the tool's undo entry on the Undo Form. This may be set at any time during a tool's operation.

tool.apply() flags


The following flags are passed in a tool.apply() call.

tool.APPLY_NONE() No special flags for tool.apply().
tool.APPLY_DONOTSELECT() New or modified geometry will not be selected after the tool's operation -- usually because of a 'Make & Cont' button press in the user interface.
tool.APPLY_DONOTDEACTIVATE() The tool will not automatically be deactivated after it is applied.
tool.APPLY_FINISH() The tool will finish what it is doing and deactivate after an apply(). Used internally.

tool.register() type functions


The following are a set of functions that are used with tool.register() - one of these is used in place of the type parameter. See tool.register(); for more information.

tool.typeGeneric() Defines a 'Generic', execute once tool that uses the v1 function conventions. An example is the CSG Subtract tool.
tool.typeInteractive() Defines a standard tool that provides user interaction with the scene that uses the v1 function conventions. An example is the Build Cube tool.
tool.typeDialog() Defines a standard tool that provides a dialog user interface that uses the v1 function conventions. An example is the Center 1D tool.

tool.register() type flags


The following are a set of flags that are used with tool.register() - one of these is used in place of the type parameter. See tool.register(); for more information.

tool.RFLAG_NONE() No flags set
tool.RFLAG_STORETRANSFORMS() Store scene transforms before plug-in operations. All tool operations will then be relative to the stored transforms. All of the scene group centers are also updated before the tool is activated. This is usually set for a standard object transform tool.
tool.RFLAG_SUPPORTONECLICKCREATE() The plug-in supports the sending of a Make event after a mouse up on the first handle used. This procedure is activated by a preference setting.
tool.RFLAG_NOACTIVATION() The tool does not allow User Activation, likely because it is always active. This skips storing the transforms upon user activation if RFLAG_STORETRANSFORMS is set.
tool.RFLAG_NOIDCOMPRESSION() Normally object ID's are compressed down after a tool's operations to account for gaps while working. This disables the compression operation.
tool.RFLAG_ALLOWNONMODALSELECTION() Indicates the plug-in supports the user changing what is selected while the tool is active. The tool gives up some of its mouse control while operating in this manner. This procedure is activated by a preference setting.
tool.RFLAG_WORKWITHAXISGIZMO()This feature is not yet implemented. The plug-in works with the Axis Gizmo.

Tool activation flags


The following are a set of flags that are used during tool's Activate() method to indicate how the GUI is set up. It is set in the instance's flagsInterface member variable.

tool.IFLAG_NONE() No special interface flags
tool.IFLAG_HIDEMOUSE() Lock and hide the mouse in the 3D viewports while mouse is used.
tool.IFLAG_NOTOOLCURSOR() Do not change the mouse cursor to the standard tool shape.
tool.IFLAG_ACTIVATEBUTTON() Include the Activate button in the Tool Properties Form.
tool.IFLAG_RESETBUTTON() Include the Reset button in the Tool Properties Form.
tool.IFLAG_MAKEBUTTON() Include the Make button in the Tool Properties Form.
tool.IFLAG_MAKECONTBUTTON() Include the Make & Cont button in the Tool Properties Form.
tool.IFLAG_UVVIEW()This feature is not yet implemented. Indicates that the plug-in operates within the UV view. If not set, all mouse operations in the UV view will not be passed along to the plug-in.
tool.IFLAG_UVVIEWONLY()This feature is not yet implemented. Indicates that the plug-in operates only within the UV view and all mouse operations in other views will not be passed along to the plug-in. The plug-in will also only be asked to draw in the UV view.
tool.IFLAG_DRAWALLSAME() Indicates that all of the views draw the same information, and the plug-in's Draw() method will only be called once. If IFLAG_UVVIEW is not set, then the plug-in will not be asked to draw into the UV view.
tool.IFLAG_DRAWALLSAMEBUTUV() The same as IFLAG_DRAWALLSAME but will ask for a separate drawing for the UV view. Does nothing different from IFLAG_DRAWALLSAME if IFLAG_UVVIEW is not set.
tool.IFLAG_DRAWALLAXISSAME() Indicates that all of the views on the same axis will share the same drawing information. For example the Top and Bottom views will come from the same drawing buffer. This also allows the Perspective view to have its own drawing buffer. If IFLAG_UVVIEW is set then the UV view will be given its own buffer and Draw() call as well.
tool.IFLAG_ALLBUTTONS() Combines flags for create all Tool Properties buttons. The flags are: IFLAG_ACTIVATEBUTTON, IFLAG_RESETBUTTON, IFLAG_MAKEBUTTON, and IFLAG_MAKECONTBUTTON.
tool.IFLAG_STANDARDGEOMETRY() Combines flags for a standard geometry creation tool. The flags are: IFLAG_ACTIVATEBUTTON, IFLAG_RESETBUTTON, IFLAG_MAKEBUTTON, and IFLAG_MAKECONTBUTTON.
tool.IFLAG_STANDARDTRANSFORM() Combines flags for a standard object transform tool. The flags are: IFLAG_MAKEBUTTON, IFLAG_RESETBUTTON, and IFLAG_HIDEMOUSE.

Post-application scene geometry state flags


The following are a set of flags that are used during tool's Activate() method to indicate the state that scene geometry should be left after the tool plug-in has been applied. It is set in the instance's flagsApply member variables.

tool.AFLAG_NONE() No special apply flags
tool.AFLAG_SELECTNEW() Select all newly created objects/geometry.
tool.AFLAG_CLEARORIGINAL() Clear any original selections present prior to the tool being used.
tool.AFLAG_ALWAYSCONTINUEONMAKE() Indicates that a 'Make' is always treated as a 'Make & Cont' button action. The only way to exit the tool is to cancel it or choose another.
tool.AFLAG_NOMAKEONFINISH() Indicates that we do not perform a 'Make' operation during an apply() when the tool is told to finish.
tool.AFLAG_MAKEISFINISH() Indicates that a 'Make' operation is treated the same as a finish.
tool.AFLAG_STANDARDGEOMETRY() Combines flags for a standard geometry creation tool. The flags are: AFLAG_SELECTNEW and AFLAG_CLEARORIGINAL.
tool.AFLAG_STANDARDTRANFORM() Combines flags for a standard transform tool. The flags are: AFLAG_MAKEISFINISH and AFLAG_NOMAKEONFINISH.

Function return values



Generic functions

The following are a set of functions that are used as return values for a number of tool functions. They are normally used in the form of: return tool.FUNC_OK();

tool.FUNC_OK() The function was successful.
tool.FUNC_BADVERSION() The tool's Activation function was unable to handle the passed version.
tool.FUNC_BADVALUE() The tool's InterfaceSet() function indicates that the value attempting to be set against the given field is invalid. The actual value should again be retrieved from the tool.
tool.FUNC_BADSELECTMODE() The user is not in the correct selection mode for the plug-in.
tool.FUNC_BADGENERAL() A general problem that doesn't fit in the above categories.

CheckEditAction()

The following are a set of functions that are used as return values for the CheckEditAction() method. They are normally used in the form of: return tool.EDIT_UPDATE();

tool.EDIT_DONOTHING() Return for CheckEditAction() function. Indicates to Constructor to do nothing and leave the edit state unchanged.
tool.EDIT_UPDATE() Return for CheckEditAction() function. Indicates to Constructor to update itself with the new settings. This will cause the plug-in's BuildGeometry() function to be called.
tool.EDIT_ACCEPT() Return for CheckEditAction() function. Indicates to Constructor keep the last operation. This causes the plug-in's End() function to be called with the 'keep' parameter set to true.
tool.EDIT_REJECT() Return for CheckEditAction() function. Indicates to Constructor reject the last operation. This causes the plug-in's End() function to be called with the 'keep' parameter set to false.
tool.EDIT_ACCEPTANDCLONE() Return for CheckEditAction() function. Indicates to Constructor keep the last operation and start again with the same parameters. This causes the plug-in's End() function to be called with the 'keep' parameter set to true, and then immediately calls the plug-in's BuildGeometry() function.

Dirty()

The following are a set of functions that are used as return values for the plug-in's Dirty() method. They are normally used in the form of: return tool.DIRTY_NONE();

tool.DIRTY_NONE(); Flag that may be returned from the Dirty() function. It indicates that the tool's appearance does not need updating.
tool.DIRTY_APPEARANCE(); Flag that may be returned from the Dirty() function. It indicates that the tool's appearance including handles (but not geometry) needs to be redrawn.
tool.DIRTY_APPEARANCEMULTI(); Flag that may be returned from the Dirty() function. It behaves the same as DIRTY_APPEARANCE(), but the plug-in will be called once for each viewport type (ortho x, y, z and perspective) to allow it to look different depending on the viewport.

Drawing flags


The following are a set of functions that are used as flags for a tool's drawing calls.

tool.DRAW_SOLID() Flag that is used in a tool's drawing calls, which may be added with other flags of the same type. It indicates that a line should be drawn as a solid.
tool.DRAW_DASH() Flag that is used in a tool's drawing calls, which may be added with other flags of the same type. It indicates that a line should be drawn with dashes.
tool.DRAW_ABSOLUTE() Flag that is used in a tool's drawing calls, which may be added with other flags of the same type. It indicates that the given coordinates are in absolute world space.
tool.DRAW_RELATIVE() Flag that is used in a tool's drawing calls, which may be added with other flags of the same type. It indicates that the given coordinates are relative to the coordinates used in the last drawing function call.

UserEvent events


The following are a set of functions that are used to indicate a particular user event has occurred, and are passed along to the UserEvent() method.

tool.EVENT_ACTIVATE() User event passed to UserEvent() to indicate that the user has activated the tool. The tool should restart its operations with the current settings.
tool.EVENT_RESET() User event passed to UserEvent() to indicate that the user has activated the tool. The tool should reset back to default parameters.
tool.EVENT_DEACTIVATE() User event passed to UserEvent() to indicate that the user has activated the tool. The tool has been deactivated (turned off, user selected another tool, etc.).
tool.EVENT_TEXTURECHANGE() User event passed to UserEvent() to indicate that the user has changed the currently active texture.
tool.EVENT_ACTIONCENTERCHANGE() User event passed to UserEvent() to indicate that the user has changed the current Action Center.
tool.EVENT_SELECTIONMODECHANGE() User event passed to UserEvent() to indicate that the user has changed the current selection mode. Ie: Brushes, Faces and Vertices.
tool.EVENT_SELECTIONCHANGE() User event passed to UserEvent() to indicate that the user has changed what items are currently selected. This event is also sent when the user has changes the current selection mode and is sent just after a tool.EVENT_SELECTIONMODECHANGE() event. This is only passed to the plug-in if it has set the tool.RFLAG_ALLOWNONMODALSELECTION() registration flag.
tool.EVENT_AXISGIZMOCHANGE() This feature is not yet implemented. User event passed to UserEvent() to indicate that the user has modified the Axis Gizmo. This is only passed to the plug-in if it has set the tool.RFLAG_WORKWITHAXISGIZMO() registration flag. The data for the event is of the form: change flags TAB world pos TAB delta pos TAB delta rotation TAB delta scale and the 'change flags' are: 1 = position 2 = rotation 4 = scale

Drawing methods


Tool drawing methods called from within toolPluginDraw(%inst, %draw).


Drawing functions


%draw.moveTo(flags, x, y, z); Moves the drawing pen to the given location. The 'flags' are a combination of tool.DRAW_*() flags added together.
%draw.moveTo(flags, "x y z"); Alternate form of %draw.moveTo(flags, x, y, z) where the coordinates are provided as a string.
%draw.lineTo(flags, x, y, z); Draws a line from the current pen location to the given location. The 'flags' are a combination of tool.DRAW_*() flags added together. When the method returns, the current pen location will be set to the end of the line.
%draw.lineTo(flags, "x y z"); Alternate form of %draw.lineTo(flags, x, y, z) where the coordinates are provided as a string.
%draw.plus(flags, radius); Draws a plus at the current pen location with the given radius. The 'flags' are a combination of tool.DRAW_*() flags added together.
%draw.circle(flags, radius, x, y, z);This feature is not yet implemented. Draws a circle at the current pen location with the given radius. The 'flags' are a combination of tool.DRAW_*() flags added together. The given x, y, and z coordinates are the circle's normal vector.
%draw.circle(flags, radius, "x y z");This feature is not yet implemented. Alternate form of %draw.circle(flags, x, y, z) where the coordinates are provided as a string.
%draw.orthoCircle(flags, radius);This feature is not yet implemented. Draws a circle at the current pen location with the given radius. The difference with this circle is that it only draws within orthographic views and always facing the camera.
%draw.buildQuad(flags, "x1 y1 z1", "x2 y2 z2", "x3 y3 z3", "x4 y4 z4"); Draw a quad polygon at the current pen location. Requires four points.
%draw.buildTriangle(flags, "x1 y1 z1", "x2 y2 z2", "x3 y3 z3"); Draw a triangle polygon at the current pen location. Requires three points.
%draw.handle(flags, "r g b", "x y z"); Draws a standard handle at the given point in the given color. This command does not change the position of the current pen. The flags determine the type of handle that is drawn, and are listed below.
%draw.changeColor(r, g, b); Change the color of the pen.
%draw.changeColor("r g b"); Alternate form of %draw.changeColor(r, g, b) where the colors are provided as a string.
%draw.changeColorAlpha(r, g, b, a); Change the color of the pen, including its alpha value.
%draw.changeColorAlpha("r g b a"); Alternate form of %draw.changeColorAlpha(r, g, b, a) where the colors and alpha are provided as a string.

Support functions


%draw.getView(); Returns the current view number to allow a tool to draw itself differently based on the view. The following numbers are valid: 0 Top 1 Bottom 2 Front 3 Back 4 Left 5 Right 6 Perspective 7 UV

Drawing flags


%draw.LINE_SOLID(); Draw solid lines [default]
%draw.LINE_DASHED(); Draw dashed lines
%draw.COORD_ABSOLUTE(); Given coordinates are in world space [default]
%draw.COORD_RELATIVE(); Given coordGiven coordinates are relative to previous coordinates
%draw.DRAW_NONOCCLUDED_ONLY(); Only draw in the nonoccluded buffer
%draw.POLYGON_SOLID(); Draw solid polygons [default]
%draw.POLYGON_OUTLINE(); Draw outlined polygons

Handle flags


%draw.HANDLE_CUBE(); Indicates that the handle will be drawn as a cube.
%draw.HANDLE_PLUS(); Indicates that the handle will be drawn as a plus.
%draw.HANDLE_ACTION_X(); Indicates that the handle will be drawn as an Action Center facing down the x-axis.
%draw.HANDLE_ACTION_Y(); Indicates that the handle will be drawn as an Action Center facing down the y-axis.
%draw.HANDLE_ACTION_Z(); Indicates that the handle will be drawn as an Action Center facing down the z-axis.

Scene edit methods


Tool scene edit methods called from within toolPluginBuildGeometry(%inst, %edit).


Edit functions


%edit.end(%error, %select); Indicates that the editing operation is complete. This is not called by tool plug-ins and is automatically handled by the Tool Manager. If a scene operation has been started manually, then the done() method will need to be called. All editing operations are buffered internally and not permanently added to the scene until this method is called, and even then only if %error contains a success code (see the list of error flags below). %select indicates if the current selection state should be modified at the end of the edit operation and contains one of the selection flags below.
%edit.deferMapBrushTextureLoading(); Defers MapBrush texture loading when the brush is added to the map.
%edit.doMapBrushTextureLoading(); Forces the MapBrush texture loading to occur.
%edit.doDetailedMapBrushTextureLoading(); Forces the MapBrush texture loading to occur as if all brushes are 'detailed' ones. Ie: no calculateBrushTexGenDiv() is called on the brush as detailed brushes already contain this information.
%edit.clearAllNewBrushes(); Clears all brushes that have been created during the editing process from the editing buffer. This is typically called before a plug-in recreates all brushes based on new user input. This method does not return a value.
%edit.updateBrush(%brush); Updates the given brush in the edit buffer, or adds it to the buffer if it does not yet exist. A brush is a special class (created with %brush = new MapBrush()) that allows the building of planes and assignment of texture coordinates with the ultimate goal of creating geometry. See the brush class below for its specific methods. This method returns the Map ID of the added brush.
%edit.getEditBrushCount(); Returns the number of brushes that are in the edit buffer.
%edit.getEditBrush(%index); Returns the MapBrush object given the brush index within the edit buffer. %index ranges from 0 to %edit.getEditBrushCount()-1.
%edit.getEditBrushID(%index); Returns the brushID for the given brush index within the edit buffer. %index ranges from 0 to %edit.getEditBrushCount()-1.
%edit.setBrushPosition(%brushID, "x y z"); Moves the given brush to the provided map-based coordinates.
%edit.moveBrushesRel("x y z"); Moves all selected brushes, or if none are selected then all visible brushes by the given offset.
%edit.moveBrushesAbsolute("x y z");This feature is not yet implemented. Moves all selected brushes, or if none are selected then all visible brushes to the given position in map coordinates. The actual point that is moved is the current action center, such as the selected brush's centroid.
%edit.moveItemsRel("x y z");This feature is not yet implemented. Moves all selected items (brushes, scene shapes, etc.), or if none are selected then all visible items by the given offset.
%edit.updateBounds();This feature is not yet implemented. Manually updates the bounds of the scene.
%edit.updateSelectionBounds();This feature is not yet implemented. Manually updates the bounds of only the selected items.

Progress dialog functions


%edit.openProgressDialog(title); Open the tool progress dialog window with the given title
%edit.closeProgressDialog(); Close the tool progress dialog window.
%edit.updateProgressDialog(text, percent); Update the tool progress dialog window. 'text' is the label above the progress control and 'percent' is the percentage to fill in the progress contro.

Transform type tool functions


%edit.moveItemsRelBuf("x y z"); Moves all selected items (brushes, scene shapes, etc.), or if none are selected then all visible items by the given offset. The offset is relative to the item's position prior to any editing operation as stored at the start of the tool edit operation.
%edit.rotateItemsCenterRelBuf(offset:"x y z", center:"x y z"); Rotates all selected items (brushes, scene shapes, etc.), or if none are selected then all visible items by the given offset and about the given center. The given rotational offset is relative to the item's rotation as stored at the start of the tool edit operation.
%edit.rotateItemsGroupRelBuf(offset:"x y z"); Rotates all selected items or if none are selected, all visible items about their group's center. If an item is not grouped, it is then rotated about its origin. The given rotational offset is relative to the item's rotation as stored at the start of the tool edit operation.
%edit.rotateItemsOriginRelBuf(offset:"x y z"); Rotates all selected items or if none are selected, all visible items about their origin. The given rotational offset is relative to the item's rotation as stored at the start of the tool edit operation.
%edit.scaleItemsCenterRelBuf(offset:"x y z", center:"x y z"); Scales all selected items (brushes, scene shapes, etc.), or if none are selected then all visible items by the given offset and about the given center. The given scale offset is relative to the item's scale as stored at the start of the tool edit operation.
%edit.scaleItemsGroupRelBuf(offset:"x y z"); Scales all selected items or if none are selected, all visible items about their group's center. If an item is not grouped, it is then scaled about its origin. The given scale offset is relative to the item's scale as stored at the start of the tool edit operation.
%edit.scaleItemsOriginRelBuf(offset:"x y z"); Scales all selected items or if none are selected, all visible items about their origin. The given scale offset is relative to the item's scale as stored at the start of the tool edit operation.
%edit.moveBrushesRelBuf("x y z"); Moves all selected brushes, or if none are selected then all visible brushes by the given offset. The offset is relative to the brush's position prior to any editing operation as stored at the start of the tool edit operation.
%edit.rotateBrushesCenterRelBuf(offset:"x y z", center:"x y z"); Rotates all selected brushes, or if none are selected then all visible brushes by the given offset and about the given center. The given rotational offset is relative to the brush's rotation as stored at the start of the tool edit operation.

Error return functions


%edit.ERR_NONE(); No error.
%edit.ERR_ABORT(); The plug-in has aborted its edit operation. No changes will be made.

Selection flags


%edit.END_LEAVEASIS(); Indicates that the current scene selection state should be left as is. This flag should not be combined with any other flags.
%edit.END_SELECTNEW(); Indicates that all of the newly created geometry should be marked as selected in the scene. This takes into account the current selection type as selected by the user (ie: Vertices, Faces, etc.)
%edit.END_FORCEBRUSHES();This feature is not yet implemented. Forces the selection of newly created geometry at the brushes level regardless of the current selection type. When combined with DONE_SELECTNEW(); the new geometry may be selected within two selection type 'buckets' if the current selection type is not at the brush level.
%edit.END_CLEARORIGINAL(); Indicates that the scene selection state just prior to the plug-in being activated should be clear. When used in combination with the DONE_SELECTNEW(); flag, only the new geometry will be selected regardless of what the user had previously selected.
%edit.END_CLEAREDITSELECT();This feature is not yet implemented. Indicates that any new selections that were made over the course of the edit operation should be cleared. This may be combined with DONE_SELECTNEW();

MapBrush class methods


%brush.getBrushID(); Returns the Map ID of the brush.
%brush.setType(%type); Used to set the brush's type using one of the functions below. If this method is not used, then the 'structural' type is assumed.
%brush.setMaterial(%material); Sets the current material that will be mapped onto all planes that are subsequently created. %material is a string containing the texture name, or an empty string to use the current texture as defined by the user.
%brush.setTextureOrigin("x y z"); Sets the texture origin for all brush texture functions that follow. The default is "0.0 0.0 0.0" which makes the texture coordinate system the same as the Brush.
%brush.setTextureScale(%u_scale, %v_scale); Sets the current texture scale for all brush texture functions that follow.
%brush.setTextureOffset(%u_offset, %v_offset); Sets the current texture offset for all brush texture functions that follow.
%brush.setTexturePlanes(u:"x y z d", v:"x y z d"); Sets the current texture planes, modified by the current offset and scale. This function does not make use of %brush.setTextureOrigin() so the planes are built in Brush coordinates.
%brush.setTexturePlanesByPoints(p1:"x y z", p2:"x y z", p3:"x y z" [, %u_value, %v_value]); Sets the current texture planes given a number of parameters. 'p1', 'p2' and 'p3' define the plane on which the texture will be applied, and should be given clockwise around the texture plane's normal vector. The texture's u coordinate follows the 'p2' to 'p1' vector while the texture's v coordinate follows the 'p2' to 'p3' vector. The given points are in Brush space as defined by %brush.setTextureOrigin(). Two optional parameters may be provided: the u and v coordinate at point 'p2'. These are helper parameters that allow the given points to represent a specific point within the texture coordinates rather than the texture's origin. The current texture scale as set by %brush.setTextureScale() is taken into account with these optional parameters.
%brush.setTexturePlanesByPointsCentered(p1:"x y z", p2:"x y z", p3:"x y z" [, %u_value, %v_value]); Works the same as %brush.setTexturePlanesByPoints() but ensures that any scaling that is set by %brush.setTextureScale() is centered around point 'p2' rather than the texture origin.
%brush.setTextureCubeProjection();This feature is not yet implemented. Sets the current texture planes using a cube map-like projection scheme. The look-up into the cube map is performed when the planes are generated. The origin of the cube map is set with %brush.setTextureOrigin().
%brush.setTexturePlanarProjection(direction:"x y z");This feature is not yet implemented. Sets the current texture planes using a planar projection scheme. The 'direction' vector points in the direction of the projection. The origin of the projection is set with %brush.setTextureOrigin().
%brush.setOrigin("x y z"); Sets the origin for all brush functions that follow. The default is "0.0 0.0 0.0" which makes the brush coordinate system the same as the Map.
%brush.clearAllPlanes(); Deletes all planes currently defined for the brush.
%brush.addPlane("x y z d"); Adds a plane to the brush using the standard plane equation's parameters given as a string vector. The plane is given the current material and appropriate texture coordinates. Returns 'true' if the plane was added to the brush. This function does not make use of the %brush.setOrigin() function which means the plane is built in Map coordinates.
%brush.addPlaneByPoints("x y z", "x y z", "x y z"); Adds a plane to the brush based on three given points. These points should be given clockwise around the intended normal vector. The plane is given the current material and appropriate texture coordinates. Returns 'true' if the plane was added to the brush.
%brush.projectPointOnPlane(p1:"x y z", p2:"x y z", p3:"x y z", point:"x y z"); This helper function takes a plane given by three points (clockwise around the intended normal vector), projects the given point onto the plane, and returns the resultant point as a string of "x y z".

Tool event methods


Tool event variables and methods - such as accessed from toolPluginMouseDown(%this, %inst, %event);

%event.getMousePointAlongLocalX(origin:"x y z", xpnt:"x y z"); Helper function to calculate the current mouse position for the event along the local axis as defined from an origin and a point along the x-axis.
%event.getMousePointAlongLocalY(origin:"x y z", xpnt:"x y z"); Helper function to calculate the current mouse position for the event along the local axis as defined from an origin and a point along the y-axis.
%event.getMousePointAlongLocalZ(origin:"x y z", xpnt:"x y z"); Helper function to calculate the current mouse position for the event along the local axis as defined from an origin and a point along the z-axis.
%event.MOD_SHIFT(); Returns true if the event's 'modifier' field indicates the SHIFT key being held by the user.
%event.MOD_LSHIFT(); Returns true if the event's 'modifier' field indicates the Left SHIFT key being held by the user.
%event.MOD_RSHIFT(); Returns true if the event's 'modifier' field indicates the Right SHIFT key being held by the user.
%event.MOD_CTRL(); Returns true if the event's 'modifier' field indicates the CTRL key being held by the user.
%event.MOD_LCTRL(); Returns true if the event's 'modifier' field indicates the Left CTRL key being held by the user.
%event.MOD_RCTRL(); Returns true if the event's 'modifier' field indicates the Right CTRL key being held by the user.
%event.MOD_ALT(); Returns true if the event's 'modifier' field indicates the ALT key being held by the user.
%event.MOD_LALT(); Returns true if the event's 'modifier' field indicates the Left ALT key being held by the user.
%event.MOD_RALT(); Returns true if the event's 'modifier' field indicates the Right ALT key being held by the user.
%event.FLAG_CONSTRAINED(); Returns true if the user is constraining mouse movement to a particular orthographic axis.
%event.FLAG_CONSTRAINEDX(); Returns true if the user is constraining mouse movement along the X-axis.
%event.FLAG_CONSTRAINEDY(); Returns true if the user is constraining mouse movement along the Y-axis.
%event.FLAG_CONSTRAINEDZ(); Returns true if the user is constraining mouse movement along the Z-axis.

Interface methods


Tool interface methods called from within toolPluginInterface(%inst, %form).

%form.defineTitle(title); Defines the title for the tool's interface -- usually displayed at the top of the rest of the fields. This must always be provided if the tool's interface is to be valid, although tools that don't require an interface need not define it.
%form.addField(id, caption, controlType); Adds a field to the tool's interface. 'id' is the tool plug-in's ID for the control. Providing a value of -1 for the ID makes the control inert and doesn't communicate with the tool -- usually used for dividers. 'caption' is the label that is used for the control as displayed to the user. Sometimes the control will add additional text to the label -- such as axis names for a distance3 control. The 'controlType' is a string that defines the control's type ie: "distance3" or "divider".
%form.addFieldListItem(fieldID, name); Adds an item to a control's list. The control must of course support a list for this to me meaningful. 'fieldID' is the tool plug-in's ID for the control and 'name' is the name of the item to be added. Each item will internally be assigned an integer starting with 0 for the first item.
%form.clearFieldListItems(fieldID); Clears all list items from the given field. The control must of course support a list for this to be meaningful. 'fieldID' is the tool plug-in's ID for the control.
%form.setFieldMaxLimit(fieldID, limit); Sets the given field's maximum value. Entered values or changes made using a spinner control may not exceed this limit.
%form.setFieldMinLimit(fieldID, limit); Sets the given field's minimum value. Entered values or changes made using a spinner control may not go below this limit.
%form.clearFieldLimits(fieldID); Removes any existing limits from the given field.



Miscellaneous



Dynamic Controls


Dynamic Controls - Control type strings that may be used to dynamically build a control

actionpopup Builds a popup control that displays a constant label on the control regardless of what is selected. It is intended to be used to list a set of actions that the user may choose from, such as a list of presets. Each item in the popup's list is referenced by an integer, starting with 0 for the first item. Use the Tool Interface's addFieldListItem() method to add items to the popup and the clearFieldListItems() method to clear all items from the popup. The first item added to the list becomes the popup's title. This control still supports the standard label just like the ordinary popup control.
angle Builds a single text edit control intended to be used to represent an angle in degrees. The label provided to the control is displayed to the left of the edit control box. This control supports equations.
angle3 Builds vertical stack of 3 text edit controls, each with a label of H, P and B, intended to be used to represent heading, pitch and bank angles in degrees. The label provided to the control is displayed to the left of the H edit control. This control supports equations.
axis2 Builds a series of horizontal buttons labeled X and Y. This allows the user to choose an axis on which something will be performed. This control uses an integer to represent the axis: 0=X 1=Y.
axisHV Builds a series of horizontal buttons labeled H and V. This allows the user to choose an axis on which something will be performed. This control uses an integer to represent the axis: 0=H 1=V.
axis3 Builds a series of horizontal buttons labeled X, Y and Z. This allows the user to choose an axis on which something will be performed. This control uses an integer to represent the axis: 0=X 1=Y 2=Z.
axisdirection Builds a series of horizontal buttons labeled '+' and '-'. This allows the user to choose a direction along an axis on which something will be performed. This control uses an integer to represent the axis: 0='+' 1='-'.
button Builds a push button with the given label centered within it. When the button is pressed it broadcasts a value of 1. This button ignores attempts at setting its state.
checkbox Builds a single check box control with a label to the left.
choices Builds a series of horizontal buttons that are mutually exclusive that display similarly to the axis3 control. Use clearFieldListItems() and addFieldListItem() to clear and set the button labels. The value of this control represents which button is pressed and ranges from 0 to (num of buttons - 1).
color3 Builds a row of three integer edit fields to enter the RGB components of a color and a small color preview box. No label is provided.
distance Builds a single text edit control intended to be used to represent a distance. The label provided to the control is displayed to the left of the edit control box. This control supports equations.
distance2 Builds vertical stack of 2 text edit controls, each with a label of X and Y, intended to be used to represent a distance. The label provided to the control is displayed to the left of the X-axis edit control. This control supports equations.
distanceHV Same as distance2 but contains the labels H and V for horizontal and vertical.
distance3 Builds vertical stack of 3 text edit controls, each with a label of X, Y and Z, intended to be used to represent a distance. The label provided to the control is displayed to the left of the X-axis edit control. This control supports equations.
divider Builds a horizontal divider line. If a caption is provided, it is placed over top of the line -- usually to title a section.
label Builds a single line of text to be used as a label.
numeric Builds a single text edit control intended to be used to store a number. The label provided to the control is displayed to the left of the edit control box. This control supports equations.
numericinteger Same as numeric but only allows integers.
pointentitylist A very specific control that lists all point entities for the current scene's game type. The value passed to and from this control is the database ID of the chosen point entity.
popup Builds a popup control. Each item in the popup's list is referenced by an integer, starting with 0 for the first item. Use the Tool Interface's addFieldListItem() method to add items to the popup and the clearFieldListItems() method to clear all items from the popup.
radio Builds a vertical stack of mutually exclusive radio buttons. If a label is provided then it is displayed to the left of the radio buttons, otherwise the radio buttons take up the entire width. Use clearFieldListItems() and addFieldListItem() to clear and set the button labels. The value of this control represents which button is active and ranges from 0 to (num of buttons - 1).
scriptbutton Builds a push button with the given label centered within it. When the button is pressed it issues its given script command and doesn't broadcast any messages about its change in state. Use the Tool Interface's addFieldListItem() method to set the button's script command.
text Builds a single text edit control intended to store a string. The label provided to the control is displayed to the left of the edit control box.
textro Builds a single read-only text control. The label provided is displayed to the left of the text control.

Preference Management


Preferences Manager - Manages preferences stored in the Preferences Database


Functions


Functions used to handle preferences.

pref.set(prefname, value); Sets the given preference to the given value.
pref.get(prefname); Returns the value of the given preference. If the preference doesn't exist, an empty string is returned (which is also a valid value).
pref.getFloat(prefname); Returns the value of the given preference as a floating point value.
pref.getInt(prefname); Returns the value of the given preference as an integer.
pref.getBool(prefname); Returns the value of the given preference as a boolean value.
pref.getColorI(prefname); Returns the value of the given preference as an integer color triplet.
pref.addPref(prefname, description, type, tgevariable, defaultvalue); Adds a preference to the manager. The 'prefname' is used to reference the prefernece from various functions. The 'description' is a user friendly description that could be displayed in a form or dialog. The 'type' tells the Preferences Manager what type of data is stored so that it may present the correct GUI control to the user when it comes time to change it -- this is the same as the Dynamic Control names. The 'tgevariable' is the name of the global variable that is used to actually store the value, usually begining with "$pref::Constructor::" which will allow the preference to persist. But it doesn't have to be. Finally, the 'defaultvalue' is what value the preference should be given if the TGE global variable doesn't currently exist.
pref.addPrefF32(prefname, description, type, tgevariable, defaultvalue); Same as above but specific to a float.
pref.addPrefS32(prefname, description, type, tgevariable, defaultvalue); Same as above but specific to an integer.
pref.addPrefBool(prefname, description, type, tgevariable, defaultvalue); Same as above but specific to a bool.
pref.addPrefColorI(prefname, description, type, tgevariable, defaultvalue); Same as above but specific to an integer color provided as a triplet.

Preferences


The following is a list of preferences and their type.

SnapToGrid Should all objects be snapped to the grid when moving, creating, etc. 0=No snapping, 1=1/10 of current grid size, 2=Fixed sizestaticpopup
GridSnapValue The distance that objects should be snapped to when SnapToGrid = 2. distance
GridUnits This feature is not yet implemented. When zooming the camera, the grid resizes itself to remain useful. This value determines at what sizes the grid should change at. 0='1', 1='1 2', 2='1 2.5', 3='1 5', 4='1 2 5', 5='1 2.5 5'. For example, setting to '1 2' would have the grid change at values that start with 1 or 2 such as 100mm, 200mm, 1m, 2m, 10m, etc. staticpopup
LastLayout The name of the last layout selected by the user. text
ToolRotationAmount The amout in degrees that an item should rotate when the mouse is moved one pixel with the Transform: Rotate tool. angle
LastMaterialGroup The last material group selected by the user. numeric
LastMaterialTexture The last material texture selected by the user numeric
RecentlyOpenedSceneX A list of recently opened scene filenames, where X=0-4. text
RecentlyImportedShapeX A list of recently imported shape filenames, where X=0-4. text
VisibleDistance Visible distance in 3D views distance
ZoomNominalDistance Distance from camera orbit point at which zoom speed is not modified distance
TranslateNominalDistance Distance from camera orbit point at which translate speed is not modified distance

Workplane Methods


Workplane Methods - Manages the workplane and standard grid

workplane.gridDraw(enable); Used to turn the drawing of the standard grid on (enable = true) or off.
workplane.draw(enable);This feature is not yet implemented. Used to turn the drawing of the workplane on (enable = true) or off.