diff options
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 19 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene_api.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 15 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 25 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_workspace.c | 2 |
13 files changed, 45 insertions, 81 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index ca8abdc8b48..1ad33b683b7 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -31,7 +31,6 @@ #include "DNA_texture_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" -#include "DNA_workspace_types.h" #include "BLI_math.h" @@ -44,8 +43,6 @@ #include "WM_types.h" -#include "DEG_depsgraph.h" - static const EnumPropertyItem prop_direction_items[] = { {0, "ADD", 0, "Add", "Add effect of brush"}, {BRUSH_DIR_IN, "SUBTRACT", 0, "Subtract", "Subtract effect of brush"}, @@ -376,23 +373,21 @@ static void rna_Brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR static void rna_Brush_main_tex_update(bContext *C, PointerRNA *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); Brush *br = (Brush *)ptr->data; - BKE_paint_invalidate_overlay_tex(scene, view_layer, br->mtex.tex, workspace->object_mode); + BKE_paint_invalidate_overlay_tex(scene, view_layer, br->mtex.tex); rna_Brush_update(bmain, scene, ptr); } static void rna_Brush_secondary_tex_update(bContext *C, PointerRNA *ptr) { Main *bmain = CTX_data_main(C); - const WorkSpace *workspace = CTX_wm_workspace(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); Brush *br = (Brush *)ptr->data; - BKE_paint_invalidate_overlay_tex(scene, view_layer, br->mask_mtex.tex, workspace->object_mode); + BKE_paint_invalidate_overlay_tex(scene, view_layer, br->mask_mtex.tex); rna_Brush_update(bmain, scene, ptr); } @@ -453,9 +448,8 @@ static void rna_TextureSlot_brush_angle_update(bContext *C, PointerRNA *ptr) MTex *mtex = ptr->data; /* skip invalidation of overlay for stencil mode */ if (mtex->mapping != MTEX_MAP_MODE_STENCIL) { - const WorkSpace *workspace = CTX_wm_workspace(C); ViewLayer *view_layer = CTX_data_view_layer(C); - BKE_paint_invalidate_overlay_tex(scene, view_layer, mtex->tex, workspace->object_mode); + BKE_paint_invalidate_overlay_tex(scene, view_layer, mtex->tex); } rna_TextureSlot_update(C, ptr); diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index 9992ab06211..7d09f30ed6a 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -64,7 +64,6 @@ const EnumPropertyItem rna_enum_collection_type_items[] = { #include "DNA_group_types.h" #include "DNA_object_types.h" -#include "DNA_workspace_types.h" #include "RNA_access.h" @@ -73,8 +72,6 @@ const EnumPropertyItem rna_enum_collection_type_items[] = { #include "BKE_node.h" #include "BKE_scene.h" #include "BKE_mesh.h" -#include "BKE_object.h" -#include "BKE_workspace.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" @@ -838,18 +835,6 @@ static void rna_LayerObjects_active_object_set(PointerRNA *ptr, PointerRNA value view_layer->basact = NULL; } -static void rna_LayerObjects_active_object_update(struct bContext *C, PointerRNA *ptr) -{ - wmWindow *win = CTX_wm_window(C); - Scene *scene = WM_window_get_active_scene(win); - - if (scene != ptr->id.data) { - return; - } - ViewLayer *view_layer = (ViewLayer *)ptr->data; - ED_object_base_activate(C, view_layer->basact); -} - static IDProperty *rna_ViewLayer_idprops(PointerRNA *ptr, bool create) { ViewLayer *view_layer = (ViewLayer *)ptr->data; @@ -2145,11 +2130,11 @@ static void rna_def_layer_objects(BlenderRNA *brna, PropertyRNA *cprop) prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_pointer_funcs(prop, "rna_LayerObjects_active_object_get", "rna_LayerObjects_active_object_set", NULL, NULL); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK | PROP_CONTEXT_UPDATE); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); RNA_def_property_ui_text(prop, "Active Object", "Active object for this layer"); /* Could call: ED_object_base_activate(C, rl->basact); * but would be a bad level call and it seems the notifier is enough */ - RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, "rna_LayerObjects_active_object_update"); + RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL); prop = RNA_def_property(srna, "selected", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 6f23b0fd281..bf6e13e587c 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -207,16 +207,23 @@ static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s if (win == NULL) { continue; } - Object *obedit = OBEDIT_FROM_WINDOW(win); + + Object *obedit = NULL; + { + WorkSpace *workspace = WM_window_get_active_workspace(win); + ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene); + obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); + } + ScrArea *sa; for (sa = sc->areabase.first; sa; sa = sa->next) { SpaceLink *sl; for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)sl; - - if (!sima->pin) + if (!sima->pin) { 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 80449a77b14..e5de42c43fa 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -347,7 +347,7 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value) Object *ob = (Object *)ptr->data; ID *id = value.data; - if (BKE_object_is_in_editmode(ob)) { + if (ob->mode & OB_MODE_EDIT) { return; } @@ -1404,9 +1404,7 @@ static void rna_Object_constraints_clear(Object *object) static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, const char *name, int type) { - Main *bmain = CTX_data_main(C); - const WorkSpace *workspace = CTX_wm_workspace(C); - return ED_object_modifier_add(reports, bmain, CTX_data_scene(C), object, workspace->object_mode, name, type); + return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type); } static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, PointerRNA *md_ptr) @@ -2431,6 +2429,12 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Type", "Type of Object"); + prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode"); + RNA_def_property_enum_items(prop, rna_enum_object_mode_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Mode", "Object interaction mode"); + prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000); RNA_def_property_array(prop, 8); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 649cb523e92..c2797abbc75 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -53,7 +53,6 @@ static const EnumPropertyItem effector_shape_items[] = { #include "BLI_math_base.h" -#include "BKE_main.h" /* type specific return values only used from functions */ static const EnumPropertyItem curve_shape_items[] = { @@ -524,7 +523,7 @@ static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA { if (!particle_id_check(ptr)) { Object *ob = (Object *)ptr->id.data; - ED_object_check_force_modifiers(bmain, scene, ob, bmain->eval_ctx->object_mode); + ED_object_check_force_modifiers(bmain, scene, ob); WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob); } @@ -711,7 +710,7 @@ static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, P /* add/remove modifier as needed */ if (ob->pd->deflect && !md) - ED_object_modifier_add(NULL, bmain, scene, ob, bmain->eval_ctx->object_mode, NULL, eModifierType_Collision); + ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision); else if (!ob->pd->deflect && md) ED_object_modifier_remove(NULL, bmain, ob, md); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index ac9fce46384..de3476264a7 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1703,10 +1703,9 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons static void rna_UnifiedPaintSettings_update(bContext *C, PointerRNA *UNUSED(ptr)) { - const WorkSpace *workspace = CTX_wm_workspace(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - Brush *br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer, workspace->object_mode)); + Brush *br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer)); WM_main_add_notifier(NC_BRUSH | NA_EDITED, br); } @@ -6961,7 +6960,6 @@ void RNA_def_scene(BlenderRNA *brna) /* Statistics */ func = RNA_def_function(srna, "statistics", "ED_info_stats_string"); - parm = RNA_def_pointer(func, "workspace", "WorkSpace", "", "Active workspace"); parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Active layer"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_string(func, "statistics", NULL, 0, "Statistics", ""); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index cb3c2078cfe..7a7537bcf1f 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -117,9 +117,9 @@ static void rna_Scene_frame_set(Scene *scene, Main *bmain, int frame, float subf static void rna_Scene_uvedit_aspect(Scene *scene, Object *ob, float *aspect) { - if (ob->type == OB_MESH) { - /* Will be NULL when not in editmode */ - BMEditMesh *em = BKE_editmesh_from_object(ob); + if ((ob->type == OB_MESH) && (ob->mode == OB_MODE_EDIT)) { + BMEditMesh *em; + em = BKE_editmesh_from_object(ob); if (EDBM_uv_check(em)) { ED_uvedit_get_aspect(scene, ob, em->bm, aspect, aspect + 1); return; diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 69237cad855..49edc742a4b 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -39,7 +39,6 @@ #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" @@ -393,12 +392,11 @@ 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; + Object *obedit = OBEDIT_FROM_OBACT(ob); bScreen *sc; Image *ima = scene->toolsettings->imapaint.canvas; diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 70ec6287924..2d8385a5f83 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -868,8 +868,8 @@ static int rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr) SpaceImage *sima = (SpaceImage *)(ptr->data); bScreen *sc = (bScreen *)ptr->id.data; wmWindow *win = ED_screen_window_find(sc, G.main->wm.first); - Object *obedit = OBEDIT_FROM_WINDOW(win); - + ViewLayer *view_layer = WM_window_get_active_view_layer(win); + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); return ED_space_image_show_uvedit(sima, obedit); } @@ -877,11 +877,9 @@ static int rna_SpaceImageEditor_show_maskedit_get(PointerRNA *ptr) { SpaceImage *sima = (SpaceImage *)(ptr->data); bScreen *sc = (bScreen *)ptr->id.data; - wmWindow *window = NULL; - Scene *scene = ED_screen_scene_find_with_window(sc, G.main->wm.first, &window); - ViewLayer *view_layer = BKE_view_layer_context_active_PLACEHOLDER(scene); - const WorkSpace *workspace = WM_window_get_active_workspace(window); - return ED_space_image_check_show_maskedit(sima, workspace, view_layer); + wmWindow *win = ED_screen_window_find(sc, G.main->wm.first); + ViewLayer *view_layer = WM_window_get_active_view_layer(win); + return ED_space_image_check_show_maskedit(sima, view_layer); } static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value) @@ -890,7 +888,8 @@ static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value) bScreen *sc = (bScreen *)ptr->id.data; wmWindow *win; Scene *scene = ED_screen_scene_find_with_window(sc, G.main->wm.first, &win); - Object *obedit = OBEDIT_FROM_WINDOW(win); + ViewLayer *view_layer = WM_window_get_active_view_layer(win); + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); ED_space_image_set(sima, scene, obedit, (Image *)value.data); } diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index e2e44a8ac5c..42e3e2c83fb 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -37,7 +37,6 @@ #include "DNA_node_types.h" #include "DNA_particle_types.h" #include "DNA_scene_types.h" /* MAXFRAME only */ -#include "DNA_workspace_types.h" #include "BLI_utildefines.h" @@ -248,11 +247,10 @@ void rna_TextureSlot_update(bContext *C, PointerRNA *ptr) break; case ID_BR: { - const WorkSpace *workspace = CTX_wm_workspace(C); Scene *scene = CTX_data_scene(C); MTex *mtex = ptr->data; ViewLayer *view_layer = CTX_data_view_layer(C); - BKE_paint_invalidate_overlay_tex(scene, view_layer, mtex->tex, workspace->object_mode); + BKE_paint_invalidate_overlay_tex(scene, view_layer, mtex->tex); WM_main_add_notifier(NC_BRUSH, id); break; } diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index eaadde52940..88330ad2a8f 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -364,11 +364,8 @@ static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRN vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL, btheme->tv3d.vertex_unreferenced); for (ob = bmain->object.first; ob; ob = ob->id.next) { - /* TODO/OBMODE (not urgent) */ - // if (ob->mode & OB_MODE_WEIGHT_PAINT) - { + if (ob->mode & OB_MODE_WEIGHT_PAINT) DEG_id_tag_update(&ob->id, OB_RECALC_DATA); - } } rna_userdef_update(bmain, scene, ptr); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 5110f4cc27a..1d4652b0212 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -473,7 +473,6 @@ const EnumPropertyItem rna_enum_wm_report_items[] = { #include "DNA_workspace_types.h" #include "ED_screen.h" -#include "ED_object.h" #include "UI_interface.h" @@ -761,9 +760,8 @@ static void rna_workspace_screen_update(bContext *C, PointerRNA *ptr) static PointerRNA rna_Window_view_layer_get(PointerRNA *ptr) { wmWindow *win = ptr->data; - 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); + Scene *scene; + ViewLayer *view_layer = WM_window_get_active_view_layer_ex(win, &scene); PointerRNA scene_ptr; RNA_id_pointer_create(&scene->id, &scene_ptr); @@ -779,21 +777,6 @@ static void rna_Window_view_layer_set(PointerRNA *ptr, PointerRNA value) BKE_workspace_view_layer_set(workspace, value.data, scene); } -static void rna_Window_view_layer_update(struct bContext *C, PointerRNA *ptr) -{ - wmWindow *win = ptr->data; - 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 *obact = OBACT(view_layer); - eObjectMode object_mode = workspace->object_mode; - if (obact && (object_mode & OB_MODE_EDIT)) { - ED_object_editmode_exit_ex(NULL, workspace, scene, obact, EM_FREEDATA); - } - workspace->object_mode = object_mode; - ED_object_base_activate(C, view_layer->basact); -} - static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr) { wmKeyMapItem *kmi = ptr->data; @@ -2077,8 +2060,8 @@ static void rna_def_window(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ViewLayer"); RNA_def_property_pointer_funcs(prop, "rna_Window_view_layer_get", "rna_Window_view_layer_set", NULL, NULL); RNA_def_property_ui_text(prop, "Active View Layer", "The active workspace view layer showing in the window"); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL | PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCREEN | ND_LAYER, "rna_Window_view_layer_update"); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); + RNA_def_property_update(prop, NC_SCREEN | ND_LAYER, NULL); prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "posx"); diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c index 7ac4134f02b..609493c54b8 100644 --- a/source/blender/makesrna/intern/rna_workspace.c +++ b/source/blender/makesrna/intern/rna_workspace.c @@ -216,9 +216,11 @@ static void rna_def_workspace(BlenderRNA *brna) RNA_def_property_ui_text(prop, "UI Tags", ""); rna_def_workspace_owner_ids(brna, prop); +#if 0 prop = RNA_def_property(srna, "object_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rna_enum_object_mode_items); RNA_def_property_ui_text(prop, "Mode", "Object interaction mode used in this window"); +#endif /* View Render */ prop = RNA_def_property(srna, "view_render", PROP_POINTER, PROP_NONE); |