Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This is the base class from which all other extension classes derive. This class has some common functions that should be implemented in some cases and others that are for internal use.

Code Block
languagecpp
class CbaseExtension
{
    MXparamList *priv;
public:
    
    CbaseExtension();
    CbaseExtension( const CbaseExtension &orig );
    
    void internalCreation ();
    void setPrivateExtensionData( MXparamList* pL ) const;
    virtual ~CbaseExtension();
    virtual CbaseExtension* clone() const = 0;
    virtual const char* getName() const = 0;
    virtual const unsigned int getVersion() const = 0;
    virtual void setExtensionData( MXparamList* p ) const  = 0;
    //User Implemented Optional Methods
    virtual void getFileDependencies( dword& numDependencies, char** &paths ) 
    {
        numDependencies = 0;
    };
    virtual void handleEvent( const char* event , void* param ) {};
    virtual bool initializeForRendering( Cmaxwell* pMaxwell ) = 0;
    virtual void cleanup( Cmaxwell* pMaxwell ) {};
    virtual bool initializePreview( Cmaxwell* pMaxwell )
    {
        return ( true );
    }
    virtual void freePreview( void )
    {
    }
    //Interface Methods
    MXparamList* getExtensionData( void ) const;
    void setEnabled( const bool enable );
    bool isEnabled( void ) const;
};

...

For example, getFileDependencies is useful when the extension depends on one or more files. Studio calls this function when doing a "Pack & Go" to retrieve and copy all the dependencies of a given scene. Mxnetwork also calls this function to check all the dependencies of a scene before sending it to the render nodes.  

initializeForRendering is called just before rendering starts, and the incoming pMaxwell (always check != NULL ) is useful for accessing the scene later, so it is handy to store it as a class member.

The following functions are called exclusively from Studio. initializePreview and freePreview mainly reset and free the arrays allocated in getProxyDisplay*. Keep a copy of the allocated pointers as members of the class and free them in freePreview.

...

char** &paths  : output, array of paths. On entry, the pointer is NULL. Allocate with malloc.

 

...

Returns

nothing.

initializePreview

virtual bool initializePreview( Cmaxwell* pMaxwell );

Reset all the pointers allocated in getProxyDisplay* and make them ready for reuse.

Arguments

Cmaxwell* pMaxwell : input, pointer to the scene.

Returns

true on success, false otherwise.

freePreview

virtual void freePreview( void );

Free the allocated pointers in getProxyDisplay*.

Arguments

none.

Returns

nothing.