Pmodel¶
-
LXsITYPE_MESHOP
¶ The procedural modeling system works by evaluating a series of mesh operations, on a target mesh, to result in a final modified mesh. To integrate a mesh operation interface into the procedural modeling system, the mesh operations need to be associated with an item, that can be managed by the user. The mesh operation item performs this duty. It contains a MeshOpObj channel which stores the mesh operation, and is evaluated by the procedural modeling system, to perform an edit to the mesh. Mesh Operation items all derive from a common type. This type is extremely basic and has no transforms or position in 3D space. There are four default channels on every Mesh Operation Item, defining things like selection type and the enable state.
LXsICHAN_MESHOP_ENABLE
LXsICHAN_MESHOP_OBJ
LXsICHAN_MESHOP_SELTYPE
LXsICHAN_MESHOP_USEXFRM
-
LXsPKG_MESHOP_CREATECMD
¶ The custom creation command allows a custom command to be fired to handle the creation of the mesh operation item. This is useful if additional setup is required, that is unique to a specific mesh operation item.
-
LXsPMODEL_NOTRANSFORM
¶ Adding this tag to a mesh operation, selection operation or tool operation items specifies that the item does not require the transform of the mesh being modified. This can improve performance in certain cases, as the operation will not be reevaluated when the mesh transform changes. The tag can have any value.
-
LXsMESHOP_PMODEL
¶ The steps to manually implement a Mesh Operation item can be quite complex. Because of this, a simpler method is provided, allowing ILxMeshOperation interfaces to be automatically converted into Mesh Operation items. This is only useful for simple mesh operations, that simply take a mesh, modify it and return a modified mesh, using nothing more than a few simple attributes. Applying the following server tag to an ILxMeshOperation interface, will automatically create a mesh operation item and a modifier, writing the mesh operation server into a channel, so that it can be evaluated as part of the procedural system. The Mesh Operation server being converted, should also implement an Attributes interface. The attributes will be automatically converted into channels on the newly created item. The value of this tag doesn’t matter, as the presence of the server tag is enough to automatically create a mesh operation item.
-
LXsITYPE_TOOLOP
¶ Tool Operation items all derive from a common type, which it itself a sub-type of the Mesh Operation item type.
-
LXsGRAPH_TOOL
¶ The “tool” graph is automatically added to any tool operation item that performs an “actor” task. It is used to connect non-actor tools into the actor tool to create a mini-toolpipe. This mini tool pipe is evaluated, allowing the behavior of an actor tool to be modified.
-
LXsTOOL_PMODEL
¶ There are a number of similarities between procedural mesh operations and traditional tools that operate on meshes. Rather than implementing a tool for one context and a mesh operation for another context, it is often desirable to implement functionality once and use in both contexts. As we have a large library of existing tools, converting a tool to work with the procedural modeling system needs to be quick and painless. Adding the following server tag to an ILxTool server, will automatically convert the tool into a Tool Operation Item, that can be integrated directly into the procedural modeling system. The value of this tag doesn’t matter, as the presence of the server tag is enough to convert the tool to work with the procedural modeling system.
-
LXsICHAN_TOOL_OBJ
¶ Whilst the addition of the server tag makes it simple to convert an existing tool to work with the procedural modeling system, more work is often needed to the tool itself, to ensure it works correctly in an evaluated context. The tool should implement a GetOp function that spawns and returns a Tool Operation interface. Some considerations also need to be made to the evaluation of the tool operation. The general rule is that when evaluated procedurally, a tool should not rely on any global state, or values that aren’t provided by either tool attributes or tool packets. It should not attempt any operation that requires an undo context or attempt to execute commands. With some thought and design, it should be possible to convert most tools that operate on meshes, to work in a procedural context, without altering the functionality of the tool itself. On automatically generated tool operation items, the tool object will be stored in the following channel.
-
LXsPKG_TOOL_CHANNEL
¶ Whilst it’s often desirable to automatically generate a Tool Operation item from an existing tool, it is also possible to manually implement Tool Operation items that can be integrated into the procedural system. This is useful for writing tool operation items that provide more complexity than is usually supported through the tool system. To create a Tool Operation Item from scratch. A package should be created, with a SuperType of LXsITYPE_TOOLOP. This will provide it with the standard set of channels, common to all Tool Operation items. A Modifier, associated with the Tool Operation Item, should read any channels it requires to evaluate the tool. It should spawn an ILxTool interface and write it into a channel on the package of the type LXsTYPE_OBJREF. The channel name used for storing the tool, should be defined on the server tags using the following tag.
-
LXsPKG_TOOL_TASK
¶ Two other server tags should also be added to the package. One defines the task of the tool, and should be of the type LXs_TASK. The other defines the order of evaluation and should be one of the LXs_ORDPKG_ defines here. In the majority of cases, the TASK value should match what is returned by the tool, and the ORD value should be equivalent to the LXs_ORD value returned by the tool.
LXsPKG_TOOL_ORDER
LXs_ORDPKG_WORK
LXs_ORDPKG_SYMM
LXs_ORDPKG_CONT
LXs_ORDPKG_STYL
LXs_ORDPKG_SNAP
LXs_ORDPKG_CONS
LXs_ORDPKG_ACEN
LXs_ORDPKG_AXIS
LXs_ORDPKG_PATH
LXs_ORDPKG_WGHT
LXs_ORDPKG_PINK
LXs_ORDPKG_NOZL
LXs_ORDPKG_BRSH
LXs_ORDPKG_PTCL
LXs_ORDPKG_SIDE
LXs_ORDPKG_EFFR
LXs_ORDPKG_ACTR
LXs_ORDPKG_POST
ILxMeshElementGroup¶
-
class
ILxMeshElementGroup
¶ Mesh Operations and Tool Operations can optionally implement an ILxMeshElementGroup interface. This interface is used to get named groups of elements that have been modified, or created by the procedural operation. These can then be used to define new selections later in the stack, allowing the user to easily access elements from an earlier operation. The returned groups should have a descriptive name that is easily understandable to the user, and is clear how it relates to the operation. For example, a curve extrude operation may return two groups; one named “End Caps” and another named “Sides”.
Public Functions
-
LxResult
GroupCount
(LXtObjectID self, unsigned int *count)¶ This method is expected to return the number of element groups.
-
LxResult
GroupName
(LXtObjectID self, unsigned int index, const char **name)¶ This method should return the name of an element group by index.
-
LxResult
GroupUserName
(LXtObjectID self, unsigned int index, const char **username)¶ This method should return the username of an element group by index. Ideally, this would be a translatable entry in a message table.
-
LxResult
TestPoint
(LXtObjectID self, unsigned int index, LXtPointID point)¶ This method returns either LXe_TRUE or LXe_FALSE, indicating whether or not the given point exists in the group. The group to test is given by index.
-
LxResult
TestEdge
(LXtObjectID self, unsigned int index, LXtEdgeID edge)¶ This method returns either LXe_TRUE or LXe_FALSE, indicating whether or not the given edge exists in the group. The group to test is given by index.
-
LxResult
TestPolygon
(LXtObjectID self, unsigned int index, LXtPolygonID polygon)¶ This method returns either LXe_TRUE or LXe_FALSE, indicating whether or not the given polygon exists in the group. The group to test is given by index.
-
LxResult
-
LXsGRAPH_SELOP
¶ The selection operation item provides a selection to the procedural system. It encapsulates channels that can be evaluated to determine the current selection state. This item will be evaluated prior to a procedural edit to determine which elements should be operated on. Selection Operation items all derive from a common type. This type is extremely basic and has no transforms or position in 3D space. The default channels define enable state, the output channel to which the ILxSelectionOperationID is written, whether the selection operation should be inverted, and the blend mode used to blend multiple selection operations together.
LXsITYPE_SELOP
LXsICHAN_SELOP_ENABLE
LXsICHAN_SELOP_OBJ
LXsICHAN_SELOP_INVERT
LXsICHAN_SELOP_BLENDMODE
-
LXiSELOP_BLEND_OVERRIDE
¶ When multiple selection operations are connected to a mesh operation, they can be blended together to create complex selections. This is similar to the concept of shading, where multiple texture layers can be blended together to create a final texture. The following blending modes are available:
OVERRIDE This blending mode (default) will override all selection operations below it in the stack. Any previous selection will be discarded, and the new selection will be used instead.
ADD This blending mode will add the new selection to the previous selection. Elements will only be treated as deselected if they are deselected by all selection operations in the stack.
SUBTRACT This blending mode will remove any elements that are selected by the selection operation from the previous selection. Deselected elements will be ignored.
MULTIPLY This blending mode will only select elements from the second selection operation that are selected by the first, essentially filtering the previous selection.
LXiSELOP_BLEND_ADD
LXiSELOP_BLEND_SUBTRACT
LXiSELOP_BLEND_MULTIPLY
-
LXsPMODEL_SELECTIONTYPES
¶ Selection Operations should specify the types of selection they support. Mesh Operation and Tool Operation items should also specify the type of selections they require. This combination of selection types on both the selection operation and the mesh operation, helps determine which selection operations can be used with which mesh operations. Supported selection types are defined using the following server tag. The server is expected to provide a comma seperated list of selection types. The server can also specify that no selection is required by returning the NONE value. If no tag is provided, it will be assumed that all types are supported.
-
LXsSELOP_TYPE_NONE
¶ The server tag must have one of the following values. Any other value will be treated as supporting all selection types.
LXsSELOP_TYPE_VERTEX
LXsSELOP_TYPE_EDGE
LXsSELOP_TYPE_POLYGON
-
LXsSELOP_PMODEL
¶ The steps to manually implement a Selection Operation item can be quite complex. Because of this, a simpler method is provided, allowing ILxSelectionOperation interfaces to be automatically converted into Selection Operation items. This is only useful for simple selection operations, that can test the selection status of an element without any complex channel input-> Applying the following server tag to an ILxSelectionOperation interface, will automatically create a selection operation item and a modifier, writing the Selection operation server into a channel, so that it can be queried as part of the procedural system. The Selection Operation server being converted, should also implement an Attributes interface. The attributes will be automatically converted into channels on the newly created item. The value of this tag doesn’t matter, as the presence of the server tag is enough to automatically create a selection operation item.
ILxSelectionOperation¶
-
class
ILxSelectionOperation
¶ This interface allows the procedural modeling system to test the selection status of a given element, allowing it to mark it for use during mesh operation evaluation.
Public Functions
-
LxResult
SetMesh
(LXtObjectID self, LXtObjectID mesh)¶ This function is called before any elements are tested, to set the mesh that the elements belong to.
-
LxResult
SetTransform
(LXtObjectID self, LXtMatrix4 xfrm)¶ This function is called before any elements are tested. It provides the transform matrix for the mesh being tested. It can then be used for transforming any component position tests into world space.
-
LxResult
TestPoint
(LXtObjectID self, LXtPointID point)¶ This method returns either LXe_TRUE or LXe_FALSE, indicating whether or not the given point should be included in the selection.
-
LxResult
TestEdge
(LXtObjectID self, LXtEdgeID edge)¶ This method returns either LXe_TRUE or LXe_FALSE, indicating whether or not the given edge should be included in the selection.
-
LxResult
TestPolygon
(LXtObjectID self, LXtPolygonID polygon)¶ This method returns either LXe_TRUE or LXe_FALSE, indicating whether or not the given polygon should be included in the selection.
-
LxResult
Evaluate
(LXtObjectID self, LXtID4 type, LXtObjectID state)¶ This function is called at the start of selection evaluation. It can be used to modify a previous selection, or initialize any state needed to evaluate individual elements. The function is called with the selection type that is being evaluated, as well as a ILxSelectionState object. The ILxSelectionState object allows individual elements to be tested for selection, and elements to be added or removed from the selection. If this function returns LXe_TRUE, the selection operation has finished modifying the selection, and then TestPoint, TestEdge and TestPolygon functions will not be called, whereas if the function returns LXe_FALSE, the various test functions will be called.
-
LxResult
ILxSelectionOperation1¶
-
class
ILxSelectionOperation1
¶ This selection operation interface was deprecated in 10.2v1.
Public Functions
-
LxResult
SetMesh
(LXtObjectID self, LXtObjectID mesh)¶
-
LxResult
SetTransform
(LXtObjectID self, LXtMatrix4 xfrm)¶
-
LxResult
TestPoint
(LXtObjectID self, LXtPointID point)¶
-
LxResult
TestEdge
(LXtObjectID self, LXtEdgeID edge)¶
-
LxResult
TestPolygon
(LXtObjectID self, LXtPolygonID polygon)¶
-
LxResult
ILxSelectionState¶
-
class
ILxSelectionState
¶ This interface caches the procedural selection state. It can be used by selection operations to query the selection state, and well as modify the selection state.
Public Functions
-
LxResult
TestPoint
(LXtObjectID self, LXtPointID point)¶ This method returns either LXe_TRUE or LXe_FALSE, indicating whether or not the given point is selected.
-
LxResult
TestEdge
(LXtObjectID self, LXtEdgeID edge)¶ This method returns either LXe_TRUE or LXe_FALSE, indicating whether or not the given edge is selected.
-
LxResult
TestPolygon
(LXtObjectID self, LXtPolygonID polygon)¶ This method returns either LXe_TRUE or LXe_FALSE, indicating whether or not the given polygon is selected.
-
LxResult
SetPoint
(LXtObjectID self, LXtPointID point, LxResult state)¶ This method is used to set a point as selected. The function should be passed either LXe_TRUE or LXe_FALSE to specify the selection state.
-
LxResult
SetEdge
(LXtObjectID self, LXtEdgeID edge, LxResult state)¶ This method is used to set an edge as selected. The function should be passed either LXe_TRUE or LXe_FALSE to specify the selection state.
-
LxResult
SetPolygon
(LXtObjectID self, LXtPolygonID polygon, LxResult state)¶ This method is used to set a polygon as selected. The function should be passed either LXe_TRUE or LXe_FALSE to specify the selection state.
-
LxResult