diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_sculpt_paint.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 40aea37d9d2..2f326d50660 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -148,10 +148,12 @@ 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), Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_ParticleEdit_redo(bContext *C, PointerRNA *UNUSED(ptr)) { - Object *ob = (scene->basact) ? scene->basact->object : NULL; - PTCacheEdit *edit = PE_get_current(scene, ob); + 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); if (!edit) return; @@ -165,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; @@ -211,14 +214,14 @@ static int rna_ParticleEdit_editable_get(PointerRNA *ptr) { ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data; - return (pset->object && pset->scene && PE_get_current(pset->scene, pset->object)); + return (pset->object && pset->scene && PE_get_current(pset->scene, pset->scene_layer, pset->object)); } static int rna_ParticleEdit_hair_get(PointerRNA *ptr) { ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data; if (pset->scene) { - PTCacheEdit *edit = PE_get_current(pset->scene, pset->object); + PTCacheEdit *edit = PE_get_current(pset->scene, pset->scene_layer, pset->object); return (edit && edit->psys); } @@ -329,9 +332,11 @@ 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), Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_ImaPaint_mode_update(bContext *C, PointerRNA *UNUSED(ptr)) { - Object *ob = OBACT; + Scene *scene = CTX_data_scene(C);\ + SceneLayer *sl = CTX_data_scene_layer(C); + Object *ob = OBACT_NEW; if (ob && ob->type == OB_MESH) { /* of course we need to invalidate here */ @@ -344,9 +349,11 @@ static void rna_ImaPaint_mode_update(Main *UNUSED(bmain), Scene *scene, PointerR } } -static void rna_ImaPaint_stencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_ImaPaint_stencil_update(bContext *C, PointerRNA *UNUSED(ptr)) { - Object *ob = OBACT; + Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); + Object *ob = OBACT_NEW; if (ob && ob->type == OB_MESH) { GPU_drawobject_free(ob->derivedFinal); @@ -355,19 +362,22 @@ static void rna_ImaPaint_stencil_update(Main *UNUSED(bmain), Scene *scene, Point } } -static void rna_ImaPaint_canvas_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr)) { - Object *ob = OBACT; + 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; Image *ima = scene->toolsettings->imapaint.canvas; for (sc = bmain->screen.first; sc; sc = sc->id.next) { 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; + SpaceLink *slink; + for (slink = sa->spacedata.first; slink; slink = slink->next) { + if (slink->spacetype == SPACE_IMAGE) { + SpaceImage *sima = (SpaceImage *)slink; if (!sima->pin) ED_space_image_set(sima, scene, scene->obedit, ima); @@ -740,12 +750,12 @@ static void rna_def_image_paint(BlenderRNA *brna) prop = RNA_def_property(srna, "stencil_image", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "stencil"); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE); RNA_def_property_ui_text(prop, "Stencil Image", "Image used as stencil"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_stencil_update"); prop = RNA_def_property(srna, "canvas", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE); RNA_def_property_ui_text(prop, "Canvas", "Image used as canvas"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_canvas_update"); @@ -787,6 +797,7 @@ static void rna_def_image_paint(BlenderRNA *brna) RNA_def_property_range(prop, 512, 16384); prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_enum_items(prop, paint_type_items); RNA_def_property_ui_text(prop, "Mode", "Mode of operation for projection painting"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_mode_update"); @@ -895,6 +906,7 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Auto Velocity", "Calculate point velocities automatically"); prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART); RNA_def_property_ui_text(prop, "Draw Particles", "Draw actual particles"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo"); @@ -915,6 +927,7 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Brush", ""); prop = RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_range(prop, 1, 10); RNA_def_property_ui_text(prop, "Steps", "How many steps to draw the path with"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo"); @@ -925,6 +938,7 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update"); prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_enum_sdna(prop, NULL, "edittype"); RNA_def_property_enum_items(prop, edit_type_items); RNA_def_property_ui_text(prop, "Type", ""); @@ -945,7 +959,7 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Object", "The edited object"); prop = RNA_def_property(srna, "shape_object", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE); RNA_def_property_ui_text(prop, "Shape Object", "Outer shape to use for tools"); RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo"); |