[Bf-blender-cvs] [2289e26fa30] master: Cleanup: correct spelling in comments, remove profanity

2021-07-10 Thread Campbell Barton
Commit: 2289e26fa306c3edc60a6b5b776646c6fd1c33dc
Author: Campbell Barton
Date:   Sun Jul 11 15:28:20 2021 +1000
Branches: master
https://developer.blender.org/rB2289e26fa306c3edc60a6b5b776646c6fd1c33dc

Cleanup: correct spelling in comments, remove profanity

===

M   intern/ghost/test/gears/GHOST_Test.cpp
M   source/blender/bmesh/intern/bmesh_opdefines.c
M   source/blender/bmesh/tools/bmesh_edgenet.c
M   source/blender/bmesh/tools/bmesh_intersect_edges.c
M   source/blender/compositor/operations/COM_SMAAOperation.cc
M   source/blender/draw/intern/draw_manager.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M   source/blender/modifiers/intern/MOD_solidify_extrude.c
M   tests/python/modules/render_report.py

===

diff --git a/intern/ghost/test/gears/GHOST_Test.cpp 
b/intern/ghost/test/gears/GHOST_Test.cpp
index aaac62a1a03..c1cb5f29e2e 100644
--- a/intern/ghost/test/gears/GHOST_Test.cpp
+++ b/intern/ghost/test/gears/GHOST_Test.cpp
@@ -365,8 +365,8 @@ void StereoProjection(float left,
  * of zero parallax.
  *
  * -0.31
- * eye = half the eye separation; positive for the right eye subfield,
- * negative for the left eye subfield.
+ * eye = half the eye separation; positive for the right eye sub-field,
+ * negative for the left eye sub-field.
  */
 {
   float xmid, ymid, clip_near, clip_far, topw, bottomw, leftw, rightw, dx, dy, 
n_over_d;
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c 
b/source/blender/bmesh/intern/bmesh_opdefines.c
index 9466be4a300..3978959a425 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -724,7 +724,7 @@ static BMOpDefine bmo_edgenet_fill_def = {
 };
 
 /*
- * Edgenet Prepare.
+ * Edge-net Prepare.
  *
  * Identifies several useful edge loop cases and modifies them so
  * they'll become a face when edgenet_fill is called.  The cases covered are:
diff --git a/source/blender/bmesh/tools/bmesh_edgenet.c 
b/source/blender/bmesh/tools/bmesh_edgenet.c
index 51af4d24e52..242b269ed47 100644
--- a/source/blender/bmesh/tools/bmesh_edgenet.c
+++ b/source/blender/bmesh/tools/bmesh_edgenet.c
@@ -17,7 +17,7 @@
 /** \file
  * \ingroup bmesh
  *
- * Edgenet Fill.
+ * Edge-net Fill.
  */
 
 #include 
diff --git a/source/blender/bmesh/tools/bmesh_intersect_edges.c 
b/source/blender/bmesh/tools/bmesh_intersect_edges.c
index 1e9adea2615..eb56075e136 100644
--- a/source/blender/bmesh/tools/bmesh_intersect_edges.c
+++ b/source/blender/bmesh/tools/bmesh_intersect_edges.c
@@ -938,7 +938,7 @@ bool BM_mesh_intersect_edges(
 }
 
 if (va_dest == v_other_dest) {
-  /* Edge/Edgenet to vertex - we can't split the face. */
+  /* Edge/Edge-net to vertex - we can't split the face. */
   break;
 }
 if (edgenet_len == 0 && BM_edge_exists(va_dest, v_other_dest)) {
diff --git a/source/blender/compositor/operations/COM_SMAAOperation.cc 
b/source/blender/compositor/operations/COM_SMAAOperation.cc
index 9dde73269fc..c3647a39909 100644
--- a/source/blender/compositor/operations/COM_SMAAOperation.cc
+++ b/source/blender/compositor/operations/COM_SMAAOperation.cc
@@ -36,12 +36,12 @@ namespace blender::compositor {
  *
  *   http://www.iryoku.com/smaa/
  *
- * This file is based on smaa-cpp:
+ * This file is based on SMAA-CPP:
  *
  *   https://github.com/iRi-E/smaa-cpp
  *
  * Currently only SMAA 1x mode is provided, so the operation will be done
- * with no spatial multisampling nor temporal supersampling.
+ * with no spatial multi-sampling nor temporal super-sampling.
  *
  * NOTE: This program assumes the screen coordinates are DirectX style, so
  * the vertical direction is upside-down. "top" and "bottom" actually mean
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 62742d082ca..6f5e041fa79 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1645,7 +1645,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
 
   drw_engines_draw_scene();
 
-  /* Fix 3D view being "laggy" on macos and win+nvidia. (See T56996, T61474) */
+  /* Fix 3D view "lagging" on APPLE and WIN32+NVIDIA. (See T56996, T61474) */
   GPU_flush();
 
   DRW_stats_reset();
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 21007bab5d2..fcc44aab583 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -205,7 +205,7 @@ static void bakeModifier(Main *UNUSED(bmain),
   }
 
   if (!gpd->runtime.lineart_cache) {
-/* Only calculate for this modifer, thus no need to get maximum values 
from all line art
+/* Only calculate for

[Bf-blender-cvs] [0f201049b4b] master: Edit Mesh: tag the object data for updating instead of the object

2021-07-10 Thread Campbell Barton
Commit: 0f201049b4b2011ab940a5689867e190930d561e
Author: Campbell Barton
Date:   Sun Jul 11 15:17:11 2021 +1000
Branches: master
https://developer.blender.org/rB0f201049b4b2011ab940a5689867e190930d561e

Edit Mesh: tag the object data for updating instead of the object

When editing vertices with number buttons, tag the mesh, not the object.

This prevents the evaluated mesh being re-created for the object
and is correct as the mesh is being edited not the object.

Note that all tags for updating object geometry should be checked
to see if this change should be applied there too.

From a simple test on a high-poly mesh this gives around 1.3x
overall speedup.

===

M   source/blender/editors/space_view3d/view3d_buttons.c

===

diff --git a/source/blender/editors/space_view3d/view3d_buttons.c 
b/source/blender/editors/space_view3d/view3d_buttons.c
index dcd4ff8df36..2e203d06b12 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -1152,7 +1152,7 @@ static void do_view3d_vgroup_buttons(bContext *C, void 
*UNUSED(arg), int event)
   ViewLayer *view_layer = CTX_data_view_layer(C);
   Object *ob = view_layer->basact->object;
   ED_vgroup_vert_active_mirror(ob, event - B_VGRP_PNL_EDIT_SINGLE);
-  DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+  DEG_id_tag_update(ob->data, ID_RECALC_GEOMETRY);
   WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
 }
 
@@ -1568,7 +1568,7 @@ static void do_view3d_region_buttons(bContext *C, void 
*UNUSED(index), int event
 case B_TRANSFORM_PANEL_MEDIAN:
   if (ob) {
 v3d_editvertex_buts(NULL, v3d, ob, 1.0);
-DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+DEG_id_tag_update(ob->data, ID_RECALC_GEOMETRY);
   }
   break;
 case B_TRANSFORM_PANEL_DIMS:

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [688f5a0fe06] soc-2021-vse-strip-thumbnails: Thumbnail Job - Version 1

2021-07-10 Thread Aditya Y Jeppu
Commit: 688f5a0fe0641408ebc61d160b649625f8a2a279
Author: Aditya Y Jeppu
Date:   Sat Jul 10 20:09:46 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB688f5a0fe0641408ebc61d160b649625f8a2a279

Thumbnail Job - Version 1

The current code has been tested and three areas it breaks.
1) refreshing a bunch of times
2) strip slide
3) multiple strips.
Multiple strip support is being worked on now. Other points are bugs.

===

M   source/blender/editors/interface/interface_templates.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/sequencer/SEQ_render.h
M   source/blender/sequencer/intern/render.c
M   source/blender/windowmanager/WM_api.h

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index 9c17486aea4..abc86504746 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -6634,6 +6634,11 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
   icon = ICON_SEQUENCE;
   break;
 }
+if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL)) {
+  handle_event = B_STOPSEQ;
+  icon = ICON_SEQUENCE;
+  break;
+}
 if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_BUILD_PROXY)) {
   handle_event = B_STOPCLIP;
   icon = ICON_TRACKER;
@@ -6670,7 +6675,8 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
   break;
 }
 if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE) ||
-WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE)) {
+WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE) ||
+WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL)) {
   /* Skip bake jobs in compositor to avoid compo header displaying
* progress bar which is not being updated (bake jobs only need
* to update NC_IMAGE context.
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 5adfe0cc6e9..c5ceca94aaf 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1082,6 +1082,75 @@ static void draw_seq_fcurve_overlay(
   }
 }
 
+typedef struct ThumbnailDrawJob {
+  SeqRenderData context;
+  Sequence *seq;
+  Scene *scene;
+  float x1;
+  float offset;
+  float *cache_limits;
+} ThumbnailDrawJob;
+
+static void thumbnail_freejob(void *data)
+{
+  ThumbnailDrawJob *tj = data;
+  MEM_freeN(tj->cache_limits);
+  MEM_freeN(tj);
+}
+
+static void thumbnail_endjob(void *data)
+{
+  ThumbnailDrawJob *tj = data;
+  WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, tj->scene);
+}
+
+static void thumbnail_startjob(void *data, short *stop, short *do_update, 
float *progress)
+{
+  ThumbnailDrawJob *tj = data;
+  SEQ_render_thumbnails(&tj->context, tj->seq, tj->x1, tj->offset, 
tj->cache_limits);
+  UNUSED_VARS(stop, do_update, progress);
+}
+
+static void sequencer_thumbnail_get_job(const bContext *C,
+float x1,
+float offset,
+float *cache_limits,
+SeqRenderData context,
+Sequence *seq)
+{
+  wmJob *wm_job;
+  ThumbnailDrawJob *tj = NULL;
+  ScrArea *area = CTX_wm_area(C);
+  wm_job = WM_jobs_get(CTX_wm_manager(C),
+   CTX_wm_window(C),
+   CTX_data_scene(C),
+   "Draw Thumbnails",
+   WM_JOB_PROGRESS,
+   WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL);
+
+  /* Get the thumbnail job if it exists. */
+  tj = WM_jobs_customdata_get(wm_job);
+  if (!tj) {
+tj = MEM_callocN(sizeof(ThumbnailDrawJob), "Thumbnail draw job");
+tj->scene = CTX_data_scene(C);
+tj->x1 = x1;
+tj->offset = offset;
+tj->cache_limits = cache_limits;
+tj->context = context;
+tj->seq = seq;
+WM_jobs_customdata_set(wm_job, tj, thumbnail_freejob);
+WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | 
ND_SEQUENCER);
+WM_jobs_callbacks(wm_job, thumbnail_startjob, NULL, NULL, 
thumbnail_endjob);
+  }
+
+  if (!WM_jobs_is_running(wm_job)) {
+G.is_break = false;
+WM_jobs_start(CTX_wm_manager(C), wm_job);
+  }
+
+  ED_area_tag_redraw(area);
+}
+
 static void draw_seq_strip_thumbnail(View2D *v2d,
  const bContext *C,
  SpaceSeq *sseq,
@@ -1096,16 +1165,14 @@ static void draw_seq_strip_thumbnail(View2D *v2d,
 {
   struct Main *bmain = CTX_data_main(C);
   struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
+  ScrArea *area = CTX_wm_area(C);
   SeqRenderData context 

[Bf-blender-cvs] [f28759541fc] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-07-10 Thread Aditya Y Jeppu
Commit: f28759541fc6009302460ecd4c0171ad4d9f4bcd
Author: Aditya Y Jeppu
Date:   Sat Jul 10 18:12:11 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBf28759541fc6009302460ecd4c0171ad4d9f4bcd

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [49a363f0e0d] master: LineArt: Fix edge type panel `use_cache` prop.

2021-07-10 Thread YimingWu
Commit: 49a363f0e0d837464503a934920033acf9a354ec
Author: YimingWu
Date:   Sat Jul 10 21:52:35 2021 +0800
Branches: master
https://developer.blender.org/rB49a363f0e0d837464503a934920033acf9a354ec

LineArt: Fix edge type panel `use_cache` prop.

The name was mistakenly written as `use_cached_result`. Fixed.

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index bcead683220..21007bab5d2 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -338,7 +338,7 @@ static void edge_types_panel_draw(const bContext 
*UNUSED(C), Panel *panel)
   PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, 
&ob_ptr);
 
   const bool is_baked = RNA_boolean_get(ptr, "is_baked");
-  const bool use_cache = RNA_boolean_get(ptr, "use_cached_result");
+  const bool use_cache = RNA_boolean_get(ptr, "use_cache");
   const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, 
ptr->data);
 
   uiLayoutSetEnabled(layout, !is_baked);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [40027f31b35] soc-2020-io-performance: Consistent var naming, function usage.

2021-07-10 Thread Ankit Meel
Commit: 40027f31b3508848d9c9c9a1d048344901d95906
Author: Ankit Meel
Date:   Sat Jul 10 19:08:45 2021 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rB40027f31b3508848d9c9c9a1d048344901d95906

Consistent var naming, function usage.

===

M   source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
M   source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
M   source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh

===

diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc 
b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
index 2895c3fb647..b1cacfb2026 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
@@ -356,11 +356,9 @@ void OBJWriter::write_poly_elements(const OBJMesh 
&obj_mesh_data,
   /* Number of normals may not be equal to number of polygons due to smooth 
shading. */
   int per_object_tot_normals = 0;
   const int tot_polygons = obj_mesh_data.tot_polygons();
-  /* If we aren't exporting UVs, need an array for the ignored argument to 
poly_element_writer. */
-  Array dummy_uvs(0);
-  Span uvs = dummy_uvs.as_span();
   for (int i = 0; i < tot_polygons; i++) {
 Vector poly_vertex_indices = 
obj_mesh_data.calc_poly_vertex_indices(i);
+Span poly_uv_indices = obj_mesh_data.calc_poly_uv_indices(i);
 /* For an Object, a normal index depends on how many of its normals have 
been written before
  * it. This is unknown because of smooth shading. So pass "per object 
total normals"
  * and update it after each call. */
@@ -373,10 +371,7 @@ void OBJWriter::write_poly_elements(const OBJMesh 
&obj_mesh_data,
 last_poly_smooth_group = write_smooth_group(obj_mesh_data, i, 
last_poly_smooth_group);
 last_poly_vertex_group = write_vertex_group(obj_mesh_data, i, 
last_poly_vertex_group);
 last_poly_mat_nr = write_poly_material(obj_mesh_data, i, last_poly_mat_nr, 
matname_fn);
-if (export_params_.export_uv) {
-  uvs = obj_mesh_data.uv_indices(i);
-}
-(this->*poly_element_writer)(poly_vertex_indices, uvs, 
poly_normal_indices);
+(this->*poly_element_writer)(poly_vertex_indices, poly_uv_indices, 
poly_normal_indices);
   }
   /* Unusual: Other indices are updated in #OBJWriter::update_index_offsets. */
   index_offsets_.normal_offset += per_object_tot_normals;
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc 
b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index d4b017bcece..7b7c5a7c4f1 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@ -154,16 +154,6 @@ int OBJMesh::tot_uv_vertices() const
   return tot_uv_vertices_;
 }
 
-/**
- * \return UV vertex indices of one polygon.
- */
-Span OBJMesh::uv_indices(const int poly_index) const
-{
-  BLI_assert(poly_index < export_mesh_eval_->totpoly);
-  BLI_assert(poly_index < uv_indices_.size());
-  return uv_indices_[poly_index];
-}
-
 int OBJMesh::tot_edges() const
 {
   return export_mesh_eval_->totedge;
@@ -354,6 +344,15 @@ void 
OBJMesh::store_uv_coords_and_indices(Vector> &r_uv_coo
   BKE_mesh_uv_vert_map_free(uv_vert_map);
 }
 
+Span OBJMesh::calc_poly_uv_indices(const int poly_index) const
+{
+  if (uv_indices_.size() <= 0) {
+return {};
+  }
+  BLI_assert(poly_index < export_mesh_eval_->totpoly);
+  BLI_assert(poly_index < uv_indices_.size());
+  return uv_indices_[poly_index];
+}
 /**
  * Calculate polygon normal of a polygon at given index.
  *
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh 
b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
index f73a114659d..6e6cf6383a9 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
@@ -96,7 +96,6 @@ class OBJMesh : NonCopyable {
   int tot_vertices() const;
   int tot_polygons() const;
   int tot_uv_vertices() const;
-  Span uv_indices(const int poly_index) const;
   int tot_edges() const;
 
   int16_t tot_materials() const;
@@ -117,6 +116,7 @@ class OBJMesh : NonCopyable {
   float3 calc_vertex_coords(const int vert_index, const float scaling_factor) 
const;
   Vector calc_poly_vertex_indices(const int poly_index) const;
   void store_uv_coords_and_indices(Vector> &r_uv_coords);
+  Span calc_poly_uv_indices(const int poly_index) const;
   float3 calc_poly_normal(const int poly_index) const;
   std::pair> calc_poly_normal_indices(const int poly_index,
const int 
object_tot_prev_normals) const;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
h

[Bf-blender-cvs] [2cb056af9a5] soc-2020-io-performance: Merge branch 'master' into soc-2020-io-performance

2021-07-10 Thread Ankit Meel
Commit: 2cb056af9a51575f8e21df27891a2e7106f85151
Author: Ankit Meel
Date:   Sat Jul 10 19:04:19 2021 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rB2cb056af9a51575f8e21df27891a2e7106f85151

Merge branch 'master' into soc-2020-io-performance

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e1abd5947ff] soc-2021-uv-editor-improvements: UV: Absolute grid snap for UV editor

2021-07-10 Thread Siddhartha Jejurkar
Commit: e1abd5947ff920ec322e52b708ae4fc54fa8dec1
Author: Siddhartha Jejurkar
Date:   Sat Jul 10 17:32:07 2021 +0530
Branches: soc-2021-uv-editor-improvements
https://developer.blender.org/rBe1abd5947ff920ec322e52b708ae4fc54fa8dec1

UV: Absolute grid snap for UV editor

Adds a UI toggle for absolute grid snap when using Increment snapping in
UV editor. This implementation mimics the behavior observed with the
same toggle in the 3D viewport.

===

M   release/scripts/startup/bl_ui/space_image.py
M   source/blender/editors/transform/transform_snap.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index 8451d337e92..e7616a4e5ed 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -941,6 +941,10 @@ class IMAGE_PT_snapping(Panel):
 col.label(text="Target")
 row = col.row(align=True)
 row.prop(tool_settings, "snap_target", expand=True)
+
+col.separator()
+if 'INCREMENT' in tool_settings.snap_uv_element:
+col.prop(tool_settings, "use_snap_uv_grid_absolute")
 
 col.label(text="Affect")
 row = col.row(align=True)
diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index 2619fdf3403..a1f65dcc7c8 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -590,6 +590,12 @@ static void initSnappingMode(TransInfo *t)
 t->tsnap.project = 0;
 
 t->tsnap.mode = ts->snap_uv_mode;
+/* NOTE : For now, absolute grid snap only works with translation */
+if ((t->tsnap.mode & SCE_SNAP_MODE_INCREMENT) && (ts->snap_flag & 
SCE_SNAP_ABS_UV_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);
@@ -1539,7 +1545,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 (!((t->spacetype == SPACE_VIEW3D) || (t->spacetype == SPACE_IMAGE))) {
 return false;
   }
 
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index f110d8c998e..274c4b96ff6 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1460,14 +1460,12 @@ typedef struct ToolSettings {
 
   char edge_mode_live_unwrap;
 
-  char _pad1[1];
-
   /* Transform */
   char transform_pivot_point;
   char transform_flag;
   char snap_mode, snap_node_mode;
   char snap_uv_mode;
-  char snap_flag;
+  short snap_flag;
   char snap_target;
   char snap_transform_mode_flag;
 
@@ -2048,6 +2046,7 @@ enum {
 #define SCE_SNAP_ABS_GRID (1 << 5)
 #define SCE_SNAP_BACKFACE_CULLING (1 << 6)
 #define SCE_SNAP_SEQ (1 << 7)
+#define SCE_SNAP_ABS_UV_GRID (1 << 8)
 
 /** #ToolSettings.snap_target */
 #define SCE_SNAP_TARGET_CLOSEST 0
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 0a91d5f01bc..57f26ae998c 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3139,6 +3139,14 @@ static void rna_def_tool_settings(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Snap UV Element", "Type of element to snap 
to");
   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header 
redraw */
 
+  prop = RNA_def_property(srna, "use_snap_uv_grid_absolute", PROP_BOOLEAN, 
PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ABS_UV_GRID);
+  RNA_def_property_ui_text(
+  prop,
+  "Absolute Grid Snap",
+  "Absolute grid alignment while translating (based on the pivot center)");
+  RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header 
redraw */
+
   prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_sdna(prop, NULL, "snap_target");
   RNA_def_property_enum_items(prop, rna_enum_snap_target_items);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs