|
Blender
V2.93
|
#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 () |
| 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) |
| 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) |
| ExtraTags * | getExtraTags (const COLLADAFW::UniqueId &uid) |
| bool | is_armature (COLLADAFW::Node *node) |
Importer class.
Definition at line 47 of file DocumentImporter.h.
Enumeration to denote the stage of import
| Enumerator | |
|---|---|
| Fetching_Scene_data | |
| Fetching_Controller_data | |
Definition at line 50 of file DocumentImporter.h.
| DocumentImporter::DocumentImporter | ( | bContext * | C, |
| const ImportSettings * | import_settings | ||
| ) |
Constructor
Definition at line 96 of file DocumentImporter.cpp.
| DocumentImporter::~DocumentImporter | ( | ) |
Destructor
Definition at line 113 of file DocumentImporter.cpp.
| bool DocumentImporter::addExtraTags | ( | const COLLADAFW::UniqueId & | uid, |
| ExtraTags * | extra_tags | ||
| ) |
Add element and data for UniqueId
Definition at line 1240 of file DocumentImporter.cpp.
Referenced by ExtraHandler::parseElement().
| 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.
| errorMessage | A message containing information about the error that occurred. |
Definition at line 164 of file DocumentImporter.cpp.
these should not be here
Definition at line 371 of file DocumentImporter.cpp.
References bc_add_object(), BKE_id_free_us(), CTX_data_main(), Object::data, and OB_CAMERA.
Referenced by write_node().
Definition at line 481 of file DocumentImporter.cpp.
References BKE_constraint_add_for_object(), ExtraTags::isProfile(), ExtraTags::setData(), and type.
| 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 405 of file DocumentImporter.cpp.
References bc_set_parent(), BKE_collection_object_add_from(), BKE_id_copy(), BKE_object_apply_mat4(), CTX_data_main(), DEG_id_tag_update(), Object::id, ID_RECALC_ANIMATION, ID_RECALC_GEOMETRY, ID_RECALC_TRANSFORM, id_us_min(), mul_m4_m4m4(), Object::obmat, and AnimationImporter::read_node_transform().
Referenced by write_node().
Definition at line 388 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().
| void DocumentImporter::finish | ( | void | ) |
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 178 of file DocumentImporter.cpp.
References bc_match_scale(), BKE_scene_collections_object_remove(), UnitConverter::calculate_scale(), CTX_data_main(), CTX_data_scene(), DEG_id_tag_update(), DEG_relations_tag_update(), Fetching_Controller_data, UnitConverter::getLinearMeter(), Scene::id, ID_RECALC_COPY_ON_WRITE, UnitConverter::Imperial, ImportSettings::import_units, UnitConverter::isMetricSystem(), ArmatureImporter::make_armatures(), ArmatureImporter::make_shape_keys(), UnitConverter::Metric, NC_OBJECT, ND_TRANSFORM, MeshImporter::optimize_material_assignements(), RNA_id_pointer_create(), RNA_pointer_get(), RNA_property_enum_set(), RNA_property_float_set(), RNA_struct_find_property(), ArmatureImporter::set_tags_map(), 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 327 of file DocumentImporter.cpp.
References count, String, and v.
Referenced by writeGlobalAsset().
| ExtraTags * DocumentImporter::getExtraTags | ( | const COLLADAFW::UniqueId & | uid | ) |
Get an existing ExtraTags for uid
Definition at line 1232 of file DocumentImporter.cpp.
Referenced by ExtraHandler::parseElement(), writeCamera(), and writeLight().
| bool DocumentImporter::import | ( | ) |
Function called by blender UI
TODO set up scene graph and such here
Definition at line 123 of file DocumentImporter.cpp.
References bc_url_encode(), BKE_view_layer_base_deselect_all(), Fetching_Controller_data, ImportSettings::filepath, and ErrorHandler::hasError().
Referenced by collada_import().
| bool DocumentImporter::is_armature | ( | COLLADAFW::Node * | node | ) |
| void DocumentImporter::start | ( | ) |
This is the method called. The writer hast to prepare to receive data.
Definition at line 174 of file DocumentImporter.cpp.
| void DocumentImporter::translate_anim_recursive | ( | COLLADAFW::Node * | node, |
| COLLADAFW::Node * | par = nullptr, |
||
| Object * | parob = nullptr |
||
| ) |
Definition at line 274 of file DocumentImporter.cpp.
References node, ROTATE, SCALE, TRANSLATE, AnimationImporter::translate_Animations(), and types.
Referenced by finish().
| std::vector< Object * > * DocumentImporter::write_node | ( | COLLADAFW::Node * | node, |
| COLLADAFW::Node * | parent_node, | ||
| Scene * | sce, | ||
| Object * | par, | ||
| bool | is_library_node | ||
| ) |
Definition at line 503 of file DocumentImporter.cpp.
References ArmatureImporter::add_root_joint(), bc_add_object(), BKE_libblock_rename(), controller, create_camera_object(), create_instance_node(), create_light_object(), MeshImporter::create_mesh_object(), CTX_data_main(), getName(), Object::id, is_armature(), lamp, node, OB_ARMATURE, OB_EMPTY, Object::parent, PAROBJECT, Object::parsubstr, Object::partype, and AnimationImporter::read_node_transform().
Referenced by finish(), and writeLibraryNodes().
| void DocumentImporter::write_profile_COMMON | ( | COLLADAFW::EffectCommon * | ef, |
| Material * | ma | ||
| ) |
Definition at line 799 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().
| bool DocumentImporter::writeAnimation | ( | const COLLADAFW::Animation * | anim | ) |
Definition at line 1168 of file DocumentImporter.cpp.
References Fetching_Controller_data, and AnimationImporter::write_animation().
| bool DocumentImporter::writeAnimationList | ( | const COLLADAFW::AnimationList * | animationList | ) |
Definition at line 1178 of file DocumentImporter.cpp.
References Fetching_Controller_data, and AnimationImporter::write_animation_list().
| bool DocumentImporter::writeCamera | ( | const COLLADAFW::Camera * | camera | ) |
When this method is called, the writer must write the camera.
Definition at line 867 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, float(), CameraDOFSettings::focus_distance, fov_to_focallength(), getExtraTags(), ExtraTags::isProfile(), Camera::lens, Camera::ortho_scale, Camera::sensor_x, ExtraTags::setData(), Camera::shiftx, Camera::shifty, tanf, type, Camera::type, and x.
| bool DocumentImporter::writeController | ( | const COLLADAFW::Controller * | controller | ) |
Definition at line 1213 of file DocumentImporter.cpp.
References controller, Fetching_Controller_data, and ArmatureImporter::write_controller().
| bool DocumentImporter::writeEffect | ( | const COLLADAFW::Effect * | effect | ) |
When this method is called, the writer must write the effect.
Definition at line 828 of file DocumentImporter.cpp.
References Fetching_Controller_data, and write_profile_COMMON().
| bool DocumentImporter::writeFormulas | ( | const COLLADAFW::Formulas * | formulas | ) |
Definition at line 1222 of file DocumentImporter.cpp.
| bool DocumentImporter::writeGeometry | ( | const COLLADAFW::Geometry * | geom | ) |
When this method is called, the writer must write the geometry.
Definition at line 769 of file DocumentImporter.cpp.
References Fetching_Controller_data, and MeshImporter::write_geometry().
| bool DocumentImporter::writeGlobalAsset | ( | const COLLADAFW::FileInfo * | asset | ) |
When this method is called, the writer must write the global document asset.
Definition at line 354 of file DocumentImporter.cpp.
References get_import_version(), UnitConverter::read_asset(), and AnimationImporter::set_import_from_version().
| bool DocumentImporter::writeImage | ( | const COLLADAFW::Image * | image | ) |
When this method is called, the writer must write the image.
Definition at line 980 of file DocumentImporter.cpp.
References BKE_image_load_exists(), BLI_exists(), BLI_join_dirfile(), BLI_split_dir_part(), CTX_data_main(), Fetching_Controller_data, FILE_MAX, and ImportSettings::filepath.
| bool DocumentImporter::writeKinematicsScene | ( | const COLLADAFW::KinematicsScene * | kinematicsScene | ) |
Definition at line 1227 of file DocumentImporter.cpp.
| bool DocumentImporter::writeLibraryNodes | ( | const COLLADAFW::LibraryNodes * | libraryNodes | ) |
When this method is called, the writer must handle all nodes contained in the library nodes.
Definition at line 746 of file DocumentImporter.cpp.
References CTX_data_scene(), Fetching_Controller_data, and write_node().
| bool DocumentImporter::writeLight | ( | const COLLADAFW::Light * | light | ) |
When this method is called, the writer must write the light.
Definition at line 1020 of file DocumentImporter.cpp.
References Light::area_shape, Light::area_size, Light::area_sizey, Light::area_sizez, Light::att1, Light::att2, Light::b, Light::bias, BKE_light_add(), Light::buffers, Light::bufsize, Light::clipend, Light::clipsta, col, Color, CTX_data_main(), DEG2RADF, Light::dist, e, Light::energy, Light::falloff_type, Fetching_Controller_data, Light::flag, Light::g, getExtraTags(), UnitConverter::getLinearMeter(), IS_EQ, ExtraTags::isProfile(), Light::k, LA_FALLOFF_INVLINEAR, LA_FALLOFF_INVSQUARE, LA_LOCAL, LA_SPOT, LA_SUN, lamp, Light::mode, Light::r, ExtraTags::setData(), Light::shdwb, Light::shdwg, Light::shdwr, Light::soft, Light::spotblend, Light::spotsize, sqrt(), and Light::type.
| bool DocumentImporter::writeMaterial | ( | const COLLADAFW::Material * | cmat | ) |
When this method is called, the writer must write the material.
Definition at line 782 of file DocumentImporter.cpp.
References BKE_material_add(), CTX_data_main(), and Fetching_Controller_data.
| bool DocumentImporter::writeScene | ( | const COLLADAFW::Scene * | scene | ) |
When this method is called, the writer must write the scene.
Definition at line 366 of file DocumentImporter.cpp.
| bool DocumentImporter::writeSkinControllerData | ( | const COLLADAFW::SkinControllerData * | skin | ) |
When this method is called, the writer must write the skin controller data.
Definition at line 1207 of file DocumentImporter.cpp.
References ArmatureImporter::write_skin_controller_data().
| 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 719 of file DocumentImporter.cpp.
References Fetching_Controller_data.