Fix #80876: Ocean Bake function is lockable #113093
|
@ -215,7 +215,7 @@ void OBJECT_OT_multires_external_pack(struct wmOperatorType *ot);
|
|||
void OBJECT_OT_correctivesmooth_bind(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_meshdeform_bind(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_explode_refresh(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_ocean_bake(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_ocean_bake_toggle(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_skin_root_mark(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_skin_loose_mark_clear(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_skin_radii_equalize(struct wmOperatorType *ot);
|
||||
|
|
|
@ -3348,13 +3348,14 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
|
|||
OceanModifierData *omd = (OceanModifierData *)edit_modifier_property_get(
|
||||
op, ob, eModifierType_Ocean);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
const bool free = RNA_boolean_get(op->ptr, "free");
|
||||
|
||||
if (!omd) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
if (free) {
|
||||
const bool is_cached = omd->cached;
|
||||
|
||||
if (is_cached) {
|
||||
BKE_ocean_free_modifier_cache(omd);
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
|
||||
|
@ -3442,11 +3443,11 @@ static int ocean_bake_invoke(bContext *C, wmOperator *op, const wmEvent * /*even
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_ocean_bake(wmOperatorType *ot)
|
||||
void OBJECT_OT_ocean_bake_toggle(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Bake Ocean";
|
||||
ot->description = "Bake an image sequence of ocean data";
|
||||
ot->idname = "OBJECT_OT_ocean_bake";
|
||||
ot->idname = "OBJECT_OT_ocean_bake_toggle";
|
||||
|
||||
ot->poll = ocean_bake_poll;
|
||||
ot->invoke = ocean_bake_invoke;
|
||||
|
@ -3455,8 +3456,6 @@ void OBJECT_OT_ocean_bake(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
|
||||
edit_modifier_properties(ot);
|
||||
|
||||
RNA_def_boolean(ot->srna, "free", false, "Free", "Free the bake, rather than generating it");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -173,7 +173,7 @@ void ED_operatortypes_object()
|
|||
WM_operatortype_append(OBJECT_OT_correctivesmooth_bind);
|
||||
WM_operatortype_append(OBJECT_OT_meshdeform_bind);
|
||||
WM_operatortype_append(OBJECT_OT_explode_refresh);
|
||||
WM_operatortype_append(OBJECT_OT_ocean_bake);
|
||||
WM_operatortype_append(OBJECT_OT_ocean_bake_toggle);
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_constraint_add);
|
||||
WM_operatortype_append(OBJECT_OT_constraint_add_with_targets);
|
||||
|
|
|
@ -637,19 +637,10 @@ static void bake_panel_draw(const bContext * /*C*/, Panel *panel)
|
|||
bool use_foam = RNA_boolean_get(ptr, "use_foam");
|
||||
|
||||
if (is_cached) {
|
||||
PointerRNA op_ptr;
|
||||
uiItemFullO(layout,
|
||||
"OBJECT_OT_ocean_bake",
|
||||
IFACE_("Delete Bake"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
RNA_boolean_set(&op_ptr, "free", true);
|
||||
uiItemO(layout, "Delete Bake", ICON_NONE, "OBJECT_OT_ocean_bake_toggle");
|
||||
}
|
||||
else {
|
||||
uiItemO(layout, nullptr, ICON_NONE, "OBJECT_OT_ocean_bake");
|
||||
uiItemO(layout, nullptr, ICON_NONE, "OBJECT_OT_ocean_bake_toggle");
|
||||
}
|
||||
|
||||
uiItemR(layout, ptr, "filepath", UI_ITEM_NONE, nullptr, ICON_NONE);
|
||||
|
|
Loading…
Reference in New Issue