This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.Importer Class

Warning
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to Engineering / Sim SDK edition to use it.

This class is used to manage a file importer. File importers are used by the Engine's import system to bring the data stored in various non-native formats to UNIGINE. Each importer can be used to import multiple file formats, but there shouldn't be two or more importers registered for a single file format.

Importer has a set of flags defining which scene components are to be extracted and imported. So, the importer should be initialized before use.

Each importer generates UNIGINE objects on the basis of metadata extracted from the imported files and uses a set of processors to perform all necessary auxiliary operations (data preparation, file saving, file management, etc.). Importer allows you to add any number of pre- and post-processors. However, you can set only one processor for each scene component.

Notice
This is a base class for all importers. Your custom importer class must be inherited from it.

You can customize actions to be performed when importing the whole scene as well as when importing textures, materials, meshes, animations, lights, cameras by overriding the corresponding event handler functions for your custom importer

Source code (C++)
class MyCustomImporter : public Unigine::Importer
{
public:
	MyCustomImporter();
	virtual ~MyCustomImporter();

/*...*/

// overrides of event functions
protected:
	virtual Unigine::ImportScene *onInit(const Unigine::String &filepath) override;
	virtual bool onImport(const char *output_path) override;
	virtual bool onImportTexture(ImportProcessor *processor, ImportTexture *import_texture) override;
	virtual bool onImportMaterial(ImportProcessor *processor, Unigine::MaterialPtr &material, ImportMaterial *import_material) override;
	virtual bool onImportMesh(ImportProcessor *processor, Unigine::MeshPtr &mesh, ImportMesh *import_mesh) override;
	virtual bool onImportLight(ImportProcessor *processor, Unigine::LightPtr &light, ImportLight *import_light) override;
	virtual bool onImportCamera(ImportProcessor *processor, Unigine::PlayerPtr &camera, ImportCamera *import_camera);
	virtual bool onImportNode(ImportProcessor *processor, Unigine::NodePtr &node, ImportNode *import_node) override;
	virtual bool onImportAnimation(ImportProcessor *processor, Unigine::MeshPtr &animation, ImportMesh *import_mesh, ImportAnimation *import_animation) override;

private:
	ImportScene *import_scene();
	void import_textures(ImportScene *scene);
	void import_materials(ImportScene *scene);
	void import_animations(ImportScene *scene);

	void process_node(ImportScene *import_scene, ImportNode *parent, fbx::FbxNode *fbx_node);
	void process_mesh(ImportScene *import_scene, ImportNode *node, fbx::FbxNode *fbx_node, fbx::FbxMesh *fbx_mesh);
	void process_light(ImportScene *import_scene, ImportNode *node, fbx::FbxNode *fbx_node, fbx::FbxLight *fbx_light);
	void process_camera(ImportScene *import_scene, ImportNode *node, fbx::FbxNode *fbx_node, fbx::FbxCamera *fbx_camera);

/*...*/

};

Importer Class

Members


int ContainsParameter ( String name ) #

Returns a value indicating whether the list of import parameters includes a parameter with a given name.

Arguments

Return value

1 if the list of import parameters includes a parameter with a given name; otherwise, 0.

void SetParameterInt ( String name, int v ) #

Sets a new value for the specified integer parameter. There are built-in parameters that can also be used in custom importers.

Arguments

  • String name - Name of the integer parameter.
  • int v - New value to be set.

int GetParameterInt ( String name ) #

Returns the current value of the specified integer parameter. There are built-in parameters that can also be used in custom importers.

Arguments

  • String name - Name of the integer parameter.

Return value

Value of the integer parameter.

void SetParameterFloat ( String name, float v ) #

Sets a new value for the specified float parameter. There are built-in parameters that can also be used in custom importers.

Arguments

  • String name - Name of the float parameter.
  • float v - New value to be set.

float GetParameterFloat ( String name ) #

Returns the current value of the specified float parameter. There are built-in parameters that can also be used in custom importers.

Arguments

  • String name - Name of the float parameter.

Return value

Value of the float parameter.

void SetParameterDouble ( String name, double v ) #

Sets a new value for the specified double parameter.

Arguments

  • String name - Name of the double parameter.
  • double v - New value to be set.

double GetParameterDouble ( String name ) #

Returns the current value of the specified double parameter.

Arguments

  • String name - Name of the double parameter.

Return value

Value of the double parameter.

void SetParameterString ( String name, String v ) #

Sets a new value for the specified string parameter. There are built-in parameters that can also be used in custom importers.

Arguments

  • String name - Name of the string parameter.
  • String v - New value to be set.

const char * GetParameterString ( String name ) #

Returns the current value of the specified string parameter. There are built-in parameters that can also be used in custom importers.

Arguments

  • String name - Name of the string parameter.

Return value

Value of the string parameter.

int AddPreProcessor ( String type_name ) #

Adds an import pre-processor with a given name. There are built-in pre-processors that can also be added to custom importers.

Arguments

  • String type_name - Pre-processor name.

Return value

1 if the specified import pre-processor is successfully added; otherwise, 0.

void RemovePreProcessor ( String type_name ) #

Removes an import pre-processor with a given name. There are built-in pre-processors that can also be added to custom importers.

Arguments

  • String type_name - Pre-processor name.

int AddPostProcessor ( String type_name ) #

Adds an import post-processor with a given name. There are built-in post-processors that can also be added to custom importers.

Arguments

  • String type_name - Post-processor name.

Return value

1 if the specified import post-processor is successfully added; otherwise, 0.

void RemovePostProcessor ( String type_name ) #

Removes an import post-processor with a given name. There are built-in post-processors that can also be added to custom importers.

Arguments

  • String type_name - Post-processor name.

int Init ( int flags ) #

Initializes the importer for the specified file using the given flags. Import flags specify which scene components are to be imported.

Arguments

  • int flags - Set of import flags. Any combination of IMPORT_* flags, or ~0 to set all of them.

Return value

1 if the importer was initialized successfully; otherwise, 0.

int Import ( String output_path ) #

Imports the contents of the input file to the specified output path.

Arguments

  • String output_path - Output path.

Return value

1 if the contents of the input file are successfully imported to the specified output path; otherwise, 0.
Last update: 2022-03-10
Build: ()