diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-11-08 17:16:49 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-11-08 23:39:01 +0300 |
commit | 206c94fea98d44ed9667607638c455c7c0e63822 (patch) | |
tree | ddc1f6f30c18d10674daaeeaee6b465550447709 /source/blender/editors/object/object_relations.c | |
parent | 670e6cab4319b94c96c6a61cb76199f1054b935a (diff) |
Farewell Scene->base
While getting rid of Scene->base we got the following fixes:
* Fix "Convert To" operator
* Fix "NLA allowing to selected objects that are not selectable
* Fix scene.objects (readonly, no option to link/unlink)
Note: Collada needs to use the context SceneLayer for adding objects
however I added a placeholder, so Collada maintainers can fix this
properly.
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index b9848a0cb4a..e2815bf2282 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -355,7 +355,6 @@ static int make_proxy_exec(bContext *C, wmOperator *op) if (ob) { Object *newob; - Base *newbase, *oldbase = BASACT_NEW(scene_layer); char name[MAX_ID_NAME + 4]; BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2); @@ -364,16 +363,6 @@ static int make_proxy_exec(bContext *C, wmOperator *op) newob = BKE_object_add_from(bmain, scene, scene_layer, OB_EMPTY, name, gob ? gob : ob); /* set layers OK */ - newbase = BASACT_NEW(scene_layer); /* BKE_object_add sets active... */ - newbase->lay = oldbase->lay; - newob->lay = newbase->lay; - - /* remove base, leave user count of object, it gets linked in BKE_object_make_proxy */ - if (gob == NULL) { - BKE_scene_base_unlink(scene, oldbase); - MEM_freeN(oldbase); - } - BKE_object_make_proxy(newob, ob, gob); /* Set back pointer immediately so dependency graph knows that this is @@ -2048,12 +2037,13 @@ void ED_object_single_users(Main *bmain, Scene *scene, const bool full, const bo { IDP_RelinkProperty(scene->id.properties); - for (Base *base = scene->base.first; base; base = base->next) { - Object *ob = base->object; + FOREACH_SCENE_OBJECT(scene, ob) + { if (!ID_IS_LINKED(ob)) { IDP_RelinkProperty(ob->id.properties); } } + FOREACH_SCENE_OBJECT_END if (scene->nodetree) { IDP_RelinkProperty(scene->nodetree->id.properties); @@ -2236,15 +2226,15 @@ static int make_local_exec(bContext *C, wmOperator *op) /* Note: we (ab)use LIB_TAG_PRE_EXISTING to cherry pick which ID to make local... */ if (mode == MAKE_LOCAL_ALL) { - SceneLayer *sl = CTX_data_scene_layer(C); - SceneCollection *sc = CTX_data_scene_collection(C); + SceneLayer *scene_layer = CTX_data_scene_layer(C); + SceneCollection *scene_collection = CTX_data_scene_collection(C); BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false); - /* de-select so the user can differentiate newly instanced from existing objects */ - BKE_scene_base_deselect_all(scene); + /* De-select so the user can differentiate newly instanced from existing objects. */ + BKE_scene_layer_base_deselect_all(scene_layer); - if (make_local_all__instance_indirect_unused(bmain, scene, sl, sc)) { + if (make_local_all__instance_indirect_unused(bmain, scene, scene_layer, scene_collection)) { BKE_report(op->reports, RPT_INFO, "Orphan library objects added to the current scene to avoid loss"); } } |