Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

ImportableI Class Reference

Importable file interface. More...

#include <ImportableI.h>

Inheritance diagram for ImportableI:

EditableI DataBlockI ImportableImageI List of all members.

Public Methods

virtual const char * get_filename ()=0
 Returns the name of the file this importable refers to.

virtual bool load_file (const char *szName, ImportInterfaceC *pInterface)
 Loads the file specified in by the argument.

virtual bool create_file (ImportInterfaceC *pInterface)
 Creates the file.

virtual bool prompt_properties (PajaSystem::DeviceContextC *pContext, PajaSystem::TimeContextC *pTimeContext, ImportInterfaceC *pInterface)
 Prompts the properties dialog.

virtual bool has_properties ()
 Returns true if the importable has editable properties.

virtual void initialize (PajaTypes::uint32 ui32Reason, PajaSystem::DeviceContextC *pContext, PajaSystem::TimeContextC *pTimeContext)=0
 Initialize importable.

virtual void update_notify (FileHandleC *pHandle, PajaSystem::DeviceContextC *pContext, PajaSystem::TimeContextC *pTimeContext, ImportInterfaceC *pInterface)
 This method is called when a referenced file is changed.

virtual PajaTypes::uint32 get_reference_file_count ()
 Returns the number of referenced files.

virtual FileHandleCget_reference_file (PajaTypes::uint32 ui32Index)
 Returns file reference at speficied index.

virtual PluginClass::SuperClassIdC get_super_class_id ()=0
 Returns super class ID of the importer.

virtual PluginClass::ClassIdC get_class_id ()=0
 Returns unique class ID of the importer.

virtual const char * get_class_name ()=0
 Returns importer's class name as NULL terminated string.

virtual const char * get_info ()=0
 Return short info about the file.

virtual PajaTypes::int32 get_duration (PajaSystem::TimeContextC *pTimeContext)=0
 Evaluate the state of the importable at specified time.

virtual PajaTypes::float32 get_start_label (PajaSystem::TimeContextC *pTimeContext)=0
 Returns start label (a numerical value).

virtual PajaTypes::float32 get_end_label (PajaSystem::TimeContextC *pTimeContext)=0
 Returns end label (a numerical value).

virtual PluginClass::ClassIdC get_default_effect ()=0
 Returns the default effect class ID this importable creates if dropped to a File List (or to the Layout View).

virtual bool equals (ImportableI *pImp)
 Test if the given importable is same as this.


Protected Methods

 ImportableI ()
 Default constructor.

 ImportableI (Edit::EditableI *pOriginal)
 Constructor with reference to the original.

virtual ~ImportableI ()
 Default destructor.


Detailed Description

Importable file interface.

Importable files are key elements in the Demopaja system. Importers imports and holds the external data in the system, and effects are used to display it. This allows data sharing between the effects. All the importers are derived from this base class.

The copy() method is used to copy the file properties while the file is reloaded.


Constructor & Destructor Documentation

ImportableI   [protected]
 

Default constructor.

ImportableI Edit::EditableI   pOriginal [protected]
 

Constructor with reference to the original.

virtual ~ImportableI   [protected, virtual]
 

Default destructor.


Member Function Documentation

virtual bool create_file ImportInterfaceC   pInterface [virtual]
 

Creates the file.

This method is similar as the load_file() but is used for procedural importables.

Default implementation returns false.

virtual bool equals ImportableI *    pImp [virtual]
 

Test if the given importable is same as this.

This method is used to check if two files are same, while merging two lists of files. The defauls implementation checks if the file name (get_filename()) and the class ID (get_class_id()) of both importables are same. If they are the method returns true.

virtual PluginClass::ClassIdC get_class_id   [pure virtual]
 

Returns unique class ID of the importer.

virtual const char* get_class_name   [pure virtual]
 

Returns importer's class name as NULL terminated string.

virtual PluginClass::ClassIdC get_default_effect   [pure virtual]
 

Returns the default effect class ID this importable creates if dropped to a File List (or to the Layout View).

virtual PajaTypes::int32 get_duration PajaSystem::TimeContextC   pTimeContext [pure virtual]
 

Evaluate the state of the importable at specified time.

