diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-19 13:22:25 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-19 13:23:06 +0300 |
commit | 4b376dbe84b205ef661ebf608c0322432fff1287 (patch) | |
tree | eac9705b9af9259b16f341ca6029ac6f2a78aac2 /source/blender/makesrna | |
parent | 54f03914b0848a1fb80d62ab2bb01bad8631667e (diff) |
Fix wrong RNA update function declarations
This fixes lots of crashes, especially with painting/brush updates.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 15 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 3 |
6 files changed, 27 insertions, 15 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index c3d2d92fc5e..9e23dd43b50 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1799,7 +1799,7 @@ static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerR * parts of the code that need it still, so we have this exception */ if (prop->flag & PROP_CONTEXT_UPDATE) { if (C) { - if (prop->flag & PROP_CONTEXT_PROPERTY_UPDATE) { + if ((prop->flag & PROP_CONTEXT_PROPERTY_UPDATE) == PROP_CONTEXT_PROPERTY_UPDATE) { ((ContextPropUpdateFunc)prop->update)(C, ptr, prop); } else { diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index a51e7bfe6d8..1948f425083 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -360,16 +360,20 @@ static void rna_Brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR /*WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL); */ } -static void rna_Brush_main_tex_update(Main *bmain, bContext *C, Scene *scene, PointerRNA *ptr) +static void rna_Brush_main_tex_update(bContext *C, PointerRNA *ptr) { + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); SceneLayer *sl = CTX_data_scene_layer(C); Brush *br = (Brush *)ptr->data; BKE_paint_invalidate_overlay_tex(scene, sl, br->mtex.tex); rna_Brush_update(bmain, scene, ptr); } -static void rna_Brush_secondary_tex_update(Main *bmain, bContext *C, Scene *scene, PointerRNA *ptr) +static void rna_Brush_secondary_tex_update(bContext *C, PointerRNA *ptr) { + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); SceneLayer *sl = CTX_data_scene_layer(C); Brush *br = (Brush *)ptr->data; BKE_paint_invalidate_overlay_tex(scene, sl, br->mask_mtex.tex); @@ -428,8 +432,9 @@ static void rna_Brush_icon_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi WM_main_add_notifier(NC_BRUSH | NA_EDITED, br); } -static void rna_TextureSlot_brush_angle_update(Main *bmain, bContext *C, Scene *scene, PointerRNA *ptr) +static void rna_TextureSlot_brush_angle_update(bContext *C, PointerRNA *ptr) { + Scene *scene = CTX_data_scene(C); MTex *mtex = ptr->data; /* skip invalidation of overlay for stencil mode */ if (mtex->mapping != MTEX_MAP_MODE_STENCIL) { @@ -437,7 +442,7 @@ static void rna_TextureSlot_brush_angle_update(Main *bmain, bContext *C, Scene * BKE_paint_invalidate_overlay_tex(scene, sl, mtex->tex); } - rna_TextureSlot_update(bmain, C, scene, ptr); + rna_TextureSlot_update(C, ptr); } static void rna_Brush_set_size(PointerRNA *ptr, int value) diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index b4c3916ffbe..75fc9a17b07 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -236,7 +236,7 @@ int rna_object_shapekey_index_set(struct ID *id, PointerRNA value, int current); /* named internal so as not to conflict with obj.update() rna func */ void rna_Object_internal_update_data(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); void rna_Mesh_update_draw(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); -void rna_TextureSlot_update(struct Main *bmain, struct bContext *C, struct Scene *scene, struct PointerRNA *ptr); +void rna_TextureSlot_update(struct bContext *C, struct PointerRNA *ptr); /* basic poll functions for object types */ int rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 92b316f7907..bce4168b75b 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1985,8 +1985,9 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons } } -static void rna_UnifiedPaintSettings_update(Main *UNUSED(bmain), bContext *C, Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_UnifiedPaintSettings_update(bContext *C, PointerRNA *UNUSED(ptr)) { + Scene *scene = CTX_data_scene(C); SceneLayer *sl = CTX_data_scene_layer(C); Brush *br = BKE_paint_brush(BKE_paint_get_active(scene, sl)); WM_main_add_notifier(NC_BRUSH | NA_EDITED, br); @@ -2011,11 +2012,11 @@ static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, flo ups->unprojected_radius = value; } -static void rna_UnifiedPaintSettings_radius_update(Main *bmain, bContext *C, Scene *scene, PointerRNA *ptr) +static void rna_UnifiedPaintSettings_radius_update(bContext *C, PointerRNA *ptr) { /* changing the unified size should invalidate the overlay but also update the brush */ BKE_paint_invalidate_overlay_all(); - rna_UnifiedPaintSettings_update(bmain, C, scene, ptr); + rna_UnifiedPaintSettings_update(C, ptr); } static char *rna_UnifiedPaintSettings_path(PointerRNA *UNUSED(ptr)) diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 26d85aee68a..2f326d50660 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -148,8 +148,9 @@ static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL); } -static void rna_ParticleEdit_redo(Main *UNUSED(bmain), bContext *C, Scene *scene, PointerRNA *UNUSED(ptr)) +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; PTCacheEdit *edit = PE_get_current(scene, sl, ob); @@ -166,6 +167,7 @@ static void rna_ParticleEdit_update(Main *UNUSED(bmain), Scene *scene, PointerRN if (ob) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } + static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value) { ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data; @@ -330,8 +332,9 @@ static void rna_ImaPaint_viewport_update(Main *UNUSED(bmain), Scene *UNUSED(scen WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); } -static void rna_ImaPaint_mode_update(Main *UNUSED(bmain), bContext *C, Scene *scene, PointerRNA *UNUSED(ptr)) +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; @@ -346,8 +349,9 @@ static void rna_ImaPaint_mode_update(Main *UNUSED(bmain), bContext *C, Scene *sc } } -static void rna_ImaPaint_stencil_update(Main *UNUSED(bmain), bContext *C, Scene *scene, PointerRNA *UNUSED(ptr)) +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; @@ -358,8 +362,10 @@ static void rna_ImaPaint_stencil_update(Main *UNUSED(bmain), bContext *C, Scene } } -static void rna_ImaPaint_canvas_update(Main *bmain, bContext *C, Scene *scene, PointerRNA *UNUSED(ptr)) +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; bScreen *sc; @@ -927,7 +933,6 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo"); prop = RNA_def_property(srna, "fade_frames", PROP_INT, PROP_NONE); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_range(prop, 1, 100); RNA_def_property_ui_text(prop, "Frames", "How many frames to fade"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update"); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 3a3359e1008..a05cc8edb11 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -225,7 +225,7 @@ static void rna_Texture_type_set(PointerRNA *ptr, int value) BKE_texture_type_set(tex, value); } -void rna_TextureSlot_update(Main *UNUSED(bmain), bContext *C, Scene *scene, PointerRNA *ptr) +void rna_TextureSlot_update(bContext *C, PointerRNA *ptr) { ID *id = ptr->id.data; @@ -245,6 +245,7 @@ void rna_TextureSlot_update(Main *UNUSED(bmain), bContext *C, Scene *scene, Poin break; case ID_BR: { + Scene *scene = CTX_data_scene(C); MTex *mtex = ptr->data; SceneLayer *sl = CTX_data_scene_layer(C); BKE_paint_invalidate_overlay_tex(scene, sl, mtex->tex); |