Blender V4.3
DocumentImporter Class Reference

#include <DocumentImporter.h>

Inherits COLLADAFW::IWriter.

Public Types

enum  ImportStage { Fetching_Scene_data , Fetching_Controller_data }
 

Public Member Functions

 DocumentImporter (bContext *C, const ImportSettings *import_settings)
 
 ~DocumentImporter ()
 
bool import ()
 
Objectcreate_camera_object (COLLADAFW::InstanceCamera *, Scene *)
 
Objectcreate_light_object (COLLADAFW::InstanceLight *, Scene *)
 
Objectcreate_instance_node (Object *, COLLADAFW::Node *, COLLADAFW::Node *, Scene *, bool)
 
void create_constraints (ExtraTags *et, Object *ob)
 
std::vector< Object * > * write_node (COLLADAFW::Node *, COLLADAFW::Node *, Scene *, Object *, bool)
 
void write_profile_COMMON (COLLADAFW::EffectCommon *, Material *)
 
void translate_anim_recursive (COLLADAFW::Node *, COLLADAFW::Node *, Object *)
 
void cancel (const COLLADAFW::String &errorMessage)
 
void start ()
 
void finish ()
 
bool writeGlobalAsset (const COLLADAFW::FileInfo *)
 
std::string get_import_version (const COLLADAFW::FileInfo *asset)
 
bool writeScene (const COLLADAFW::Scene *)
 
bool writeVisualScene (const COLLADAFW::VisualScene *)
 
bool writeLibraryNodes (const COLLADAFW::LibraryNodes *)
 
bool writeAnimation (const COLLADAFW::Animation *)
 
bool writeAnimationList (const COLLADAFW::AnimationList *)
 
bool writeGeometry (const COLLADAFW::Geometry *)
 
bool writeMaterial (const COLLADAFW::Material *)
 
bool writeEffect (const COLLADAFW::Effect *)
 
bool writeCamera (const COLLADAFW::Camera *)
 
bool writeImage (const COLLADAFW::Image *)
 
bool writeLight (const COLLADAFW::Light *)
 
bool writeSkinControllerData (const COLLADAFW::SkinControllerData *)
 
bool writeController (const COLLADAFW::Controller *)
 
bool writeFormulas (const COLLADAFW::Formulas *)
 
bool writeKinematicsScene (const COLLADAFW::KinematicsScene *)
 
bool addExtraTags (const COLLADAFW::UniqueId &uid, ExtraTags *extra_tags)
 
ExtraTagsgetExtraTags (const COLLADAFW::UniqueId &uid)
 
bool is_armature (COLLADAFW::Node *node)
 

Detailed Description

Importer class.

Definition at line 35 of file DocumentImporter.h.

Member Enumeration Documentation

◆ ImportStage

Enumeration to denote the stage of import

Enumerator
Fetching_Scene_data 
Fetching_Controller_data 

Definition at line 38 of file DocumentImporter.h.

Constructor & Destructor Documentation

◆ DocumentImporter()

DocumentImporter::DocumentImporter ( bContext * C,
const ImportSettings * import_settings )

Constructor

Definition at line 80 of file DocumentImporter.cpp.

◆ ~DocumentImporter()

DocumentImporter::~DocumentImporter ( )

Destructor

Definition at line 101 of file DocumentImporter.cpp.

Member Function Documentation

◆ addExtraTags()

bool DocumentImporter::addExtraTags ( const COLLADAFW::UniqueId & uid,
ExtraTags * extra_tags )

Add element and data for UniqueId

Definition at line 1136 of file DocumentImporter.cpp.

Referenced by ExtraHandler::parseElement().

◆ cancel()

void DocumentImporter::cancel ( const COLLADAFW::String & errorMessage)

This method will be called if an error in the loading process occurred and the loader cannot continue to load. The writer should undo all operations that have been performed.

Parameters
errorMessageA message containing information about the error that occurred.

Definition at line 152 of file DocumentImporter.cpp.

◆ create_camera_object()

Object * DocumentImporter::create_camera_object ( COLLADAFW::InstanceCamera * camera,
Scene * sce )

these should not be here

Definition at line 345 of file DocumentImporter.cpp.

References bc_add_object(), BKE_id_free_us(), CTX_data_main(), Object::data, and OB_CAMERA.

Referenced by write_node().

◆ create_constraints()

void DocumentImporter::create_constraints ( ExtraTags * et,
Object * ob )

To create constraints off node <extra> tags. Assumes only constraint data in current <extra> with blender profile.

Definition at line 452 of file DocumentImporter.cpp.

References BKE_constraint_add_for_object(), ExtraTags::isProfile(), and ExtraTags::setData().

◆ create_instance_node()

Object * DocumentImporter::create_instance_node ( Object * source_ob,
COLLADAFW::Node * source_node,
COLLADAFW::Node * instance_node,
Scene * sce,
bool is_library_node )

◆ create_light_object()

Object * DocumentImporter::create_light_object ( COLLADAFW::InstanceLight * lamp,
Scene * sce )

Definition at line 362 of file DocumentImporter.cpp.

References bc_add_object(), BKE_id_free_us(), CTX_data_main(), Object::data, lamp, and OB_LAMP.

Referenced by write_node().

◆ finish()

◆ get_import_version()

std::string DocumentImporter::get_import_version ( const COLLADAFW::FileInfo * asset)

If the imported file was made with Blender, return the Blender version used, otherwise return an empty std::string

Definition at line 309 of file DocumentImporter.cpp.

References count, and v.

Referenced by writeGlobalAsset().

◆ getExtraTags()

ExtraTags * DocumentImporter::getExtraTags ( const COLLADAFW::UniqueId & uid)

Get an existing ExtraTags for uid

Definition at line 1128 of file DocumentImporter.cpp.

