The Scene object represents a Softimage scene that is loaded in memory.
You can access most of the contents of the scene using Scene::GetRoot, which returns the root Model.
The full path of the Scene is stored inside the
FileName
Parameter (see the example below for more details).
The scripting name of the scene is stored inside the
Name
Parameter
A-Z
,
a-z
, 0-9
, and must not begin with a
numeral. Therefore, if you want to save a scene with a filename
that begins with a numeral,
XSI prefixes an underscore (_) to the actual filename you
used.// Shortcut to application Application app = Application(); // Start with a fresh scene CValue outArg; CValueArray args; args.Add( L"" ); args.Add( false ); app.ExecuteCommand( L"NewScene", args, outArg ); // Get the active scene as a scene object and then get its root Project proj = app.GetActiveProject(); Scene scn = proj.GetActiveScene(); Model root = scn.GetRoot(); // Add a null and a cube to the scene root Null n; root.AddNull( L"Thing1", n ); X3DObject c; root.AddGeometry( L"Cube", L"MeshSurface", L"Thing2", c ); // Save the scene as "2Things.scn" under the projects directory CString sProjectsDir = app.GetInstallationPath( siProjectPath ); args.Clear(); args.Add( sProjectsDir + L"\\2Things.scn" ); app.ExecuteCommand( L"SaveSceneAs", args, outArg ); // Save the actual scene name in a variable and display it CParameterRefArray params = scn.GetParameters(); Parameter p = params.GetItem( L"Filename" ); CString sRealName = p.GetValue( double(1) ); app.LogMessage( L"My real name is " + sRealName ); // Save the scripting name in a variable and display it Parameter q = params.GetItem( L"Name" ); CString sScriptingName = q.GetValue( double(1) ); app.LogMessage( L"My scripting name is " + sScriptingName ); // Expected result: //INFO : My real name is <project location>\2Things.scn //INFO : My scripting name is _2Things
#include <xsi_scene.h>
Public Member Functions |
|
Scene () | |
~Scene () | |
Scene (const CRef &in_ref) | |
Scene (const Scene &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
Scene & | operator= (const Scene &in_obj) |
Scene & | operator= (const CRef &in_ref) |
Model | GetRoot () const |
Property | GetColors () const |
Layer | GetActiveLayer () const |
Pass | GetActivePass () const |
CRefArray | GetLayers () const |
CRefArray | GetPasses () const |
PassContainer | GetPassContainer () const |
Library | GetActiveMaterialLibrary () const |
CRefArray | GetMaterialLibraries () const |
SimulationEnvironment | GetActiveSimulationEnvironment () const |
CRefArray | GetSimulationEnvironments () const |
CRefArray | GetProperties () const |
CRefArray | GetExternalFiles () const |
FileReference | GetExternalFileFromGUID (const CString &in_csGUID) const |
CRefArray | GetImageClips () const |
ImageClip2 | GetDefaultImageClip () |
Scene | ( | ) |
Default constructor.
~Scene | ( | ) |
Default destructor.
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from ProjectItem.
siClassID GetClassID | ( | ) | const [virtual] |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
in_obj | constant class object. |
Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.
in_ref | constant class object. |
Reimplemented from ProjectItem.
Model GetRoot | ( | ) | const |
Returns the scene's root model (Scene_Root
). The
scene root is the entry point for a lot of functionality in the C++
API. For example, to add a 3D scene object you call X3DObject::AddGeometry
on the scene root; to get the
Mixer object you need to call Model::GetMixer
on the scene root, etc.
This member is typically called from the active (or current) scene which you can get by calling Project::GetActiveScene on the active project, which is available from Application::GetActiveProject. However, there is a more direct way to access the scene root directly from the Application class which is preferable: Application.GetActiveSceneRoot.
Property GetColors | ( | ) | const |
Returns the Scene Colors property (found under the scene's Preferences in the UI). The Scene Colors property allows you to control the color that objects and components display in their selected, unselected, and unselectable state.
The value of each color Parameter represents an RGB value as a LONG (0 to 1023). For more details, see the explanation for how Wireframe colors are represented in the CColor documentation.
Layer GetActiveLayer | ( | ) | const |
Returns the currently active Layer object. Layers help you organize, view, and edit the contents in your scene, but they only affect the final render if you want them to (they are not associated with render passes).
Pass GetActivePass | ( | ) | const |
Returns the currently active render Pass object. A render pass creates a picture layer of a scene that can be composited with any other pass(es) to create a complete image. Passes also allow you to quickly re-render a single layer without re-rendering the entire scene.
CRefArray GetLayers | ( | ) | const |
Returns an array of references to the Layer objects associated with the scene.
CRefArray GetPasses | ( | ) | const |
Returns an array of references to the Pass objects associated with the scene.
PassContainer GetPassContainer | ( | ) | const |
Returns the scene's pass container. The pass container contains all the passes in the scene, along with scene global render options properties.
Library GetActiveMaterialLibrary | ( | ) | const |
Returns the currently active MaterialLibrary. A material library is a common container for materials used in a scene. Every Material you create is added to a library. You can then assign it to one or more objects (or clusters, hierarchies, groups, partitions, and so on). This makes it easy to share a single material between multiple scene elements while having only the one material to manage.
CRefArray GetMaterialLibraries | ( | ) | const |
Returns an array of references to the MaterialLibrary objects associated with the scene. This list contains all material libraries under the Source container ("Scene.Sources").
SimulationEnvironment GetActiveSimulationEnvironment | ( | ) | const |
Returns the currently active SimulationEnvironment. All elements that are part of a rigid body simulation are controlled within a simulation environment. A simulation environment is created as soon as you make an object into a rigid body. You can also create environments so that you can have multiple simulation environments in one scene.
CRefArray GetSimulationEnvironments | ( | ) | const |
Returns an array of references to the SimulationEnvironment objects associated with the scene. This list contains all simulation environments under the Environments container ("Scene.Environments").
CRefArray GetProperties | ( | ) | const |
Returns an array of references to the properties installed on the scene.
CRefArray GetExternalFiles | ( | ) | const |
Returns a list of FileReference objects containing all external files related to this scene. Only input files are added to this list (for example graphics files, audio files, referenced model files, etc.).
FileReference GetExternalFileFromGUID | ( | const CString & | in_csGUID | ) | const |
Returns the FileReference object which corresponds to the specified unique indentifier (GUID).
in_csGUID | The GUID of the object to retrieve |
CRefArray GetImageClips | ( | ) | const |
Returns an array of all ImageClip2 objects associated with the scene. Image clips and their sources are always stored under the scene in the Clips ("Scene.Clips.Image") and Sources ("Scene.Sources.Image") containers.
This differs from animation clips and sources for animation which are stored under the Track, Mixer, and Model where they are used, so Scene::GetImageClips returns all image clips in the scene, whereas ClipContainer::GetClips and Track::GetClips return only clips for the specific container (mixer or track).
ImageClip2 GetDefaultImageClip | ( | ) |
Returns or creates an ImageClip2 object representing the default image clip.