diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-06-27 20:19:43 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-06-27 20:19:59 +0300 |
commit | e91d5811676c5ad110f3639ba815ccf082083606 (patch) | |
tree | 6d62aa05551ceaf2424a0f3bb45dd7f0d16c6074 | |
parent | a55eac5107ed54597197e721eee0ad8d6f14a98f (diff) |
Fix T78259: Proportional editing does not work in particle editing
And better identify what is bool and what is flag in the
proportional edit properties.
4 files changed, 48 insertions, 52 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index dce3cb47b10..b9e6258c1ba 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1591,7 +1591,6 @@ static void drawTransformPixel(const struct bContext *C, ARegion *region, void * void saveTransform(bContext *C, TransInfo *t, wmOperator *op) { ToolSettings *ts = CTX_data_tool_settings(C); - int proportional = 0; PropertyRNA *prop; if (!(t->con.mode & CON_APPLY) && (t->flag & T_MODAL) && @@ -1627,15 +1626,17 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } } + bool use_prop_edit = false; + int prop_edit_flag = 0; if (t->flag & T_PROP_EDIT_ALL) { if (t->flag & T_PROP_EDIT) { - proportional |= PROP_EDIT_USE; + use_prop_edit = true; } if (t->flag & T_PROP_CONNECTED) { - proportional |= PROP_EDIT_CONNECTED; + prop_edit_flag |= PROP_EDIT_CONNECTED; } if (t->flag & T_PROP_PROJECTED) { - proportional |= PROP_EDIT_PROJECTED; + prop_edit_flag |= PROP_EDIT_PROJECTED; } } @@ -1647,20 +1648,27 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) if (!(t->options & CTX_NO_PET)) { if ((prop = RNA_struct_find_property(op->ptr, "use_proportional_edit")) && !RNA_property_is_set(op->ptr, prop)) { + const Object *obact = OBACT(t->view_layer); + if (t->spacetype == SPACE_GRAPH) { - ts->proportional_fcurve = proportional; + ts->proportional_fcurve = use_prop_edit; } else if (t->spacetype == SPACE_ACTION) { - ts->proportional_action = proportional; - } - else if (t->obedit_type != -1) { - ts->proportional_edit = proportional; + ts->proportional_action = use_prop_edit; } else if (t->options & CTX_MASK) { - ts->proportional_mask = proportional != 0; + ts->proportional_mask = use_prop_edit; } - else if ((t->options & CTX_CURSOR) == 0) { - ts->proportional_objects = proportional != 0; + else if (obact && obact->mode == OB_MODE_OBJECT) { + ts->proportional_objects = use_prop_edit; + } + else { + if (use_prop_edit) { + ts->proportional_edit |= PROP_EDIT_USE; + } + else { + ts->proportional_edit &= ~PROP_EDIT_USE; + } } } @@ -1693,9 +1701,9 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } if ((prop = RNA_struct_find_property(op->ptr, "use_proportional_edit"))) { - RNA_property_boolean_set(op->ptr, prop, proportional & PROP_EDIT_USE); - RNA_boolean_set(op->ptr, "use_proportional_connected", proportional & PROP_EDIT_CONNECTED); - RNA_boolean_set(op->ptr, "use_proportional_projected", proportional & PROP_EDIT_PROJECTED); + RNA_property_boolean_set(op->ptr, prop, use_prop_edit); + RNA_boolean_set(op->ptr, "use_proportional_connected", prop_edit_flag & PROP_EDIT_CONNECTED); + RNA_boolean_set(op->ptr, "use_proportional_projected", prop_edit_flag & PROP_EDIT_PROJECTED); RNA_enum_set(op->ptr, "proportional_edit_falloff", t->prop_mode); RNA_float_set(op->ptr, "proportional_size", t->prop_size); } diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index ce37cb9dacd..fab851144ee 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -1160,6 +1160,7 @@ void createTransData(bContext *C, TransInfo *t) break; case TC_POSE: createTransPose(t); + /* Disable PET, its not usable in pose mode yet [#32444] */ init_prop_edit = false; break; case TC_ARMATURE_VERTS: @@ -1291,6 +1292,10 @@ void createTransData(bContext *C, TransInfo *t) * and are still added into transform data. */ sort_trans_data_selected_first(t); } + + if (!init_prop_edit) { + t->flag &= ~T_PROP_EDIT_ALL; + } } BLI_assert((!(t->flag & T_EDIT)) == (!(t->obedit_type != -1))); diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c index 7d670ef3dec..f721ed0b866 100644 --- a/source/blender/editors/transform/transform_convert_armature.c +++ b/source/blender/editors/transform/transform_convert_armature.c @@ -857,8 +857,6 @@ void createTransPose(TransInfo *t) } t->flag |= T_POSE; - /* disable PET, its not usable in pose mode yet [#32444] */ - t->flag &= ~T_PROP_EDIT_ALL; } void createTransArmatureVerts(TransInfo *t) diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 32b23ad7ff3..c6d8c4356fa 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -131,21 +131,6 @@ void resetTransRestrictions(TransInfo *t) t->flag &= ~T_ALL_RESTRICTIONS; } -static int initTransInfo_edit_pet_to_flag(const int proportional) -{ - int flag = 0; - if (proportional & PROP_EDIT_USE) { - flag |= T_PROP_EDIT; - } - if (proportional & PROP_EDIT_CONNECTED) { - flag |= T_PROP_CONNECTED; - } - if (proportional & PROP_EDIT_PROJECTED) { - flag |= T_PROP_PROJECTED; - } - return flag; -} - void initTransDataContainers_FromObjectData(TransInfo *t, Object *obact, Object **objects, @@ -637,45 +622,45 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve /* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */ if (op && (prop = RNA_struct_find_property(op->ptr, "use_proportional_edit"))) { if (RNA_property_is_set(op->ptr, prop)) { - int proportional = 0; if (RNA_property_boolean_get(op->ptr, prop)) { - proportional |= PROP_EDIT_USE; + t->flag |= T_PROP_EDIT; if (RNA_boolean_get(op->ptr, "use_proportional_connected")) { - proportional |= PROP_EDIT_CONNECTED; + t->flag |= T_PROP_CONNECTED; } if (RNA_boolean_get(op->ptr, "use_proportional_projected")) { - proportional |= PROP_EDIT_PROJECTED; + t->flag |= T_PROP_PROJECTED; } } - t->flag |= initTransInfo_edit_pet_to_flag(proportional); } else { /* use settings from scene only if modal */ if (t->flag & T_MODAL) { if ((t->options & CTX_NO_PET) == 0) { + bool use_prop_edit = false; if (t->spacetype == SPACE_GRAPH) { - t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_fcurve); + use_prop_edit = ts->proportional_fcurve; } else if (t->spacetype == SPACE_ACTION) { - t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_action); + use_prop_edit = ts->proportional_action; } - else if (t->obedit_type != -1) { - t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_edit); + else if (t->options & CTX_MASK) { + use_prop_edit = ts->proportional_mask; } - else if (t->options & CTX_GPENCIL_STROKES) { - t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_edit); + else if (obact && obact->mode == OB_MODE_OBJECT) { + use_prop_edit = ts->proportional_objects; } - else if (t->options & CTX_MASK) { - if (ts->proportional_mask) { - t->flag |= T_PROP_EDIT; - - if (ts->proportional_edit & PROP_EDIT_CONNECTED) { - t->flag |= T_PROP_CONNECTED; - } - } + else { + use_prop_edit = (ts->proportional_edit & PROP_EDIT_USE) != 0; } - else if (!(t->options & CTX_CURSOR) && ts->proportional_objects) { + + if (use_prop_edit) { t->flag |= T_PROP_EDIT; + if (ts->proportional_edit & PROP_EDIT_CONNECTED) { + t->flag |= T_PROP_CONNECTED; + } + if (ts->proportional_edit & PROP_EDIT_PROJECTED) { + t->flag |= T_PROP_PROJECTED; + } } } } |