Cleanup/refactor: no new general arg-less macros enforcing var names please!
authorBastien Montagne <montagne29@wanadoo.fr>
Tue, 15 Aug 2017 13:59:38 +0000 (15:59 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Tue, 15 Aug 2017 13:59:38 +0000 (15:59 +0200)
We do have an history of those pieces of evil in our code, would be nice
to get fully rid of it, but at the very least let's not add more of them
in new code. :)

54 files changed:
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/smoke.c
source/blender/blenkernel/intern/softbody.c
source/blender/draw/intern/draw_manager.c
source/blender/draw/intern/draw_view.c
source/blender/draw/modes/object_mode.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/armature/pose_select.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_bake.c
source/blender/editors/object/object_constraint.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_group.c
source/blender/editors/object/object_relations.c
source/blender/editors/object/object_select.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/physics/rigidbody_constraint.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_image_proj.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/space_clip/tracking_ops_orient.c
source/blender/editors/space_image/image_edit.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_logic/logic_window.c
source/blender/editors/space_outliner/outliner_draw.c
source/blender/editors/space_outliner/outliner_edit.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_outliner/outliner_tree.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_draw_legacy.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_manipulator_camera.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/transform/transform_orientations.c
source/blender/editors/transform/transform_snap.c
source/blender/gpu/intern/gpu_draw.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/makesrna/intern/rna_space.c
source/blender/nodes/shader/node_shader_tree.c
source/blender/nodes/texture/node_texture_tree.c

