User Tools

Site Tools


Dz3DViewport

Viewport for displaying and manipulating three dimensional objects.

More...

Inherits :

Enumerations

Properties

Methods

Signals

Detailed Description

See Also:

Enumerations


: FloorStyle

The styles of the floor that is drawn in the viewport.

  • NoFloor - No floor is drawn.
  • WireFloor - A grid floor is drawn.
  • SolidFloor - A solid floor is drawn. (not currently implemented)

—–

: ShadeStyle

A list of shading styles for rendering scene objects in OpenGL. These coincide with the ShadeStyle types in DzDrawStyle, and are provided here for scriptability.

  • WireBox - Draws unlit wire-frame bounding boxes.
  • SolidBox - Draws smooth-shaded bounding boxes.
  • Wireframe - Draws unlit wire-frames.
  • LitWireframe - Draws lit wire-frames.
  • HiddenLine - Draws unlit wire-frames, front geometry facing only.
  • WireShaded - Draws lit smooth shaded objects with wireframes imposed.
  • SmoothShaded - Draws lit smooth shaded objects.
  • WireTextured - Draws lit smooth shaded objects with any texture/transparency maps applied and wireframes imposed.
  • Textured - Draws lit smooth shaded objects with any texture/transparency maps applied.

—–

: ToolBarMode

The different toolbar modes for the interface.

  • DockedToolBar - A mode that docks the toolbar along the top edge of the viewport.
  • CameraCubeHUD - A mode that uses a Camera Cube HUD in the top right corner of the viewport.

Properties


Boolean : aspectOn

Holds whether or not the aspect frame is drawn in the viewport.


Boolean : axesOn

Holds whether or not the origin axes are drawn in the viewport.


Color : background

Holds the background color of the viewport


FloorStyle : floorStyle

Holds the style of the floor that is drawn in the viewport.


ShadeStyle : shadeStyle

Holds the shading style of the viewport.


Boolean : showPoseTool

Holds whether or not the Pose Tool is shown.


Boolean : thirdsGuideOn

Holds whether or not the thirds guide is drawn in the viewport.

Since:

  • 4.6.3.12

ToolBarMode : toolBarMode

Holds the mode for the viewport display of toolbars/camera cube

Methods


void : aimCamera()

Aim the viewport's camera at the selected nodes in the scene. If the scene does not have any select nodes, all nodes in the scene are aimed. Note that the viewport's camera is excluded, as are any nodes that are parented to the viewport's camera.

See Also:


void : aimCameraAtBox( DzBox3 box )

Aim the viewport's camera at the given box. If the box is invalid this function does nothing.

Parameter(s):

  • box - the box to aim the viewport's camera at.

void : aimCameraAtPrimaryNode()

Aim the viewport's camera at the selected nodes in the scene. If the scene does not have any select nodes, all nodes in the scene are aimed. Note that the viewport's camera is excluded, as are any nodes that are parented to the viewport's camera.


Image : captureImage()

Captures the current contents from the OpenGL frame buffer as an image.

Return Value:

  • A snap shot of the OpenGL frame buffer.

Example:

// Get the image manager
var oImgMgr = App.getImageMgr();
 
// If there is a main window
if( MainWindow ){
	// Get the active viewport
	var oViewportMgr = MainWindow.getViewportMgr();
	var oViewport = oViewportMgr.getActiveViewport().get3DViewport();
 
	// Capture the contents of the active viewport
	var oImg = oViewport.captureImage();
 
	// Save the image to a file
	oImgMgr.saveImage( String( "%1/viewport.png" ).arg( App.getDocumentsPath()) , oImg );
}

DzInt2 : currentDimensions()

Return Value:

  • The current dimensions of the viewport.

Since:

  • 4.6.4.100

void : frameCamera()

Frame the viewport's camera at the selected nodes in the scene. If the scene does not have any select nodes, all nodes in the scene are framed. Note that the viewport's camera is excluded, as are any nodes that are parented to the viewport's camera.

See Also:


void : frameCameraOnBox( DzBox3 box )

Frame the viewport's camera at the given box. If the box is invalid this function does nothing.

Parameter(s):

  • box - the box to frame the viewport's camera on.

void : frameCameraOnSelectedNodes()

