Predest¶
ILxShaderPreDest¶
-
class
ILxShaderPreDest
¶ Item presets are .LXP (IFF LXPR) files that require a destination item and/or scene to apply themselves, usually somewhere in a shader tree. The presets store a primary item, and possibly also linked or child items. Their destination requirements are identified based on the type of the primary item, which will typically be a material item, or a group/mask item with material, texture(s), etc.
Public Functions
-
LxResult
Scene
(LXtObjectID self, void **ppvObj)¶ The shader preset may need a scene to load into, if it was no item is directly applicable. In this case, the contents of the preset will simply be added to the scene.
-
LxResult
Item
(LXtObjectID self, int *mode, void **ppvObj)¶ The destination item will ‘receive’ the preset, and either have some channels changed, or have some items added as children, or possibly, have its children all killed, and replaced by new children that it must love just as much. The mode argument gives the loader’s Apply method a hint about how to treat the destination content.
-
LxResult
ContainerItem
(LXtObjectID self, void **ppvObj)¶ This method returns the parent or container for the the destination item. In most cases, this is simply the scene’s render item, and if this method returns NOT_IMPLEMENTED, the client can just find the first render item in the scene, as so much other code does. It will often be useful however, to provide a container group for the preset. In the case of a material preset, this could specify the group into which the material should be added, (though the Item should have returned a material in this group…). For a group preset, the group would be added inside the container, which will let a preset import be encapsulated by the client.
-
LxResult
HitItem
(LXtObjectID self, void **ppvObj)¶ This method returns the geometry item the preset was dropped on. This may be NULL if the preset wasn’t dropped on actual geometry.
-
LxResult
GetTag
(LXtObjectID self, LXtID4 type, const char **tag)¶ This method allows the client to read tags defining the surface being shaded. This can be useful for positioning some more complex shading presets.
-
LxResult
Mode
(LXtObjectID self, int *mode)¶ This method returns the preset mode either add or apply.
-
LxResult
ILxMeshLayerPreDest¶
-
class
ILxMeshLayerPreDest
¶ At this point the vague consensus serving as a design indicates mesh presets will be single layer mesh information, along with the necessary materials. (we will ignore for a moment the completely open-ended nature of this requirement, given the potential dependency of shading a single poly on the entire scene graph.) All that we need for a mesh preset destination, besides a potentially infinite bit of the shader tree, is a mesh. While it has been suggested that the destination should also supply a transformation for the mesh elements, this does not make sense in the driving scenario of meshpaint, since each painted mesh will need a different transform. If the transform is built into the destination, it implies that each painted clone will be reloaded from disk individually. Further, existing tools that use mesh layers (booleans, meshpaint, etc) expect to work with a source mesh, and little else. Nevertheless, a transform may be specified, for a initial transformation. Clients which will be duplicating the mesh with different transforms are expected to hold the mesh themselves, rather than reloading it, and transform the copies as needed.
Public Functions
-
LxResult
Mesh
(LXtObjectID self, void **ppvObj)¶ The mesh layer preset needs an existing mesh to load into (what else?). This method returns the destination mesh. It may be a current user mesh, or it may be a newly created ‘template’ mesh which will then be used like a BG layer for cloning, booleans, etc.
-
LxResult
Transform
(LXtObjectID self, LXtMatrix4 xform)¶ For false convenience, and to adhere to the fascination with bloated, lossy homogeneous matrices for passing transformations around, the desired transformation of the mesh elements as they are placed in the mesh is returned in an LXtMatrix4 by this function. If this function returns not implemented, no transformation is applied.
-
LxResult
ShaderDest
(LXtObjectID self, void **ppvObj)¶ To facilitate the loading of a mesh layer’s various shader tree components, we will simply demand a shader tree destination object.
-
LxResult
LXSHPRE_MODEi_ADD
LXSHPRE_MODEi_APPLY
LXSHPRE_MODEi_REF
ILxSceneItemPreDest¶
-
class
ILxSceneItemPreDest
¶ Destination requirements for a general item preset seem, based on the current vague consensus of what an item preset does, to be similar to tha shader destination; there is possibly a target item, or there might be an item that should become the parent, and there is almost certainly a scene. Thus for efficiency we can start of with an identical interface, and see where it goes as requirements are first defined then refined.
Public Functions
-
LxResult
Scene
(LXtObjectID self, void **ppvObj)¶ Return the ILxScene
-
LxResult
Item
(LXtObjectID self, int *mode, void **ppvObj)¶ This is the target item, presumably the same type as the preset, that will have channels replaced by the incoming item’s channels.. or whatever. It can be null to just add a new item from the preset to the scene.
-
LxResult
ContainerItem
(LXtObjectID self, void **ppvObj)¶ This method returns the parent or container for the the destination item.
-
LxResult
Position
(LXtObjectID self, LXtVector pos)¶ This method returns a position at which to place the item, if it has been set, or LXe_FAIL otherwise
-
LxResult
Orientation
(LXtObjectID self, LXtMatrix xfrm)¶ This method returns an orientation for the item, if it has been set, or LXe_FAIL otherwise. The orientation is stored in a matrix to assure that no useful information can be retrieved from it and rotations are clipped to 1 cycle.
-
LxResult
ILxProfile1DPreDest¶
-
class
ILxProfile1DPreDest
¶ Profile presets store a geometry pattern used with modeling tools. There are two types of profile.
Public Functions
-
LxResult
MoveTo
(LXtObjectID self, double x, double y)¶ 1D profile is a single path consist of lines and cubic bezier curves and it would be used for a parametric function to modulate a scale parameter along a path in modeling tools such as tube, sketch extrude and path step generator. The 1D profile would be also worked with lathe tool as a source profile curve. The following are methods to build an open path. “MoveTo” sets the start position. “LineTo” makes a segment line with the last position and the given position. “CurveTo” defines a cubic bezier curve.
-
LxResult
LineTo
(LXtObjectID self, double x, double y)¶
-
LxResult
CurveTo
(LXtObjectID self, double x0, double y0, double x1, double y1, double x2, double y2)¶
-
double
Evaluate
(LXtObjectID self, double t, int flags, int axis)¶ “Evaluate” method returns X or Y value at position ‘t’ along the path. If ‘NORMALIZE’ is set, it returns the normalized value between 0 and 1. If ‘RESETZERO’ is set, the origin is reset to the minimum of the bbox.
-
int
PathSteps
(LXtObjectID self, double tol, int flags, double *x, double *y, int nstep)¶ “PathSteps” generates all freezed positions and it returns the number of steps. “tol” is allowable maximum height when the function subdivides bezier curve to polyline. If “nstep” is zero, it returns only returns the best number of steps with the given tolerance.
-
LxResult
Box
(LXtObjectID self, LXtBBox *box)¶ “Box” method sets the bounding box on the profile space.
-
unsigned
Count
(LXtObjectID self)¶ “Count” method returns the number of profile in the packet.
-
LxResult
SelectByIndex
(LXtObjectID self, unsigned index)¶ “SelectByIndex” method sets the current profile to generate by “PathSteps” by index. The index must be between 0 to count-1.
-
LxResult
SelectByParameter
(LXtObjectID self, double t)¶ “SelectByParameter” method sets the current profile to generate by “PathSteps” by parameter value between 0.0 to 1.0.”PathSteps” generates an interpolated x and y positions at ‘t’.
-
LxResult
SelectByVertex
(LXtObjectID self, LXtMeshID meshID, LXtPointID pointID)¶ “SelectByVertex” method sets the current profile to generate by “PathSteps” for the given vertex.
-
LxResult
LXPROFILEf_NORMALIZE
LXPROFILEf_RESETZERO
LXPROFILEf_BLENDING
ILxProfile1DPreDest1¶
-
class
ILxProfile1DPreDest1
¶ This interface was retired in modo 10.1, and was replaced with an updated one that adds a method for multiple profile support.
Public Functions
-
LxResult
MoveTo
(LXtObjectID self, double x, double y)¶
-
LxResult
LineTo
(LXtObjectID self, double x, double y)¶
-
LxResult
CurveTo
(LXtObjectID self, double x0, double y0, double x1, double y1, double x2, double y2)¶
-
double
Evaluate
(LXtObjectID self, double t, int flags, int axis)¶
-
int
PathSteps
(LXtObjectID self, double tol, int flags, double *x, double *y, int nstep)¶
-
LxResult
Box
(LXtObjectID self, LXtBBox *box)¶
-
LxResult
ILxProfile2DPreDest¶
-
class
ILxProfile2DPreDest
¶ Profile presets store a geometry pattern used with modeling tools. There are two types of profile.
Public Functions
-
LxResult
MoveTo
(LXtObjectID self, double x, double y)¶ 2D profile is a 2-dimentional pattern shape consist of lines and cubic bezier curves. This profile would be useful when it is used with sweep tools. The following are methods to build an open path. “MoveTo” sets the start position. “LineTo” makes a segment line with the last position and the given position. “CurveTo” defines a cubic bezier curve.
-
LxResult
LineTo
(LXtObjectID self, double x, double y)¶
-
LxResult
CurveTo
(LXtObjectID self, double x0, double y0, double x1, double y1, double x2, double y2)¶
-
LxResult
NewPath
(LXtObjectID self)¶ “NewPath” starts a new profile in the object. 2D profile allows to have multiple pathes.
-
LxResult
Closed
(LXtObjectID self, int closed)¶ Set closed flag to the current path. The default is true.
-
LxResult
Box
(LXtObjectID self, LXtBBox *box)¶ “Box” method sets the bounding box on the profile space.
-
unsigned
Count
(LXtObjectID self)¶ “Count” method returns the number of profile in the packet.
-
LxResult
SelectByIndex
(LXtObjectID self, unsigned index)¶ “SelectByIndex” method sets the current profile to generate by “PathSteps” by index. The index must be between 0 to count-1.
-
LxResult
ILxProfile2DPreDest1¶
-
class
ILxProfile2DPreDest1
¶ This interface was retired in modo 10.1, and was replaced with an updated one that adds a method for multiple profile support.
Public Functions
-
LxResult
MoveTo
(LXtObjectID self, double x, double y)¶
-
LxResult
LineTo
(LXtObjectID self, double x, double y)¶
-
LxResult
CurveTo
(LXtObjectID self, double x0, double y0, double x1, double y1, double x2, double y2)¶
-
LxResult
NewPath
(LXtObjectID self)¶
-
LxResult
Closed
(LXtObjectID self, int closed)¶
-
LxResult
Box
(LXtObjectID self, LXtBBox *box)¶
-
LxResult
ILxColorPreDest¶
-
class
ILxColorPreDest
¶ The color preset destination is used to apply color presets to a target. Due to the various ways that colors can be used, we let the destination decide how to actually perform the apply. The destination works by the preset loader calling its various methods to set up state, followed by the Apply() method. Appy() should execute a command (thus ensuring it is undoable) that actually applies the contents of the object to the desired target.
Public Functions
-
LxResult
SetColor
(LXtObjectID self, const LXtVector rgb)¶ This method is called by the preset server to set the HDR RGB color on the destination. If this method fails, Apply() will not be called. Colors should always be set in linear space.
-
LxResult
SetColorModel
(LXtObjectID self, const char *name, const double *vec)¶ This optional method sets the name of the color model server that the color was originally saved in, as well as the color in the model’s space. Only color pickers generally care about this.
-
LxResult
Apply
(LXtObjectID self)¶ SetColor() will always be called, but SetColorModel() may not be. Once set, the preset loader will call Apply() so that the destination can perform its specific apply of the color to the target, preferably through a command (to ensure that it is undable and scriptable).
-
LxResult
ILxPresetDestinationService¶
-
class
ILxPresetDestinationService
¶ The preset destination service provides utilities for allocating preset destination objects.
Public Functions
-
LxResult
ShaderPDFromItem
(LXtObjectID self, LXtObjectID item, void **ppvObj)¶ Various preset destination objects can be allocated through the SDK.
ShaderPDFromItem A ShaderPreDest object can be created from a material group item in the scene.
CreateMeshLayerPD A MeshLayerPreDest object can be created from a mesh. The optional shadeItem is a material group where any loaded materials will be applied.
Profile1DPDFromPath A Profile1DPreDest object can be created from a filepath pointing to a valid 1D profile preset.
Profile2DPDFromPath A Profile2DPreDest object can be created from a filepath pointing to a valid 2D profile preset.
-
LxResult
CreateMeshLayerPD
(LXtObjectID self, LXtObjectID mesh, LXtObjectID shadeItem, void **ppvObj)¶
-
LxResult
Profile1DPDFromPath
(LXtObjectID self, const char *filepath, void **ppvObj)¶
-
LxResult
Profile2DPDFromPath
(LXtObjectID self, const char *filepath, void **ppvObj)¶
-
LxResult
ApplyProfilePDToMesh
(LXtObjectID self, LXtObjectID predest, double tolerance, int freeze, int axis, LXtObjectID mesh)¶ Some Preset Destination items can be applied programmatically as well. This function makes mesh elements from the preset. If ‘freeze’ is on, it converts the preset to face polygons. If ‘center’ is NULL, the shape center will be located in the raw position of the file. ‘tol’ is the tolerance to subdive curve. If ‘tol’ is zero, this subdivide curves based on curve display level. “metrics” stores optional data to transform the profile.
ApplyProfilePDToMesh A ProfilePreDest object can be loaded into an existing mesh. It requires setting a distance tolerance for subdividing the profile curves, a freeze boolean to force convert the shape into face polygons, and integer representing the plane axis (0,1,2 for x,y,z) to load the preset on, and the editable mesh to load the preset shape into. #item ApplyMeshPresetToMeshPD A MeshLayerPreDest object can have a mesh preset loaded into it.
-
LxResult
ApplyMeshPresetToMeshPD
(LXtObjectID self, LXtObjectID predest, const char *filepath)¶
-
LxResult