index 45c3e92b70bd689da9dc74d06ee9288fcd71a2f4..50a476c3fdeedddcba9cc7316e808ad9cd209d7b 100644 (file)
@@ -500,7 +500,7 @@ static int surface_getBrushFlags(DynamicPaintSurface *surface, const SceneLayer
        if (surface->brush_group)
                go = surface->brush_group->gobject.first;
        else
-               base = FIRSTBASE_NEW;
+               base = FIRSTBASE_NEW(sl);
 
        while (base || go) {
                brushObj = NULL;
@@ -5788,7 +5788,7 @@ static int dynamicPaint_doStep(struct EvaluationContext *eval_ctx, Scene *scene,
                if (surface->brush_group)
                        go = surface->brush_group->gobject.first;
                else
-                       base = FIRSTBASE_NEW;
+                       base = FIRSTBASE_NEW(sl);
 
                while (base || go) {
                        brushObj = NULL;
index af1d4cc2e7d149f0c169388572335778a8c7da68..521f91b2afa1d723d02cdaa7007aed254f568161 100644 (file)
@@ -243,7 +243,7 @@ ListBase *pdInitEffectors(struct EvaluationContext *eval_ctx, Scene *scene, Obje
                }
        }
        else {
-               for (base = FIRSTBASE_NEW; base; base = base->next) {
+               for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
                        if ( base->object->pd && base->object->pd->forcefield )
                                add_object_to_effectors(&effectors, eval_ctx, scene, weights, base->object, ob_src, for_simulation);
 
index a479f45f275e29edb5433c55d3634995aa60a76c..7470453ba77e2a07057d69202be98c58f54632ed 100644 (file)
@@ -834,7 +834,7 @@ static LodLevel *lod_level_select(Object *ob, const float camera_position[3])
 
 bool BKE_object_lod_is_usable(Object *ob, SceneLayer *sl)
 {
-       bool active = (sl) ? ob == OBACT_NEW : false;
+       bool active = (sl) ? ob == OBACT_NEW(sl) : false;
        return (ob->mode == OB_MODE_OBJECT || !active);
 }
 
@@ -2538,7 +2538,7 @@ void BKE_scene_foreach_display_point(
        Base *base;
        Object *ob;
 
-       for (base = FIRSTBASE_NEW; base; base = base->next) {
+       for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
                if (((base->flag & BASE_VISIBLED) != 0) && ((base->flag & BASE_SELECTED) != 0)) {
                        ob = base->object;
 
index 807c672d23425fa38f3f82b6c162d765d6c2d87d..7ea408471b8f5bc361b73b96739a4a4249c3235e 100644 (file)
@@ -266,7 +266,7 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
                BLI_listbase_clear(&new_sl->drawdata);
                layer_collections_recreate(new_sl, &sl->layer_collections, mcn, mc);
 
-               Object *active_ob = OBACT_NEW;
+               Object *active_ob = OBACT_NEW(sl);
                Base *new_base = new_sl->object_bases.first;
                for (Base *base = sl->object_bases.first; base; base = base->next) {
                        new_base->flag = base->flag;
index b222b6f4f3cbe5c62331618133c59d53c5590b1f..cad4b2e1dd0ce8e983329ce8ace5a7fb9975f639 100644 (file)
@@ -704,7 +704,7 @@ static int get_lamp(SceneLayer *sl, float *light)
        int found_lamp = 0;
 
        // try to find a lamp, preferably local
-       for (base_tmp = FIRSTBASE_NEW; base_tmp; base_tmp = base_tmp->next) {
+       for (base_tmp = FIRSTBASE_NEW(sl); base_tmp; base_tmp = base_tmp->next) {
                if (base_tmp->object->type == OB_LAMP) {
                        Lamp *la = base_tmp->object->data;
 
index 4d8270568ba81cfad10f28be445eb8c48707b33d..28dea3e166989bf72e8ef781eba57a0a28d7e896 100644 (file)
@@ -532,7 +532,7 @@ static void ccd_build_deflector_hash(SceneLayer *sl, Group *group, Object *verte
                }
        }
        else {
-               for (Base *base = FIRSTBASE_NEW; base; base = base->next) {
+               for (Base *base = FIRSTBASE_NEW(sl); base; base = base->next) {
                        /*Only proceed for mesh object in same layer */
                        if (base->object->type == OB_MESH) {
                                ob = base->object;
@@ -578,7 +578,7 @@ static void ccd_update_deflector_hash(SceneLayer *sl, Group *group, Object *vert
                }
        }
        else {
-               for (Base *base = FIRSTBASE_NEW; base; base = base->next) {
+               for (Base *base = FIRSTBASE_NEW(sl); base; base = base->next) {
                        /*Only proceed for mesh object in same layer */
                        if (base->object->type == OB_MESH) {
                                ob = base->object;
@@ -988,7 +988,7 @@ static bool are_there_deflectors(SceneLayer *sl, Group *group)
                }
        }
        else {
-               for (Base *base = FIRSTBASE_NEW; base; base = base->next) {
+               for (Base *base = FIRSTBASE_NEW(sl); base; base = base->next) {
                        if (base->object->pd) {
                                if (base->object->pd->deflect)
                                        return 1;
index 7b46efd0566b5a7bc882c1b29d872a95414ba015..96f7b2864ede106116e1909bf6ef26887f1caf3b 100644 (file)
@@ -2942,7 +2942,7 @@ static void DRW_engines_enable_external(void)
 
 static void DRW_engines_enable(const Scene *scene, SceneLayer *sl)
 {
-       Object *obact = OBACT_NEW;
+       Object *obact = OBACT_NEW(sl);
        const int mode = CTX_data_mode_enum_ex(scene->obedit, obact);
        DRW_engines_enable_from_engine(scene);
 
@@ -3134,7 +3134,7 @@ void DRW_draw_render_loop_ex(
        cache_is_dirty = GPU_viewport_cache_validate(DST.viewport, DRW_engines_get_hash());
 
        DST.draw_ctx = (DRWContextState){
-               ar, rv3d, v3d, scene, sl, OBACT_NEW,
+               ar, rv3d, v3d, scene, sl, OBACT_NEW(sl),
                /* reuse if caller sets */
                DST.draw_ctx.evil_C,
        };
@@ -3318,7 +3318,7 @@ void DRW_draw_select_loop(
 
        /* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */
        DST.draw_ctx = (DRWContextState){
-               ar, rv3d, v3d, scene, sl, OBACT_NEW, (bContext *)NULL,
+               ar, rv3d, v3d, scene, sl, OBACT_NEW(sl), (bContext *)NULL,
        };
 
        DRW_viewport_var_init();
@@ -3414,7 +3414,7 @@ void DRW_draw_depth_loop(
 
        /* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */
        DST.draw_ctx = (DRWContextState){
-               ar, rv3d, v3d, scene, sl, OBACT_NEW, (bContext *)NULL,
+               ar, rv3d, v3d, scene, sl, OBACT_NEW(sl), (bContext *)NULL,
        };
 
        DRW_viewport_var_init();
index 67bb781562ec0d731384aae9b81a1f33a298da82..ea1d93a6a851d349e557e92d858ff714f2d94630 100644 (file)
@@ -613,7 +613,7 @@ void DRW_draw_background(void)
 
 static bool is_cursor_visible(Scene *scene, SceneLayer *sl)
 {
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        /* don't draw cursor in paint modes, but with a few exceptions */
        if (ob && ob->mode & OB_MODE_ALL_PAINT) {
index 1e70e942d071bd9d53d720fddd6c1ec97d1cf38d..3f492b2f054d878425ca492d4641ece1a63b346c 100644 (file)
@@ -1571,7 +1571,7 @@ static void DRW_shgroup_object_center(OBJECT_StorageList *stl, Object *ob, Scene
        const bool is_library = ob->id.us > 1 || ID_IS_LINKED_DATABLOCK(ob);
        DRWShadingGroup *shgroup;
 
-       if (ob == OBACT_NEW) {
+       if (ob == OBACT_NEW(sl)) {
                shgroup = stl->g_data->center_active;
        }
        else if (ob->base_flag & BASE_SELECTED) {
index 5b7ae216c556881791dcbc8b46ef8eb07a870706..9d296c0316061186fec819b4106f736aaa0d3eb6 100644 (file)
@@ -136,7 +136,7 @@ static Key *actedit_get_shapekeys(bAnimContext *ac)
        Object *ob;
        Key *key;
        
-       ob = OBACT_NEW;
+       ob = OBACT_NEW(sl);
        if (ob == NULL) 
                return NULL;
        
index 0d1752e07a19349c5b624ec88aa9ef222c5b5c68..e43212c7bde518db29f7e83fe655f2cb46fe5195 100644 (file)
@@ -146,7 +146,7 @@ bool ED_do_pose_selectbuffer(
        
        /* if the bone cannot be affected, don't do anything */
        if ((nearBone) && !(nearBone->flag & BONE_UNSELECTABLE)) {
-               Object *ob_act = OBACT_NEW;
+               Object *ob_act = OBACT_NEW(sl);
                bArmature *arm = ob->data;
                
                /* since we do unified select, we don't shift+select a bone if the
index 839e5f415e2d23911be3062ba3accd1d777e9aa9..7df436efdd5e03b81b4a1286c8666be386412dbb 100644 (file)
@@ -2029,11 +2029,11 @@ static int convert_exec(bContext *C, wmOperator *op)
        if (basact) {
                /* active base was changed */
                ED_object_base_activate(C, basact);
-               BASACT_NEW = basact;
+               BASACT_NEW(sl) = basact;
        }
-       else if (BASACT_NEW->object->flag & OB_DONE) {
-               WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, BASACT_NEW->object);
-               WM_event_add_notifier(C, NC_OBJECT | ND_DATA, BASACT_NEW->object);
+       else if (BASACT_NEW(sl)->object->flag & OB_DONE) {
+               WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, BASACT_NEW(sl)->object);
+               WM_event_add_notifier(C, NC_OBJECT | ND_DATA, BASACT_NEW(sl)->object);
        }
 
        DEG_relations_tag_update(bmain);
@@ -2366,7 +2366,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
                }
 
                /* new object becomes active */
-               if (BASACT_NEW == base)
+               if (BASACT_NEW(sl) == base)
                        ED_object_base_activate(C, basen);
 
                if (basen->object->data) {
index e3dd47295fe05632a424309a30902d9cca62d343..b02cb3e02a80eceb4909dc560927dcac4227dea8 100644 (file)
@@ -625,7 +625,7 @@ static void init_bake_internal(BakeRender *bkr, bContext *C)
        bkr->sa = sc ? BKE_screen_find_big_area(sc, SPACE_IMAGE, 10) : NULL; /* can be NULL */
        bkr->main = CTX_data_main(C);
        bkr->scene = scene;
-       bkr->actob = (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT_NEW : NULL;
+       bkr->actob = (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT_NEW(sl) : NULL;
        bkr->re = RE_NewRender("_Bake View_");
 
        if (scene->r.bake_mode == RE_BAKE_AO) {
@@ -858,7 +858,7 @@ static int bake_image_exec(bContext *C, wmOperator *op)
                        RE_test_break_cb(bkr.re, NULL, thread_break);
                        G.is_break = false;   /* BKE_blender_test_break uses this global */
 
-                       RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT_NEW : NULL);
+                       RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT_NEW(sl) : NULL);
 
                        /* baking itself is threaded, cannot use test_break in threads  */
                        BLI_init_threads(&threads, do_bake_render, 1);
index 0605be5c773fdfff9a11b1658398d960d7c905a9..4e578906e0730f583d9d46e439076a06c5b5cd2f 100644 (file)
@@ -1689,14 +1689,14 @@ static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob
                Main *bmain = CTX_data_main(C);
                Scene *scene = CTX_data_scene(C);
                SceneLayer *sl = CTX_data_scene_layer(C);
-               Base *base = BASACT_NEW, *newbase = NULL;
+               Base *base = BASACT_NEW(sl), *newbase = NULL;
                Object *obt;
                
                /* add new target object */
                obt = BKE_object_add(bmain, scene, sl, OB_EMPTY, NULL);
                
                /* set layers OK */
-               newbase = BASACT_NEW;
+               newbase = BASACT_NEW(sl);
                newbase->lay = base->lay;
                obt->lay = newbase->lay;
                
@@ -1715,7 +1715,7 @@ static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob
                }
 
                /* restore, BKE_object_add sets active */
-               BASACT_NEW = base;
+               BASACT_NEW(sl) = base;
                base->flag |= BASE_SELECTED;
                
                /* make our new target the new object */
index 13f9f950236e16952bbe4802eec09c1db728c4d4..953dedab02deaba5aabea8acd80d9a8adb9f8f11 100644 (file)
@@ -545,8 +545,8 @@ static void copymenu_properties(SceneLayer *sl, Object *ob)
        nr = pupmenu(str);
        
        if (nr == 1 || nr == 2) {
-               for (base = FIRSTBASE_NEW; base; base = base->next) {
-                       if ((base != BASACT_NEW) && (TESTBASELIB_NEW(base))) {
+               for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
+                       if ((base != BASACT_NEW(sl)) && (TESTBASELIB_NEW(base))) {
                                if (nr == 1) { /* replace */
                                        BKE_bproperty_copy_list(&base->object->prop, &ob->prop);
                                }
@@ -562,8 +562,8 @@ static void copymenu_properties(SceneLayer *sl, Object *ob)
                prop = BLI_findlink(&ob->prop, nr - 4); /* account for first 3 menu items & menu index starting at 1*/
                
                if (prop) {
-                       for (base = FIRSTBASE_NEW; base; base = base->next) {
-                               if ((base != BASACT_NEW) && (TESTBASELIB_NEW(base))) {
+                       for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
+                               if ((base != BASACT_NEW(sl)) && (TESTBASELIB_NEW(base))) {
                                        BKE_bproperty_object_set(base->object, prop);
                                }
                        }
@@ -578,7 +578,7 @@ static void copymenu_logicbricks(SceneLayer *sl, Object *ob)
 //XXX no longer used - to be removed - replaced by logicbricks_copy_exec
        Base *base;
        
-       for (base = FIRSTBASE_NEW; base; base = base->next) {
+       for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
                if (base->object != ob) {
                        if (TESTBASELIB_NEW(base)) {
                                
@@ -669,7 +669,7 @@ static void copy_attr(Main *bmain, Scene *scene, SceneLayer *sl, short event)
        
        if (ID_IS_LINKED_DATABLOCK(scene)) return;
 
-       if (!(ob = OBACT_NEW)) return;
+       if (!(ob = OBACT_NEW(sl))) return;
        
        if (scene->obedit) { // XXX get from context
                /* obedit_copymenu(); */
@@ -689,8 +689,8 @@ static void copy_attr(Main *bmain, Scene *scene, SceneLayer *sl, short event)
                return;
        }
 
-       for (base = FIRSTBASE_NEW; base; base = base->next) {
-               if (base != BASACT_NEW) {
+       for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
+               if (base != BASACT_NEW(sl)) {
                        if (TESTBASELIB_NEW(base)) {
                                DEG_id_tag_update(&base->object->id, OB_RECALC_DATA);
                                
@@ -916,7 +916,7 @@ static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, SceneLay
        short event;
        char str[512];
        
-       if (!(ob = OBACT_NEW)) return;
+       if (!(ob = OBACT_NEW(sl))) return;
        
        if (scene->obedit) { /* XXX get from context */
 /*             if (ob->type == OB_MESH) */
@@ -1341,7 +1341,7 @@ static void UNUSED_FUNCTION(image_aspect) (Scene *scene, SceneLayer *sl)
        if (scene->obedit) return;  // XXX get from context
        if (ID_IS_LINKED_DATABLOCK(scene)) return;
        
-       for (base = FIRSTBASE_NEW; base; base = base->next) {
+       for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
                if (TESTBASELIB_NEW(base)) {
                        ob = base->object;
                        done = false;
index 3064bf8af1a5756f963f84c14797d457bcfdd6a8..b32fb975ea829a244940a9b0093842b382795abf 100644 (file)
@@ -201,7 +201,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
 {
        Main *bmain = CTX_data_main(C);
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        int single_group_index = RNA_enum_get(op->ptr, "group");
        Group *single_group = group_object_active_find_index(ob, single_group_index);
        Group *group;
index 7e10cbeeb82ed35b18a8b1285b289341e8a0eb17..04ac42a5471c4ce76d27c58307ee7087c1c5dff3 100644 (file)
@@ -247,7 +247,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
                        else {
                                Object workob;
 
-                               ob->parent = BASACT_NEW->object;
+                               ob->parent = BASACT_NEW(sl)->object;
                                if (v3) {
                                        ob->partype = PARVERT3;
                                        ob->par1 = v1 - 1;
@@ -354,7 +354,7 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
 
        if (ob) {
                Object *newob;
-               BaseLegacy *newbase, *oldbase = BASACT_NEW;
+               BaseLegacy *newbase, *oldbase = BASACT_NEW(sl);
                char name[MAX_ID_NAME + 4];
 
                BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2);
@@ -363,7 +363,7 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
                newob = BKE_object_add(bmain, scene, sl, OB_EMPTY, name);
 
                /* set layers OK */
-               newbase = BASACT_NEW;    /* BKE_object_add sets active... */
+               newbase = BASACT_NEW(sl);    /* BKE_object_add sets active... */
                newbase->lay = oldbase->lay;
                newob->lay = newbase->lay;
 
index 0a9b8b749f1146aaca7f95df6797337a87ac23c6..628c5b846a3a16cd133366d2dfc0a762fab5258f 100644 (file)
@@ -425,7 +425,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
                CTX_DATA_END;
        }
        
-       ob = OBACT_NEW;
+       ob = OBACT_NEW(sl);
        if (ob == NULL) {
                BKE_report(op->reports, RPT_ERROR, "No active object");
                return OPERATOR_CANCELLED;
@@ -836,7 +836,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
                CTX_DATA_END;
        }
 
-       ob = OBACT_NEW;
+       ob = OBACT_NEW(sl);
        if (ob == NULL) {
                BKE_report(op->reports, RPT_ERROR, "No active object");
                return OPERATOR_CANCELLED;
index d935915e1c989db5d34040f94c959c567a5241c8..1838c0fba5f6a48eef63b5d6e871968914850e45 100644 (file)
@@ -4438,7 +4438,7 @@ static void get_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
 
 void PE_undo_push(Scene *scene, SceneLayer *sl, const char *str)
 {
-       PTCacheEdit *edit= PE_get_current(scene, sl, OBACT_NEW);
+       PTCacheEdit *edit= PE_get_current(scene, sl, OBACT_NEW(sl));
        PTCacheUndo *undo;
        int nr;
 
@@ -4480,7 +4480,7 @@ void PE_undo_push(Scene *scene, SceneLayer *sl, const char *str)
 
 void PE_undo_step(Scene *scene, SceneLayer *sl, int step)
 {      
-       PTCacheEdit *edit= PE_get_current(scene, sl, OBACT_NEW);
+       PTCacheEdit *edit= PE_get_current(scene, sl, OBACT_NEW(sl));
 
        if (!edit) return;
 
@@ -4511,12 +4511,12 @@ void PE_undo_step(Scene *scene, SceneLayer *sl, int step)
                }
        }
 
-       DEG_id_tag_update(&OBACT_NEW->id, OB_RECALC_DATA);
+       DEG_id_tag_update(&OBACT_NEW(sl)->id, OB_RECALC_DATA);
 }
 
 bool PE_undo_is_valid(Scene *scene, SceneLayer *sl)
 {
-       PTCacheEdit *edit= PE_get_current(scene, sl, OBACT_NEW);
+       PTCacheEdit *edit= PE_get_current(scene, sl, OBACT_NEW(sl));
        
        if (edit) {
                return (edit->undo.last != edit->undo.first);
@@ -4551,7 +4551,7 @@ void PE_redo(Scene *scene, SceneLayer *sl)
 
 void PE_undo_number(Scene *scene, SceneLayer *sl, int nr)
 {
-       PTCacheEdit *edit= PE_get_current(scene, sl, OBACT_NEW);
+       PTCacheEdit *edit= PE_get_current(scene, sl, OBACT_NEW(sl));
        PTCacheUndo *undo;
        int a=0;
        
@@ -4567,7 +4567,7 @@ void PE_undo_number(Scene *scene, SceneLayer *sl, int nr)
 /* if active pointer, set it to 1 if true */
 const char *PE_undo_get_name(Scene *scene, SceneLayer *sl, int nr, bool *r_active)
 {
-       PTCacheEdit *edit= PE_get_current(scene, sl, OBACT_NEW);
+       PTCacheEdit *edit= PE_get_current(scene, sl, OBACT_NEW(sl));
        PTCacheUndo *undo;
        
        if (r_active) *r_active = false;
@@ -4588,7 +4588,7 @@ const char *PE_undo_get_name(Scene *scene, SceneLayer *sl, int nr, bool *r_activ
 
 int PE_minmax(Scene *scene, SceneLayer *sl, float min[3], float max[3])
 {
-       Object *ob= OBACT_NEW;
+       Object *ob= OBACT_NEW(sl);
        PTCacheEdit *edit= PE_get_current(scene, sl, ob);
        ParticleSystem *psys;
        ParticleSystemModifierData *psmd = NULL;
index 9cd571c68cf5fd36390eb19c3cb69993a6645988..b38b8640c8d59b7ce250e61520391ef157c3a0d5 100644 (file)
@@ -349,7 +349,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
        channels->DomainTime = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "channel DomainTime");
        
        /* allocate fluid objects */
-       for (base = FIRSTBASE_NEW; base; base = base->next) {
+       for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
                Object *ob = base->object;
                FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
                
@@ -586,7 +586,7 @@ static int fluid_validate_scene(ReportList *reports, SceneLayer *sl, Object *fsD
        int channelObjCount = 0;
        int fluidInputCount = 0;
 
-       for (base = FIRSTBASE_NEW; base; base = base->next) {
+       for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
                Object *ob = base->object;
                FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
 
index d93eb95243e484180ef0ec6ff68a1872c14992e9..1c9b59268e45cbb84a6f35c2c9d41f37871c33f4 100644 (file)
@@ -121,7 +121,7 @@ static int rigidbody_con_add_exec(bContext *C, wmOperator *op)
        Scene *scene = CTX_data_scene(C);
        SceneLayer *sl = CTX_data_scene_layer(C);
        RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        int type = RNA_enum_get(op->ptr, "type");
        bool changed;
 
@@ -170,7 +170,7 @@ static int rigidbody_con_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 = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        /* apply to active object */
        if (ELEM(NULL, ob, ob->rigidbody_constraint)) {
index 8c6b3b0106cc31b640235b42aff65e64cddb6434..d2115aae2ac26d8625b8266302c3baacf3dd6687 100644 (file)
@@ -766,7 +766,7 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo
        /* initialize from context */
        if (CTX_wm_region_view3d(C)) {
                SceneLayer *sl = CTX_data_scene_layer(C);
-               Object *ob = OBACT_NEW;
+               Object *ob = OBACT_NEW(sl);
                bool uvs, mat, tex, stencil;
                if (!BKE_paint_proj_mesh_data_check(scene, ob, &uvs, &mat, &tex, &stencil)) {
                        BKE_paint_data_warning(op->reports, uvs, mat, tex, stencil);
index 65f4618e43eb3997ac6be5c2e01be9bd0727ff13..b7ec80bb74e6acde9b6de5a842bbfe6ae4e80ecc 100644 (file)
@@ -5323,7 +5323,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
        int orig_brush_size;
        IDProperty *idgroup;
        IDProperty *view_data = NULL;
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        bool uvs, mat, tex;
 
        if (ob == NULL || ob->type != OB_MESH) {
index f8c8d8fb41e6716883b61233ba8504cd8e9314ab..b581c785b3cba01d5711f5901f04c51e450177e7 100644 (file)
@@ -447,7 +447,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr
        if (CTX_wm_view3d(C) && texpaint_proj) {
                /* first try getting a colour directly from the mesh faces if possible */
                SceneLayer *sl = CTX_data_scene_layer(C);
-               Object *ob = OBACT_NEW;
+               Object *ob = OBACT_NEW(sl);
                bool sample_success = false;
                ImagePaintSettings *imapaint = &scene->toolsettings->imapaint;
                bool use_material = (imapaint->mode == IMAGEPAINT_MODE_MATERIAL);
index 7b21e11d34282944af47b041401248282440637c..c411f64a88ba4b27eb5da1c8e0adc7c2db949b1e 100644 (file)
@@ -99,7 +99,7 @@ static Object *get_orientation_object(bContext *C)
                object = get_camera_with_movieclip(scene, clip);
        }
        else {
-               object = OBACT_NEW;
+               object = OBACT_NEW(sl);
        }
 
        if (object != NULL && object->parent != NULL) {
@@ -122,7 +122,7 @@ static int set_orientation_poll(bContext *C)
                                return true;
                        }
                        else {
-                               return OBACT_NEW != NULL;
+                               return OBACT_NEW(sl) != NULL;
                        }
                }
        }
index a3a115b3e6ab0f45da8471fece5ce79ef71ab792..fbc67ab8090d4606bb3e4664ab533483428ba442 100644 (file)
@@ -377,7 +377,7 @@ bool ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit)
 bool ED_space_image_check_show_maskedit(SceneLayer *sl, SpaceImage *sima)
 {
        /* check editmode - this is reserved for UV editing */
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        if (ob && ob->mode & OB_MODE_EDIT && ED_space_image_show_uvedit(sima, ob)) {
                return false;
        }
index 58fb75edd84f2321cb7990517ebc6e2bd0006c95..514cb1ab97eab09ba17c55802678ca13681f7032 100644 (file)
@@ -537,7 +537,7 @@ static void image_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, co
                                case ND_MODIFIER:
                                {
                                        SceneLayer *sl = BKE_scene_layer_context_active_PLACEHOLDER(scene);
-                                       Object *ob = OBACT_NEW;
+                                       Object *ob = OBACT_NEW(sl);
                                        if (ob && (ob == wmn->reference) && (ob->mode & OB_MODE_EDIT)) {
                                                if (sima->lock && (sima->flag & SI_DRAWSHADOW)) {
                                                        ED_area_tag_refresh(sa);
index 04790f5405778d8bc15019b174a1061ea8c5cb30..3fd2805efe0e0895f3fcb7c68ffb73aa361df406 100644 (file)
@@ -485,7 +485,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
                ob= ob->id.next;
        }
        
-       for (base = FIRSTBASE_NEW; base; base = base->next) {
+       for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
                if ((base->flag & BASE_VISIBLED) && (base->flag & SELECT)) {
                        if (scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS;
                        if (scavisflag & BUTS_CONT_SEL) base->object->scavisflag |= OB_VIS_CONT;
index 7a1eca0f1798273f752db1e8f8276215378d06eb..e3baf44bf9cd8239d306a427f9f31a904ef53f48 100644 (file)
@@ -337,7 +337,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
                                                BLI_strncpy(newname, ebone->name, sizeof(ebone->name));
                                                BLI_strncpy(ebone->name, oldname, sizeof(ebone->name));
                                                ED_armature_bone_rename(obedit->data, oldname, newname);
-                                               WM_event_add_notifier(C, NC_OBJECT | ND_POSE, OBACT_NEW);
+                                               WM_event_add_notifier(C, NC_OBJECT | ND_POSE, OBACT_NEW(sl));
                                        }
                                        break;
                                }
@@ -350,7 +350,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
                                        
                                        /* always make current object active */
                                        tree_element_active(C, scene, sl, soops, te, OL_SETSEL_NORMAL, true);
-                                       ob = OBACT_NEW;
+                                       ob = OBACT_NEW(sl);
                                        
                                        /* restore bone name */
                                        BLI_strncpy(newname, bone->name, sizeof(bone->name));
@@ -367,7 +367,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
                                        
                                        /* always make current pose-bone active */
                                        tree_element_active(C, scene, sl, soops, te, OL_SETSEL_NORMAL, true);
-                                       ob = OBACT_NEW;
+                                       ob = OBACT_NEW(sl);
 
                                        BLI_assert(ob->type == OB_ARMATURE);
                                        
@@ -1217,7 +1217,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Sce
                        /* active blocks get white circle */
                        if (tselem->type == 0) {
                                if (te->idcode == ID_OB) {
-                                       active = (OBACT_NEW == (Object *)tselem->id) ? OL_DRAWSEL_NORMAL : OL_DRAWSEL_NONE;
+                                       active = (OBACT_NEW(sl) == (Object *)tselem->id) ? OL_DRAWSEL_NORMAL : OL_DRAWSEL_NONE;
                                }
                                else if (scene->obedit && scene->obedit->data == tselem->id) {
                                        active = OL_DRAWSEL_NORMAL;
@@ -1323,13 +1323,13 @@ static void outliner_draw_tree_element(
                        else if (te->idcode == ID_OB) {
                                Object *ob = (Object *)tselem->id;
                                
-                               if (ob == OBACT_NEW || (ob->flag & SELECT)) {
+                               if (ob == OBACT_NEW(sl) || (ob->flag & SELECT)) {
                                        char col[4] = {0, 0, 0, 0};
                                        
                                        /* outliner active ob: always white text, circle color now similar to view3d */
                                        
                                        active = OL_DRAWSEL_ACTIVE;
-                                       if (ob == OBACT_NEW) {
+                                       if (ob == OBACT_NEW(sl)) {
                                                if (ob->flag & SELECT) {
                                                        UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col);
                                                        col[3] = alpha;
index 498e1cfe87f0a037182c8681746da20c3d222e85..d9a54f51f7ca121b977bf988f9f76c8c4a04d205 100644 (file)
@@ -986,7 +986,7 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
        TreeElement *te;
        int xdelta, ytop;
 
-       Object *obact = OBACT_NEW;
+       Object *obact = OBACT_NEW(sl);
 
        if (!obact)
                return OPERATOR_CANCELLED;
index d9590d2af7f823c8690a57fd501a6bc949d8ae39..a470711d9dfe43841babeed8b0a351566c0d4e3a 100644 (file)
@@ -103,7 +103,7 @@ static void do_outliner_object_select_recursive(SceneLayer *sl, Object *ob_paren
 {
        Base *base;
 
-       for (base = FIRSTBASE_NEW; base; base = base->next) {
+       for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
                Object *ob = base->object;
                if ((((base->flag & BASE_VISIBLED) == 0) && BKE_object_is_child_recursive(ob_parent, ob))) {
                        ED_object_base_select(base, select ? BA_SELECT : BA_DESELECT);
@@ -151,7 +151,7 @@ static eOLDrawState tree_element_set_active_object(
        }
        else {
                ob = (Object *)outliner_search_back(soops, te, ID_OB);
-               if (ob == OBACT_NEW) {
+               if (ob == OBACT_NEW(sl)) {
                        return OL_DRAWSEL_NONE;
                }
        }
@@ -209,7 +209,7 @@ static eOLDrawState tree_element_active_material(
        /* we search for the object parent */
        ob = (Object *)outliner_search_back(soops, te, ID_OB);
        // note: ob->matbits can be NULL when a local object points to a library mesh.
-       if (ob == NULL || ob != OBACT_NEW || ob->matbits == NULL) {
+       if (ob == NULL || ob != OBACT_NEW(sl) || ob->matbits == NULL) {
                return OL_DRAWSEL_NONE;  /* just paranoia */
        }
        
@@ -258,7 +258,7 @@ static eOLDrawState tree_element_active_texture(
 {
        TreeElement *tep;
        TreeStoreElem /* *tselem,*/ *tselemp;
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        SpaceButs *sbuts = NULL;
        
        if (ob == NULL) {
@@ -347,7 +347,7 @@ static eOLDrawState tree_element_active_lamp(
        
        /* we search for the object parent */
        ob = (Object *)outliner_search_back(soops, te, ID_OB);
-       if (ob == NULL || ob != OBACT_NEW) {
+       if (ob == NULL || ob != OBACT_NEW(sl)) {
                /* just paranoia */
                return OL_DRAWSEL_NONE;
        }
@@ -423,7 +423,7 @@ static eOLDrawState tree_element_active_defgroup(
                WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, ob);
        }
        else {
-               if (ob == OBACT_NEW)
+               if (ob == OBACT_NEW(sl))
                        if (ob->actdef == te->index + 1) {
                                return OL_DRAWSEL_NORMAL;
                        }
@@ -443,7 +443,7 @@ static eOLDrawState tree_element_active_posegroup(
                }
        }
        else {
-               if (ob == OBACT_NEW && ob->pose) {
+               if (ob == OBACT_NEW(sl) && ob->pose) {
                        if (ob->pose->active_group == te->index + 1) {
                                return OL_DRAWSEL_NORMAL;
                        }
@@ -487,7 +487,7 @@ static eOLDrawState tree_element_active_posechannel(
                }
        }
        else {
-               if (ob == OBACT_NEW && ob->pose) {
+               if (ob == OBACT_NEW(sl) && ob->pose) {
                        if (pchan->bone->flag & BONE_SELECTED) {
                                return OL_DRAWSEL_NORMAL;
                        }
@@ -504,7 +504,7 @@ static eOLDrawState tree_element_active_bone(
        
        if (set != OL_SETSEL_NONE) {
                if (!(bone->flag & BONE_HIDDEN_P)) {
-                       Object *ob = OBACT_NEW;
+                       Object *ob = OBACT_NEW(sl);
                        if (ob) {
                                if (set != OL_SETSEL_EXTEND) {
                                        /* single select forces all other bones to get unselected */
@@ -533,7 +533,7 @@ static eOLDrawState tree_element_active_bone(
                }
        }
        else {
-               Object *ob = OBACT_NEW;
+               Object *ob = OBACT_NEW(sl);
                
                if (ob && ob->data == arm) {
                        if (bone->flag & BONE_SELECTED) {
@@ -842,7 +842,7 @@ eOLDrawState tree_element_type_active(
                        if (set != OL_SETSEL_NONE) {
                                tree_element_set_active_object(C, scene, sl, soops, te, set, false);
                        }
-                       else if (tselem->id == (ID *)OBACT_NEW) {
+                       else if (tselem->id == (ID *)OBACT_NEW(sl)) {
                                return OL_DRAWSEL_NORMAL;
                        }
                        break;
index adb019766ea9a940d6a306a36e59678b9cd53393..0401505b4cdeacee0e938862bcfdc9ffaaceebcb 100644 (file)
@@ -1871,7 +1871,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SceneLayer *sl, SpaceOops
                }
        }
        else if (soops->outlinevis == SO_SAME_TYPE) {
-               Object *ob_active = OBACT_NEW;
+               Object *ob_active = OBACT_NEW(sl);
                if (ob_active) {
                        FOREACH_SCENE_OBJECT(scene, ob)
                        {
@@ -1950,8 +1950,8 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SceneLayer *sl, SpaceOops
                outliner_add_collections_master(soops, scene);
        }
        else {
-               ten = outliner_add_element(soops, &soops->tree, OBACT_NEW, NULL, 0, 0);
-               ten->directdata = BASACT_NEW;
+               ten = outliner_add_element(soops, &soops->tree, OBACT_NEW(sl), NULL, 0, 0);
+               ten->directdata = BASACT_NEW(sl);
        }
 
        if ((soops->flag & SO_SKIP_SORT_ALPHA) == 0) {
index 191dfed01bfff2b4808898411e96e16ec4c51f1e..b4e968226f41287ceb41a6f738f862f98e4b1233 100644 (file)
@@ -2982,10 +2982,10 @@ bool draw_armature(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d,
                                                        draw_ghost_poses(C, scene, sl, v3d, ar, base);
                                        }
                                        if ((dflag & DRAW_SCENESET) == 0) {
-                                               if (ob == OBACT_NEW)
+                                               if (ob == OBACT_NEW(sl))
                                                        arm->flag |= ARM_POSEMODE;
-                                               else if (OBACT_NEW && (OBACT_NEW->mode & OB_MODE_WEIGHT_PAINT)) {
-                                                       if (ob == modifiers_isDeformedByArmature(OBACT_NEW))
+                                               else if (OBACT_NEW(sl) && (OBACT_NEW(sl)->mode & OB_MODE_WEIGHT_PAINT)) {
+                                                       if (ob == modifiers_isDeformedByArmature(OBACT_NEW(sl)))
                                                                arm->flag |= ARM_POSEMODE;
                                                }
                                                draw_pose_paths(scene, v3d, ar, ob);
index 166a5cbbd170533f6dbd7ba43f7cd0dc352f5697..1490ad6288fa9f7c517ebd825962c8c2f49e8660 100644 (file)
@@ -318,7 +318,7 @@ bool draw_glsl_material(Scene *scene, SceneLayer *sl, Object *ob, View3D *v3d, c
                return false;
        if (!check_object_draw_texture(scene, v3d, dt))
                return false;
-       if (ob == OBACT_NEW && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
+       if (ob == OBACT_NEW(sl) && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
                return false;
        
        if (v3d->flag2 & V3D_SHOW_SOLID_MATCAP)
@@ -4312,7 +4312,7 @@ static void draw_mesh_fancy(EvaluationContext *eval_ctx, Scene *scene, SceneLaye
        eWireDrawMode draw_wire = OBDRAW_WIRE_OFF;
        bool /* no_verts,*/ no_edges, no_faces;
        DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, scene->customdata_mask);
-       const bool is_obact = (ob == OBACT_NEW);
+       const bool is_obact = (ob == OBACT_NEW(sl));
        int draw_flags = (is_obact && BKE_paint_select_face_test(ob)) ? DRAW_FACE_SELECT : 0;
 
        if (!dm)
@@ -4730,7 +4730,7 @@ static void draw_mesh_fancy_new(EvaluationContext *eval_ctx, Scene *scene, Scene
        eWireDrawMode draw_wire = OBDRAW_WIRE_OFF; /* could be bool draw_wire_overlay */
        bool no_edges, no_faces;
        DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, scene->customdata_mask);
-       const bool is_obact = (ob == OBACT_NEW);
+       const bool is_obact = (ob == OBACT_NEW(sl));
        int draw_flags = (is_obact && BKE_paint_select_face_test(ob)) ? DRAW_FACE_SELECT : 0;
 
        if (!dm)
@@ -4851,7 +4851,7 @@ static void draw_mesh_fancy_new(EvaluationContext *eval_ctx, Scene *scene, Scene
                    !(G.f & G_PICKSEL || (draw_flags & DRAW_FACE_SELECT)) &&
                    (draw_wire == OBDRAW_WIRE_OFF))
                {
-                       draw_mesh_object_outline_new(v3d, rv3d, ob, me, (ob == OBACT_NEW));
+                       draw_mesh_object_outline_new(v3d, rv3d, ob, me, (ob == OBACT_NEW(sl)));
                }
 
                if (draw_glsl_material(scene, sl, ob, v3d, dt) && !(draw_flags & DRAW_MODIFIERS_PREVIEW)) {
@@ -4918,7 +4918,7 @@ static void draw_mesh_fancy_new(EvaluationContext *eval_ctx, Scene *scene, Scene
                                    (draw_wire == OBDRAW_WIRE_OFF) &&
                                    (ob->sculpt == NULL))
                                {
-                                       draw_mesh_object_outline_new(v3d, rv3d, ob, me, (ob == OBACT_NEW));
+                                       draw_mesh_object_outline_new(v3d, rv3d, ob, me, (ob == OBACT_NEW(sl)));
                                }
 
                                /* materials arent compatible with vertex colors */
@@ -4943,7 +4943,7 @@ static void draw_mesh_fancy_new(EvaluationContext *eval_ctx, Scene *scene, Scene
                            (ob->sculpt == NULL))
                        {
                                /* TODO: move this into a separate pass */
-                               draw_mesh_object_outline_new(v3d, rv3d, ob, me, (ob == OBACT_NEW));
+                               draw_mesh_object_outline_new(v3d, rv3d, ob, me, (ob == OBACT_NEW(sl)));
                        }
 
                        glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
@@ -8575,7 +8575,7 @@ void draw_object(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, V
        unsigned char _ob_wire_col[4];            /* dont initialize this */
        const unsigned char *ob_wire_col = NULL;  /* dont initialize this, use NULL crashes as a way to find invalid use */
        bool zbufoff = false, is_paint = false, empty_object = false;
-       const bool is_obact = (ob == OBACT_NEW);
+       const bool is_obact = (ob == OBACT_NEW(sl));
        const bool render_override = (v3d->flag2 & V3D_RENDER_OVERRIDE) != 0;
        const bool is_picking = (G.f & G_PICKSEL) != 0;
        const bool has_particles = (ob->particlesystem.first != NULL);
index a8e5e1ad536976a23351e5e17b956d650eb2c9e0..ddb87d96ec189044eb370b786c7c624f0193a4b2 100644 (file)
@@ -788,7 +788,7 @@ static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
 static int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
 {
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        if (ob && (BKE_object_is_in_editmode_vgroup(ob) ||
                   BKE_object_is_in_wpaint_select_vert(ob)))
        {
@@ -1099,7 +1099,7 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
 {
        SceneLayer *sl = CTX_data_scene_layer(C);
        View3D *v3d = CTX_wm_view3d(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        switch (event) {
 
index 04cc77ddd9cf02f4ffdba7ce3087ff168825dc95..037e3b26b9f14627dca330878a22c6deb4c86452 100644 (file)
@@ -1313,7 +1313,7 @@ float ED_view3d_grid_scale(Scene *scene, View3D *v3d, const char **grid_unit)
 
 static bool is_cursor_visible(Scene *scene, SceneLayer *sl)
 {
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        /* don't draw cursor in paint modes, but with a few exceptions */
        if (ob && ob->mode & OB_MODE_ALL_PAINT) {
@@ -1844,7 +1844,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int offset)
 
        if (U.uiflag & USER_DRAWVIEWINFO) {
                SceneLayer *sl = CTX_data_scene_layer(C);
-               Object *ob = OBACT_NEW;
+               Object *ob = OBACT_NEW(sl);
                draw_selected_name(scene, ob, &rect);
        }
 #if 0 /* TODO */
index fe388ef8cdd5cf14b67ae298c0e1fa61537e0d58..c458539be3e7b8390fee969b3cf26c46e9f0301b 100644 (file)
@@ -1290,12 +1290,12 @@ void ED_view3d_draw_select_loop(
        const short dflag = DRAW_PICKING | DRAW_CONSTCOLOR;
 
        if (vc->obedit && vc->obedit->type == OB_MBALL) {
-               draw_object(C, scene, sl, ar, v3d, BASACT_NEW, dflag);
+               draw_object(C, scene, sl, ar, v3d, BASACT_NEW(sl), dflag);
        }
        else if ((vc->obedit && vc->obedit->type == OB_ARMATURE)) {
                /* if not drawing sketch, draw bones */
                if (!BDR_drawSketchNames(vc)) {
-                       draw_object(C, scene, sl, ar, v3d, BASACT_NEW, dflag);
+                       draw_object(C, scene, sl, ar, v3d, BASACT_NEW(sl), dflag);
                }
        }
        else {
@@ -2054,7 +2054,7 @@ static void view3d_main_region_draw_info(const bContext *C, Scene *scene,
                        draw_view_icon(rv3d, &rect);
 
                if (U.uiflag & USER_DRAWVIEWINFO) {
-                       Object *ob = OBACT_NEW;
+                       Object *ob = OBACT_NEW(sl);
                        VP_legacy_draw_selected_name(scene, ob, &rect);
                }
        }
index eb7da6ca5442b9f178d153a2a9fec710025815b8..eef0710b59cfccd9364c8fcd6fc59cbfd0251479 100644 (file)
@@ -623,7 +623,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
 
        Scene *scene = CTX_data_scene(C);
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob_act = OBACT_NEW;
+       Object *ob_act = OBACT_NEW(sl);
 
        if (ob_act && (ob_act->mode & OB_MODE_ALL_PAINT) &&
            /* with weight-paint + pose-mode, fall through to using calculateTransformCenter */
@@ -665,7 +665,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
                float select_center[3];
 
                zero_v3(select_center);
-               for (base = FIRSTBASE_NEW; base; base = base->next) {
+               for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
                        if (TESTBASE_NEW(base)) {
                                /* use the boundbox if we can */
                                Object *ob = base->object;
@@ -3071,7 +3071,7 @@ static int viewselected_exec(bContext *C, wmOperator *op)
        const bool is_gp_edit = ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE));
        const bool is_face_map = ((is_gp_edit == false) && ar->manipulator_map &&
                                  WM_manipulatormap_is_any_selected(ar->manipulator_map));
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        Object *obedit = CTX_data_edit_object(C);
        float min[3], max[3];
        bool ok = false, ok_dist = true;
@@ -3139,7 +3139,7 @@ static int viewselected_exec(bContext *C, wmOperator *op)
        }
        else {
                Base *base;
-               for (base = FIRSTBASE_NEW; base; base = base->next) {
+               for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
                        if (TESTBASE_NEW(base)) {
 
                                if (skip_camera && base->object == v3d->camera) {
@@ -3937,7 +3937,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
                        /* lastview -  */
 
                        if (rv3d->persp != RV3D_CAMOB) {
-                               Object *ob = OBACT_NEW;
+                               Object *ob = OBACT_NEW(sl);
 
                                if (!rv3d->smooth_timer) {
                                        /* store settings of current view before allowing overwriting with camera view
index bb86b0a991fe61ad4eb9461c3c7d6479bcb0ca33..b6deabdb447b466b7d730650c3c6783e3807aff1 100644 (file)
@@ -283,7 +283,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
        SceneLayer *sl = CTX_data_scene_layer(C);
        ToolSettings *ts = CTX_data_tool_settings(C);
        PointerRNA v3dptr, toolsptr, sceneptr;
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        Object *obedit = CTX_data_edit_object(C);
        bGPdata *gpd = CTX_data_gpencil_data(C);
        uiBlock *block;
index 10f1684b6cb577ffb1dfe4b1c294496f6aee4693..a1ad45ae6b671000cec752329e08ae52d53a50cc 100644 (file)
@@ -306,7 +306,7 @@ static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmManipulatorGroupTy
         * We could change the rules for when to show. */
        {
                SceneLayer *sl = CTX_data_scene_layer(C);
-               if (scene->camera != OBACT_NEW) {
+               if (scene->camera != OBACT_NEW(sl)) {
                        return false;
                }
        }
index d49262bc5d79c412b4804279a5d20d1d8442d477..526d0b979e2ab7ff575d243bb14a925547000a5a 100644 (file)
@@ -1286,8 +1286,8 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
                }
                else {
                        /* only exclude active object when it is selected... */
-                       if (BASACT_NEW && (BASACT_NEW->flag & BASE_SELECTED) && hits > 1) {
-                               notcol = BASACT_NEW->object->select_color;
+                       if (BASACT_NEW(sl) && (BASACT_NEW(sl)->flag & BASE_SELECTED) && hits > 1) {
+                               notcol = BASACT_NEW(sl)->object->select_color;
                        }
                        
                        for (a = 0; a < hits; a++) {
@@ -1298,7 +1298,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
                        }
                }
                
-               base = FIRSTBASE_NEW;
+               base = FIRSTBASE_NEW(sl);
                while (base) {
                        if (BASE_SELECTABLE_NEW(base)) {
                                if (base->object->select_color == selcol) break;
@@ -1315,7 +1315,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
                         * with an un-selectable choice */
                        if ((base->flag & BASE_SELECTABLED) == 0) {
                                base = base->next;
-                               if (base == NULL) base = FIRSTBASE_NEW;
+                               if (base == NULL) base = FIRSTBASE_NEW(sl);
                                if (base == startbase) break;
                        }
                        
@@ -1338,7 +1338,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
                        if (basact) break;
                        
                        base = base->next;
-                       if (base == NULL) base = FIRSTBASE_NEW;
+                       if (base == NULL) base = FIRSTBASE_NEW(sl);
                        if (base == startbase) break;
                }
        }
@@ -1415,8 +1415,8 @@ static bool ed_object_select_pick(
        }
        
        /* always start list from basact in wire mode */
-       startbase =  FIRSTBASE_NEW;
-       if (BASACT_NEW && BASACT_NEW->next) startbase = BASACT_NEW->next;
+       startbase =  FIRSTBASE_NEW(sl);
+       if (BASACT_NEW(sl) && BASACT_NEW(sl)->next) startbase = BASACT_NEW(sl)->next;
        
        /* This block uses the control key to make the object selected by its center point rather than its contents */
        /* in editmode do not activate */
@@ -1435,7 +1435,7 @@ static bool ed_object_select_pick(
                                                                           V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
                                        {
                                                float dist_temp = len_manhattan_v2v2(mval_fl, screen_co);
-                                               if (base == BASACT_NEW) dist_temp += 10.0f;
+                                               if (base == BASACT_NEW(sl)) dist_temp += 10.0f;
                                                if (dist_temp < dist) {
                                                        dist = dist_temp;
                                                        basact = base;
@@ -1444,7 +1444,7 @@ static bool ed_object_select_pick(
                                }
                                base = base->next;
                                
-                               if (base == NULL) base = FIRSTBASE_NEW;
+                               if (base == NULL) base = FIRSTBASE_NEW(sl);
                                if (base == startbase) break;
                        }
                }
@@ -1474,7 +1474,7 @@ static bool ed_object_select_pick(
                        
                        if (has_bones && basact) {
                                if (basact->object->type == OB_CAMERA) {
-                                       if (BASACT_NEW == basact) {
+                                       if (BASACT_NEW(sl) == basact) {
                                                int i, hitresult;
                                                bool changed = false;
 
@@ -1544,14 +1544,14 @@ static bool ed_object_select_pick(
                                        WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, basact->object);
                                        
                                        /* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */
-                                       if (BASACT_NEW && (BASACT_NEW->object->mode & OB_MODE_WEIGHT_PAINT)) {
+                                       if (BASACT_NEW(sl) && (BASACT_NEW(sl)->object->mode & OB_MODE_WEIGHT_PAINT)) {
                                                /* prevent activating */
                                                basact = NULL;
                                        }
 
                                }
                                /* prevent bone selecting to pass on to object selecting */
-                               if (basact == BASACT_NEW)
+                               if (basact == BASACT_NEW(sl))
                                        basact = NULL;
                        }
                }
@@ -1569,7 +1569,7 @@ static bool ed_object_select_pick(
                /* also prevent making it active on mouse selection */
                else if (BASE_SELECTABLE_NEW(basact)) {
 
-                       oldbasact = BASACT_NEW;
+                       oldbasact = BASACT_NEW(sl);
                        
                        if (extend) {
                                ED_object_base_select(basact, BA_SELECT);
@@ -2811,7 +2811,7 @@ static bool object_circle_select(ViewContext *vc, const bool select, const int m
 
 
        Base *base;
-       for (base = FIRSTBASE_NEW; base; base = base->next) {
+       for (base = FIRSTBASE_NEW(sl); base; base = base->next) {
                if (BASE_SELECTABLE_NEW(base) && ((base->flag & BASE_SELECTED) != select_flag)) {
                        float screen_co[2];
                        if (ED_view3d_project_float_global(vc->ar, base->object->obmat[3], screen_co,
index d79babde707b86b8f4a88153148f93d8641e7c26..cb5274e7967b1449a5f1a0e841a3c8779c4ac92b 100644 (file)
@@ -1906,7 +1906,7 @@ static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, vo
        TransInfo *t = arg;
        Scene *scene = t->scene;
        SceneLayer *sl = t->scene_layer;
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        
        /* draw autokeyframing hint in the corner 
         * - only draw if enabled (advanced users may be distracted/annoyed), 
index 2936966a552c6a548d182cd2b6d454b4266dd372..ca52625ef1e7c02edfd8aaf81afa65e639eb2ef1 100644 (file)
@@ -292,7 +292,7 @@ static void createTransTexspace(TransInfo *t)
        ID *id;
        short *texflag;
 
-       ob = OBACT_NEW;
+       ob = OBACT_NEW(sl);
 
        if (ob == NULL) { // Shouldn't logically happen, but still...
                t->total = 0;
@@ -2011,7 +2011,7 @@ void flushTransParticles(TransInfo *t)
 {
        Scene *scene = t->scene;
        SceneLayer *sl = t->scene_layer;
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        PTCacheEdit *edit = PE_get_current(scene, sl, ob);
        ParticleSystem *psys = edit->psys;
        ParticleSystemModifierData *psmd = NULL;
@@ -2051,7 +2051,7 @@ void flushTransParticles(TransInfo *t)
                        point->flag |= PEP_EDIT_RECALC;
        }
 
-       PE_update_object(t->context, scene, sl, OBACT_NEW, 1);
+       PE_update_object(t->context, scene, sl, OBACT_NEW(sl), 1);
 }
 
 /* ********************* mesh ****************** */
@@ -5758,7 +5758,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, SceneLayer *sl, View3D *
                        }
                        else if (ELEM(tmode, TFM_ROTATION, TFM_TRACKBALL)) {
                                if (v3d->around == V3D_AROUND_ACTIVE) {
-                                       if (ob != OBACT_NEW)
+                                       if (ob != OBACT_NEW(sl))
                                                do_loc = true;
                                }
                                else if (v3d->around == V3D_AROUND_CURSOR)
@@ -5769,7 +5769,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, SceneLayer *sl, View3D *
                        }
                        else if (tmode == TFM_RESIZE) {
                                if (v3d->around == V3D_AROUND_ACTIVE) {
-                                       if (ob != OBACT_NEW)
+                                       if (ob != OBACT_NEW(sl))
                                                do_loc = true;
                                }
                                else if (v3d->around == V3D_AROUND_CURSOR)
@@ -8071,7 +8071,7 @@ void createTransData(bContext *C, TransInfo *t)
 {
        Scene *scene = t->scene;
        SceneLayer *sl = t->scene_layer;
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        /* if tests must match recalcData for correct updates */
        if (t->options & CTX_TEXTURE) {
index 6d3b240854214d02f21a8b8191455899dd027ba3..a0eee4296c1b92b7373d39701f840ba110f0a151 100644 (file)
@@ -329,7 +329,7 @@ static void recalcData_actedit(TransInfo *t)
        /* NOTE: sync this with the code in ANIM_animdata_get_context() */
        ac.scene = t->scene;
        ac.scene_layer = t->scene_layer;
-       ac.obact = OBACT_NEW;
+       ac.obact = OBACT_NEW(sl);
        ac.sa = t->sa;
        ac.ar = t->ar;
        ac.sl = (t->sa) ? t->sa->spacedata.first : NULL;
@@ -379,7 +379,7 @@ static void recalcData_graphedit(TransInfo *t)
        /* NOTE: sync this with the code in ANIM_animdata_get_context() */
        ac.scene = t->scene;
        ac.scene_layer = t->scene_layer;
-       ac.obact = OBACT_NEW;
+       ac.obact = OBACT_NEW(sl);
        ac.sa = t->sa;
        ac.ar = t->ar;
        ac.sl = (t->sa) ? t->sa->spacedata.first : NULL;
@@ -1793,7 +1793,7 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
        }
        else if (t->flag & T_POSE) {
                SceneLayer *sl = t->scene_layer;
-               Object *ob = OBACT_NEW;
+               Object *ob = OBACT_NEW(sl);
                if (ob) {
                        bPoseChannel *pchan = BKE_pose_channel_active(ob);
                        if (pchan && (!select_only || (pchan->bone->flag & BONE_SELECTED))) {
@@ -1813,8 +1813,8 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
        else {
                /* object mode */
                SceneLayer *sl = t->scene_layer;
-               Object *ob = OBACT_NEW;
-               Base *base = BASACT_NEW;
+               Object *ob = OBACT_NEW(sl);
+               Base *base = BASACT_NEW(sl);
                if (ob && ((!select_only) || ((base->flag & BASE_SELECTED) != 0))) {
                        copy_v3_v3(r_center, ob->obmat[3]);
                        ok = true;
index 8f80bf9b100b73865face3df3957db3f35f03654..8825d1e55bc7c84e9dd9245ed79a46a87f532454 100644 (file)
@@ -603,7 +603,7 @@ static int calc_manipulator_stats(const bContext *C)
        View3D *v3d = sa->spacedata.first;
        RegionView3D *rv3d = ar->regiondata;
        Base *base;
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        bGPdata *gpd = CTX_data_gpencil_data(C);
        const bool is_gp_edit = ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE));
        int a, totsel = 0;
@@ -913,8 +913,8 @@ static int calc_manipulator_stats(const bContext *C)
        else {
 
                /* we need the one selected object, if its not active */
-               base = BASACT_NEW;
-               ob = OBACT_NEW;
+               base = BASACT_NEW(sl);
+               ob = OBACT_NEW(sl);
                if (base && ((base->flag & BASE_SELECTED) == 0)) ob = NULL;
 
                for (base = sl->object_bases.first; base; base = base->next) {
@@ -1025,7 +1025,7 @@ static void manipulator_prepare_mat(const bContext *C, View3D *v3d, RegionView3D
                case V3D_AROUND_ACTIVE:
                {
                                bGPdata *gpd = CTX_data_gpencil_data(C);
-                               Object *ob = OBACT_NEW;
+                               Object *ob = OBACT_NEW(sl);
 
                                if (((v3d->around == V3D_AROUND_ACTIVE) && (scene->obedit == NULL)) &&
                                    ((gpd == NULL) || !(gpd->flag & GP_DATA_STROKE_EDITMODE)) &&
index 21d071b1f8de0ff3e1860f642572bf837ad7e7f8..e91db762eb1000e284e383bea74a24cb5e33de3a 100644 (file)
@@ -581,7 +581,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
        SceneLayer *sl = CTX_data_scene_layer(C);
        Object *obedit = CTX_data_edit_object(C);
        Base *base;
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        int result = ORIENTATION_NONE;
        const bool activeOnly = (around == V3D_AROUND_ACTIVE);
 
@@ -1044,8 +1044,8 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
        }
        else {
                /* we need the one selected object, if its not active */
-               base = BASACT_NEW;
-               ob = OBACT_NEW;
+               base = BASACT_NEW(sl);
+               ob = OBACT_NEW(sl);
                if (base && ((base->flag & BASE_SELECTED) != 0)) {
                        /* pass */
                }
index 1181f5843137c393489e840ff3ffad6530e62e2f..8753018a9af3d037ca6f33feb43749a4bad2b8ef 100644 (file)
@@ -78,7 +78,7 @@
 #include "transform.h"
 
 /* this should be passed as an arg for use in snap functions */
-#undef BASACT_NEW
+#undef BASACT_NEW(sl)
 
 /* use half of flt-max so we can scale up without an exception */
 
index e6c37425828462cc5c42f9a567b42b5d1ba565d3..601de2249f50d0811943c6b43c6daa4bc2872331 100644 (file)
@@ -2023,7 +2023,7 @@ int GPU_scene_object_lights(SceneLayer *sl, float viewmat[4][4], int ortho)
 
        int count = 0;
 
-       for (Base *base = FIRSTBASE_NEW; base; base = base->next) {
+       for (Base *base = FIRSTBASE_NEW(sl); base; base = base->next) {
                if (base->object->type != OB_LAMP)
                        continue;
 
index 34b1afdf3310c8936481265280e830bf44b15c95..44eb0881089b1487ea035f68f9bbb0fbc3be5748 100644 (file)
@@ -1980,10 +1980,10 @@ extern const char *RE_engine_id_CYCLES;
 #define BASACT                 (scene->basact)
 #define OBACT                  (BASACT ? BASACT->object: NULL)
 
-#define FIRSTBASE_NEW  (sl)->object_bases.first
-#define LASTBASE_NEW   (sl)->object_bases.last
-#define BASACT_NEW             ((sl)->basact)
-#define OBACT_NEW              (BASACT_NEW ? BASACT_NEW->object: NULL)
+#define FIRSTBASE_NEW(_sl)  ((_sl)->object_bases.first)
+#define LASTBASE_NEW(_sl)   ((_sl)->object_bases.last)
+#define BASACT_NEW(_sl)     ((_sl)->basact)
+#define OBACT_NEW(_sl)      (BASACT_NEW(_sl) ? BASACT_NEW(_sl)->object: NULL)
 
 #define V3D_CAMERA_LOCAL(v3d) ((!(v3d)->scenelock && (v3d)->camera) ? (v3d)->camera : NULL)
 #define V3D_CAMERA_SCENE(scene, v3d) ((!(v3d)->scenelock && (v3d)->camera) ? (v3d)->camera : (scene)->camera)
index 2975c318d66d07a29281283868da3e4d0fe16148..ab94c8e303b1872df6351f1943d438607d32738c 100644 (file)
@@ -2159,7 +2159,7 @@ static char *rna_MeshStatVis_path(PointerRNA *UNUSED(ptr))
 static void rna_Scene_update_active_object_data(bContext *C, PointerRNA *UNUSED(ptr))
 {
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        if (ob) {
                DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -2692,7 +2692,7 @@ static void rna_LayerCollectionEngineSettings_wire_update(bContext *C, PointerRN
 {
        Scene *scene = CTX_data_scene(C);
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        if (ob != NULL && ob->type == OB_MESH) {
                BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_NOCHECK);
index 49988f75fccde1d64cf099504989b3590e875673..73fe801106a99e6eab7367b38dd6a25d79d368fc 100644 (file)
@@ -156,7 +156,7 @@ static void rna_ParticleEdit_redo(bContext *C, PointerRNA *UNUSED(ptr))
 {
        Scene *scene = CTX_data_scene(C);
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        PTCacheEdit *edit = PE_get_current(scene, sl, ob);
 
        if (!edit)
@@ -168,7 +168,7 @@ static void rna_ParticleEdit_redo(bContext *C, PointerRNA *UNUSED(ptr))
 static void rna_ParticleEdit_update(Main *UNUSED(bmain), Scene *UNUSED(scene), bContext *C, PointerRNA *UNUSED(ptr))
 {
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        if (ob) DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
 }
@@ -192,7 +192,7 @@ static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UN
                                                      PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
 {
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 #if 0
        Scene *scene = CTX_data_scene(C);
        PTCacheEdit *edit = PE_get_current(scene, ob);
@@ -266,7 +266,7 @@ static void rna_Sculpt_update(bContext *C, PointerRNA *UNUSED(ptr))
 {
        Scene *scene = CTX_data_scene(C);
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        if (ob) {
                DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -282,7 +282,7 @@ static void rna_Sculpt_update(bContext *C, PointerRNA *UNUSED(ptr))
 static void rna_Sculpt_ShowDiffuseColor_update(bContext *C, Scene *scene, PointerRNA *UNUSED(ptr))
 {
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        if (ob && ob->sculpt) {
                Sculpt *sd = scene->toolsettings->sculpt;
@@ -345,7 +345,7 @@ static void rna_ImaPaint_mode_update(bContext *C, PointerRNA *UNUSED(ptr))
 {
        Scene *scene = CTX_data_scene(C);\
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        if (ob && ob->type == OB_MESH) {
                /* of course we need to invalidate here */
@@ -362,7 +362,7 @@ static void rna_ImaPaint_stencil_update(bContext *C, PointerRNA *UNUSED(ptr))
 {
        Scene *scene = CTX_data_scene(C);
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
 
        if (ob && ob->type == OB_MESH) {
                GPU_drawobject_free(ob->derivedFinal);
@@ -376,7 +376,7 @@ static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr))
        Main *bmain = CTX_data_main(C);
        Scene *scene = CTX_data_scene(C);
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        bScreen *sc;
        Image *ima = scene->toolsettings->imapaint.canvas;
        
index a43baffeb268e290055aae74fee86727e6adfdf2..cc12cd9568e3605d63019423b39776875cedef62 100644 (file)
@@ -1308,7 +1308,7 @@ static void rna_SpaceDopeSheetEditor_action_update(Main *bmain, bContext *C, Sce
 {
        SpaceAction *saction = (SpaceAction *)(ptr->data);
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *obact = OBACT_NEW;
+       Object *obact = OBACT_NEW(sl);
 
        /* we must set this action to be the one used by active object (if not pinned) */
        if (obact /* && saction->pin == 0*/) {
@@ -1384,7 +1384,7 @@ static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr)
 {
        SpaceAction *saction = (SpaceAction *)(ptr->data);
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *obact = OBACT_NEW;
+       Object *obact = OBACT_NEW(sl);
 
        /* special exceptions for ShapeKey Editor mode */
        if (saction->mode == SACTCONT_SHAPEKEY) {
index ec35959f31a4f020c545402bd7d562c7e136482b..29cfc6b0f170139cfd257dd4f03396803a6b2e03 100644 (file)
@@ -80,7 +80,7 @@ static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tre
        SpaceNode *snode = CTX_wm_space_node(C);
        Scene *scene = CTX_data_scene(C);
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        
        if ((snode->shaderfrom == SNODE_SHADER_OBJECT) ||
            (BKE_scene_use_new_shading_nodes(scene) == false))
index 3b53d29d147beefb4abb0cdd02143d37e3b38000..2ac4ce2f48cf0d7b6330f3dbf0377acfaf8eb20b 100644 (file)
@@ -63,7 +63,7 @@ static void texture_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tr
        SpaceNode *snode = CTX_wm_space_node(C);
        Scene *scene = CTX_data_scene(C);
        SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *ob = OBACT_NEW;
+       Object *ob = OBACT_NEW(sl);
        Tex *tx = NULL;
 
        if (snode->texfrom == SNODE_TEX_OBJECT) {