Object Mode: remove Scene.obedit for RNA

This commit is contained in:
Campbell Barton 2018-02-13 21:06:51 +11:00
parent 8234f24838
commit cd517c002f
6 changed files with 28 additions and 11 deletions

View File

@ -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);
}
}
}

View File

@ -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");

View File

@ -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);
}
}
}

View File

@ -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)

View File

@ -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;

View File

@ -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)
{