Commit: cd517c002f8293ed9a7a3f8c5877bba944c21a45
Author: Campbell Barton
Date:   Tue Feb 13 21:06:51 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBcd517c002f8293ed9a7a3f8c5877bba944c21a45

Object Mode: remove Scene.obedit for RNA

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

M       source/blender/makesrna/intern/rna_material.c
M       source/blender/makesrna/intern/rna_object.c
M       source/blender/makesrna/intern/rna_sculpt_paint.c
M       source/blender/makesrna/intern/rna_space.c
M       source/blender/makesrna/intern/rna_wm.c
M       source/gameengine/Converter/BL_BlenderDataConversion.cpp

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

diff --git a/source/blender/makesrna/intern/rna_material.c 
b/source/blender/makesrna/intern/rna_material.c
index 440af0d0e8e..6f23b0fd281 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -92,13 +92,15 @@ const EnumPropertyItem rna_enum_ramp_blend_items[] = {
 #include "BKE_texture.h"
 #include "BKE_node.h"
 #include "BKE_paint.h"
+#include "BKE_scene.h"
+#include "BKE_workspace.h"
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
 
 #include "ED_node.h"
 #include "ED_image.h"
-#include "BKE_scene.h"
+#include "ED_screen.h"
 
 static void rna_Material_update(Main *UNUSED(bmain), Scene *UNUSED(scene), 
PointerRNA *ptr)
 {
@@ -201,6 +203,11 @@ static void 
rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s
        if (ma->texpaintslot) {
                Image *image = ma->texpaintslot[ma->paint_active_slot].ima;
                for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+                       wmWindow *win = ED_screen_window_find(sc, 
bmain->wm.first);
+                       if (win == NULL) {
+                               continue;
+                       }
+                       Object *obedit = OBEDIT_FROM_WINDOW(win);
                        ScrArea *sa;
                        for (sa = sc->areabase.first; sa; sa = sa->next) {
                                SpaceLink *sl;
@@ -209,7 +216,7 @@ static void 
rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s
                                                SpaceImage *sima = (SpaceImage 
*)sl;
                                                
                                                if (!sima->pin)
-                                                       
ED_space_image_set(sima, scene, scene->obedit, image);
+                                                       
ED_space_image_set(sima, scene, obedit, image);
                                        }
                                }
                        }
diff --git a/source/blender/makesrna/intern/rna_object.c 
b/source/blender/makesrna/intern/rna_object.c
index 270d9fe14ca..d3096bbb6bb 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -295,11 +295,11 @@ void rna_Object_internal_update_data(Main *UNUSED(bmain), 
Scene *UNUSED(scene),
        WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data);
 }
 
