Table of contents

MTObject

Derived from: none

Declared in: MTObject.h

Library: 3DM.so

The class MTObject represents a 3DMorph object generator.

The main class in an add-on is a class that inherits from this one. The most important function is Update() , a virtual function that returns the set of points that make the object.


Constructor and Destructor


MTObject

                                                         
  

MTObject( )

Nothing special. Nothing is done in the default constructor.


~MTObject

                                                         
  

virtual ~MTObject( )

The default destructor is also empty.


Virtual Functions


Update

                                                         
  

virtual MTPoints * Update( float f )

Called by 3DMorph when it needs to update the 3D points. This function musn't return NULL, it must return a valid MTPoints object, which can be empty. The application becomes the owner of the object. A normal object has about 1000 points, and its coordinates are between -1 and 1.

The float f isn't used by 3DMorph yet.

The returned object musn't be used by the add-on after the call, nor deleted. This means that the object must be re-created at each call of Update() . If your object is stored in a member variable, you can return a copy:

MTPoints *MyClass::Update(float)
{
  return new MTPoints(myPoints);  // myPoints is a member variable (a MTPoints object)
}


CreateView

                                                         
  

virtual BView * CreateView( )

Returns a view that can be used to configure the add-on. If you don't need a configuration view, just return NULL. The view can call RequestUpdate() when the user made something that modifies the object.

Be careful if you use controls in your view. The default target for the controls is the window. As you don't have access to the window's BWindow::MessageReceived() method, you'll have to change their target in the BView::AttachedToWindow() inherited function. Have a look at the sample codes to see how it can be done.


Member Functions


RequestUpdate

                                                         
  

inline void RequestUpdate( )

Asks the application to do a new update of the object. Update() will be called.