![]() |
Blender V2.61 - r43446
|
#include <DocumentImporter.h>
Public Types | |
| enum | ImportStage { General, Controller } |
Enumeration to denote the stage of import. More... | |
Public Member Functions | |
| DocumentImporter (bContext *C, const char *filename) | |
| ~DocumentImporter () | |
| bool | import () |
| Object * | create_camera_object (COLLADAFW::InstanceCamera *, Scene *) |
| Object * | create_lamp_object (COLLADAFW::InstanceLight *, Scene *) |
| Object * | create_instance_node (Object *, COLLADAFW::Node *, COLLADAFW::Node *, Scene *, Object *, bool) |
| void | write_node (COLLADAFW::Node *, COLLADAFW::Node *, Scene *, Object *, bool) |
| MTex * | create_texture (COLLADAFW::EffectCommon *, COLLADAFW::Texture &, Material *, int, TexIndexTextureArrayMap &) |
| 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 *) |
| 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) |
Importer class.
Definition at line 55 of file DocumentImporter.h.
Enumeration to denote the stage of import.
| General |
First pass to collect all data except controller. |
| Controller |
Second pass to collect controller data. |
Definition at line 59 of file DocumentImporter.h.
| DocumentImporter::DocumentImporter | ( | bContext * | C, |
| const char * | filename | ||
| ) |
Constructor
Definition at line 96 of file DocumentImporter.cpp.
| DocumentImporter::~DocumentImporter | ( | ) |
Destructor
Definition at line 105 of file DocumentImporter.cpp.
| bool DocumentImporter::addExtraTags | ( | const COLLADAFW::UniqueId & | uid, |
| ExtraTags * | extra_tags | ||
| ) |
Add element and data for UniqueId
Definition at line 1125 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 informations about the error that occurred. |
Definition at line 146 of file DocumentImporter.cpp.
these should not be here
Definition at line 282 of file DocumentImporter.cpp.
References add_object(), Object::data, free_libblock(), G, Camera::id, if(), NULL, OB_CAMERA, and ID::us.
Referenced by write_node().
| Object * DocumentImporter::create_instance_node | ( | Object * | source_ob, |
| COLLADAFW::Node * | source_node, | ||
| COLLADAFW::Node * | instance_node, | ||
| Scene * | sce, | ||
| Object * | par_ob, | ||
| bool | is_library_node | ||
| ) |
Definition at line 316 of file DocumentImporter.cpp.
References bc_set_parent(), copy_object(), CTX_data_main(), DAG_ids_flush_update(), DAG_scene_sort(), i, mult_m4_m4m4(), NULL, OB_RECALC_DATA, OB_RECALC_OB, OB_RECALC_TIME, object_apply_mat4(), Object::obmat, AnimationImporter::read_node_transform(), Object::recalc, and scene_add_base().
Referenced by write_node().
Definition at line 299 of file DocumentImporter.cpp.
References add_object(), Object::data, free_libblock(), G, Lamp::id, if(), NULL, OB_LAMP, and ID::us.
Referenced by write_node().
| MTex * DocumentImporter::create_texture | ( | COLLADAFW::EffectCommon * | ef, |
| COLLADAFW::Texture & | ctex, | ||
| Material * | ma, | ||
| int | i, | ||
| TexIndexTextureArrayMap & | texindex_texarray_map | ||
| ) |
Definition at line 548 of file DocumentImporter.cpp.
References add_mtex(), add_texture(), i, Tex::ima, Tex::imaflag, Material::mtex, NULL, MTex::tex, TEX_IMAGE, TEX_USEALPHA, MTex::texco, TEXCO_UV, and Tex::type.
Referenced by write_profile_COMMON().
| void DocumentImporter::finish | ( | ) |
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 158 of file DocumentImporter.cpp.
References Scene::basact, Scene::base, BLI_remlink(), CTX_data_main(), CTX_data_scene(), DAG_ids_flush_update(), DAG_scene_sort(), free_libblock_us(), G, General, UnitConverter::getLinearMeter(), i, Scene::id, UnitConverter::Imperial, UnitConverter::isMetricSystem(), ArmatureImporter::make_armatures(), MEM_freeN(), UnitConverter::Metric, NULL, Base::object, object_in_scene(), 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, and write_node().
| ExtraTags * DocumentImporter::getExtraTags | ( | const COLLADAFW::UniqueId & | uid | ) |
Get an extisting ExtraTags for uid
Definition at line 1117 of file DocumentImporter.cpp.
References NULL.
Referenced by ExtraHandler::parseElement().
| bool DocumentImporter::import | ( | ) |
Function called by blender UI
TODO set up scene graph and such here
Definition at line 115 of file DocumentImporter.cpp.
References Controller, ErrorHandler::hasError(), and MakeCursor::root.
Referenced by collada_import().
| void DocumentImporter::start | ( | ) |
This is the method called. The writer hast to prepare to receive data.
Definition at line 156 of file DocumentImporter.cpp.
| void DocumentImporter::translate_anim_recursive | ( | COLLADAFW::Node * | node, |
| COLLADAFW::Node * | par = NULL, |
||
| Object * | parob = NULL |
||
| ) |
Definition at line 236 of file DocumentImporter.cpp.
References i, NULL, and AnimationImporter::translate_Animations().
Referenced by finish().
| void DocumentImporter::write_node | ( | COLLADAFW::Node * | node, |
| COLLADAFW::Node * | parent_node, | ||
| Scene * | sce, | ||
| Object * | par, | ||
| bool | is_library_node | ||
| ) |
Definition at line 383 of file DocumentImporter.cpp.
References ArmatureImporter::add_joint(), add_object(), bc_set_parent(), create_camera_object(), create_instance_node(), create_lamp_object(), MeshImporter::create_mesh_object(), credits_svn_gen::empty, i, Object::id, NULL, OB_ARMATURE, OB_EMPTY, Object::parent, AnimationImporter::read_node_transform(), and rename_id().
Referenced by finish(), and writeLibraryNodes().
| void DocumentImporter::write_profile_COMMON | ( | COLLADAFW::EffectCommon * | ef, |
| Material * | ma | ||
| ) |
Definition at line 573 of file DocumentImporter.cpp.
References Material::alpha, Material::ambb, Material::ambg, Material::ambr, Material::ang, Material::b, create_texture(), Material::diff_shader, Material::g, Material::har, i, Tex::imaflag, MA_DIFF_LAMBERT, MA_SPEC_BLINN, MA_SPEC_PHONG, MA_TRANSP, MA_ZTRANSP, MAP_ALPHA, MAP_AMB, MAP_COL, MAP_EMIT, MAP_REF, MAP_SPEC, MTex::mapto, Material::mirb, Material::mirg, Material::mirr, Material::mode, NULL, Material::r, Material::ray_mirror, Material::spec, Material::spec_shader, Material::specb, Material::specg, Material::specr, Material::spectra, MTex::tex, TEX_USEALPHA, Material::texact, and Texture.
Referenced by writeEffect().
| bool DocumentImporter::writeAnimation | ( | const COLLADAFW::Animation * | anim | ) |
Definition at line 1072 of file DocumentImporter.cpp.
References General, and AnimationImporter::write_animation().
| bool DocumentImporter::writeAnimationList | ( | const COLLADAFW::AnimationList * | animationList | ) |
Definition at line 1082 of file DocumentImporter.cpp.
References General, 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 760 of file DocumentImporter.cpp.
References add_camera(), CAM_ORTHO, CAM_PERSP, DEG2RADF, fov_to_focallength(), General, NULL, and UNDEFINED.
| bool DocumentImporter::writeController | ( | const COLLADAFW::Controller * | controller | ) |
Definition at line 1099 of file DocumentImporter.cpp.
References General, 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 722 of file DocumentImporter.cpp.
References General, and write_profile_COMMON().
| bool DocumentImporter::writeFormulas | ( | const COLLADAFW::Formulas * | formulas | ) |
Definition at line 1107 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 523 of file DocumentImporter.cpp.
References General, 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 268 of file DocumentImporter.cpp.
References UnitConverter::read_asset().
| bool DocumentImporter::writeImage | ( | const COLLADAFW::Image * | image | ) |
When this method is called, the writer must write the image.
Definition at line 876 of file DocumentImporter.cpp.
References BKE_add_image_file(), BLI_join_dirfile(), BLI_split_dir_part(), FILE_MAX, and General.
| bool DocumentImporter::writeKinematicsScene | ( | const COLLADAFW::KinematicsScene * | kinematicsScene | ) |
Definition at line 1112 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 505 of file DocumentImporter.cpp.
References CTX_data_scene(), General, i, nodes, NULL, and write_node().
| bool DocumentImporter::writeLight | ( | const COLLADAFW::Light * | light | ) |
When this method is called, the writer must write the light.
Definition at line 901 of file DocumentImporter.cpp.
References add_lamp(), simple_enum_gen::d, credits_svn_gen::e, General, UnitConverter::getLinearMeter(), IS_EQ, ExtraTags::isProfile(), LA_FALLOFF_INVLINEAR, LA_FALLOFF_INVSQUARE, LA_HEMI, LA_LOCAL, LA_NO_SPEC, LA_SPOT, LA_SUN, NULL, ExtraTags::setData(), sqrt(), and UNDEFINED.
| bool DocumentImporter::writeMaterial | ( | const COLLADAFW::Material * | cmat | ) |
When this method is called, the writer must write the material.
Definition at line 533 of file DocumentImporter.cpp.
References add_material(), and General.
| bool DocumentImporter::writeScene | ( | const COLLADAFW::Scene * | scene | ) |
When this method is called, the writer must write the scene.
Definition at line 277 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 1093 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.
Definition at line 482 of file DocumentImporter.cpp.
References General.