-static void rna_Object_active_shape_update(Main *bmain, Scene *scene, 
PointerRNA *ptr)
+static void rna_Object_active_shape_update(bContext *C, Main *bmain, Scene 
*scene, PointerRNA *ptr)
 {
        Object *ob = ptr->id.data;
 
-       if (scene->obedit == ob) {
+       if (CTX_data_edit_object(C) == ob) {
                /* exit/enter editmode to get new shape */
                switch (ob->type) {
                        case OB_MESH:
@@ -3018,6 +3018,7 @@ static void rna_def_object(BlenderRNA *brna)
 
        prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, 
PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "shapenr");
+       RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is 
really unpredictable... */
        RNA_def_property_int_funcs(prop, 
"rna_Object_active_shape_key_index_get", 
"rna_Object_active_shape_key_index_set",
                                   "rna_Object_active_shape_key_index_range");
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c 
b/source/blender/makesrna/intern/rna_sculpt_paint.c
index cc447f2a028..06c0260d08f 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -39,6 +39,7 @@
 #include "DNA_brush_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
+#include "DNA_workspace_types.h"
 
 #include "BKE_paint.h"
 #include "BKE_material.h"
@@ -107,6 +108,7 @@ const EnumPropertyItem 
rna_enum_symmetrize_direction_items[] = {
 #include "BKE_pointcache.h"
 #include "BKE_particle.h"
 #include "BKE_pbvh.h"
+#include "BKE_object.h"
 
 #include "DEG_depsgraph.h"
 
@@ -391,10 +393,12 @@ static void rna_ImaPaint_stencil_update(bContext *C, 
PointerRNA *UNUSED(ptr))
 
 static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr))
 {
+       const WorkSpace *workspace = CTX_wm_workspace(C);
        Main *bmain = CTX_data_main(C);
        Scene *scene = CTX_data_scene(C);
        ViewLayer *view_layer = CTX_data_view_layer(C);
        Object *ob = OBACT(view_layer);
+       Object *obedit = ((workspace->object_mode & OB_MODE_EDIT) && 
BKE_object_is_in_editmode(ob)) ? ob : NULL;
        bScreen *sc;
        Image *ima = scene->toolsettings->imapaint.canvas;
        
@@ -407,7 +411,7 @@ static void rna_ImaPaint_canvas_update(bContext *C, 
PointerRNA *UNUSED(ptr))
                                        SpaceImage *sima = (SpaceImage *)slink;
                                        
                                        if (!sima->pin)
-                                               ED_space_image_set(sima, scene, 
scene->obedit, ima);
+                                               ED_space_image_set(sima, scene, 
obedit, ima);
                                }
                        }
                }
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index b4a42b3a909..c95b33d90ad 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -857,9 +857,10 @@ static int rna_SpaceImageEditor_show_uvedit_get(PointerRNA 
*ptr)
 {
        SpaceImage *sima = (SpaceImage *)(ptr->data);
        bScreen *sc = (bScreen *)ptr->id.data;
-       Scene *scene = ED_screen_scene_find(sc, G.main->wm.first);
+       wmWindow *win = ED_screen_window_find(sc, G.main->wm.first);
+       Object *obedit = OBEDIT_FROM_WINDOW(win);
 
-       return ED_space_image_show_uvedit(sima, scene->obedit);
+       return ED_space_image_show_uvedit(sima, obedit);
 }
 
 static int rna_SpaceImageEditor_show_maskedit_get(PointerRNA *ptr)
@@ -877,9 +878,10 @@ static void rna_SpaceImageEditor_image_set(PointerRNA 
*ptr, PointerRNA value)
 {
        SpaceImage *sima = (SpaceImage *)(ptr->data);
        bScreen *sc = (bScreen *)ptr->id.data;
-       Scene *scene = ED_screen_scene_find(sc, G.main->wm.first);
-
-       ED_space_image_set(sima, scene, scene->obedit, (Image *)value.data);
+       wmWindow *win;
+       Scene *scene = ED_screen_scene_find_with_window(sc, G.main->wm.first, 
&win);
+       Object *obedit = OBEDIT_FROM_WINDOW(win);
+       ED_space_image_set(sima, scene, obedit, (Image *)value.data);
 }
 
 static void rna_SpaceImageEditor_mask_set(PointerRNA *ptr, PointerRNA value)
diff --git a/source/blender/makesrna/intern/rna_wm.c 
b/source/blender/makesrna/intern/rna_wm.c
index f3cf2bb0d64..dca4fa3822d 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -785,9 +785,10 @@ static void rna_Window_view_layer_update(struct bContext 
*C, PointerRNA *ptr)
        Scene *scene = WM_window_get_active_scene(win);
        WorkSpace *workspace = WM_window_get_active_workspace(win);
        ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene);
+       Object *obedit = CTX_data_edit_object(C);
 
        eObjectMode object_mode = workspace->object_mode;
-       if (scene->obedit) {
+       if (obedit) {
                ED_object_editmode_exit(C, EM_FREEDATA);
        }
        workspace->object_mode = object_mode;
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp 
b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 3b0fb335d21..dda1864f07c 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1688,6 +1688,7 @@ struct parentChildLink {
        SG_Node* m_gamechildnode;
 };
 
+#if 0
 static bPoseChannel *get_active_posechannel2(Object *ob)
 {
        bArmature *arm= (bArmature*)ob->data;
@@ -1701,6 +1702,7 @@ static bPoseChannel *get_active_posechannel2(Object *ob)
        
        return NULL;
 }
+#endif
 
 static ListBase *get_active_constraints2(Object *ob)
 {

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

Reply via email to