Before using any importable the importable should be evalutated to a certain time.

            void
            TestEffectC::eval_state( PajaTypes::int32 i32Time, DeviceContextC* pContext, TimeContextC* pTimeContext )
            {
                ...
                ImportableImageI*   pImp = 0;
                FileHandleC*        pHandle = 0;
                int32               i32FileTime = 0;
                // Get the file handle and evaluation time from the file parameter.
                pParamFile->get_file( i32Time, pHandle, i32FileTime );
                if( pHandle ) {
                    pImp = (ImportableImageI*)pHandle->get_importable();
                if( pImp ) {
                    pImp->eval_state( i32FileTime, pContext, pTimeContext );
                    // Now the importable is valid and ready to use
                    ...
                }
                ...
            }

            \end code
        */
        virtual void                        eval_state( PajaTypes::int32 i32Time, PajaSystem::DeviceContextC* pContext, PajaSystem::TimeContextC* pTimeContext ) = 0;

virtual PajaTypes::float32 get_end_label PajaSystem::TimeContextC   pTimeContext [pure virtual]
 

Returns end label (a numerical value).

The value does not have to be related to the returned duration. The start label is shown in the duration bar in the timegraph. The Demopaja system will find nice values for the labels between the start and end label returned from the importable.

Example:

            float32
            MASImportC::get_end_label( TimeContextC* pTimeContext )
            {
                return m_i32LastFrame;
            }

virtual const char* get_filename   [pure virtual]
 

Returns the name of the file this importable refers to.

virtual const char* get_info   [pure virtual]
 

Return short info about the file.

The information can be for example width and height and bit depth, etc. This information is displayed in the File Inspector window.

virtual FileHandleC* get_reference_file PajaTypes::uint32    ui32Index [virtual]
 

Returns file reference at speficied index.

The default implementation returns zero.

virtual PajaTypes::uint32 get_reference_file_count   [virtual]
 

Returns the number of referenced files.

If the importable has references to other files (such as textures in 3D meshes) this method returns number of file references.

File loading is implemented in the ImportInterfaceC which is passed to the load_file() method.

The default implementation returns zero.

virtual PajaTypes::float32 get_start_label PajaSystem::TimeContextC   pTimeContext [pure virtual]
 

Returns start label (a numerical value).

The value does not have to be related to the returned duration. The start label is shown in the duration bar in the timegraph. The Demopaja system will find nice values for the labels between the start and end label returned from the importable.

Example:

            float32
            MASImportC::get_start_label( TimeContextC* pTimeContext )
            {
                return m_i32FirstFrame;
            }

virtual PluginClass::SuperClassIdC get_super_class_id   [pure virtual]
 

Returns super class ID of the importer.

Implemented in ImportableImageI.

virtual bool has_properties   [virtual]
 

Returns true if the importable has editable properties.

The default implementation returns false. See also:

See also:
prompt_properties().

virtual void initialize PajaTypes::uint32    ui32Reason,
PajaSystem::DeviceContextC   pContext,
PajaSystem::TimeContextC   pTimeContext
[pure virtual]
 

Initialize importable.

Parameters:
ui32Reason  The reason this method was called.
If ui32Reason is INIT_INITIAL_UPDATE, the importable has been just instantiated (created) and all available data is passed to the importable. This happens either if the importable has just been created by the user or the importable is just loaded.

If ui32Reason is INIT_DEVICE_CHANGED, the settings for a device has been changed. importable should check that all the devices it uses and release all resources bind to them and later restore the resources when INIT_DEVICE_VALIDATE command is send. If a device is removed or replaced with another (in case of graphics device), the device which present is present when INIT_DEVICE_CHANGED is called may not be anymore present when INIT_DEVICE_VALIDATE is called later.

If ui32Reason is INIT_DEVICE_INVALIDATE, most a device has gone into a state where some device resources needs to released so that the device can be reset. Such case can be for example when graphics device changes resolution.

If ui32Reason is INIT_DEVICE_VALIDATE, initialize() is called either after INIT_DEVICE_INVALIDATE or INIT_DEVICE_CHANGED. In both cases the importable should try to restore and recreate the resources it uses from devices.

virtual bool load_file const char *    szName,
ImportInterfaceC   pInterface
[virtual]
 

Loads the file specified in by the argument.

When a file is reloaded, a new instance of a importable is created, the copy() method is called first to enable copy settings from old file, and finally load_file() is called.

If the copy() method is implemented so that it also duplicates the data, load_file() should check and delete all existing data if needed.

Not used for procedural importables. See:

See also:
create_file().
Default implementation returns false.

virtual bool prompt_properties PajaSystem::DeviceContextC   pContext,
PajaSystem::TimeContextC   pTimeContext,
ImportInterfaceC   pInterface
[virtual]
 

Prompts the properties dialog.

Returns :
True if the changes should be committed, or false if the action should be cancelled. The default implementation returns true. See also:
See also:
has_properties().

virtual void update_notify FileHandleC   pHandle,
PajaSystem::DeviceContextC   pContext,
PajaSystem::TimeContextC   pTimeContext,
ImportInterfaceC   pInterface
[virtual]
 

This method is called when a referenced file is changed.


Moppi Demopaja SDK Documentation -- Copyright © 2000-2002 Moppi Productions