Unigine.ImportProcessor Class
This class is used to manage import processors. An import processor is a module that saves objects generated by an importer on the basis of metadata on the whole scene or some of its components to files in UNIGINE native format and performs auxiliary operations during the import process (data preparation, file management, etc.). You can use a set of different processors for each scene component or a single processor for all of them. There are also two specific types of processors:
- Pre-processors - perform additional operations with scene metadata prior to generation of UNIGINE's objects.
- Post-processors - perform additional operations with files generated in the process of import (e.g. copying files to other folders, adding files to packages, etc.).
This is a base class for all import processors. Your custom import processor class must be inherited from it.
You can override one (or all) onProcess*() methods to define the types of components to be processed by it, these overridden methods will be called by the importer when corresponding import operations are performed.
For pre- and post-processors only the onProcessScene() method is to be overridden.
ImportProcessor Class
Properties
Importer Importer#
The importer to be used for the import processor.
string OutputPath#
The output path to be used to put files with imported scene elements to.
Members
ImportProcessor GetImportProcessor ( ) #
Returns the import processor itself.Return value
Import processor itself.bool ProcessScene ( ImportScene scene ) #
Performs scene processing: modifies the metadata of scene elements or files generated in the process of importing the scene.This method is used by pre-processors and post-processors. To customize actions to be performed on scene processing, when implementing a custom pre- or post-processor, you can override the OnProcessScene() method.
Arguments
- ImportScene scene - Scene to be processed.
Return value
true if the specified scene is successfully processed; otherwise, false.bool ProcessTexture ( ImportTexture import_texture ) #
Performs texture processing: saves the specified generated texture to a corresponding file in the output directory.To customize actions to be performed on texture processing, when implementing a custom import processor, you can override the OnProcessTexture() method.
Arguments
- ImportTexture import_texture - Instance of the ImportTexture class containing information about the imported texture.
Return value
true if the specified texture is successfully imported to a file; otherwise, false.bool ProcessMesh ( Mesh mesh, ImportMesh import_mesh ) #
Performs mesh processing: saves the specified generated mesh to a corresponding *.mesh file in the output directory.To customize actions to be performed on mesh processing, when implementing a custom import processor, you can override the OnProcessMesh() method.
Arguments
- Mesh mesh - UNIGINE's mesh instance generated for the specified imported mesh.
- ImportMesh import_mesh - Instance of the ImportMesh class containing information about the imported mesh.
Return value
true if the specified mesh is successfully imported to a file; otherwise, false.bool ProcessLight ( Light light, ImportLight import_light ) #
Performs light processing: saves the specified generated light source to a corresponding file in the output directory.To customize actions to be performed on light processing, when implementing a custom import processor, you can override the OnProcessLight() method.
Arguments
- Light light - UNIGINE's light instance generated for the specified imported light.
- ImportLight import_light - Instance of the ImportLight class containing information about the imported light.
Return value
true if the specified light is successfully processed; otherwise, false.bool ProcessCamera ( Player camera, ImportCamera import_camera ) #
Performs camera processing: saves the specified generated player to a corresponding file in the output directory.To customize actions to be performed on camera processing, when implementing a custom import processor, you can override the OnProcessCamera() method.
Arguments
- Player camera - UNIGINE's player instance generated for the specified imported camera.
- ImportCamera import_camera - Instance of the ImportCamera class containing information about the imported camera.
Return value
true if the specified camera is successfully processed; otherwise, false.bool ProcessAnimation ( MeshAnimation animation, ImportAnimation import_animation ) #
Performs mesh animation processing: saves the specified generated mesh animation to a corresponding file in the output directory.To customize actions to be performed on mesh animation processing, when implementing a custom import processor, you can override the OnProcessAnimation() method.
Arguments
- MeshAnimation animation - UNIGINE's mesh animation instance generated for the specified imported animation.
- ImportAnimation import_animation - Instance of the ImportAnimation class containing information about the imported animation.
Return value
true if the specified animation is successfully processed; otherwise, false.bool ProcessAnimation ( MeshAnimation animation, ImportMesh import_mesh, ImportAnimation import_animation ) #
Performs mesh animation processing: saves the specified generated mesh animation to a corresponding file in the output directory.To customize actions to be performed on mesh animation processing, when implementing a custom import processor, you can override the OnProcessAnimation() method.
Arguments
- MeshAnimation animation - UNIGINE's mesh animation instance generated for the specified imported animation.
- ImportMesh import_mesh - Instance of the ImportMesh class containing information about the imported mesh.
- ImportAnimation import_animation - Instance of the ImportAnimation class containing information about the imported animation.
Return value
true if the specified animation is successfully processed; otherwise, false.bool ProcessNode ( Node node, ImportNode import_node ) #
Performs node processing: saves the specified generated node to a corresponding *.node file in the output directory.To customize actions to be performed on node processing, when implementing a custom import processor, you can override the OnProcessNode() method.
Arguments
- Node node - UNIGINE's node instance generated for the specified imported node.
- ImportNode import_node - Instance of the ImportNode class containing information about the imported node.
Return value
true if the specified node is successfully processed; otherwise, false.bool ProcessNodeChild ( Node node_parent, ImportNode import_node_parent, Node node_child, ImportNode import_node_child ) #
Performs node processing: saves the specified generated node along with the specified child to a corresponding *.node file in the output directory.To customize actions to be performed on node processing, when implementing a custom import processor, you can override the OnProcessNodeChild() method.
Arguments
- Node node_parent - Target UNIGINE's node instance to store the specified imported parent node.
- ImportNode import_node_parent - Instance of the ImportNode class containing information about the imported parent node.
- Node node_child
- ImportNode import_node_child - Instance of the ImportNode class containing information about the imported child node.
Return value
true if the specified parent node with its specified child node is successfully processed; otherwise, false.bool ProcessMaterial ( Material material, ImportMaterial import_material ) #
Performs material processing: saves the specified generated material to a corresponding file in the output directory.To customize actions to be performed on material processing, when implementing a custom import processor, you can override the OnProcessMaterial() method.
Arguments
- Material material - UNIGINE's material instance generated for the specified imported material.
- ImportMaterial import_material - Instance of the ImportMaterial class containing information about the imported material.
Return value
true if the specified material is successfully processed; otherwise, false.bool OnProcessScene ( ImportScene scene ) #
Scene processing event handler function. This function is called each time when the ProcessScene() function is called. You can specify your custom actions to be performed: modify the metadata of scene elements (pre-process) or files generated in the process of importing the scene (post-process).This method is used by pre-processors and post-processors.
class MyCustomProcessor : public Unigine::ImportProcessor
{
public:
MyCustomProcessor();
virtual ~MyCustomProcessor();
/*...*/
// overrides of event functions
protected:
virtual bool onProcessScene(ImportScene *scene) override;
/*...*/
};
/*...*/
bool MyCustomProcessor::onProcessScene(ImportScene *scene)
{
bool result = false;
// your custom actions
return result;
}
Arguments
- ImportScene scene - Scene to be processed.
Return value
true if the specified scene is successfully processed; otherwise, false.bool OnProcessTexture ( ImportTexture import_texture ) #
Texture processing event handler function. This function is called each time when the ProcessTexture() function is called. You can specify your custom actions to be performed on texture processing.class MyCustomProcessor : public Unigine::ImportProcessor
{
public:
MyCustomProcessor();
virtual ~MyCustomProcessor();
/*...*/
// overrides of event functions
protected:
virtual bool onProcessTexture(ImportTexture *import_texture) override;
/*...*/
};
/*...*/
bool MyCustomProcessor::onProcessTexture(ImportTexture *import_texture)
{
bool result = false;
// your custom actions
return result;
}
Arguments
- ImportTexture import_texture - Instance of the ImportTexture class containing information about the imported texture.
Return value
true if the specified texture is successfully processed; otherwise, false.bool OnProcessMesh ( Mesh mesh, ImportMesh import_mesh ) #
Mesh processing event handler function. This function is called each time when the ProcessMesh() function is called. You can specify your custom actions to be performed on mesh processing.class MyCustomProcessor : public Unigine::ImportProcessor
{
public:
MyCustomProcessor();
virtual ~MyCustomProcessor();
/*...*/
// overrides of event functions
protected:
virtual bool onProcessMesh(MeshPtr &mesh, ImportMesh *import_mesh) override;
/*...*/
};
/*...*/
bool MyCustomProcessor::onProcessMesh(MeshPtr &mesh, ImportMesh *import_mesh)
{
bool result = false;
// your custom actions
return result;
}
Arguments
- Mesh mesh - UNIGINE's mesh instance generated for specified imported mesh.
- ImportMesh import_mesh - Instance of the ImportMesh class containing information about the imported mesh.
Return value
true if the specified mesh is successfully processed; otherwise, false.bool OnProcessLight ( Light light, ImportLight import_light ) #
Light processing event handler function. This function is called each time when the ProcessLight() function is called. You can specify your custom actions to be performed on light processing.class MyCustomProcessor : public Unigine::ImportProcessor
{
public:
MyCustomProcessor();
virtual ~MyCustomProcessor();
/*...*/
// overrides of event functions
protected:
virtual bool onProcessLight(LightPtr &light, ImportLight *import_light) override;
/*...*/
};
/*...*/
bool MyCustomProcessor::onProcessLight(LightPtr &light, ImportLight *import_light)
{
bool result = false;
// your custom actions
return result;
}
Arguments
- Light light - UNIGINE's light instance generated for specified imported light.
- ImportLight import_light - Instance of the ImportLight class containing information about the imported light.
Return value
true if the specified light is successfully processed; otherwise, false.bool OnProcessCamera ( Player camera, ImportCamera import_camera ) #
Camera processing event handler function. This function is called each time when the ProcessCamera() function is called. You can specify your custom actions to be performed on camera processing.class MyCustomProcessor : public Unigine::ImportProcessor
{
public:
MyCustomProcessor();
virtual ~MyCustomProcessor();
/*...*/
// overrides of event functions
protected:
virtual bool onProcessCamera(PlayerPtr &camera, ImportCamera *import_camera) override;
/*...*/
};
/*...*/
bool MyCustomProcessor::onProcessCamera(PlayerPtr &camera, ImportCamera *import_camera)
{
bool result = false;
// your custom actions
return result;
}
Arguments
- Player camera - UNIGINE's player instance generated for the specified imported camera.
- ImportCamera import_camera - Instance of the ImportCamera class containing information about the imported camera.
Return value
true if the specified camera is successfully processed; otherwise, false.bool OnProcessAnimation ( MeshAnimation animation, ImportAnimation import_animation ) #
Animation processing event handler function. This function is called each time when the ProcessAnimation() function is called. You can specify your custom actions to be performed on animation processing.class MyCustomProcessor : public Unigine::ImportProcessor
{
public:
MyCustomProcessor();
virtual ~MyCustomProcessor();
/*...*/
// overrides of event functions
protected:
virtual bool onProcessAnimation(MeshAnimationPtr &animation, ImportMesh *import_mesh, ImportAnimation *import_animation) override;
/*...*/
};
/*...*/
bool MyCustomProcessor::onProcessAnimation(MeshAnimationPtr &animation, ImportMesh *import_mesh, ImportAnimation *import_animation)
{
bool result = false;
// your custom actions
return result;
}
Arguments
- MeshAnimation animation - UNIGINE's mesh animation instance generated for the specified imported mesh animation.
- ImportAnimation import_animation - Instance of the ImportAnimation class containing information about the imported animation.
Return value
true if the specified animation is successfully processed; otherwise, false.bool OnProcessAnimation ( MeshAnimation animation, ImportMesh import_mesh, ImportAnimation import_animation ) #
Animation processing event handler function. This function is called each time when the ProcessAnimation() function is called. You can specify your custom actions to be performed on animation processing.class MyCustomProcessor : public Unigine::ImportProcessor
{
public:
MyCustomProcessor();
virtual ~MyCustomProcessor();
/*...*/
// overrides of event functions
protected:
virtual bool onProcessAnimation(MeshAnimationPtr &animation, ImportMesh *import_mesh, ImportAnimation *import_animation) override;
/*...*/
};
/*...*/
bool MyCustomProcessor::onProcessAnimation(MeshAnimationPtr &animation, ImportMesh *import_mesh, ImportAnimation *import_animation)
{
bool result = false;
// your custom actions
return result;
}
Arguments
- MeshAnimation animation - UNIGINE's mesh animation instance generated for the specified imported mesh animation.
- ImportMesh import_mesh - Instance of the ImportMesh class containing information about the imported mesh.
- ImportAnimation import_animation - Instance of the ImportAnimation class containing information about the imported animation.
Return value
true if the specified animation is successfully processed; otherwise, false.bool OnProcessNode ( Node node, ImportNode import_node ) #
Node processing event handler function. This function is called each time when the ProcessNode() function is called. You can specify your custom actions to be performed on node processing.class MyCustomProcessor : public Unigine::ImportProcessor
{
public:
MyCustomProcessor();
virtual ~MyCustomProcessor();
/*...*/
// overrides of event functions
protected:
virtual bool onProcessNode(NodePtr &node, ImportNode *import_node) override;
/*...*/
};
/*...*/
bool MyCustomProcessor::onProcessNode(NodePtr &node, ImportNode *import_node)
{
bool result = false;
// your custom actions
return result;
}
Arguments
- Node node - UNIGINE's node instance generated for the specified imported node.
- ImportNode import_node - Instance of the ImportNode class containing information about the imported node.
Return value
true if the specified node is successfully processed; otherwise, false.bool OnProcessNodeChild ( Node node_parent, ImportNode import_node_parent, Node node_child, ImportNode import_node_child ) #
Node processing event handler function for node hierarchies. This function is called each time when the ProcessNodeChild() function is called. You can specify your custom actions to be performed on node processing (e.g. assigning properties to node's children).class MyCustomProcessor : public Unigine::ImportProcessor
{
public:
MyCustomProcessor();
virtual ~MyCustomProcessor();
/*...*/
// overrides of event functions
protected:
virtual bool onProcessNodeChild(const NodePtr &node_parent, const ImportNodePtr &import_node_parent, const NodePtr &node_child, const ImportNodePtr &import_node_child) override;
/*...*/
};
/*...*/
bool MyCustomProcessor::onProcessNode(NodePtr &node, ImportNode *import_node)
{
bool result = false;
// your custom actions
return result;
}
Arguments
- Node node_parent - Target UNIGINE's node instance to store the specified imported parent node.
- ImportNode import_node_parent - Instance of the ImportNode class containing information about the imported parent node.
- Node node_child - Target UNIGINE's node instance to store the specified imported child node.
- ImportNode import_node_child - Instance of the ImportNode class containing information about the imported child node.
Return value
true if the specified parent node is successfully processed with its specified child node; otherwise, false.bool OnProcessMaterial ( Material material, ImportMaterial import_material ) #
Material processing event handler function. This function is called each time when the ProcessMaterial() function is called. You can specify your custom actions to be performed on material processing.class MyCustomProcessor : public Unigine::ImportProcessor
{
public:
MyCustomProcessor();
virtual ~MyCustomProcessor();
/*...*/
// overrides of event functions
protected:
virtual bool onProcessMaterial(MaterialPtr &material, ImportMaterial *import_material) override;
/*...*/
};
/*...*/
bool MyCustomProcessor::onProcessMaterial(MaterialPtr &material, ImportMaterial *import_material)
{
bool result = false;
// your custom actions
return result;
}
Arguments
- Material material - UNIGINE's material instance generated for the specified imported material.
- ImportMaterial import_material - Instance of the ImportMaterial class containing information about the imported material.
Return value
true if the specified material is successfully processed; otherwise, false.Last update:
2024-12-13
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)