Viewobject (lx-viewobject.hpp)

From The Foundry MODO SDK wiki
Revision as of 21:02, 19 February 2018 by LuxSDKBot (Talk | contribs) (Header Documentation)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
There are security restrictions on this page


The ILxViewObject is used to generate passes that are used for drawing. It is usually generated by a modifier attached to an item that wishes to draw. At draw time, the passes (also ILxViewObjects) are generated and passed to the drawing loop.

(1) SDK: LXu_VIEWOBJECT, etc. defines
 #define LXu_VIEWOBJECT                  "81C986D1-A7BA-4278-B060-E784779F5C36"
 #define LXa_VIEWOBJECT                  "viewobject"

BBOX_FAST This is the simplest draw type. This bounding box should be fast to generate and can be used until a slower bounding box is calculated.
BBOX This pass represents a bounding box. In most cases, this will be identical to BBOX_FAST, but in some cases may be slower to calculate.
WIREFRAME The wireframe pass is a line drawing of the surface wireframe.
SURFACE The surface pass is triangles with normals.
TEXTURED The textured pass is triangles, with normals and UV coordinates.
(2) SDK: LXiVIEWPASS_BBOX_FAST, etc. defines

The TestMode function is used to test if a draw pass type is available. It is called with a single type, such as BBox or Surface. If the function returns LXe_TRUE, it has been generated and is available. If the function returns LXe_FALSE, the Generate function should be called to generate that data. The function can also return LXe_NOTREADY to specify that the ViewObject is working on generating the data in a thread, or LXe_NOTAVAILABLE if the requested data is not supported.

(3) SDK: ViewObject::TestMode
         LXxMETHOD( LxResult,
 TestMode) (
         LXtObjectID               self,
         unsigned int              type);

The Flags method allows the ViewObject to declare some properties that determine how it should be evaluated.

(4) SDK: ViewObject::Flags
         LXxMETHOD( unsigned int,
 Flags) (
         LXtObjectID               self);

NOTHREADS The ViewObject data will be generated in a single thread.
PERVIEW The ViewObject drawing varies per viewport, and seperate passes should be generated for each view.

If the TestMode function has declared that work needs to be done to generate the ViewObject data, the Generate function will be called. It is expected to generate new draw passes of the requested type. This function may be called from threads if that is supported.

(6) SDK: ViewObject::Generate
         LXxMETHOD( void,
 Generate) (
         LXtObjectID               self,
         unsigned int              type);

The Count method is expected to return the number of available draw passes of the requested type.

(7) SDK: ViewObject::Count
         LXxMETHOD( unsigned int,
 Count) (
         LXtObjectID               self,
         unsigned int              type);

The ByIndex method is expected to return draw passes by index of the requested type.

(8) SDK: ViewObject::ByIndex
         LXxMETHOD( LxResult,
 ByIndex) (
         LXtObjectID               self,
         unsigned int              type,
         unsigned int              index,
         void                    **ppvObj);

If the ViewObject drawing varies per viewport, this function will be called. It is expected to return a copy of itself, configured to generate draw passes for the provided viewport.

(9) SDK: ViewObject::ByView
         LXxMETHOD( LxResult,
 ByView) (
         LXtObjectID               self,
         LXtObjectID               view,
         void                    **ppvObj);

(10) SDK: empty ViewObject User Class

Empty View Object Python user class.

(11) PY: empty ViewObject user class


Items declare that they can provide a ViewObject with a package server tag giving the name of the channel that contains the ILxViewObject. Read in an evaluated context, this will be a ValueReference object channel holding the ILxViewObject.