Referenced by ExtraHandler::parseElement(), write_node(), writeCamera(), and writeLight().

◆ import()

bool DocumentImporter::import ( )

Function called by blender UI

TODO: set up scene graph and such here.

Definition at line 111 of file DocumentImporter.cpp.

References bc_url_encode(), BKE_view_layer_base_deselect_all(), CTX_data_scene(), Fetching_Controller_data, ImportSettings::filepath, and ErrorHandler::hasError().

Referenced by collada_import().

◆ is_armature()

bool DocumentImporter::is_armature ( COLLADAFW::Node * node)

Definition at line 1142 of file DocumentImporter.cpp.

Referenced by write_node().

◆ start()

void DocumentImporter::start ( )

This is the method called. The writer hast to prepare to receive data.

Definition at line 162 of file DocumentImporter.cpp.

◆ translate_anim_recursive()

void DocumentImporter::translate_anim_recursive ( COLLADAFW::Node * node,
COLLADAFW::Node * par = nullptr,
Object * parob = nullptr )

◆ write_node()

◆ write_profile_COMMON()

◆ writeAnimation()

bool DocumentImporter::writeAnimation ( const COLLADAFW::Animation * anim)

This function is called only for animations that pass COLLADAFW::validate.

Definition at line 1070 of file DocumentImporter.cpp.

References Fetching_Controller_data, and AnimationImporter::write_animation().

◆ writeAnimationList()

bool DocumentImporter::writeAnimationList ( const COLLADAFW::AnimationList * animationList)

Called on post-process stage after writeVisualScenes.

Definition at line 1079 of file DocumentImporter.cpp.

References Fetching_Controller_data, and AnimationImporter::write_animation_list().

◆ writeCamera()

bool DocumentImporter::writeCamera ( const COLLADAFW::Camera * camera)

◆ writeController()

bool DocumentImporter::writeController ( const COLLADAFW::Controller * controller)

This is called on post-process, before writeVisualScenes.

Definition at line 1109 of file DocumentImporter.cpp.

References controller, Fetching_Controller_data, and ArmatureImporter::write_controller().

◆ writeEffect()

bool DocumentImporter::writeEffect ( const COLLADAFW::Effect * effect)

When this method is called, the writer must write the effect.

Returns
The writer should return true, if writing succeeded, false otherwise.

Definition at line 780 of file DocumentImporter.cpp.

References Fetching_Controller_data, and write_profile_COMMON().

◆ writeFormulas()

bool DocumentImporter::writeFormulas ( const COLLADAFW::Formulas * formulas)

Definition at line 1118 of file DocumentImporter.cpp.

◆ writeGeometry()

bool DocumentImporter::writeGeometry ( const COLLADAFW::Geometry * geom)

When this method is called, the writer must write the geometry.

Returns
The writer should return true, if writing succeeded, false otherwise.

Definition at line 728 of file DocumentImporter.cpp.

References Fetching_Controller_data, and MeshImporter::write_geometry().

◆ writeGlobalAsset()

bool DocumentImporter::writeGlobalAsset ( const COLLADAFW::FileInfo * asset)

When this method is called, the writer must write the global document asset.

Returns
The writer should return true, if writing succeeded, false otherwise.

Definition at line 332 of file DocumentImporter.cpp.

References get_import_version(), UnitConverter::read_asset(), and AnimationImporter::set_import_from_version().

◆ writeImage()

bool DocumentImporter::writeImage ( const COLLADAFW::Image * image)

When this method is called, the writer must write the image.

Returns
The writer should return true, if writing succeeded, false otherwise.

Definition at line 934 of file DocumentImporter.cpp.

References BKE_image_load_exists(), BLI_exists(), BLI_path_join, BLI_path_split_dir_part(), CTX_data_main(), Fetching_Controller_data, FILE_MAX, and ImportSettings::filepath.

◆ writeKinematicsScene()

bool DocumentImporter::writeKinematicsScene ( const COLLADAFW::KinematicsScene * kinematicsScene)

Definition at line 1123 of file DocumentImporter.cpp.

◆ writeLibraryNodes()

bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes * libraryNodes)

When this method is called, the writer must handle all nodes contained in the library nodes.

Returns
The writer should return true, if writing succeeded, false otherwise.

Definition at line 709 of file DocumentImporter.cpp.

References CTX_data_scene(), Fetching_Controller_data, and write_node().

◆ writeLight()

bool DocumentImporter::writeLight ( const COLLADAFW::Light * light)

◆ writeMaterial()

bool DocumentImporter::writeMaterial ( const COLLADAFW::Material * cmat)

When this method is called, the writer must write the material.

Returns
The writer should return true, if writing succeeded, false otherwise.

Definition at line 737 of file DocumentImporter.cpp.

References BKE_material_add(), CTX_data_main(), Fetching_Controller_data, Material::id, and id_us_min().

◆ writeScene()

bool DocumentImporter::writeScene ( const COLLADAFW::Scene * scene)

When this method is called, the writer must write the scene.

Returns
The writer should return true, if writing succeeded, false otherwise.

Definition at line 340 of file DocumentImporter.cpp.

◆ writeSkinControllerData()

bool DocumentImporter::writeSkinControllerData ( const COLLADAFW::SkinControllerData * skin)

When this method is called, the writer must write the skin controller data.

Returns
The writer should return true, if writing succeeded, false otherwise.

Definition at line 1104 of file DocumentImporter.cpp.

References ArmatureImporter::write_skin_controller_data().

◆ writeVisualScene()

bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene * visualScene)

When this method is called, the writer must write the entire visual scene. Return The writer should return true, if writing succeeded, false otherwise.

Definition at line 687 of file DocumentImporter.cpp.

References Fetching_Controller_data.


The documentation for this class was generated from the following files: