Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_sculpt_paint.c
| Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | |||||
| static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr) | static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr) | ||||
| { | { | ||||
| return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL); | return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL); | ||||
| } | } | ||||
| static void rna_ParticleEdit_redo(bContext *C, PointerRNA *UNUSED(ptr)) | static void rna_ParticleEdit_redo(bContext *C, PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| SceneLayer *scene_layer = CTX_data_scene_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Object *ob = OBACT(scene_layer); | Object *ob = OBACT(view_layer); | ||||
| PTCacheEdit *edit = PE_get_current(scene, scene_layer, ob); | PTCacheEdit *edit = PE_get_current(scene, view_layer, ob); | ||||
| if (!edit) | if (!edit) | ||||
| return; | return; | ||||
| psys_free_path_cache(edit->psys, edit); | psys_free_path_cache(edit->psys, edit); | ||||
| } | } | ||||
| static void rna_ParticleEdit_update(Main *UNUSED(bmain), Scene *UNUSED(scene), bContext *C, PointerRNA *UNUSED(ptr)) | static void rna_ParticleEdit_update(Main *UNUSED(bmain), Scene *UNUSED(scene), bContext *C, PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| SceneLayer *scene_layer = CTX_data_scene_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Object *ob = OBACT(scene_layer); | Object *ob = OBACT(view_layer); | ||||
| if (ob) DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | if (ob) DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | ||||
| } | } | ||||
| static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value) | static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value) | ||||
| { | { | ||||
| ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data; | ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data; | ||||
| /* redraw hair completely if weight brush is/was used */ | /* redraw hair completely if weight brush is/was used */ | ||||
| if ((pset->brushtype == PE_BRUSH_WEIGHT || value == PE_BRUSH_WEIGHT) && pset->scene_layer) { | if ((pset->brushtype == PE_BRUSH_WEIGHT || value == PE_BRUSH_WEIGHT) && pset->view_layer) { | ||||
| Object *ob = (pset->scene_layer->basact) ? pset->scene_layer->basact->object : NULL; | Object *ob = (pset->view_layer->basact) ? pset->view_layer->basact->object : NULL; | ||||
| if (ob) { | if (ob) { | ||||
| DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | ||||
| WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL); | WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL); | ||||
| } | } | ||||
| } | } | ||||
| pset->brushtype = value; | pset->brushtype = value; | ||||
| } | } | ||||
| static const EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr), | static const EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr), | ||||
| PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) | PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) | ||||
| { | { | ||||
| SceneLayer *scene_layer = CTX_data_scene_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Object *ob = OBACT(scene_layer); | Object *ob = OBACT(view_layer); | ||||
| #if 0 | #if 0 | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| PTCacheEdit *edit = PE_get_current(scene, ob); | PTCacheEdit *edit = PE_get_current(scene, ob); | ||||
| ParticleSystem *psys = edit ? edit->psys : NULL; | ParticleSystem *psys = edit ? edit->psys : NULL; | ||||
| #else | #else | ||||
| /* use this rather than PE_get_current() - because the editing cache is | /* use this rather than PE_get_current() - because the editing cache is | ||||
| * dependent on the cache being updated which can happen after this UI | * dependent on the cache being updated which can happen after this UI | ||||
| * draws causing a glitch [#28883] */ | * draws causing a glitch [#28883] */ | ||||
| Show All 11 Lines | #endif | ||||
| return particle_edit_cache_brush_items; | return particle_edit_cache_brush_items; | ||||
| } | } | ||||
| static int rna_ParticleEdit_editable_get(PointerRNA *ptr) | static int rna_ParticleEdit_editable_get(PointerRNA *ptr) | ||||
| { | { | ||||
| ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data; | ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data; | ||||
| return (pset->object && pset->scene && PE_get_current(pset->scene, pset->scene_layer, pset->object)); | return (pset->object && pset->scene && PE_get_current(pset->scene, pset->view_layer, pset->object)); | ||||
| } | } | ||||
| static int rna_ParticleEdit_hair_get(PointerRNA *ptr) | static int rna_ParticleEdit_hair_get(PointerRNA *ptr) | ||||
| { | { | ||||
| ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data; | ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data; | ||||
| if (pset->scene) { | if (pset->scene) { | ||||
| PTCacheEdit *edit = PE_get_current(pset->scene, pset->scene_layer, pset->object); | PTCacheEdit *edit = PE_get_current(pset->scene, pset->view_layer, pset->object); | ||||
| return (edit && edit->psys); | return (edit && edit->psys); | ||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| static char *rna_ParticleEdit_path(PointerRNA *UNUSED(ptr)) | static char *rna_ParticleEdit_path(PointerRNA *UNUSED(ptr)) | ||||
| Show All 21 Lines | else if (ptr->data == ts->wpaint) | ||||
| mode = OB_MODE_WEIGHT_PAINT; | mode = OB_MODE_WEIGHT_PAINT; | ||||
| return brush->ob_mode & mode; | return brush->ob_mode & mode; | ||||
| } | } | ||||
| static void rna_Sculpt_update(bContext *C, PointerRNA *UNUSED(ptr)) | static void rna_Sculpt_update(bContext *C, PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| SceneLayer *scene_layer = CTX_data_scene_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Object *ob = OBACT(scene_layer); | Object *ob = OBACT(view_layer); | ||||
| if (ob) { | if (ob) { | ||||
| DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | DEG_id_tag_update(&ob->id, OB_RECALC_DATA); | ||||
| WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob); | WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob); | ||||
| if (ob->sculpt) { | if (ob->sculpt) { | ||||
| ob->sculpt->bm_smooth_shading = ((scene->toolsettings->sculpt->flags & | ob->sculpt->bm_smooth_shading = ((scene->toolsettings->sculpt->flags & | ||||
| SCULPT_DYNTOPO_SMOOTH_SHADING) != 0); | SCULPT_DYNTOPO_SMOOTH_SHADING) != 0); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void rna_Sculpt_ShowDiffuseColor_update(bContext *C, Scene *scene, PointerRNA *UNUSED(ptr)) | static void rna_Sculpt_ShowDiffuseColor_update(bContext *C, Scene *scene, PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| SceneLayer *scene_layer = CTX_data_scene_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Object *ob = OBACT(scene_layer); | Object *ob = OBACT(view_layer); | ||||
| if (ob && ob->sculpt) { | if (ob && ob->sculpt) { | ||||
| Sculpt *sd = scene->toolsettings->sculpt; | Sculpt *sd = scene->toolsettings->sculpt; | ||||
| ob->sculpt->show_diffuse_color = ((sd->flags & SCULPT_SHOW_DIFFUSE) != 0); | ob->sculpt->show_diffuse_color = ((sd->flags & SCULPT_SHOW_DIFFUSE) != 0); | ||||
| if (ob->sculpt->pbvh) | if (ob->sculpt->pbvh) | ||||
| pbvh_show_diffuse_color_set(ob->sculpt->pbvh, ob->sculpt->show_diffuse_color); | pbvh_show_diffuse_color_set(ob->sculpt->pbvh, ob->sculpt->show_diffuse_color); | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| /* not the best solution maybe, but will refresh the 3D viewport */ | /* not the best solution maybe, but will refresh the 3D viewport */ | ||||
| WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); | WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); | ||||
| } | } | ||||
| static void rna_ImaPaint_mode_update(bContext *C, PointerRNA *UNUSED(ptr)) | static void rna_ImaPaint_mode_update(bContext *C, PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C);\ | Scene *scene = CTX_data_scene(C);\ | ||||
| SceneLayer *scene_layer = CTX_data_scene_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Object *ob = OBACT(scene_layer); | Object *ob = OBACT(view_layer); | ||||
| if (ob && ob->type == OB_MESH) { | if (ob && ob->type == OB_MESH) { | ||||
| /* of course we need to invalidate here */ | /* of course we need to invalidate here */ | ||||
| BKE_texpaint_slots_refresh_object(scene, ob); | BKE_texpaint_slots_refresh_object(scene, ob); | ||||
| /* we assume that changing the current mode will invalidate the uv layers so we need to refresh display */ | /* we assume that changing the current mode will invalidate the uv layers so we need to refresh display */ | ||||
| GPU_drawobject_free(ob->derivedFinal); | GPU_drawobject_free(ob->derivedFinal); | ||||
| BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); | BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); | ||||
| WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); | WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); | ||||
| } | } | ||||
| } | } | ||||
| static void rna_ImaPaint_stencil_update(bContext *C, PointerRNA *UNUSED(ptr)) | static void rna_ImaPaint_stencil_update(bContext *C, PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| SceneLayer *scene_layer = CTX_data_scene_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Object *ob = OBACT(scene_layer); | Object *ob = OBACT(view_layer); | ||||
| if (ob && ob->type == OB_MESH) { | if (ob && ob->type == OB_MESH) { | ||||
| GPU_drawobject_free(ob->derivedFinal); | GPU_drawobject_free(ob->derivedFinal); | ||||
| BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); | BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); | ||||
| WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); | WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); | ||||
| } | } | ||||
| } | } | ||||
| static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr)) | static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| SceneLayer *scene_layer = CTX_data_scene_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Object *ob = OBACT(scene_layer); | Object *ob = OBACT(view_layer); | ||||
| bScreen *sc; | bScreen *sc; | ||||
| Image *ima = scene->toolsettings->imapaint.canvas; | Image *ima = scene->toolsettings->imapaint.canvas; | ||||
| for (sc = bmain->screen.first; sc; sc = sc->id.next) { | for (sc = bmain->screen.first; sc; sc = sc->id.next) { | ||||
| ScrArea *sa; | ScrArea *sa; | ||||
| for (sa = sc->areabase.first; sa; sa = sa->next) { | for (sa = sc->areabase.first; sa; sa = sa->next) { | ||||
| SpaceLink *slink; | SpaceLink *slink; | ||||
| for (slink = sa->spacedata.first; slink; slink = slink->next) { | for (slink = sa->spacedata.first; slink; slink = slink->next) { | ||||
| ▲ Show 20 Lines • Show All 759 Lines • Show Last 20 Lines | |||||