Commit: 3f6a74560e0ee4fb247e36e6ef2516a997316dba
Author: Dalai Felinto
Date:   Thu Mar 30 11:41:33 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB3f6a74560e0ee4fb247e36e6ef2516a997316dba

Layers: Scene->basact > SceneLayer->basact (more work)

This brings back adding hooks among other areas

===================================================================

M       source/blender/editors/object/object_edit.c
M       source/blender/editors/object/object_hook.c
M       source/blender/editors/object/object_modifier.c
M       source/blender/editors/physics/particle_object.c
M       source/blender/editors/space_view3d/drawobject.c
M       source/blender/editors/space_view3d/view3d_buttons.c
M       source/blender/editors/transform/transform_conversions.c
M       source/blender/editors/transform/transform_generics.c
M       source/blender/editors/util/ed_util.c

===================================================================

diff --git a/source/blender/editors/object/object_edit.c 
b/source/blender/editors/object/object_edit.c
index cf1a7e39337..abdbf3afd5a 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -231,6 +231,7 @@ void ED_object_editmode_exit(bContext *C, int flag)
        /* Note! only in exceptional cases should 'EM_DO_UNDO' NOT be in the 
flag */
        /* Note! if 'EM_FREEDATA' isn't in the flag, use 
ED_object_editmode_load directly */
        Scene *scene = CTX_data_scene(C);
+       SceneLayer *sl = CTX_data_scene_layer(C);
        Object *obedit = CTX_data_edit_object(C);
        const bool freedata = (flag & EM_FREEDATA) != 0;
 
