Viewport Info

class lwsdk.LWViewportInfo(*args)

Bases: object

Proxy of C++ PCore::LWViewportInfo class

approxPixelSize(self, int n) → double
 clip(int n) → (hither, yon)

Returns hither and yon which hold the near and far Z clipping distances for the nth viewport.

 flags(int n) → unsigned int

Returns a set of bit flags for the nth viewport. These can be any combination of the following:

lwsdk.LWVIEWF_CENTER
lwsdk.LWVIEWF_WEIGHTSHADE
lwsdk.LWVIEWF_XRAY

 gridSize(int n) → double

Returns the size of the grid spacing for the nth viewport, in metres.

 gridType(int n) → int

!! NOT DOCUMENTED !!

 handleSize(int n) → int

Returns the standard handle size for the nth viewport, in pixels. This is the size used for example for drawing the translation and rotation tool handles.

 hoverIndex(double out_cursor_pos) → int

!! NOT DOCUMENTED !!

 modelview(int n) → (result, modelview[16], inverse[16])

Returns the matrices of the modelview matrix and the inverse of the modelview matrix for the nth viewport. The matrices follow the OpenGL convention of m[column][row] with column vectors. result will be 1 if the asked for matrices were retrieved, 0 on failure which usually means that an inverse matrix was asked for for a matrix that could not be inverted.

 numViewports → int

The number of viewports visible in the Layout interface.

 pixelSize(int n, double pixels, LWDVector refpos) → double

Returns the world size of the given number of pixels at the reference position in world for the nth viewport. A sphere with a diameter of the returned size, placed at the reference position, will have a diameter of approximately the given number of pixels when projected.

 pos(int n) → spot[3]

Returns spot vector with the viewing position of the nth viewport.

 project(int n, LWDVector world) → (result, winx, winy, winz)

Computes the projected position of the given world coordinates for the nth viewport. The computed winx and winy position is in pixels, relative to the upper-left corner of the viewport. result will be 1 if the projection was successful, 0 otherwise. Note that the resulting coordinates may fall outside of the viewport.

 projection(int n) → (result, projection[16], inverse[16])

Returns the matrices of the projection matrix and the inverse of the projection matrix for the nth viewport. The matrices follow the OpenGL convention of m[column][row] with column vectors. result will be 1 if the asked for matrices were retrieved, 0 on failure which usually means that an inverse matrix was asked for for a matrix that could not be inverted.

ray(self, int n, double mouse_pos, double out_origin, double out_dir) → int
 rect(int n) → (left, top, width, height)

Returns the left, top, width and height of the pixel coordinates of the nth viewport.

 type(int n) → int

The type of view in the nth viewport. It will be one of the following:

lwsdk.LVVIEWT_NONE
lwsdk.LVVIEWT_TOP
lwsdk.LVVIEWT_BOTTOM
lwsdk.LVVIEWT_BACK
lwsdk.LVVIEWT_FRONT
lwsdk.LVVIEWT_RIGHT
lwsdk.LVVIEWT_LEFT
lwsdk.LVVIEWT_PERSPECTIVE
lwsdk.LVVIEWT_LIGHT
lwsdk.LVVIEWT_CAMERA
lwsdk.LVVIEWT_SCHEMATIC

 unproject(int n, double winx, double winy, double winz) → (result, world[16])

Computes the world coordinates of a given pixel position of the nth viewport. The winz value ranges from 0 for a spot on the near clipping plane, to 1 for a spot on the far clipping plane. Note that drawing on the near or far clipping plane may cause flickering due to floating point imprecision causing random clipping. Returns 1 if the projection was successful, 0 otherwise. Failure is typically caused by the viewport having a non-invertible modelview or projection matrix.

 viewItem(int n) → LWItemID

For viewports which have a view through a scene item (lwsdk.LWVIEWT_LIGHT and lwsdk.LWVIEWT_CAMERA) the ID of the item is returned. Otherwise lwsdk.LWITEM_NULL is returned.

 viewLevel(int n) → int

Returns the view level for the nth viewport. The returned value is one of the lwsdk.LWOVIS_* values.

 viewPicking(int n) → LWPicking

!! NOT DOCUMENTED !!

 xfrm(int n) → double[9]

Returns the 3x3 transformation from viewport coordinates to world coordinates for the nth viewport. Note that from LW9.0, the LWViewportInfo::projection() and LWViewportInfo::modelview() functions should be preferred, as this method may not produce correct results for non-perspective camera views.

Previous topic

Surface Functions

Next topic

Raster Funcs

This Page