Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/physics/dynamicpaint_ops.c
| Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| canvas = pmd->canvas; | canvas = pmd->canvas; | ||||
| surface = dynamicPaint_createNewSurface(canvas, CTX_data_scene(C)); | surface = dynamicPaint_createNewSurface(canvas, CTX_data_scene(C)); | ||||
| if (!surface) { | if (!surface) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| /* set preview for this surface only and set active */ | |||||
| canvas->active_sur = 0; | canvas->active_sur = 0; | ||||
| for (surface = surface->prev; surface; surface = surface->prev) { | for (surface = surface->prev; surface; surface = surface->prev) { | ||||
| surface->flags &= ~MOD_DPAINT_PREVIEW; | |||||
| canvas->active_sur++; | canvas->active_sur++; | ||||
| } | } | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| /* add surface slot */ | /* add surface slot */ | ||||
| void DPAINT_OT_surface_slot_add(wmOperatorType *ot) | void DPAINT_OT_surface_slot_add(wmOperatorType *ot) | ||||
| Show All 33 Lines | for (; surface; surface = surface->next) { | ||||
| if (id == canvas->active_sur) { | if (id == canvas->active_sur) { | ||||
| canvas->active_sur -= 1; | canvas->active_sur -= 1; | ||||
| dynamicPaint_freeSurface(pmd, surface); | dynamicPaint_freeSurface(pmd, surface); | ||||
| break; | break; | ||||
| } | } | ||||
| id++; | id++; | ||||
| } | } | ||||
| dynamicPaint_resetPreview(canvas); | |||||
| DEG_id_tag_update(&obj_ctx->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&obj_ctx->id, ID_RECALC_GEOMETRY); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obj_ctx); | WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obj_ctx); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| /* remove surface slot */ | /* remove surface slot */ | ||||
| void DPAINT_OT_surface_slot_remove(wmOperatorType *ot) | void DPAINT_OT_surface_slot_remove(wmOperatorType *ot) | ||||
| ▲ Show 20 Lines • Show All 392 Lines • Show Last 20 Lines | |||||