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:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-11-16 19:59:28 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-11-16 19:59:28 +0300
commit917218269e4d8b4cf581a637cee0ece2675c9d92 (patch)
tree8b7376b5e87803d9fd7eb455602af7bb9a077ea9 /source/blender/editors/transform
parentba6427adfaec0d405386f14fef5728f0114f7589 (diff)
parent1572c4d3d3317209bb846ca2d05cafeed06d1ead (diff)
Merge branch 'blender-v3.0-release'
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c11
-rw-r--r--source/blender/editors/transform/transform_generics.c125
2 files changed, 78 insertions, 58 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index f212c7f5747..ae4c3f02c46 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -601,8 +601,15 @@ static bool transform_modal_item_poll(const wmOperator *op, int value)
if ((t->tsnap.mode & ~(SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID)) == 0) {
return false;
}
- if (!validSnap(t)) {
- return false;
+ if (value == TFM_MODAL_ADD_SNAP) {
+ if (!validSnap(t)) {
+ return false;
+ }
+ }
+ else {
+ if (!t->tsnap.selectedPoint) {
+ return false;
+ }
}
break;
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 7ff95ebeeae..4194fb2a0ad 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -138,6 +138,54 @@ void resetTransRestrictions(TransInfo *t)
t->flag &= ~T_ALL_RESTRICTIONS;
}
+static void *t_view_get(TransInfo *t)
+{
+ if (t->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = t->area->spacedata.first;
+ return (void *)v3d;
+ }
+ else if (t->region) {
+ return (void *)&t->region->v2d;
+ }
+ return NULL;
+}
+
+static int t_around_get(TransInfo *t)
+{
+ if (t->flag & T_OVERRIDE_CENTER) {
+ /* Avoid initialization of individual origins (#V3D_AROUND_LOCAL_ORIGINS). */
+ return V3D_AROUND_CENTER_BOUNDS;
+ }
+
+ ScrArea *area = t->area;
+ if (t->spacetype == SPACE_VIEW3D) {
+ /* Bend always uses the cursor. */
+ if (t->mode == TFM_BEND) {
+ return V3D_AROUND_CURSOR;
+ }
+ else {
+ return t->settings->transform_pivot_point;
+ }
+ }
+ else if (t->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima = area->spacedata.first;
+ return sima->around;
+ }
+ else if (t->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = area->spacedata.first;
+ return sipo->around;
+ }
+ else if (t->spacetype == SPACE_CLIP) {
+ SpaceClip *sclip = area->spacedata.first;
+ return sclip->around;
+ }
+ else if (t->spacetype == SPACE_SEQ && t->region->regiontype == RGN_TYPE_PREVIEW) {
+ return SEQ_tool_settings_pivot_point_get(t->scene);
+ }
+
+ return V3D_AROUND_CENTER_BOUNDS;
+}
+
/**
* Setup internal data, mouse, vectors
*
@@ -261,32 +309,13 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
if (t->spacetype == SPACE_VIEW3D) {
- View3D *v3d = area->spacedata.first;
bScreen *animscreen = ED_screen_animation_playing(CTX_wm_manager(C));
- t->view = v3d;
t->animtimer = (animscreen) ? animscreen->animtimer : NULL;
if (t->scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) {
t->flag |= T_V3D_ALIGN;
}
- t->around = t->scene->toolsettings->transform_pivot_point;
-
- /* bend always uses the cursor */
- if (t->mode == TFM_BEND) {
- t->around = V3D_AROUND_CURSOR;
- }
-
- /* exceptional case */
- if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
- if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
- const bool use_island = transdata_check_local_islands(t, t->around);
-
- if ((t->obedit_type != -1) && !use_island) {
- t->options |= CTX_NO_PET;
- }
- }
- }
if (object_mode & OB_MODE_ALL_PAINT) {
Paint *p = BKE_paint_get_active_from_context(C);
@@ -313,10 +342,6 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
else if (t->spacetype == SPACE_IMAGE) {
SpaceImage *sima = area->spacedata.first;
- /* XXX for now, get View2D from the active region. */
- t->view = &region->v2d;
- t->around = sima->around;
-
if (ED_space_image_show_uvedit(sima, OBACT(t->view_layer))) {
/* UV transform */
}
@@ -331,21 +356,8 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
/* image not in uv edit, nor in mask mode, can happen for some tools */
}
- else if (t->spacetype == SPACE_NODE) {
- /* XXX for now, get View2D from the active region. */
- t->view = &region->v2d;
- t->around = V3D_AROUND_CENTER_BOUNDS;
- }
- else if (t->spacetype == SPACE_GRAPH) {
- SpaceGraph *sipo = area->spacedata.first;
- t->view = &region->v2d;
- t->around = sipo->around;
- }
else if (t->spacetype == SPACE_CLIP) {
SpaceClip *sclip = area->spacedata.first;
- t->view = &region->v2d;
- t->around = sclip->around;
-
if (ED_space_clip_check_show_trackedit(sclip)) {
t->options |= CTX_MOVIECLIP;
}
@@ -354,20 +366,30 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
}
else if (t->spacetype == SPACE_SEQ && region->regiontype == RGN_TYPE_PREVIEW) {
- t->view = &region->v2d;
- t->around = SEQ_tool_settings_pivot_point_get(t->scene);
t->options |= CTX_SEQUENCER_IMAGE;
}
- else {
- if (region) {
- /* XXX: For now, get View2D from the active region. */
- t->view = &region->v2d;
- /* XXX: For now, the center point is the midpoint of the data. */
- }
- else {
- t->view = NULL;
+
+ setTransformViewAspect(t, t->aspect);
+
+ if (op && (prop = RNA_struct_find_property(op->ptr, "center_override")) &&
+ RNA_property_is_set(op->ptr, prop)) {
+ RNA_property_float_get_array(op->ptr, prop, t->center_global);
+ mul_v3_v3(t->center_global, t->aspect);
+ t->flag |= T_OVERRIDE_CENTER;
+ }
+
+ t->view = t_view_get(t);
+ t->around = t_around_get(t);
+
+ /* Exceptional case. */
+ if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
+ if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
+ const bool use_island = transdata_check_local_islands(t, t->around);
+
+ if ((t->obedit_type != -1) && !use_island) {
+ t->options |= CTX_NO_PET;
+ }
}
- t->around = V3D_AROUND_CENTER_BOUNDS;
}
bool t_values_set_is_array = false;
@@ -656,15 +678,6 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->flag |= T_NO_CURSOR_WRAP;
}
- setTransformViewAspect(t, t->aspect);
-
- if (op && (prop = RNA_struct_find_property(op->ptr, "center_override")) &&
- RNA_property_is_set(op->ptr, prop)) {
- RNA_property_float_get_array(op->ptr, prop, t->center_global);
- mul_v3_v3(t->center_global, t->aspect);
- t->flag |= T_OVERRIDE_CENTER;
- }
-
setTransformViewMatrices(t);
initNumInput(&t->num);
}