Frame the viewport's camera at the selected nodes in the scene. If the scene does not have any select nodes, all nodes in the scene are framed. Note that the viewport's camera is excluded, as are any nodes that are parented to the viewport's camera.


Rect : getAspectFrameRect()

Return Value:

  • A rect describing the aspect frame for this viewport.

DzCamera : getCamera()

Return Value:

  • The currently active camera for this viewport.

Example:

// Get the active viewport
var oViewportMgr = MainWindow.getViewportMgr();
var oViewport = oViewportMgr.getActiveViewport().get3DViewport();
 
// Get the active camera
var oCamera = oViewport.getCamera();
// Reset the camera
oCamera.reset();

See Also:


cameracube_dz : getCameraCube()

Return Value:

Since:

  • 4.9.3.107

String : getUserDrawStyle()

Return Value:

  • If the current DrawStyle is a DzUserDrawStyle, the description of the DrawStyle, otherwise an empty string.

Since:

  • 4.9.2.22

DzViewport : getViewport()

Return Value:

  • This 3D view's parent viewport

Boolean : hardwareRender( DzRenderHandler handler )

Performs a hardware assisted OpenGL render in this viewport with the given settings.

Parameter(s):

  • handler - The render handler for the rendering operation.

Return Value:

  • true if the scene was rendered successfully, otherwise false.

Boolean : hardwareRenderWithOptions( DzRenderHandler handler, DzRenderOptions options, DzCamera camera=null, DzDrawStyle style=null )

Performs a hardware assisted OpenGL render in this viewport with the given settings.

Parameter(s):

  • handler - The render handler for the rendering operation.
  • options - The render options to use. (since 4.9.3.61)
  • camera - The camera to render through, set to null to render from current view. (since 4.9.3.61)
  • style - The draw style to use, null to use standard render draw style. (since 4.9.3.61)

Return Value:

  • true if the scene was rendered successfully, otherwise false.

Since:

  • 4.9.3.57

Boolean : isHardwareRenderable()

Return Value:

  • true if this viewport supports rendering via OpenGL, otherwise false.

Boolean : mouseIsDown()

Return Value:

  • true if a mouse button is pressed, otherwise false.

Since:

  • 4.6.4.20

Number : pickOnFacet( Point pnt )

Performs a facet picking operation on the scene through this viewport.

Parameter(s):

  • pnt - The pixel coordinates of the point in the viewport to pick on.

Return Value:

  • The index of the facet that was hit (if any), otherwise -1.

Number : pickOnGizmo( Point pnt )

Performs a gizmo picking operation through this viewport. View tools (see DzViewTool) can draw a 'gizmo' in the viewport for the user to interact with. The tool can assign different parts of the gizmo to specific indices, so as to tell what part of the gizmo was clicked by the user.

Parameter(s):

  • pnt - The point in the viewport to pick on.

Return Value:

  • The gizmo index that was hit (if any), otherwise 0.

DzMaterial : pickOnMaterial( Point pnt )

Performs a material picking operation on the scene through this viewport. This example shows the mousePress() implementation from a view tool (see DzViewTool) that sets the color of any material that the user clicks in the viewport.

Parameter(s):

  • pnt - The pixel coordinates of the point in the viewport to pick on.

Return Value:

  • The material that was hit, if any.

DzNode : pickOnNode( Point pnt, Boolean useSelectionMaps=true )

Performs a node picking operation on the scene through this viewport. View tools (see DzViewTool) will commonly use this function to determine what node (if any) that the user clicks on. This example shows the mousePress() implementation from a view tool that selects the node that the user clicks in the viewport.

Parameter(s):

  • pnt - The pixel coordinates of the point in the viewport to pick on.

Return Value:

  • The node that was hit, if any.

Boolean : renderThumbnail( DzRenderHandler handler )

Performs a quick render of the scene suitable for a thumbnail image.

Parameter(s):

  • handler - The render handler for the rendering operation.

Return Value:

  • true if the scene was successfully rendered, otherwise false.

void : resetCamera()

Reset the viewport's camera to its default state.


void : setCamera( String cam )

Set the camera for the view. If a matching camera is not found, this function does nothing.

Parameter(s):

  • cam - The name (not label) of a view camera, or a scene camera.

void : setCamera( DzCamera cam )

Set the camera for the view. The pointer passed in must be a camera in the scene, or one of the view cameras from DzViewportMgr.

Parameter(s):

  • cam - The camera to use for viewing in the viewport.

Example:

// Get the active viewport
var oViewportMgr = MainWindow.getViewportMgr();
var oViewport = oViewportMgr.getActiveViewport().get3DViewport();
 
// Create a new camera
var oCam = new DzBasicCamera( oCam.GENERAL_CAMERA );
oCam.setName( "Test Camera" );
 
// Add the camera to the scene
Scene.addNode( oCam );
 
// Set the active viewport to view through the new camera
oViewport.setCamera( oCam );

See Also:


void : setDrawStyle( DzDrawStyle style )

Set the draw style for the viewport. DzDrawStyle objects are ref counted, so the viewport refs the style when it is set, and unrefs it when it is no longer using the style. The draw style will then delete itself when its ref count reaches zero.

Parameter(s):

  • style - The new draw style for the viewport.

See Also:


Boolean : setUserDrawStyle( String description )

Attempts to set the DrawStyle for the viewport.

Parameter(s):

Return Value:

  • true if a DzUserDrawStyle that matches the description could be found, otherwise false.

Since:

  • 4.9.2.22

Signals


void : activeCameraChanged( DzCamera cam )

Signature:“activeCameraChanged(DzCamera*)”

Emitted when a new active camera has been changed for this viewport.

Parameter(s):

  • cam - The new camera for this viewport.

void : activeCameraProjectionChanged()

Signature:“activeCameraProjectionChanged()”

Emitted when the projection of the active camera of this viewport has changed.


void : activeCameraTransformChanged()

Signature:“activeCameraTransformChanged()”

Emitted when the transform of the active camera of this viewport has changed.


void : aspectOnChanged( Boolean onOff )

Signature:“aspectOnChanged(bool)”

Emitted when the draw state for the aspect frame changes.

Parameter(s):

  • onOff - true if the aspect frame is displayed, otherwise false.

void : axesOnChanged( Boolean onOff )

Signature:“axesOnChanged(bool)”

Emitted when the draw state for the origin axes changes.

Parameter(s):

  • onOff - true if the origin axis is displayed, otherwise false.

void : backgroundColorChanged( Color color )

Signature:“backgroundColorChanged(const QColor&)”

Emitted when the background color of the viewport changes.

Parameter(s):

  • color - The new background color.

void : contextMenuAboutToShow( DzMenu menu, Point pos )

Signature:“contextMenuAboutToShow(DzMenu*,QPoint)”

Emitted when the viewport is about to display a context menu. Other objects can connect to this signal to add custom items to the menu that is displayed to the user. Only connect to this signal if you only want to affect this particular viewport - otherwise connect to DzViewportMgr::contextMenuAboutToShow().

Parameter(s):

  • menu - The menu that will be displayed.
  • pos - The position in the viewport where the context menu was triggered.

void : currentDimensionsChanged()

Signature:“currentDimensionsChanged()”

Emitted when the current dimensions of this viewport has changed.


void : dimensionsChanged()

Signature:“dimnesionsChanged()”

Emitted when the dimensions of this viewport has changed.


void : drawStyleChanged( DzDrawStyle style )

Signature:“drawStyleChanged(DzDrawStyle*)”

Emitted when the draw style of the viewport has changed.

Parameter(s):

  • style - The new draw style of the viewport.

void : floorStyleChanged( FloorStyle style )

Signature:“floorStyleChanged(FloorStyle)”

Emitted when the floor style of the viewport changes.

Parameter(s):

  • style - The new floor style for the viewport.

void : thirdsGuideOnChanged( Boolean onOff )

Signature:“thirdsGuideOnChanged(bool)”

Emitted when the draw state for the thirds guide changes.

Parameter(s):

  • onOff - true if the thirds guide is displayed, otherwise false.

void : toolBarDocked( Boolean onOff )

Signature:“toolBarDocked(bool)”

Emitted when the view tool bar is docked or undocked.

Parameter(s):

  • onOff - true if the view tool bar is docked, otherwise false.

void : toolModeChanged( ToolBarMode mode )

Signature:“toolModeChanged(ToolBarMode)”

Emitted when the toolbar mode has been changed for this viewport.

Parameter(s):

  • mode - The new toolbar mode for this viewport.

void : viewChanged()

Signature:“viewChanged()”

Emitted when the area this viewport displays has changed.