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:
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c13
-rw-r--r--source/blender/editors/transform/transform_convert_armature.c8
-rw-r--r--source/blender/editors/transform/transform_convert_nla.c44
-rw-r--r--source/blender/editors/transform/transform_convert_object.c14
-rw-r--r--source/blender/editors/transform/transform_convert_sequencer_image.c7
-rw-r--r--source/blender/editors/transform/transform_gizmo_2d.c5
-rw-r--r--source/blender/editors/transform/transform_mode_timescale.c2
-rw-r--r--source/blender/editors/transform/transform_snap.c8
-rw-r--r--source/blender/editors/transform/transform_snap_object.c2
9 files changed, 53 insertions, 50 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index e58e524e341..6ed2c28a7eb 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -28,6 +28,7 @@
#include "DNA_gpencil_types.h"
#include "DNA_mask_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_screen_types.h"
#include "BLI_math.h"
#include "BLI_rect.h"
@@ -1609,8 +1610,16 @@ static void initSnapSpatial(TransInfo *t, float r_snap[2])
}
}
else if (t->spacetype == SPACE_IMAGE) {
- r_snap[0] = 0.0625f;
- r_snap[1] = 0.03125f;
+ SpaceImage *sima = t->area->spacedata.first;
+ View2D *v2d = &t->region->v2d;
+ int grid_size = SI_GRID_STEPS_LEN;
+ float zoom_factor = ED_space_image_zoom_level(v2d, grid_size);
+ float grid_steps[SI_GRID_STEPS_LEN];
+
+ ED_space_image_grid_steps(sima, grid_steps, grid_size);
+ /* Snapping value based on what type of grid is used (adaptive-subdividing or custom-grid). */
+ r_snap[0] = ED_space_image_increment_snap_value(grid_size, grid_steps, zoom_factor);
+ r_snap[1] = r_snap[0] / 2.0f;
}
else if (t->spacetype == SPACE_CLIP) {
r_snap[0] = 0.125f;
diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c
index d3e0f55b127..d19ff123037 100644
--- a/source/blender/editors/transform/transform_convert_armature.c
+++ b/source/blender/editors/transform/transform_convert_armature.c
@@ -1496,8 +1496,10 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb)
}
}
-/* Sets transform flags in the bones.
- * Returns total number of bones with `BONE_TRANSFORM`. */
+/**
+ * Sets transform flags in the bones.
+ * Returns total number of bones with #BONE_TRANSFORM.
+ */
int transform_convert_pose_transflags_update(Object *ob,
const int mode,
const short around,
@@ -1730,7 +1732,7 @@ void special_aftertrans_update__pose(bContext *C, TransInfo *t)
BKE_pose_where_is(t->depsgraph, t->scene, pose_ob);
}
- /* set BONE_TRANSFORM flags for autokey, gizmo draw might have changed them */
+ /* Set BONE_TRANSFORM flags for auto-key, gizmo draw might have changed them. */
if (!canceled && (t->mode != TFM_DUMMY)) {
transform_convert_pose_transflags_update(ob, t->mode, t->around, NULL);
}
diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c
index 7e5b80c2453..acef8a666e3 100644
--- a/source/blender/editors/transform/transform_convert_nla.c
+++ b/source/blender/editors/transform/transform_convert_nla.c
@@ -208,30 +208,18 @@ void createTransNlaData(bContext *C, TransInfo *t)
/* just set tdn to assume that it only has one handle for now */
tdn->handle = -1;
- /* now, link the transform data up to this data */
- if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
- td->loc = tdn->h1;
- copy_v3_v3(td->iloc, tdn->h1);
+ /* Now, link the transform data up to this data. */
+ td->loc = tdn->h1;
+ copy_v3_v3(td->iloc, tdn->h1);
- /* store all the other gunk that is required by transform */
+ if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
+ /* Store all the other gunk that is required by transform. */
copy_v3_v3(td->center, center);
- memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
-
- td->ext = NULL;
- td->val = NULL;
-
td->flag |= TD_SELECTED;
- td->dist = 0.0f;
-
unit_m3(td->mtx);
unit_m3(td->smtx);
}
- else {
- /* time scaling only needs single value */
- td->val = &tdn->h1[0];
- td->ival = tdn->h1[0];
- }
td->extra = tdn;
td++;
@@ -241,30 +229,18 @@ void createTransNlaData(bContext *C, TransInfo *t)
* then we're doing both, otherwise, only end */
tdn->handle = (tdn->handle) ? 2 : 1;
- /* now, link the transform data up to this data */
- if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
- td->loc = tdn->h2;
- copy_v3_v3(td->iloc, tdn->h2);
+ /* Now, link the transform data up to this data. */
+ td->loc = tdn->h2;
+ copy_v3_v3(td->iloc, tdn->h2);
- /* store all the other gunk that is required by transform */
+ if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
+ /* Store all the other gunk that is required by transform. */
copy_v3_v3(td->center, center);
- memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
-
- td->ext = NULL;
- td->val = NULL;
-
td->flag |= TD_SELECTED;
- td->dist = 0.0f;
-
unit_m3(td->mtx);
unit_m3(td->smtx);
}
- else {
- /* time scaling only needs single value */
- td->val = &tdn->h2[0];
- td->ival = tdn->h2[0];
- }
td->extra = tdn;
td++;
diff --git a/source/blender/editors/transform/transform_convert_object.c b/source/blender/editors/transform/transform_convert_object.c
index ad22b0fc444..09aa4314b32 100644
--- a/source/blender/editors/transform/transform_convert_object.c
+++ b/source/blender/editors/transform/transform_convert_object.c
@@ -958,25 +958,25 @@ void special_aftertrans_update__object(bContext *C, TransInfo *t)
}
BLI_freelistN(&pidlist);
- /* pointcache refresh */
+ /* Point-cache refresh. */
if (BKE_ptcache_object_reset(t->scene, ob, PTCACHE_RESET_OUTDATED)) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
- /* Needed for proper updating of "quick cached" dynamics. */
- /* Creates troubles for moving animated objects without */
- /* autokey though, probably needed is an anim sys override? */
- /* Please remove if some other solution is found. -jahka */
+ /* Needed for proper updating of "quick cached" dynamics.
+ * Creates troubles for moving animated objects without
+ * auto-key though, probably needed is an animation-system override?
+ * NOTE(@jahka): Please remove if some other solution is found. */
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
- /* Set autokey if necessary */
+ /* Set auto-key if necessary. */
if (!canceled) {
ED_transform_autokeyframe_object(C, t->scene, t->view_layer, ob, t->mode);
}
motionpath_update |= ED_transform_motionpath_need_update_object(t->scene, ob);
- /* restore rigid body transform */
+ /* Restore rigid body transform. */
if (ob->rigidbody_object && canceled) {
float ctime = BKE_scene_ctime_get(t->scene);
if (BKE_rigidbody_check_sim_running(t->scene->rigidbody_world, ctime)) {
diff --git a/source/blender/editors/transform/transform_convert_sequencer_image.c b/source/blender/editors/transform/transform_convert_sequencer_image.c
index 5db9a2e092f..6e3f12de472 100644
--- a/source/blender/editors/transform/transform_convert_sequencer_image.c
+++ b/source/blender/editors/transform/transform_convert_sequencer_image.c
@@ -113,12 +113,17 @@ static void freeSeqData(TransInfo *UNUSED(t),
void createTransSeqImageData(TransInfo *t)
{
Editing *ed = SEQ_editing_get(t->scene);
+
+ if (ed == NULL) {
+ return;
+ }
+
ListBase *seqbase = SEQ_active_seqbase_get(ed);
SeqCollection *strips = SEQ_query_rendered_strips(seqbase, t->scene->r.cfra, 0);
SEQ_filter_selected_strips(strips);
const int count = SEQ_collection_len(strips);
- if (ed == NULL || count == 0) {
+ if (count == 0) {
SEQ_collection_free(strips);
return;
}
diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c
index 0d66db0d7e1..4f6556cd2a2 100644
--- a/source/blender/editors/transform/transform_gizmo_2d.c
+++ b/source/blender/editors/transform/transform_gizmo_2d.c
@@ -32,6 +32,7 @@
#include "DNA_view3d_types.h"
#include "BKE_context.h"
+#include "BKE_global.h"
#include "BKE_layer.h"
#include "RNA_access.h"
@@ -70,6 +71,10 @@ static bool gizmo2d_generic_poll(const bContext *C, wmGizmoGroupType *gzgt)
return false;
}
+ if (G.moving) {
+ return false;
+ }
+
ScrArea *area = CTX_wm_area(C);
switch (area->spacetype) {
case SPACE_IMAGE: {
diff --git a/source/blender/editors/transform/transform_mode_timescale.c b/source/blender/editors/transform/transform_mode_timescale.c
index 50fd714727b..0a7ae54982e 100644
--- a/source/blender/editors/transform/transform_mode_timescale.c
+++ b/source/blender/editors/transform/transform_mode_timescale.c
@@ -87,7 +87,7 @@ static void applyTimeScaleValue(TransInfo *t, float value)
}
/* now, calculate the new value */
- *(td->val) = ((td->ival - startx) * fac) + startx;
+ td->loc[0] = ((td->iloc[0] - startx) * fac) + startx;
}
}
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 05a20a14477..39a70f5477e 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -590,6 +590,11 @@ static void initSnappingMode(TransInfo *t)
t->tsnap.project = 0;
t->tsnap.mode = ts->snap_uv_mode;
+ if ((t->tsnap.mode & SCE_SNAP_MODE_INCREMENT) && (ts->snap_uv_flag & SCE_SNAP_ABS_GRID) &&
+ (t->mode == TFM_TRANSLATION)) {
+ t->tsnap.mode &= ~SCE_SNAP_MODE_INCREMENT;
+ t->tsnap.mode |= SCE_SNAP_MODE_GRID;
+ }
}
else if (t->spacetype == SPACE_SEQ) {
t->tsnap.mode = SEQ_tool_settings_snap_mode_get(t->scene);
@@ -1502,7 +1507,8 @@ bool transform_snap_grid(TransInfo *t, float *val)
return false;
}
- if (t->spacetype != SPACE_VIEW3D) {
+ /* Don't do grid snapping if not in 3D viewport or UV editor */
+ if (!ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) {
return false;
}
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index 891919fd46c..70297fad4ff 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -734,7 +734,7 @@ static bool raycastMesh(SnapObjectContext *sctx,
}
/* Test BoundBox */
- BoundBox *bb = BKE_mesh_boundbox_get(ob_eval);
+ BoundBox *bb = BKE_object_boundbox_get(ob_eval);
if (bb) {
/* was BKE_boundbox_ray_hit_check, see: cf6ca226fa58 */
if (!isect_ray_aabb_v3_simple(