Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-04-27 06:17:00 +0300
committerHans Goudey <h.goudey@me.com>2021-04-27 06:17:00 +0300
commit2841d225a9ef41160e705b8612b418373b7d12a1 (patch)
treed2f8f00c2fc38d5bb1d10fcdeca0ece6efd3b238
parentf5123b1fc9ad7a04c263d9cbee169473e58e780b (diff)
parentfe79935f0021755ba133020a3414f6c29b46e9aa (diff)
Merge branch 'blender-v2.93-release'
-rw-r--r--source/blender/editors/object/object_intern.h8
-rw-r--r--source/blender/editors/object/object_modifier.c41
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c11
3 files changed, 28 insertions, 32 deletions
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 5b2e0e36ba9..ededcbfdba8 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -157,10 +157,10 @@ bool edit_modifier_poll_generic(struct bContext *C,
const bool is_liboverride_allowed);
void edit_modifier_properties(struct wmOperatorType *ot);
bool edit_modifier_invoke_properties(struct bContext *C, struct wmOperator *op);
-bool edit_modifier_invoke_properties_with_hover_no_active(struct bContext *C,
- struct wmOperator *op,
- const struct wmEvent *event,
- int *r_retval);
+bool edit_modifier_invoke_properties_with_hover(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,
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 2c279eb64ee..49c07b28f07 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1116,20 +1116,27 @@ bool edit_modifier_invoke_properties(bContext *C, wmOperator *op)
}
/**
- * If the "modifier" property is not set,fill the modifier property with the name of the modifier
- * with a UI panel below the mouse cursor, without checking the context pointer. Used in order to
- * apply modifier operators on hover over their panels. If this checked the context pointer then it
- * would always use the active modifier, which isn't desired.
+ * If the "modifier" property is not set, fill the modifier property with the name of the modifier
+ * with a UI panel below the mouse cursor, unless a specific modifier is set with a context
+ * pointer. Used in order to apply modifier operators on hover over their panels.
*/
-bool edit_modifier_invoke_properties_with_hover_no_active(bContext *C,
- wmOperator *op,
- const wmEvent *event,
- int *r_retval)
+bool edit_modifier_invoke_properties_with_hover(bContext *C,
+ wmOperator *op,
+ const wmEvent *event,
+ int *r_retval)
{
if (RNA_struct_property_is_set(op->ptr, "modifier")) {
return true;
}
+ /* Note that the context pointer is *not* the active modifier, it is set in UI layouts. */
+ 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;
+ }
+
PointerRNA *panel_ptr = UI_region_panel_custom_data_under_cursor(C, event);
if (panel_ptr == NULL || RNA_pointer_is_null(panel_ptr)) {
*r_retval = OPERATOR_CANCELLED;
@@ -1211,7 +1218,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
static int modifier_remove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int retval;
- if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, &retval)) {
+ if (edit_modifier_invoke_properties_with_hover(C, op, event, &retval)) {
return modifier_remove_exec(C, op);
}
return retval;
@@ -1257,7 +1264,7 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op)
static int modifier_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int retval;
- if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, &retval)) {
+ if (edit_modifier_invoke_properties_with_hover(C, op, event, &retval)) {
return modifier_move_up_exec(C, op);
}
return retval;
@@ -1302,7 +1309,7 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op)
static int modifier_move_down_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int retval;
- if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, &retval)) {
+ if (edit_modifier_invoke_properties_with_hover(C, op, event, &retval)) {
return modifier_move_down_exec(C, op);
}
return retval;
@@ -1345,7 +1352,7 @@ 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)
{
int retval;
- if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, &retval)) {
+ if (edit_modifier_invoke_properties_with_hover(C, op, event, &retval)) {
return modifier_move_to_index_exec(C, op);
}
return retval;
@@ -1458,7 +1465,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
static int modifier_apply_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int retval;
- if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, &retval)) {
+ if (edit_modifier_invoke_properties_with_hover(C, op, event, &retval)) {
return modifier_apply_exec(C, op);
}
return retval;
@@ -1502,7 +1509,7 @@ static int modifier_apply_as_shapekey_exec(bContext *C, wmOperator *op)
static int modifier_apply_as_shapekey_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int retval;
- if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, &retval)) {
+ if (edit_modifier_invoke_properties_with_hover(C, op, event, &retval)) {
return modifier_apply_as_shapekey_exec(C, op);
}
return retval;
@@ -1614,7 +1621,7 @@ static int modifier_copy_exec(bContext *C, wmOperator *op)
static int modifier_copy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int retval;
- if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, &retval)) {
+ if (edit_modifier_invoke_properties_with_hover(C, op, event, &retval)) {
return modifier_copy_exec(C, op);
}
return retval;
@@ -1657,7 +1664,7 @@ static int modifier_set_active_exec(bContext *C, wmOperator *op)
static int modifier_set_active_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int retval;
- if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, &retval)) {
+ if (edit_modifier_invoke_properties_with_hover(C, op, event, &retval)) {
return modifier_set_active_exec(C, op);
}
return retval;
@@ -1749,7 +1756,7 @@ static int modifier_copy_to_selected_exec(bContext *C, wmOperator *op)
static int modifier_copy_to_selected_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int retval;
- if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, &retval)) {
+ if (edit_modifier_invoke_properties_with_hover(C, op, event, &retval)) {
return modifier_copy_to_selected_exec(C, op);
}
return retval;
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index c42e2531f25..1699e704a4d 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -981,17 +981,6 @@ int /*eContextResult*/ buttons_context(const bContext *C,
return CTX_RESULT_OK;
}
- if (CTX_data_equals(member, "modifier")) {
- PointerRNA *ptr = get_pointer_type(path, &RNA_Modifier);
-
- if (ptr != NULL && !RNA_pointer_is_null(ptr)) {
- Object *ob = (Object *)ptr->owner_id;
- ModifierData *md = ptr->data;
- CTX_data_pointer_set(result, &ob->id, &RNA_Modifier, md);
- return CTX_RESULT_OK;
- }
- return CTX_RESULT_NO_DATA;
- }
if (CTX_data_equals(member, "texture_user")) {
ButsContextTexture *ct = sbuts->texuser;