@@ -239,8 +240,8 @@ void ED_object_editmode_exit(bContext *C, int flag)
        if (ED_object_editmode_load_ex(CTX_data_main(C), obedit, freedata) == 
false) {
                /* in rare cases (background mode) its possible active object
                 * is flagged for editmode, without 'obedit' being set [#35489] 
*/
-               if (UNLIKELY(scene->basact && (scene->basact->object->mode & 
OB_MODE_EDIT))) {
-                       scene->basact->object->mode &= ~OB_MODE_EDIT;
+               if (UNLIKELY(sl->basact && (sl->basact->object->mode & 
OB_MODE_EDIT))) {
+                       sl->basact->object->mode &= ~OB_MODE_EDIT;
                }
                if (flag & EM_WAITCURSOR) waitcursor(0);
                return;
diff --git a/source/blender/editors/object/object_hook.c 
b/source/blender/editors/object/object_hook.c
index f41f21f5bd4..abb0172d9ce 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -49,6 +49,7 @@
 #include "BKE_action.h"
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
+#include "BKE_layer.h"
 #include "BKE_main.h"
 #include "BKE_modifier.h"
 #include "BKE_object.h"
@@ -447,19 +448,19 @@ static int hook_op_edit_poll(bContext *C)
 
 static Object *add_hook_object_new(Main *bmain, Scene *scene, SceneLayer *sl, 
Object *obedit)
 {
-       BaseLegacy *base, *basedit;
+       Base *base, *basedit;
        Object *ob;
 
        ob = BKE_object_add(bmain, scene, sl, OB_EMPTY, NULL);
        
-       basedit = BKE_scene_base_find(scene, obedit);
-       base = scene->basact;
+       basedit = BKE_scene_layer_base_find(sl, obedit);
+       base = sl->basact;
        base->lay = ob->lay = obedit->lay;
-       BLI_assert(scene->basact->object == ob);
+       BLI_assert(sl->basact->object == ob);
        
        /* icky, BKE_object_add sets new base as active.
         * so set it back to the original edit object */
-       scene->basact = basedit;
+       sl->basact = basedit;
 
        return ob;
 }
diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index 9f281b10f00..5d53768601c 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -873,6 +873,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
 {
        Main *bmain = CTX_data_main(C);
        Scene *scene = CTX_data_scene(C);
+       SceneLayer *sl = CTX_data_scene_layer(C);
        Object *ob = ED_object_active_context(C);
        ModifierData *md = edit_modifier_property_get(op, ob, 0);
        int mode_orig = ob->mode;
@@ -885,7 +886,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
        /* if cloth/softbody was removed, particle mode could be cleared */
        if (mode_orig & OB_MODE_PARTICLE_EDIT)
                if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0)
-                       if (scene->basact && scene->basact->object == ob)
+                       if (sl->basact && sl->basact->object == ob)
                                WM_event_add_notifier(C, NC_SCENE | ND_MODE | 
NS_MODE_OBJECT, NULL);
        
        return OPERATOR_FINISHED;
diff --git a/source/blender/editors/physics/particle_object.c 
b/source/blender/editors/physics/particle_object.c
index ca8ec81e56b..782e0253267 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -133,6 +133,7 @@ static int particle_system_remove_exec(bContext *C, 
wmOperator *UNUSED(op))
 {
        Object *ob = ED_object_context(C);
        Scene *scene = CTX_data_scene(C);
+       SceneLayer *sl = CTX_data_scene_layer(C);
        int mode_orig;
 
        if (!scene || !ob)
@@ -146,7 +147,7 @@ static int particle_system_remove_exec(bContext *C, 
wmOperator *UNUSED(op))
         */
        if (mode_orig & OB_MODE_PARTICLE_EDIT) {
                if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) {
-                       if (scene->basact && scene->basact->object == ob) {
+                       if (sl->basact && sl->basact->object == ob) {
                                WM_event_add_notifier(C, 
NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
                        }
                }
diff --git a/source/blender/editors/space_view3d/drawobject.c 
b/source/blender/editors/space_view3d/drawobject.c
index da261d437c9..782bd20f05f 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -8384,7 +8384,7 @@ void draw_object_wire_color(Scene *scene, SceneLayer *sl, 
Base *base, unsigned c
                                        /* uses darker active color for 
non-active + selected */
                                        theme_id = TH_GROUP_ACTIVE;
 
-                                       if (scene->basact != base) {
+                                       if (sl->basact != base) {
                                                theme_shade = -16;
                                        }
                                }
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c 
b/source/blender/editors/space_view3d/view3d_buttons.c
index b76266ad84b..c19fdb0d4b1 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -776,8 +776,8 @@ static void do_view3d_vgroup_buttons(bContext *C, void 
*UNUSED(arg), int event)
                return;
        }
        else {
-               Scene *scene = CTX_data_scene(C);
-               Object *ob = scene->basact->object;
+               SceneLayer *sl = CTX_data_scene_layer(C);
+               Object *ob = sl->basact->object;
                ED_vgroup_vert_active_mirror(ob, event - 
B_VGRP_PNL_EDIT_SINGLE);
                DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
                WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
@@ -805,7 +805,8 @@ static void view3d_panel_vgroup(const bContext *C, Panel 
*pa)
 {
        uiBlock *block = uiLayoutAbsoluteBlock(pa->layout);
        Scene *scene = CTX_data_scene(C);
-       Object *ob = scene->basact->object;
+       SceneLayer *sl = CTX_data_scene_layer(C);
+       Object *ob = sl->basact->object;
 
        MDeformVert *dv;
 
@@ -1119,16 +1120,17 @@ static void do_view3d_region_buttons(bContext *C, void 
*UNUSED(index), int event
 
 static int view3d_panel_transform_poll(const bContext *C, PanelType 
*UNUSED(pt))
 {
-       Scene *scene = CTX_data_scene(C);
-       return (scene->basact != NULL);
+       SceneLayer *sl = CTX_data_scene_layer(C);
+       return (sl->basact != NULL);
 }
 
 static void view3d_panel_transform(const bContext *C, Panel *pa)
 {
        uiBlock *block;
        Scene *scene = CTX_data_scene(C);
+       SceneLayer *sl = CTX_data_scene_layer(C);
        Object *obedit = CTX_data_edit_object(C);
-       Object *ob = scene->basact->object;
+       Object *ob = sl->basact->object;
        uiLayout *col;
 
        block = uiLayoutGetBlock(pa->layout);
diff --git a/source/blender/editors/transform/transform_conversions.c 
b/source/blender/editors/transform/transform_conversions.c
index 550f80e284c..c09434a3bc9 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -6388,8 +6388,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
        else if (t->options & CTX_PAINT_CURVE) {
                /* pass */
        }
-       else if ((t->scene->basact) &&
-                (ob = t->scene->basact->object) &&
+       else if ((t->sl->basact) &&
+                (ob = t->sl->basact->object) &&
                 (ob->mode & OB_MODE_PARTICLE_EDIT) &&
                 PE_get_current(t->scene, t->sl, ob))
        {
diff --git a/source/blender/editors/transform/transform_generics.c 
b/source/blender/editors/transform/transform_generics.c
index 3eda8992826..aeac219c0a9 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -711,7 +711,7 @@ static void recalcData_spaceclip(TransInfo *t)
 /* helper for recalcData() - for object transforms, typically in the 3D view */
 static void recalcData_objects(TransInfo *t)
 {
-       BaseLegacy *base = t->scene->basact;
+       Base *base = t->sl->basact;
 
        if (t->obedit) {
                if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) {
diff --git a/source/blender/editors/util/ed_util.c 
b/source/blender/editors/util/ed_util.c
index 482523e56be..96864c88d9d 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -88,7 +88,8 @@ void ED_editors_init(bContext *C)
        wmWindowManager *wm = CTX_wm_manager(C);
        Main *bmain = CTX_data_main(C);
        Scene *sce = CTX_data_scene(C);
-       Object *ob, *obact = (sce && sce->basact) ? sce->basact->object : NULL;
+       SceneLayer *sl = CTX_data_scene_layer(C);
+       Object *ob, *obact = (sl && sl->basact) ? sl->basact->object : NULL;
        ID *data;
 
        /* This is called during initialization, so we don't want to store any 
reports */

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to