|
Blender V4.5
|
#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 () override | |
| bool | import () |
| Object * | create_camera_object (COLLADAFW::InstanceCamera *, Scene *) |
| Object * | create_light_object (COLLADAFW::InstanceLight *, Scene *) |
| Object * | create_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) override |
| void | start () override |
| void | finish () override |
| bool | writeGlobalAsset (const COLLADAFW::FileInfo *) override |
| std::string | get_import_version (const COLLADAFW::FileInfo *asset) |
| bool | writeScene (const COLLADAFW::Scene *) override |
| bool | writeVisualScene (const COLLADAFW::VisualScene *) override |
| bool | writeLibraryNodes (const COLLADAFW::LibraryNodes *) override |
| bool | writeAnimation (const COLLADAFW::Animation *) override |
| bool | writeAnimationList (const COLLADAFW::AnimationList *) override |
| bool | writeGeometry (const COLLADAFW::Geometry *) override |
| bool | writeMaterial (const COLLADAFW::Material *) override |
| bool | writeEffect (const COLLADAFW::Effect *) override |
| bool | writeCamera (const COLLADAFW::Camera *) override |
| bool | writeImage (const COLLADAFW::Image *) override |
| bool | writeLight (const COLLADAFW::Light *) override |
| bool | writeSkinControllerData (const COLLADAFW::SkinControllerData *) override |
| bool | writeController (const COLLADAFW::Controller *) override |
| bool | writeFormulas (const COLLADAFW::Formulas *) override |
| bool | writeKinematicsScene (const COLLADAFW::KinematicsScene *) override |
| bool | addExtraTags (const COLLADAFW::UniqueId &uid, ExtraTags *extra_tags) |
| ExtraTags * | getExtraTags (const COLLADAFW::UniqueId &uid) |
| bool | is_armature (COLLADAFW::Node *node) |
Importer class.
Definition at line 26 of file DocumentImporter.h.
Enumeration to denote the stage of import
| Enumerator | |
|---|---|
| Fetching_Scene_data | |
| Fetching_Controller_data | |
Definition at line 29 of file DocumentImporter.h.
| DocumentImporter::DocumentImporter | ( | bContext * | C, |
| const ImportSettings * | import_settings ) |
Constructor
Definition at line 66 of file DocumentImporter.cpp.
References C, CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), and Fetching_Scene_data.
|
override |
Destructor
Definition at line 87 of file DocumentImporter.cpp.
| bool DocumentImporter::addExtraTags | ( | const COLLADAFW::UniqueId & | uid, |
| ExtraTags * | extra_tags ) |
Add element and data for UniqueId
Definition at line 1122 of file DocumentImporter.cpp.
|
override |
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.
| errorMessage | A message containing information about the error that occurred. |
Definition at line 138 of file DocumentImporter.cpp.
these should not be here
Definition at line 331 of file DocumentImporter.cpp.
References bc_add_object(), BKE_id_free_us(), CTX_data_main(), Object::data, and OB_CAMERA.
Referenced by write_node().
To create constraints off node <extra> tags. Assumes only constraint data in current <extra> with blender profile.
Definition at line 438 of file DocumentImporter.cpp.
References BKE_constraint_add_for_object(), ExtraTags::isProfile(), and ExtraTags::setData().
| Object * DocumentImporter::create_instance_node | ( | Object * | source_ob, |
| COLLADAFW::Node * | source_node, | ||
| COLLADAFW::Node * | instance_node, | ||
| Scene * | sce, | ||
| bool | is_library_node ) |
Definition at line 365 of file DocumentImporter.cpp.
References bc_set_parent(), BKE_collection_object_add_from(), BKE_id_copy(), BKE_object_apply_mat4(), create_instance_node(), CTX_data_main(), DEG_id_tag_update(), i, Object::id, ID_RECALC_ANIMATION, ID_RECALC_GEOMETRY, ID_RECALC_TRANSFORM, id_us_min(), mul_m4_m4m4(), and Object::runtime.
Referenced by create_instance_node(), and write_node().
Definition at line 348 of file DocumentImporter.cpp.
References bc_add_object(), BKE_id_free_us(), CTX_data_main(), Object::data, and OB_LAMP.
Referenced by write_node().
|
override |
This method is called after the last write* method. No other methods will be called after this.
TODO: Break up and put into 2-pass parsing of DAE.
Definition at line 150 of file DocumentImporter.cpp.
References bc_match_scale(), BKE_scene_collections_object_remove(), CTX_data_main(), CTX_data_scene(), DEG_id_tag_update(), DEG_relations_tag_update(), Fetching_Controller_data, i, Scene::id, ID_RECALC_SYNC_TO_EVAL, UnitConverter::Imperial, UnitConverter::Metric, NC_OBJECT, ND_TRANSFORM, RNA_id_pointer_create(), RNA_pointer_get(), RNA_property_enum_set(), RNA_property_float_set(), RNA_struct_find_property(), translate_anim_recursive(), USER_UNIT_IMPERIAL, USER_UNIT_METRIC, USER_UNIT_NONE, WM_event_add_notifier(), and write_node().
| 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 295 of file DocumentImporter.cpp.
Referenced by writeGlobalAsset().
| ExtraTags * DocumentImporter::getExtraTags | ( | const COLLADAFW::UniqueId & | uid | ) |
Get an existing ExtraTags for uid
Definition at line 1114 of file DocumentImporter.cpp.
Referenced by write_node(), writeCamera(), and writeLight().
| bool DocumentImporter::import | ( | ) |
Function called by blender UI
TODO: set up scene graph and such here.
Definition at line 97 of file DocumentImporter.cpp.
References bc_url_encode(), BKE_view_layer_base_deselect_all(), CTX_data_scene(), Fetching_Controller_data, and ErrorHandler::hasError().
Referenced by collada_import().
| bool DocumentImporter::is_armature | ( | COLLADAFW::Node * | node | ) |
|
override |
This is the method called. The writer hast to prepare to receive data.
Definition at line 148 of file DocumentImporter.cpp.
| void DocumentImporter::translate_anim_recursive | ( | COLLADAFW::Node * | node, |
| COLLADAFW::Node * | par = nullptr, | ||
| Object * | parob = nullptr ) |
Definition at line 246 of file DocumentImporter.cpp.
References i, translate_anim_recursive(), and types.
Referenced by finish(), and translate_anim_recursive().
| std::vector< Object * > * DocumentImporter::write_node | ( | COLLADAFW::Node * | node, |
| COLLADAFW::Node * | parent_node, | ||
| Scene * | sce, | ||
| Object * | par, | ||
| bool | is_library_node ) |
Definition at line 459 of file DocumentImporter.cpp.
References bc_add_armature(), bc_add_object(), BKE_libblock_rename(), controller, create_camera_object(), create_instance_node(), create_light_object(), CTX_data_main(), getExtraTags(), getName(), i, Object::id, is_armature(), OB_ARMATURE, OB_EMPTY, Object::parent, PAROBJECT, Object::parsubstr, Object::partype, and write_node().
Referenced by finish(), write_node(), and writeLibraryNodes().
| void DocumentImporter::write_profile_COMMON | ( | COLLADAFW::EffectCommon * | ef, |
| Material * | ma ) |
Definition at line 741 of file DocumentImporter.cpp.
References MaterialNode::set_alpha(), MaterialNode::set_ambient(), MaterialNode::set_diffuse(), MaterialNode::set_emission(), MaterialNode::set_ior(), MaterialNode::set_reflective(), MaterialNode::set_reflectivity(), MaterialNode::set_shininess(), MaterialNode::set_specular(), and MaterialNode::update_material_nodetree().
Referenced by writeEffect().
|
override |
This function is called only for animations that pass COLLADAFW::validate.
Definition at line 1056 of file DocumentImporter.cpp.
References Fetching_Controller_data.
|
override |
Called on post-process stage after writeVisualScenes.
Definition at line 1065 of file DocumentImporter.cpp.
References Fetching_Controller_data.
|
override |
When this method is called, the writer must write the camera.
Definition at line 801 of file DocumentImporter.cpp.
References atanf, BKE_camera_add(), CAM_ORTHO, CAM_PERSP, Camera::clip_end, Camera::clip_start, CTX_data_main(), DEG2RADF, Camera::dof, Fetching_Controller_data, CameraDOFSettings::focus_distance, fov_to_focallength(), getExtraTags(), ExtraTags::isProfile(), Camera::lens, Camera::ortho_scale, Camera::sensor_x, ExtraTags::setData(), Camera::shiftx, Camera::shifty, tanf, Camera::type, and x.
|
override |
This is called on post-process, before writeVisualScenes.
Definition at line 1095 of file DocumentImporter.cpp.
References controller, and Fetching_Controller_data.
|
override |
When this method is called, the writer must write the effect.
Definition at line 766 of file DocumentImporter.cpp.
References Fetching_Controller_data, and write_profile_COMMON().
|
override |
Definition at line 1104 of file DocumentImporter.cpp.
|
override |
When this method is called, the writer must write the geometry.
Definition at line 714 of file DocumentImporter.cpp.
References Fetching_Controller_data.
|
override |
When this method is called, the writer must write the global document asset.
Definition at line 318 of file DocumentImporter.cpp.
References get_import_version().
|
override |
When this method is called, the writer must write the image.
Definition at line 920 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, and FILE_MAX.
|
override |
Definition at line 1109 of file DocumentImporter.cpp.
|
override |
When this method is called, the writer must handle all nodes contained in the library nodes.
Definition at line 695 of file DocumentImporter.cpp.
References CTX_data_scene(), Fetching_Controller_data, i, and write_node().
|
override |
When this method is called, the writer must write the light.
Definition at line 956 of file DocumentImporter.cpp.
References Light::area_shape, Light::area_size, Light::area_sizey, Light::area_sizez, Light::att_dist, Light::b, BKE_light_add(), Light::clipsta, col, CTX_data_main(), DEG2RADF, e, Light::energy, Fetching_Controller_data, Light::flag, Light::g, getExtraTags(), ExtraTags::isProfile(), LA_LOCAL, LA_SPOT, LA_SUN, Light::mode, Light::r, Light::radius, ExtraTags::setData(), Light::spotblend, Light::spotsize, and Light::type.
|
override |
When this method is called, the writer must write the material.
Definition at line 723 of file DocumentImporter.cpp.
References BKE_material_add(), CTX_data_main(), Fetching_Controller_data, Material::id, and id_us_min().
|
override |
When this method is called, the writer must write the scene.
Definition at line 326 of file DocumentImporter.cpp.
|
override |
When this method is called, the writer must write the skin controller data.
Definition at line 1090 of file DocumentImporter.cpp.
|
override |
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 673 of file DocumentImporter.cpp.
References Fetching_Controller_data.