Dz3DViewport Class Reference
[Interface Components]

3D Viewport for displaying and manipulating 3D objects More...

List of all members.

Enumerations



enum  AnchorLocation { AnchorTopLeft, AnchorTopRight, AnchorBottomLeft, AnchorBottomRight }
enum  FloorStyle { NO_FLOOR, WIRE_FLOOR, SOLID_FLOOR }
enum  ShadeStyle {
  WIRE_BOX, SOLID_BOX, WIREFRAME, LIT_WIREFRAME,
  HIDDEN_LINE, WIRE_SHADED, SMOOTH_SHADED, WIRE_TEXTURED,
  TEXTURED
}

Properties

Boolean aspectOn
Boolean axesOn
Color background
Boolean dockToolBar
FloorStyle floorStyle
ShadeStyle shadeStyle
Boolean showNavigationBar
Boolean showViewportBar
AnchorLocation viewBarLocation

Methods

void aimCamera ()
Image captureImage ()
void frameCamera ()
Rect getAspectFrameRect ()
DzCamera getCamera ()
DzViewport getViewport ()
Boolean hardwareRender (DzRenderHandler handler)
Boolean isHardwareRenderable ()
Number pickOnGizmo (Point pnt)
DzMaterial pickOnMaterial (Point pnt)
DzNode pickOnNode (Point pnt)
Boolean renderThumbnail (DzRenderHandler handler)
void resetCamera ()
void setCamera (String cam)
void setCamera (DzCamera cam)

Signals

void activeCameraChanged (DzCamera cam)
 Signature: "activeCameraChanged(DzCamera*)"
void aspectOnChanged (Boolean onOff)
 Signature: "aspectOnChanged(bool)"
void axesOnChanged (Boolean onOff)
 Signature: "axesOnChanged(bool)"
void backgroundColorChanged (Color color)
 Signature: "backgroundColorChanged(const QColor&)"
void contextMenuAboutToShow (DzMenu menu, Point pos)
 Signature: "contextMenuAboutToShow(DzMenu*,QPoint)"
void drawStyleChanged (DzDrawStyle style)
 Signature: "drawStyleChanged(DzDrawStyle*)"
void floorStyleChanged (FloorStyle style)
 Signature: "floorStyleChanged(FloorStyle)"
void toolBarDocked (Boolean onOff)
 Signature: "toolBarDocked(bool)"
void viewChanged ()
 Signature: "viewChanged()"


Detailed Description

3D Viewport for displaying and manipulating 3D objects

See also:
DzViewport::get3DViewport()


Member Enumeration Documentation

enum Dz3DViewport::AnchorLocation

The possible locations for the view tool bar.

Enumerator:
AnchorTopLeft  Top Left corner of the viewport.
AnchorTopRight  Top Right corner of the viewport.
AnchorBottomLeft  Bottom Left corner of the viewport.
AnchorBottomRight  Bottom Right corner of the viewport.

enum Dz3DViewport::FloorStyle

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

Enumerator:
NO_FLOOR  No floor is drawn
WIRE_FLOOR  A grid floor is drawn
SOLID_FLOOR  A solid floor is drawn

enum Dz3DViewport::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.

Enumerator:
WIRE_BOX  Draws unlit wireframe bounding boxes
SOLID_BOX  Draws smooth-shaded bounding boxes
WIREFRAME  Draws unlit wireframes
LIT_WIREFRAME  Draws lit wireframes
HIDDEN_LINE  Draws unlit wireframes, front geometry facing only
WIRE_SHADED  Draws lit smooth shaded objects with wireframes imposed
SMOOTH_SHADED  Draws lit smooth shaded objects
WIRE_TEXTURED  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


Member Function Documentation

Dz3DViewport::activeCameraChanged ( DzCamera  cam  )  [signal]

Signature: "activeCameraChanged(DzCamera*)"

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

Parameters:
cam The new camera for this viewport.

void Dz3DViewport::aimCamera (  ) 

Aim the viewport's camera at the primary selection in the scene. If the scene does not have a primary selection this function does nothing.

Samples:
Aim Camera, Point At

Dz3DViewport::aspectOnChanged ( Boolean  onOff  )  [signal]

Signature: "aspectOnChanged(bool)"

Emitted when the draw state for the aspect frame changes

Parameters:
onOff The new state of the aspect frame on property.

Dz3DViewport::axesOnChanged ( Boolean  onOff  )  [signal]

Signature: "axesOnChanged(bool)"

Emitted when the draw state for the origin axes changes

Parameters:
onOff The new state of the axes on property.

Dz3DViewport::backgroundColorChanged ( Color  color  )  [signal]

Signature: "backgroundColorChanged(const QColor&)"

Emitted when the background color of the viewport changes

Parameters:
color The new background color.

QImage Dz3DViewport::captureImage (  ) 

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

Returns:
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 );
    }

Dz3DViewport::contextMenuAboutToShow ( DzMenu  menu,
Point  pos 
) [signal]

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().

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

Dz3DViewport::drawStyleChanged ( DzDrawStyle  style  )  [signal]

Signature: "drawStyleChanged(DzDrawStyle*)"

Transmitted when the draw style of the viewport has changed.

Parameters:
style The new draw style of the viewport.

void Dz3DViewport::floorStyleChanged ( FloorStyle  style  )  [signal]

Signature: "floorStyleChanged(FloorStyle)"

Emitted when the floor style of the viewport changes

Parameters:
style The new floor style for the viewport.

void Dz3DViewport::frameCamera (  ) 

Frame the viewport's camera at the primary selection in the scene. If the scene does not have a primary selection this function does nothing.

Samples:
Frame Camera

Rect Dz3DViewport::getAspectFrameRect (  ) 

Returns:
A QRect describing the aspect frame for this viewport.

DzCamera Dz3DViewport::getCamera (  ) 

Returns:
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();

Samples:
Aim Camera, Frame Camera
See also:
setCamera()

DzViewport Dz3DViewport::getViewport (  ) 

Returns:
This 3D view's parent viewport

Boolean Dz3DViewport::hardwareRender ( DzRenderHandler  handler  ) 

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

Parameters:
handler The render handler for the rendering operation.
Returns:
true if the scene was rendered successfully, otherwise false.

Boolean Dz3DViewport::isHardwareRenderable (  ) 

Returns:
true if this viewport supports rendering via OpenGL.

Number Dz3DViewport::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.

Parameters:
pnt The point in the viewport to pick on.
Returns:
The gizmo index that was hit, 0 if none.

DzMaterial Dz3DViewport::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.

Parameters:
pnt The pixel coordinates of the point in the viewport to pick on.
Returns:
The material that was hit, if any.

DzNode Dz3DViewport::pickOnNode ( Point  pnt  ) 

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.

Parameters:
pnt The pixel coordinates of the point in the viewport to pick on.
Returns:
The node that was hit, if any.

Boolean Dz3DViewport::renderThumbnail ( DzRenderHandler  handler  ) 

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

Parameters:
handler The render handler for the rendering operation.
Returns:
true if the scene was successfully rendered, otherwise, false.

void Dz3DViewport::resetCamera (  ) 

Reset the viewport's camera to its default state.

void Dz3DViewport::setCamera ( String  cam  ) 

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

Parameters:
cam The name (not label) of a view camera, or a scene camera.

void Dz3DViewport::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.

Parameters:
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:
getCamera()

Dz3DViewport::toolBarDocked ( Boolean  onOff  )  [signal]

Signature: "toolBarDocked(bool)"

Emitted when the view tool bar is docked or undocked

Parameters:
onOff true if the view tool bar is docked, false if it is undocked.

void Dz3DViewport::viewChanged (  )  [signal]

Signature: "viewChanged()"

Transmitted when the area this viewport displays has changed.


Member Data Documentation

Boolean Dz3DViewport::aspectOn

This property determines whether or not the aspect frame is drawn in the viewport.

Boolean Dz3DViewport::axesOn

This property determines whether or not the origin axes are drawn in the viewport.

Color Dz3DViewport::background

This property holds the background color of the viewport

void Dz3DViewport::dockToolBar

This property determines whether or not the view tool bar is docked.

FloorStyle Dz3DViewport::floorStyle

This property holds the style of the floor that is drawn in the viewport.

ShadeStyle Dz3DViewport::shadeStyle

This property holds the shading style of the viewport.

void Dz3DViewport::showNavigationBar

This property determines whether or not the navigation bar is shown.

void Dz3DViewport::showViewportBar

This property determines whether or not the viewport bar is shown.

AnchorLocation Dz3DViewport::viewBarLocation

This property controls the location of the view tool bar


Generated on Thu Sep 24 12:21:10 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.