UI: Add shortcuts for grease pencil modifier panels
See rB1fa40c9f8a81 for more details. The implementation is the same. The only difference to the mesh modifier commit is a slight rework of edit_modifier_invoke_properties in order to pass through to check for other keymap items with the same shortcut.
This commit is contained in:
parent
1d29822fa9
commit
5d2005cbb5
Notes:
blender-bot
2023-02-14 10:11:49 +01:00
Referenced by commit608d9b5aa1
, UI: Add shortcuts for constraint panels Referenced by commit053e0c0af3
, UI: Add shortcuts for shader effect panels Referenced by issue #78666, Non-Uniform scaling of hair emitters results in incorrect Cycles renders Referenced by issue #78326, Add shortcuts for modifier panels
|
@ -733,6 +733,11 @@ def km_property_editor(_params):
|
|||
("object.modifier_remove", {"type": 'DEL', "value": 'PRESS'}, {"properties": [("report", True)]}),
|
||||
("object.modifier_copy", {"type": 'D', "value": 'PRESS', "shift": True}, None),
|
||||
("object.modifier_apply", {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("report", True)]}),
|
||||
# Grease pencil modifier panels
|
||||
("object.gpencil_modifier_remove", {"type": 'X', "value": 'PRESS'}, {"properties": [("report", True)]}),
|
||||
("object.gpencil_modifier_remove", {"type": 'DEL', "value": 'PRESS'}, {"properties": [("report", True)]}),
|
||||
("object.gpencil_modifier_copy", {"type": 'D', "value": 'PRESS', "shift": True}, None),
|
||||
("object.gpencil_modifier_apply", {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("report", True)]}),
|
||||
])
|
||||
|
||||
return keymap
|
||||
|
|
|
@ -2083,7 +2083,7 @@ void uiTemplateConstraints(uiLayout *UNUSED(layout), bContext *C, bool use_bone_
|
|||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Grease Pencil Modifier Template
|
||||
/** \name Grease Pencil Modifiers Template
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
|
@ -2109,15 +2109,22 @@ void uiTemplateGpencilModifiers(uiLayout *UNUSED(layout), bContext *C)
|
|||
GpencilModifierData *md = modifiers->first;
|
||||
for (int i = 0; md; i++, md = md->next) {
|
||||
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
|
||||
if (mti->panelRegister) {
|
||||
char panel_idname[MAX_NAME];
|
||||
gpencil_modifier_panel_id(md, panel_idname);
|
||||
if (mti->panelRegister == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Panel *new_panel = UI_panel_add_instanced(
|
||||
sa, region, ®ion->panels, panel_idname, i, NULL);
|
||||
if (new_panel != NULL) {
|
||||
UI_panel_set_expand_from_list_data(C, new_panel);
|
||||
}
|
||||
char panel_idname[MAX_NAME];
|
||||
gpencil_modifier_panel_id(md, panel_idname);
|
||||
|
||||
/* Create custom data RNA pointer. */
|
||||
PointerRNA *md_ptr = MEM_mallocN(sizeof(PointerRNA), "panel customdata");
|
||||
RNA_pointer_create(&ob->id, &RNA_GpencilModifier, md, md_ptr);
|
||||
|
||||
Panel *new_panel = UI_panel_add_instanced(
|
||||
sa, region, ®ion->panels, panel_idname, i, md_ptr);
|
||||
|
||||
if (new_panel != NULL) {
|
||||
UI_panel_set_expand_from_list_data(C, new_panel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2127,6 +2134,27 @@ void uiTemplateGpencilModifiers(uiLayout *UNUSED(layout), bContext *C)
|
|||
if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED))
|
||||
UI_panel_set_expand_from_list_data(C, panel);
|
||||
}
|
||||
|
||||
/* Assuming there's only one group of instanced panels, update the custom data pointers. */
|
||||
Panel *panel = region->panels.first;
|
||||
LISTBASE_FOREACH (ModifierData *, md, modifiers) {
|
||||
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
|
||||
if (mti->panelRegister == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Move to the next instanced panel corresponding to the next modifier. */
|
||||
while ((panel->type == NULL) || !(panel->type->flag & PNL_INSTANCED)) {
|
||||
panel = panel->next;
|
||||
BLI_assert(panel != NULL); /* There shouldn't be fewer panels than modifiers with UIs. */
|
||||
}
|
||||
|
||||
PointerRNA *md_ptr = MEM_mallocN(sizeof(PointerRNA), "panel customdata");
|
||||
RNA_pointer_create(&ob->id, &RNA_GpencilModifier, md, md_ptr);
|
||||
UI_panel_custom_data_set(panel, md_ptr);
|
||||
|
||||
panel = panel->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -854,7 +854,7 @@ static int datalayout_transfer_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int datalayout_transfer_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return datalayout_transfer_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
|
@ -54,6 +55,8 @@
|
|||
#include "ED_object.h"
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
|
@ -445,22 +448,58 @@ static void gpencil_edit_modifier_properties(wmOperatorType *ot)
|
|||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
}
|
||||
|
||||
static int gpencil_edit_modifier_invoke_properties(bContext *C, wmOperator *op)
|
||||
static void gpencil_edit_modifier_report_property(wmOperatorType *ot)
|
||||
{
|
||||
GpencilModifierData *md;
|
||||
PropertyRNA *prop = RNA_def_boolean(
|
||||
ot->srna, "report", false, "Report", "Create a notification after the operation");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* \param event: If this isn't NULL, the operator will also look for panels underneath
|
||||
* the cursor with customdata set to a modifier.
|
||||
* \param r_retval: This should be used if #event is used in order to to return
|
||||
* #OPERATOR_PASS_THROUGH to check other operators with the same key set.
|
||||
*/
|
||||
static bool gpencil_edit_modifier_invoke_properties(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *event,
|
||||
int *r_retval)
|
||||
{
|
||||
if (RNA_struct_property_is_set(op->ptr, "modifier")) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_GpencilModifier);
|
||||
if (ptr.data) {
|
||||
md = ptr.data;
|
||||
RNA_string_set(op->ptr, "modifier", md->name);
|
||||
return true;
|
||||
|
||||
PointerRNA ctx_ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_GpencilModifier);
|
||||
if (ctx_ptr.data != NULL) {
|
||||
GpencilModifierData *md = ctx_ptr.data;
|
||||
RNA_string_set(op->ptr, "modifier", md->name);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Check the custom data of panels under the mouse for a modifier. */
|
||||
if (event != NULL) {
|
||||
PointerRNA *panel_ptr = UI_region_panel_custom_data_under_cursor(C, event);
|
||||
|
||||
if (!(panel_ptr == NULL || RNA_pointer_is_null(panel_ptr))) {
|
||||
if (RNA_struct_is_a(panel_ptr->type, &RNA_GpencilModifier)) {
|
||||
GpencilModifierData *md = panel_ptr->data;
|
||||
RNA_string_set(op->ptr, "modifier", md->name);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
BLI_assert(r_retval != NULL); /* We need the return value in this case. */
|
||||
if (r_retval != NULL) {
|
||||
*r_retval = (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (r_retval != NULL) {
|
||||
*r_retval = OPERATOR_CANCELLED;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -489,24 +528,35 @@ static int gpencil_modifier_remove_exec(bContext *C, wmOperator *op)
|
|||
Object *ob = ED_object_active_context(C);
|
||||
GpencilModifierData *md = gpencil_edit_modifier_property_get(op, ob, 0);
|
||||
|
||||
if (!md || !ED_object_gpencil_modifier_remove(op->reports, bmain, ob, md)) {
|
||||
if (md == NULL) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* Store name temporarily for report. */
|
||||
char name[MAX_NAME];
|
||||
strcpy(name, md->name);
|
||||
|
||||
if (!ED_object_gpencil_modifier_remove(op->reports, bmain, ob, md)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
|
||||
|
||||
if (RNA_boolean_get(op->ptr, "report")) {
|
||||
BKE_reportf(op->reports, RPT_INFO, "Removed modifier: %s", name);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int gpencil_modifier_remove_invoke(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *UNUSED(event))
|
||||
static int gpencil_modifier_remove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op)) {
|
||||
int retval;
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return gpencil_modifier_remove_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -523,6 +573,7 @@ void OBJECT_OT_gpencil_modifier_remove(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
|
||||
gpencil_edit_modifier_properties(ot);
|
||||
gpencil_edit_modifier_report_property(ot);
|
||||
}
|
||||
|
||||
/************************ move up modifier operator *********************/
|
||||
|
@ -542,15 +593,14 @@ static int gpencil_modifier_move_up_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int gpencil_modifier_move_up_invoke(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *UNUSED(event))
|
||||
static int gpencil_modifier_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op)) {
|
||||
int retval;
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return gpencil_modifier_move_up_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -586,15 +636,14 @@ static int gpencil_modifier_move_down_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int gpencil_modifier_move_down_invoke(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *UNUSED(event))
|
||||
static int gpencil_modifier_move_down_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op)) {
|
||||
int retval;
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return gpencil_modifier_move_down_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -636,15 +685,14 @@ static int gpencil_modifier_move_to_index_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int gpencil_modifier_move_to_index_invoke(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *UNUSED(event))
|
||||
static int gpencil_modifier_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op)) {
|
||||
int retval;
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return gpencil_modifier_move_to_index_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -677,23 +725,36 @@ static int gpencil_modifier_apply_exec(bContext *C, wmOperator *op)
|
|||
GpencilModifierData *md = gpencil_edit_modifier_property_get(op, ob, 0);
|
||||
int apply_as = RNA_enum_get(op->ptr, "apply_as");
|
||||
|
||||
if (!md || !ED_object_gpencil_modifier_apply(bmain, op->reports, depsgraph, ob, md, apply_as)) {
|
||||
if (md == NULL) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* Store name temporarily for report. */
|
||||
char name[MAX_NAME];
|
||||
strcpy(name, md->name);
|
||||
|
||||
if (!ED_object_gpencil_modifier_apply(bmain, op->reports, depsgraph, ob, md, apply_as)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
|
||||
|
||||
if (RNA_boolean_get(op->ptr, "report")) {
|
||||
BKE_reportf(op->reports, RPT_INFO, "Applied modifier: %s", name);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int gpencil_modifier_apply_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
static int gpencil_modifier_apply_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op)) {
|
||||
int retval;
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return gpencil_modifier_apply_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -727,6 +788,7 @@ void OBJECT_OT_gpencil_modifier_apply(wmOperatorType *ot)
|
|||
"Apply as",
|
||||
"How to apply the modifier to the geometry");
|
||||
gpencil_edit_modifier_properties(ot);
|
||||
gpencil_edit_modifier_report_property(ot);
|
||||
}
|
||||
|
||||
/************************ copy modifier operator *********************/
|
||||
|
@ -746,13 +808,14 @@ static int gpencil_modifier_copy_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int gpencil_modifier_copy_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
static int gpencil_modifier_copy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op)) {
|
||||
int retval;
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return gpencil_modifier_copy_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -153,9 +153,10 @@ bool edit_modifier_poll_generic(struct bContext *C,
|
|||
const bool is_editmode_allowed);
|
||||
bool edit_modifier_poll(struct bContext *C);
|
||||
void edit_modifier_properties(struct wmOperatorType *ot);
|
||||
int edit_modifier_invoke_properties(struct bContext *C,
|
||||
struct wmOperator *op,
|
||||
const struct wmEvent *event);
|
||||
bool edit_modifier_invoke_properties(struct bContext *C,
|
||||
struct wmOperator *op,
|
||||
const struct wmEvent *event,
|
||||
int *r_retval);
|
||||
struct ModifierData *edit_modifier_property_get(struct wmOperator *op,
|
||||
struct Object *ob,
|
||||
int type);
|
||||
|
|
|
@ -1049,20 +1049,27 @@ static void edit_modifier_report_property(wmOperatorType *ot)
|
|||
/**
|
||||
* \param event: If this isn't NULL, the operator will also look for panels underneath
|
||||
* the cursor with customdata set to a modifier.
|
||||
* \param r_retval: This should be used if #event is used in order to to return
|
||||
* #OPERATOR_PASS_THROUGH to check other operators with the same key set.
|
||||
*/
|
||||
int edit_modifier_invoke_properties(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
bool edit_modifier_invoke_properties(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *event,
|
||||
int *r_retval)
|
||||
{
|
||||
PointerRNA ctx_ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
|
||||
|
||||
if (RNA_struct_property_is_set(op->ptr, "modifier")) {
|
||||
return true;
|
||||
}
|
||||
else if (ctx_ptr.data != NULL) {
|
||||
|
||||
PointerRNA ctx_ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
|
||||
if (ctx_ptr.data != NULL) {
|
||||
ModifierData *md = ctx_ptr.data;
|
||||
RNA_string_set(op->ptr, "modifier", md->name);
|
||||
return true;
|
||||
}
|
||||
else if (event != NULL) {
|
||||
|
||||
/* Check the custom data of panels under the mouse for a modifier. */
|
||||
if (event != NULL) {
|
||||
PointerRNA *panel_ptr = UI_region_panel_custom_data_under_cursor(C, event);
|
||||
|
||||
if (!(panel_ptr == NULL || RNA_pointer_is_null(panel_ptr))) {
|
||||
|
@ -1071,9 +1078,19 @@ int edit_modifier_invoke_properties(bContext *C, wmOperator *op, const wmEvent *
|
|||
RNA_string_set(op->ptr, "modifier", md->name);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
BLI_assert(r_retval != NULL); /* We need the return value in this case. */
|
||||
if (r_retval != NULL) {
|
||||
*r_retval = (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (r_retval != NULL) {
|
||||
*r_retval = OPERATOR_CANCELLED;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1106,11 +1123,15 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
|
|||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||
int mode_orig = ob->mode;
|
||||
|
||||
if (md == NULL) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* Store name temporarily for report. */
|
||||
char name[MAX_NAME];
|
||||
strcpy(name, md->name);
|
||||
|
||||
if (!md || !ED_object_modifier_remove(op->reports, bmain, ob, md)) {
|
||||
if (!ED_object_modifier_remove(op->reports, bmain, ob, md)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -1134,11 +1155,12 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int modifier_remove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, event)) {
|
||||
int retval;
|
||||
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return modifier_remove_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1181,11 +1203,12 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int modifier_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, event)) {
|
||||
int retval;
|
||||
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return modifier_move_up_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1227,11 +1250,12 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int modifier_move_down_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, event)) {
|
||||
int retval;
|
||||
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return modifier_move_down_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1279,11 +1303,12 @@ static int modifier_move_to_index_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int modifier_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, event)) {
|
||||
int retval;
|
||||
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return modifier_move_to_index_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1346,11 +1371,15 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
|
|||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||
int apply_as = RNA_enum_get(op->ptr, "apply_as");
|
||||
|
||||
if (md == NULL) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* Store name temporarily for report. */
|
||||
char name[MAX_NAME];
|
||||
strcpy(name, md->name);
|
||||
|
||||
if (!md || !ED_object_modifier_apply(bmain, op->reports, depsgraph, scene, ob, md, apply_as)) {
|
||||
if (!ED_object_modifier_apply(bmain, op->reports, depsgraph, scene, ob, md, apply_as)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -1367,11 +1396,12 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int modifier_apply_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, event)) {
|
||||
int retval;
|
||||
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return modifier_apply_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1436,7 +1466,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int modifier_convert_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return modifier_convert_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -1482,11 +1512,12 @@ static int modifier_copy_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int modifier_copy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, event)) {
|
||||
int retval;
|
||||
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
|
||||
return modifier_copy_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1541,7 +1572,7 @@ static int multires_higher_levels_delete_invoke(bContext *C,
|
|||
wmOperator *op,
|
||||
const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return multires_higher_levels_delete_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -1619,7 +1650,7 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int multires_subdivide_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return multires_subdivide_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -1696,7 +1727,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int multires_reshape_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return multires_reshape_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -1760,7 +1791,7 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, const wmEv
|
|||
Mesh *me = ob->data;
|
||||
char path[FILE_MAX];
|
||||
|
||||
if (!edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (!edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -1875,9 +1906,9 @@ static int multires_base_apply_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int multires_base_apply_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int multires_base_apply_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, event)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return multires_base_apply_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -1931,7 +1962,7 @@ static int multires_unsubdivide_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int multires_unsubdivide_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return multires_unsubdivide_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -1989,7 +2020,7 @@ static int multires_rebuild_subdiv_invoke(bContext *C,
|
|||
wmOperator *op,
|
||||
const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return multires_rebuild_subdiv_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -2367,7 +2398,7 @@ static int skin_armature_create_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int skin_armature_create_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return skin_armature_create_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -2446,7 +2477,7 @@ static int correctivesmooth_bind_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int correctivesmooth_bind_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return correctivesmooth_bind_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -2523,7 +2554,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int meshdeform_bind_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return meshdeform_bind_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -2579,7 +2610,7 @@ static int explode_refresh_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int explode_refresh_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return explode_refresh_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -2783,7 +2814,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int ocean_bake_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return ocean_bake_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -2862,7 +2893,7 @@ static int laplaciandeform_bind_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int laplaciandeform_bind_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return laplaciandeform_bind_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
@ -2931,7 +2962,7 @@ static int surfacedeform_bind_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int surfacedeform_bind_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op, NULL)) {
|
||||
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
|
||||
return surfacedeform_bind_exec(C, op);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -278,12 +278,10 @@ static void gpencil_modifier_ops_extra_draw(bContext *C, uiLayout *layout, void
|
|||
|
||||
/* Apply. */
|
||||
if (!(mti->flags & eGpencilModifierTypeFlag_NoApply)) {
|
||||
uiItemEnumO(layout,
|
||||
"OBJECT_OT_gpencil_modifier_apply",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
|
||||
ICON_CHECKMARK,
|
||||
"apply_as",
|
||||
MODIFIER_APPLY_DATA);
|
||||
uiItemO(layout,
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
|
||||
ICON_CHECKMARK,
|
||||
"OBJECT_OT_gpencil_modifier_apply");
|
||||
}
|
||||
|
||||
/* Duplicate. */
|
||||
|
|
Loading…
Reference in New Issue