#include <AlUniverse.h>
class AlUniverse : public AlMessage
enum AlFileType {
kUnknown, // File type is unknown and will be ignored by ::retrieve()
kWire, // Alias/Wavefront Wire File
kIges, // Initial Graphics Exchange Standard
kVdais, // Verband Der Automobilindustrie IGES Subset
kC4x, // EDS/GM format.
kJamais, // Japan Automobile Manufacturers Association IGES Subset.
kVdafs, // Verband Der Automobilindustrie Freeform Surface
Interface.
kDxf, // Drawing Exchange Format
// The file types below are available only in OpenAlias.
kDes, // EDS/GM Data Exchange Standard
kTri, // Alias/Wavefront Object Separated Triangle Format
kQuad, // Alias/Wavefront Object Separated Quad Format
kProRender, // Pro/Engineer Render File Format.
kInventor, // OpenInventor Metafile Subset V1.0
kStl, // 3D Systems SLA Format
kObj, // Alias/Wavefront TAV format.
kGeo, // Alias/Wavefront Explore format.
kStyle, // Alias/Wavefront Sketch Format.
kEpsf, // Adobe Encapsulated Postscript v2.x
kIllustrator, // Illustrator Format.
kSlc // 3D Systems Slice Format.
};
// Project subdirectory types.
// These indicate the subdirectories where different types of files are
// located.
;
enum AlApplicationMode
{
kOpenModel,
kOpenAlias
};
static statusCode initialize( AlCoordinateSystem = kZUp,
boolean initProjectEnv = FALSE );
static boolean isInitialized();
static AlCoordinateSystem coordinateSystem ();
static statusCode expandFileName( char[], const char *,
AlDirectoryType directoryType );
static boolean isWireFile( const char *, char * );
static statusCode wireFileWindowSize( int &sizeX, int &sizeY );
static statusCode setWireFileWindowSize( int sizeX, int sizeY );
static AlFileType fileType( const char * );
static statusCode retrieveOptions( AlRetrieveOptions& );
static statusCode setRetrieveOptions( const AlRetrieveOptions& );
static statusCode retrieve( const char * );
static statusCode retrieveStdin();
static const char* lastWireFileRetrieved();
static statusCode store( const char *, AlDagNode* = NULL );
static statusCode storeActive( const char * );
static statusCode storeStdout();
static AlDagNode* firstDagNode();
static AlSet* firstSet();
static AlCluster* firstCluster();
static const char* currentStage( void );
static statusCode setCurrentStage( const char* );
static statusCode mergeStage( const char* );
static statusCode mergeAllStages( void );
static statusCode deleteStage( const char* );
static statusCode deleteAllStages( void );
static statusCode visibility( const char *, boolean& );
static statusCode setVisibility( const char *, boolean );
static const char* windowSource( void );
static statusCode setWindowSource( const char * );
static const char* backgroundSource( void );
static statusCode setBackgroundSource( const char * );
static statusCode renameStage( const char *, const char * );
static AlList* stageNames( void );
static statusCode createNewStage( const char * );
static statusCode createNewStage( const char *, char*& );
static statusCode retrieveStageSet( const char *,boolean );
static statusCode saveStageSet( const char *);
static statusCode setStageWireFileName( const char *, const char * );
static const char* stageWireFileName( const char * );
static AlWindow* firstWindow();
static AlWindow* currentWindow();
static AlWindow* sbdWindow();
static AlImagePlane* firstImagePlane();
static statusCode blindData( int, long&, const char*& );
static statusCode setBlindData( int, long, const char* );
static statusCode removeBlindData( int );
static AlChannel* firstChannel();
static AlChannel* nextChannel(AlChannel *);
static statusCode nextChannelD( AlChannel *);
static AlAction* firstAction();
static AlAction* nextAction(AlAction *);
static AlShader* firstShader();
static AlShader* nextShader( AlShader* );
static statusCode nextShaderD( AlShader* );
static AlEnvironment* firstEnvironment();
static statusCode deleteAll();
static statusCode redrawScreen( unsigned flags = kRedrawInactive |
kRedrawActive );
static statusCode applyIteratorToImagePlanes( AlIterator*, int& );
static statusCode applyIteratorToWindows( AlIterator *, int& );
static statusCode applyIteratorToDagNodes( AlIterator *, int& );
static statusCode applyIteratorToActions( AlIterator *, int& );
static statusCode applyIteratorToChannels( AlIterator *, int& );
static statusCode applyIteratorToSets( AlIterator *, int& );
static statusCode applyIteratorToClusters( AlIterator *, int& );
static statusCode applyIteratorToShaders( AlIterator *, int& );
static statusCode writeSDLNoAnimation( const char *, boolean );
static statusCode writeSDL( const char *, boolean, double, double, double );
static statusCode frameRange(AlFrameRangeType, double&, double&, double&);
static double currentTime();
static statusCode doUpdates( boolean = TRUE );
static boolean updatesOn()
static AlApplicationMode applicationMode();
static statusCode userPrefColor( int, int&, int&, int& );
static statusCode setUserPrefColor( int, int, int, int );
In Alias, there is the concept of a 'stage', an independant entity thatencapsulates all the top-level information about a modeling environment. The stage effectively represents the running version of an individual Wire file. In the interactive package, stages can be controlled through the Stage Editor. The identical control also exists in the AlUniverse class, via the Stage functions. These let you switch between stages, create and destroy stages, merge stages, and alter their features.
LiveData and OpenModel use object data thatdefines, among other things, transformations, curve and surface geometry, cameras and lights. Transformations are kept in objects called "dag nodes". Dag nodes can be connected to other dag nodes to form a list of dag nodes. There are particular types of dag nodes which refer specifically to geometry, cameras, lights, or refer to another list of dag nodes to form a hierarchical structure. Together, these different types of dag nodes can be used to build a list of hierarchical structures which is collectively called a directed acyclic graph or "DAG".
The AlUniverse class gives access to the first dag node in the DAG, and from that dag node, the list of all dag nodes in the universe can be traversed.
The object data may also contain animation information on various animatable items, such as a dag node or a piece of geometry. The animation information can be accessed through the item that is animated. The AlUniverse class also gives access to animation data through global lists.
Geometry also contains shading information. Each surface or face (a particular kind of curve) contains a list of shaders. The AlUniverse class also gives access to a global list of all shaders in the universe, as well as the single environment class.
The AlUniverse class also gives access to the list of sets in the universe via the firstSet() method. Similarly, the firstCluster() method gives access to all the clusters in the universe. However, clusters are also accessible through methods in the classes that can belong to clusters (i.e. AlDagNode, AlCurveCV and AlSurfaceCV). A cluster is an object in the DAG that has a collection of dag nodes and/or CVs. The transformations in the dag nodes above the cluster are applied to the CVs in the cluster after the latter's own transformations have been applied.
AlUniverse provides base access to the ImagePlane list and the Window list through firstImagePlane, firstWindow and related functions.
Whenever a new Alias object of any kind is created, it is automatically added to the appropriate place in the universe. For example, if a dag node is created, it is traversable through the AlUniverse::firstDagNode() method. If a new animation action is created, it is accessable by walking the list of actions via AlUniverse::firstAction()/nextAction().
However, there are a few exceptions. The AlCurve, AlFace, AlSurface and AlKeyframe classes can all be created and will not be part of the universe initially. They will become part of the universe when they are added to other objects. For example, an AlCurve becomes part of the universe when its AlCurveNode is created. An AlKeyframe becomes part of the universe when its AlParamAction is created. If a class is not part of the universe, this means that if AlUniverse::store() is called, that class will not be stored. If a LiveData application exits without making an object part of the universe, then the data will be lost and wasted memory will result.
The initialize method must be called before any other AlUniverse method is called. An Alias AlObject cannot be created until the initialize method is called.
< initProjEnv - indicates whether the OpenModel application is to be aware of the Alias project environment or not. The default if FALSE.
sAlreadyCreated - the universe is already initialized
sInsufficientMemory - not enough memory to initialize
sFailure - could not initialize
sNoProjectEnvironment - this will be the case if initProjEnv is TRUE and Alias project environment does not exist.
kZUp - positive Z-axis is "up"
< fileName - name of the file to locate within the project environment. Must not contain leading slashes or dots.
< directoryType - The type of project subdirectory where the file is located. (See AlUniverse.h for possible values.
sInvalidArguments - the passed filename is already absolute (contains leading '/'), or is relative (contains
leading '..'), or the directory type is invalid.
sNoProjectEnvironment - the returned path does not exist. This may be because the Alias project environment does not exist in whole or in part.
SFailure - either or both passed names were NULL.
sFailure - OpenAlias is in use
sInvalidArgument - sizeX <=0 or sizeY <=0
Note that these values are changed whenever a call to AlUniverse::retrieve is called.
OpenModel wire files default to 1279x1022 if the size has not been set. This method is available only under OpenModel and fails under OpenAlias.
sFailure - OpenAlias is in use
sInvalidArgument - sizeX <=0 or sizeY <=0
FALSE - one of the arguments was invalid or the file was not a Wire file
The file types listed below are available for import in both OpenModel and OpenAlias.
The file types listed below are available for import only in OpenAlias.
statusCode AlUniverse::retrieveOptions( AlRetrieveOptions &options )
Description
Get the options used by ::retrieve(). Arguments
> options - options that ::retrieve() will use when retrieving files. Return codes
sSuccess - the options were returned succesfully. statusCode AlUniverse::setRetrieveOptions( const AlRetrieveOptions &options )
Description
Set the options used by ::retrieve(). Arguments
< options - options that ::retrieve() will use when retrieving files. Return codes
sSuccess - the options were set correctly. statusCode AlUniverse::retrieve( const char *fileName )
Description
Retrieves an Alias Wire file and adds the objects stored in the file to the list of Alias AlDagNode objects. If fileName is NULL the file is read from stdin. Arguments
< fileName - the name of the file to be retrieved Return codes
sSuccess - the file was retrieved successfully const char* AlUniverse::lastWireFileRetrieved()
Description:
This function returns the last wire file retrieved either by the API or by Alias. Note that the file name will not change to NULL if a delete all is performed. A NULL is returned if no files have been retrieved or if the function fails. statusCode AlUniverse::store( const char * fileName, AlDagNode* dagNode )
Description
If the AlDagNode argument is absent or NULL then this method stores all the AlObjects in the universe to a file as an Alias Wire file. If the AlDagNode argument is not NULL then only the model below the AlDagNode is stored. If the AlDagNode is in the middle of a hierarchy, the AlDagNodes above the argument will also be stored so as to preserve transformations on the model. Arguments
fileName - the name of the file to be stored Return codes
sSuccess - the file was stored successfully statusCode AlUniverse::storeActive( const char * fileName )
Description
This method allows the user to store only those objects which are on the pick list. Arguments
fileName - the name of the file to be stored Return codes
sSuccess - the file was stored successfully AlDagNode* AlUniverse::firstDagNode()
Description
Returns the first AlDagNode in the list of Alias AlDagNode objects (the DAG). NULL is returned if the list is empty. AlSet* AlUniverse::firstSet()
Description
Returns a pointer to the first set in this universe. Returns NULL if there are no sets in this universe. AlCluster* AlUniverse::firstCluster()
Description
Returns a pointer to the first cluster in this universe. Returns NULL if there are no clusters in this universe. AlChannel* AlUniverse::firstChannel()
Description
This method returns the first channel in the list of all channels in the universe. This list is not in any particular order, although channels animating the same item will appear consecutively in the list. If this method returns NULL, then that means that nothing in the universe is animated. const char* AlUniverse::currentStage( void )
Description
Returns the name of the current stage. statusCode AlUniverse::setCurrentStage( const char* name )
Description
Switch the current stage to the stage with the indicated name Arguments
name - the name of the stage to switch to Return codes
sSuccess - the stage was set to the indicated stage statusCode AlUniverse::mergeStage( const char *name )
Description
Merges the current stage with another stage Arguments
name - the name of the stage to merge with Return codes
sSuccess - the stage was successfully merged statusCode AlUniverse::mergeAllStages( void )
Description
Merges all of the stages into a single stage. The current stage is switched to the merged stage. Return codes
sSuccess - all of the stages were successfully merged statusCode AlUniverse::deleteStage( const char *name )
Description
Deletes the stage with the given name. Under OpenAlias, this operation will not delete the last stage if there is only one stage remaining. Arguments
name - the name of the stage to delete Return codes
sSuccess - the stage was successfully deleted statusCode AlUniverse::deleteAllStages( void )
Description
Deletes the stage with the given name. This operation will fail if there is only one stage remaining. Return codes
sSuccess - all of the stages were successfully merged statusCode AlUniverse::visibility( const char *name, boolean& on_or_off )
Description
Returns the visibility status of the indicated stage. Arguments
< name - the name of the stage to examine Return codes
sSuccess - the stage was found and its visibility status was returned statusCode AlUniverse::setVisibility( const char *name, boolean on_or_off )
Description
Sets the visibility status of the indicated stage. Arguments
name - the name of the stage to alter Return codes
sSuccess - the stage was found and its visibility status was returned const char *AlUniverse::windowSource( void )
Description
Returns the name of the currently active application window universe. statusCode AlUniverse::setWindowSource( const char *name )
Description
Sets the window universe to the indicated stage. The window universe contains the windows you are looking through to see the objects in the current universe. Arguments
name - the name of the stage to set the window universe to Return codes
sSuccess - the stage was found and the window universe was set const char *AlUniverse::backgroundSource( void )
Description
Returns the name of the current background source. statusCode AlUniverse::setBackgroundSource( const char *name )
Description
Chooses which stage to take the background source from (the environment shader) that is used for rendering. Arguments
name - the name of the stage to use Return codes
sSuccess - the stage was found statusCode AlUniverse::renameStage( const char* oldName, const char *newName )
Description
Renames the stage with the name 'oldName' to 'newName'. If NULL is specified for oldName, then the current stage is renamed. Arguments
oldName - the name of the stage to rename Return codes
sSuccess - the stage was renamed AlList* AlUniverse::stageNames( void )
Description
Returns an AlList (of AlNameItems) containing the names of all of the stages that are present. statusCode AlUniverse::createNewStage( const char* name )
Description
This routine is now OBSOLETE. Use the routine AlUniverse::createNewStage( const char*, char*&) instead. statusCode AlUniverse::createNewStage( const char* name, char*& stagename )
Description
Creates a new stage and sets the current stage to the new stage. The name assigned to the stage is returned in stagename. Access to stagename is important when stage names are reused and a new unique name is selected. Note that stagename will be assigned to something that can change through calls in the API. So caution must be taken when using stagename in future calls. Arguments
< name - the name of the stage to create Return codes
sSuccess - a new stage with the name 'name' was created statusCode AlUniverse::retrieveStageSet( const char *stageSet, boolean deleteStages )
Description:
This method retrieves a stage set file. Arguments:
> stageSet - the name of the stage set file to be retrieved Return codes:
sSuccess - the method succeeded in retrieving the stage set statusCode AlUniverse::saveStageSet( const char *stageSet )
Description:
This method saves a stage set file. It saves out all of the stages and their associated wire file names. Arguments:
> stageSet - the name(with path) of the stage set file to be created Return codes:
sSuccess - the method succeeded in saving the stage set statusCode AlUniverse::setStageWireFileName( const char *stageName, const char *wireFileName )
Description:
This method sets the wire file name that is to be used for the stage when the stage set is written out using the saveStageSet() call. Arguments:
> stageName - the name of the stage Return codes:
sSuccess - the method succeeded in setting the wire file for the stage const char* AlUniverse::stageWireFileName( const char *stageName )
Description:
This method returns the wire file name of stage 'stageName' NULL is returned if the wire file is not set or if an error occurred. Arguments:
> stageName - the name of the stage AlWindow *AlUniverse::firstWindow( void )
Description
Returns the first window layer. statusCode AlUniverse::applyIteratorToWindows( AlIterator *iter, int& rc )
Description
Applies an iterator to each window. Arguments
< iter - the iterator to apply Return codes
sSuccess - the iterator was successfully applied to each window AlImagePlane* AlUniverse::firstImagePlane( void )
Description
Returns the first image plane. statusCode AlUniverse::applyIteratorToImagePlanes( AlIterator* iter, int& rc )
Description
Applies an iterator to each image plane. Arguments
< iter - the iterator to apply Return codes
sSuccess - the iterator was successfully applied to each image plane AlWindow* AlUniverse::currentWindow( void )
Description
Returns the currently active window. AlWindow* AlUniverse::sbdWindow( void )
Description
Returns the current SBD window. statusCode AlUniverse::blindData( int type, long& size, const char*& ptr )
Description
Retrieves the blind data for the universe. If there is no data, the size will be 0 and the pointer will be NULL. Arguments
< type - the blind data type to find Return codes
sSuccess - the blind data type was found statusCode AlUniverse::setBlindData( int type, long size, const char* ptr )
Description
Associates a block of data with the object. If a block of data is already associated with this object and this user_type, the old block is replaced by a reference to the new block. The old block of data is not deleted. Arguments
type - the type of the blind data to set Return codes
sSuccess - the blind data was set statusCode AlUniverse::removeBlindData( int type )
Description
Removes the blind data from the universe with the indicated type. Note that the user is still responsible for the memory associated with this block of data. Arguments
type - the blind data type to remove Return codes
sSuccess - the type was found and removed AlChannel* AlUniverse::nextChannel(AlChannel *curChannel )
Description
This method returns the next channel in the global list of all channels that appears after the given channel 'curChannel'. Arguments
< curChannel - the channel in the list to obtain the next channel from statusCode AlUniverse::nextChannelD(AlChannel *curChannel )
Description
This method destructively points 'curChannel' to the next channel in the global list of all channels that appear after the given channel. sFailure is returned if there is no next channel. Arguments
< curChannel - the channel in the list to obtain the next channel from Return codes
sSuccess - 'curChannel' now points to the next channel AlAction* AlUniverse::firstAction()
Description
This method returns the first action in the list of all actions in the universe. This list is not in any particular order, and in particular, if an action is added to or deleted from the universe, this list may be reordered. Returns NULL if there are no actions in this universe. AlAction* AlUniverse::nextAction( AlAction *curAction )
Description
This method returns the next action in the global list of all actions that appears after the given action 'curAction'. This list is not in any particular order, and in particular, if an action is added to or deleted from the universe, this list may be reordered. Arguments
< curAction - the action in the list to obtain the next action from AlShader* AlUniverse::firstShader()
Description
Returns the first AlShader in the list of Alias AlShader objects. NULL is returned if the list is empty. AlShader* AlUniverse::nextShader( AlShader* curShader )
Description
Returns the AlShader following curShader in the list of Alias AlShader objects. NULL is returned if curShader has no next shader. Arguments
< curShader - Shader from which to walk forward statusCode AlUniverse::nextShaderD( AlShader* curShader )
Description
Destructively points 'curShader' to the AlShader following curShader in the list of Alias AlShader objects. Arguments
< curShader - Shader from which to walk forward Return codes
sSuccess - curShader now points to the next shader AlEnvironment* AlUniverse::firstEnvironment()
Description
Returns the first AlEnvironment in the list of Alias AlEnvironment objects. NULL is returned if the list is empty. statusCode AlUniverse::deleteAll()
Description
Deletes all objects in the universe. After this operation ALL references to ALL objects will be invalid. Return codes
sSuccess - everything was successfully deleted. statusCode AlUniverse::redrawScreen( unsigned flags )
Description
This routine redraws the modeling windows. Use it after you have completed an operation if you want to see the results. Different parts of the display can be selectively updated. These are selected by performing a bitwise OR of the flags kRedrawInactive, kRedrawActive and kRedrawTemplate. This routine succeeds in LiveData and fails in OpenModel. Return codes
sSuccess - if it was able to redraw. statusCode AlUniverse::applyIteratorToDagNodes( AlIterator* iter, int& rc )
Description
Applies an iterator to all dagnodes. This does not recursively go down the dag. Arguments
< iter - the iterator to apply Return codes
sSuccess - the iterator was successfully applied to each dagNode statusCode AlUniverse::applyIteratorToActions( AlIterator* iter, int& rc )
Description
Applies an iterator to each action. Arguments
< iter - the iterator to apply Return codes
sSuccess - the iterator was successfully applied to each action statusCode AlUniverse::applyIteratorToChannels( AlIterator* iter, int& rc )
Description
Applies an iterator to each channel. Arguments
< iter - the iterator to apply Return codes
sSuccess - the iterator was successfully applied to each channel statusCode AlUniverse::applyIteratorToSets( AlIterator* iter, int& rc )
Description
Applies an iterator to each set. Arguments
< iter - the iterator to apply Return codes
sSuccess - the iterator was successfully applied to each set statusCode AlUniverse::applyIteratorToClusters( AlIterator* iter, int& rc )
Description
Applies an iterator to each cluster. Arguments
< iter - the iterator to apply Return codes
sSuccess - the iterator was successfully applied to each cluster statusCode AlUniverse::applyIteratorToShaders( AlIterator* iter, int& rc )
Description
Applies an iterator to each shader. Arguments
< iter - the iterator to apply Return codes
sSuccess - the iterator was successfully applied to each shader statusCode AlUniverse::writeSDLNoAnimation( const char *filename, boolean store_active )
Arguments
< filename - the base name of the SDL file to write to (including path if appropriate) Return codes
sSuccess - the file(s) was/were successfully written statusCode AlUniverse::writeSDL( const char *filename, boolean store_active, double start, double end, double by )
Arguments
< filename - the base name of the SDL file to write to (including path if appropriate) Return codes
sSuccess - the file(s) was/were successfully written double AlUniverse::currentTime()
Description
When used during playback, this function returns the value of the current frame. statusCode AlUniverse::frameRange(AlFrameRangeType rangeType, double &start, double &end, double &by)
Description
Determines the frame range for the current universe. The range type can be one of kFromPreviewWindow (gets the value from the Preview window, either kMinMax or kGlobal; based on the choice in the preview window - this is undefined for OpenModel), kMinMax (gets the actual start and end as defined by the animaiton on the objects), and kGlobal (gets the values entered by the user - again, undefined for OpenModel). Arguments
rangeType - as described above. Return codes
sSuccess - the frame range was successfully determined. Description
Returns the current mode that the Alias API is running in (kOpenModel or kOpenAlias). This is useful when writing code that is shared between OpenModel and OpenAlias. statusCode AlUniverse::userPrefColor( int colorField, int &r, int &g, int &b)
Description
Returns RGB values for the given color field. Color field constants are defined in AlUserColors.h. This method always fails in OpenModel. Arguments
< colorField - color field Return codes
sSuccess - normal completion statusCode AlUniverse::setUserPrefColor( int colorField, int &r, int &g, int &b)
Description
Sets RGB values for the given color field. Color field constants are defined in AlUserColors.h. This method always fails in OpenModel. Arguments
< colorField - color field Return codes
sSuccess - normal completion