[Bf-blender-cvs] [ea3a4acacc1] temp-vse-preview-transform2: Remove transform gizmo
Richard Antalik
noreply at git.blender.org
Wed Sep 15 17:19:53 CEST 2021
Commit: ea3a4acacc163c3f2d045aff1feca3b0959f7447
Author: Richard Antalik
Date: Fri Sep 10 07:30:17 2021 +0200
Branches: temp-vse-preview-transform2
https://developer.blender.org/rBea3a4acacc163c3f2d045aff1feca3b0959f7447
Remove transform gizmo
===================================================================
M release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
M source/blender/editors/transform/transform_gizmo_2d.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index b968a661c09..3bf959f3daa 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -2472,19 +2472,6 @@ class _defs_sequencer_generic:
keymap="Sequencer Tool: Scale",
)
- @ToolDef.from_fn
- def transform():
- return dict(
- idname="builtin.transform",
- label="Transform",
- description=(
- "Supports any combination of grab, rotate, and scale at once"
- ),
- icon="ops.transform.transform",
- widget="SEQUENCER_GGT_gizmo2d",
- # No keymap default action, only for gizmo!
- )
-
class _defs_sequencer_select:
@ToolDef.from_fn
@@ -3081,7 +3068,6 @@ class SEQUENCER_PT_tools_active(ToolSelectPanelHelper, Panel):
_defs_sequencer_generic.translate,
_defs_sequencer_generic.rotate,
_defs_sequencer_generic.scale,
- _defs_sequencer_generic.transform,
*_tools_annotate,
],
'SEQUENCER': [
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
index 8e911203b4d..6fd06b47656 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
@@ -909,7 +909,6 @@ static int gizmo_cage2d_test_select(bContext *C, wmGizmo *gz, const int mval[2])
typedef struct RectTransformInteraction {
float orig_mouse[2];
- float orig_mouse_pivot_comp[2];
float orig_matrix_offset[4][4];
float orig_matrix_final_no_offset[4][4];
Dial *dial;
@@ -933,14 +932,6 @@ static int gizmo_cage2d_invoke(bContext *C, wmGizmo *gz, const wmEvent *event)
zero_v2(data->orig_mouse);
}
- float pivot[2];
- zero_v2(pivot);
- if (RNA_property_is_set(gz->ptr, RNA_struct_find_property(gz->ptr, "pivot"))) {
- RNA_float_get_array(gz->ptr, "pivot", pivot);
- }
- copy_v2_v2(data->orig_mouse_pivot_comp, data->orig_mouse);
- sub_v2_v2(data->orig_mouse_pivot_comp, pivot);
-
gz->interaction_data = data;
return OPERATOR_RUNNING_MODAL;
@@ -1010,37 +1001,29 @@ static int gizmo_cage2d_modal(bContext *C,
data->dial = BLI_dial_init(test_co, FLT_EPSILON);
- MUL_V2_V3_M4_FINAL(test_co, data->orig_mouse_pivot_comp);
+ MUL_V2_V3_M4_FINAL(test_co, data->orig_mouse);
BLI_dial_angle(data->dial, test_co);
}
- float pivot[3];
- if (RNA_property_is_set(
- gz->ptr,
- RNA_struct_find_property(gz->ptr, "pivot"))) { // XXX this can be easily 0-1 range
- zero_v3(pivot);
- RNA_float_get_array(gz->ptr, "pivot", pivot);
- sub_v2_v2(point_local, pivot);
- }
- else {
- copy_v3_v3(pivot, data->orig_matrix_offset[3]);
- }
-
/* rotate */
MUL_V2_V3_M4_FINAL(test_co, point_local);
const float angle = BLI_dial_angle(data->dial, test_co);
float matrix_space_inv[4][4];
float matrix_rotate[4][4];
+ float pivot[3];
+
+ copy_v3_v3(pivot, data->orig_matrix_offset[3]);
+
invert_m4_m4(matrix_space_inv, gz->matrix_space);
+
unit_m4(matrix_rotate);
mul_m4_m4m4(matrix_rotate, matrix_rotate, matrix_space_inv);
rotate_m4(matrix_rotate, 'Z', -angle);
- mul_m4_m4m4(matrix_rotate, matrix_rotate, gz->matrix_space); // XXX M x inv(M) == Mid???
+ mul_m4_m4m4(matrix_rotate, matrix_rotate, gz->matrix_space);
zero_v3(matrix_rotate[3]);
transform_pivot_set_m4(matrix_rotate, pivot);
- printf("%f\n", RAD2DEG(angle));
mul_m4_m4m4(gz->matrix_offset, matrix_rotate, data->orig_matrix_offset);
@@ -1206,9 +1189,6 @@ static void GIZMO_GT_cage_2d(wmGizmoType *gzt)
static float unit_v2[2] = {1.0f, 1.0f};
RNA_def_float_vector(
gzt->srna, "dimensions", 2, unit_v2, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX);
- static float pivot_v2[2] = {0.0f, 0.0f};
- RNA_def_float_vector(
- gzt->srna, "pivot", 2, pivot_v2, 0, FLT_MAX, "Pivot Point", "", 0.0f, FLT_MAX);
RNA_def_enum_flag(gzt->srna, "transform", rna_enum_transform, 0, "Transform Options", "");
RNA_def_enum(gzt->srna,
"draw_style",
diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c
index 0e8587a04d2..4a89cb5cfbc 100644
--- a/source/blender/editors/transform/transform_gizmo_2d.c
+++ b/source/blender/editors/transform/transform_gizmo_2d.c
@@ -149,11 +149,6 @@ typedef struct GizmoGroup2D {
float min[2];
float max[2];
- /* Sequencer uses matrix instead of values above. */
- float seq_matrix[4][4];
- float seq_center_point[2];
- bool use_seq_matrix;
-
bool no_cage;
} GizmoGroup2D;
@@ -210,18 +205,16 @@ static GizmoGroup2D *gizmogroup2d_init(wmGizmoGroup *gzgroup)
/**
* Calculates origin in view space, use with #gizmo2d_origin_to_region.
*/
-static bool gizmo2d_calc_bounds(const bContext *C, float *r_center, GizmoGroup2D *ggd)
+static bool gizmo2d_calc_bounds(const bContext *C, float *r_center, float *r_min, float *r_max)
{
float min_buf[2], max_buf[2];
- if (ggd->min == NULL) {
- copy_v2_v2(ggd->min, min_buf);
+ if (r_min == NULL) {
+ r_min = min_buf;
}
- if (ggd->max == NULL) {
- copy_v2_v2(ggd->max, max_buf);
+ if (r_max == NULL) {
+ r_max = max_buf;
}
- ggd->use_seq_matrix = false;
-
ScrArea *area = CTX_wm_area(C);
bool changed = false;
if (area->spacetype == SPACE_IMAGE) {
@@ -230,62 +223,18 @@ static bool gizmo2d_calc_bounds(const bContext *C, float *r_center, GizmoGroup2D
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
view_layer, NULL, &objects_len);
- if (ED_uvedit_minmax_multi(scene, objects, objects_len, ggd->min, ggd->max)) {
+ if (ED_uvedit_minmax_multi(scene, objects, objects_len, r_min, r_max)) {
changed = true;
}
MEM_freeN(objects);
}
- else if (area->spacetype == SPACE_SEQ) {
- Scene *scene = CTX_data_scene(C);
- ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene));
- SeqCollection *strips = Seq_query_rendered_strips(seqbase, scene->r.cfra, 0);
- SEQ_filter_selected_strips(strips);
-
- Sequence *seq = NULL;
- SEQ_ITERATOR_FOREACH (seq, strips) {
- const StripTransform *transform = seq->strip->transform;
-
- float seq_loc[3] = {transform->xofs, transform->yofs, 0};
- float seq_rot[3][3];
- unit_m3(seq_rot);
- rotate_m3(seq_rot, transform->rotation);
-
- // float seq_scale[3] = {1, 1, 1};
- float seq_scale[3] = {transform->scale_x, transform->scale_y, 1};
-
- float pivot[2] = {transform->origin[0], transform->origin[1]};
- float seq_mat_pivot[3] = {pivot[0], pivot[1], 0};
- loc_rot_size_to_mat4(ggd->seq_matrix, seq_loc, seq_rot, seq_scale);
- transform_pivot_set_m4(ggd->seq_matrix, seq_mat_pivot);
-
- RNA_float_set_array(ggd->cage->ptr, "pivot", pivot);
-
- add_v2_v2(pivot, (const float[]){transform->xofs, transform->yofs});
- copy_v2_v2(ggd->seq_center_point, pivot); // xxx this is bit awkward, that I need to specify
- // pivot again, this time in sequencer space
-
- /*ggd->max[0] = transform->scale_x * seq->strip->stripdata->orig_width / 2;
- ggd->min[0] = -ggd->max[0];
- ggd->max[1] = transform->scale_y * seq->strip->stripdata->orig_height / 2;
- ggd->min[1] = -ggd->max[1];*/
-
- ggd->max[0] = seq->strip->stripdata->orig_width / 2;
- ggd->min[0] = -ggd->max[0];
- ggd->max[1] = seq->strip->stripdata->orig_height / 2;
- ggd->min[1] = -ggd->max[1];
-
- ggd->use_seq_matrix = true;
- }
-
- changed = SEQ_collection_len(strips) > 0;
- SEQ_collection_free(strips);
- }
if (changed == false) {
- zero_v2(ggd->min);
- zero_v2(ggd->max);
+ zero_v2(r_min);
+ zero_v2(r_max);
}
- mid_v2_v2v2(r_center, ggd->min, ggd->max);
+
+ mid_v2_v2v2(r_center, r_min, r_max);
return changed;
}
@@ -386,12 +335,6 @@ static void gizmo2d_xform_setup(const bContext *C, wmGizmoGroup *gzgroup)
GizmoGroup2D *ggd = gizmogroup2d_init(gzgroup);
gzgroup->customdata = ggd;
- bool is_sequencer = false;
- ScrArea *area = CTX_wm_area(C);
- if (area->spacetype == SPACE_SEQ) {
- is_sequencer = true;
- }
-
for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
wmGizmo *gz = ggd->translate_xy[i];
@@ -449,8 +392,6 @@ static void gizmo2d_xform_setup(const bContext *C, wmGizmoGroup *gzgroup)
}
RNA_boolean_set(ptr, "release_confirm", true);
- is_sequencer ? RNA_boolean_set(ptr, "sequencer_image", true) :
- RNA_boolean_set(ptr, "sequencer_image", false);
}
{
@@ -461,8 +402,6 @@ static void gizmo2d_xform_setup(const bContext *C, wmGizmoGroup *gzgroup)
/* assign operator */
ptr = WM_gizmo_operator_set(ggd->cage, 0, ot_translate, NULL);
RNA_boolean_set(ptr, "release_confirm", 1);
- is_sequencer ? RNA_boolean_set(ptr, "sequencer_image", true) :
- RNA_boolean_set(ptr, "sequencer_image", false);
const bool constraint_x[3] = {1, 0, 0};
const bool constraint_y[3] = {0, 1, 0};
@@ -472,48 +411,30 @@ static void gizmo2d_xform_setup(const bContext *C, wmGizmoGroup *gzgroup)
PropertyRNA *prop_constraint_axis = RNA_struct_find_property(ptr, "constraint_axis");
RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_x);
RNA_property_boolean_set(ptr, prop_release_confirm, true);
- is_sequencer ? RNA_boolean_set(ptr, "sequencer_image", true) :
- RNA_boolean_set(ptr, "sequencer_image", false);
ptr = WM_gizmo_operator_set(ggd->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X, ot_resize, NULL);
RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_x);
RNA_property_boolean_set(ptr, prop_release_confirm, true);
- is_sequencer ? RNA_boolean_set(ptr, "sequencer_image", true) :
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list