Changeset View
Changeset View
Standalone View
Standalone View
source/blender/collada/DocumentImporter.cpp
| Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | #endif | ||||
| if (libnode_ob.size()) { | if (libnode_ob.size()) { | ||||
| fprintf(stderr, "got %d library nodes to free\n", (int)libnode_ob.size()); | fprintf(stderr, "got %d library nodes to free\n", (int)libnode_ob.size()); | ||||
| // free all library_nodes | // free all library_nodes | ||||
| std::vector<Object *>::iterator it; | std::vector<Object *>::iterator it; | ||||
| for (it = libnode_ob.begin(); it != libnode_ob.end(); it++) { | for (it = libnode_ob.begin(); it != libnode_ob.end(); it++) { | ||||
| Object *ob = *it; | Object *ob = *it; | ||||
| BKE_collections_object_remove(G.main, &sce->id, ob, true); | BKE_scene_collections_object_remove(G.main, sce, ob, true); | ||||
| } | } | ||||
| libnode_ob.clear(); | libnode_ob.clear(); | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| } | } | ||||
| bc_match_scale(objects_to_scale, unit_converter, !this->import_settings->import_units); | bc_match_scale(objects_to_scale, unit_converter, !this->import_settings->import_units); | ||||
| ▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Node *source_node, COLLADAFW::Node *instance_node, Scene *sce, bool is_library_node) | Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Node *source_node, COLLADAFW::Node *instance_node, Scene *sce, bool is_library_node) | ||||
| { | { | ||||
| fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL); | fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL); | ||||
| Object *obn = BKE_object_copy(G.main, source_ob); | Object *obn = BKE_object_copy(G.main, source_ob); | ||||
| DEG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); | DEG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); | ||||
| BKE_collection_object_add_from(sce, source_ob, obn); | BKE_collection_object_add_from(G.main, sce, source_ob, obn); | ||||
| if (instance_node) { | if (instance_node) { | ||||
| anim_importer.read_node_transform(instance_node, obn); | anim_importer.read_node_transform(instance_node, obn); | ||||
| // if we also have a source_node (always ;), take its | // if we also have a source_node (always ;), take its | ||||
| // transformation matrix and apply it to the newly instantiated | // transformation matrix and apply it to the newly instantiated | ||||
| // object to account for node hierarchy transforms in | // object to account for node hierarchy transforms in | ||||
| // .dae | // .dae | ||||
| if (source_node) { | if (source_node) { | ||||
| ▲ Show 20 Lines • Show All 899 Lines • Show Last 20 Lines | |||||