[Bf-blender-cvs] [e27c89c7c7c] master: Docs: added missing documentation for `WindowManager` methods

2023-02-06 Thread Jon Denning
Commit: e27c89c7c7c4db37afca8e54f07905973b7a09e3
Author: Jon Denning
Date:   Mon Feb 6 22:40:10 2023 -0500
Branches: master
https://developer.blender.org/rBe27c89c7c7c4db37afca8e54f07905973b7a09e3

Docs: added missing documentation for `WindowManager` methods

Added missing documentation for `draw_cursor_add` and
`draw_cursor_remove` methods for `WindowManager`.

Differential Revision: https://developer.blender.org/D14860

===

M   source/blender/python/intern/bpy_rna_types_capi.c

===

diff --git a/source/blender/python/intern/bpy_rna_types_capi.c 
b/source/blender/python/intern/bpy_rna_types_capi.c
index 2b830eb9ffe..99bcc17654a 100644
--- a/source/blender/python/intern/bpy_rna_types_capi.c
+++ b/source/blender/python/intern/bpy_rna_types_capi.c
@@ -139,15 +139,48 @@ static int pyrna_WindowManager_clipboard_set(PyObject 
*UNUSED(self),
 /** \name Window Manager Type
  * \{ */
 
+PyDoc_STRVAR(
+pyrna_draw_cursor_add_doc,
+".. method:: draw_cursor_add(callback, args, space_type, region_type)\n"
+"\n"
+"   Add a new draw cursor handler to this space type.\n"
+"   It will be called every time the cursor for the specified region in 
the space "
+"type will be drawn.\n"
+"   Note: All arguments are positional only for now.\n"
+"\n"
+"   :param callback:\n"
+"  A function that will be called when the cursor is drawn.\n"
+"  It gets the specified arguments as input with the mouse position 
(tuple) as last "
+"argument.\n"
+"   :type callback: function\n"
+"   :param args: Arguments that will be passed to the callback.\n"
+"   :type args: tuple\n"
+"   :param space_type: The space type the callback draws in; for example 
``VIEW_3D``. "
+"(:class:`bpy.types.Space.type`)\n"
+"   :type space_type: str\n"
+"   :param region_type: The region type the callback draws in; usually 
``WINDOW``. "
+"(:class:`bpy.types.Region.type`)\n"
+"   :type region_type: str\n"
+"   :return: Handler that can be removed later on.\n"
+"   :rtype: object\n");
+
+PyDoc_STRVAR(pyrna_draw_cursor_remove_doc,
+ ".. method:: draw_cursor_remove(handler)\n"
+ "\n"
+ "   Remove a draw cursor handler that was added previously.\n"
+ "\n"
+ "   :param handler: The draw cursor handler that should be 
removed.\n"
+ "   :type handler: object\n");
+
 static struct PyMethodDef pyrna_windowmanager_methods[] = {
 {"draw_cursor_add",
  (PyCFunction)pyrna_callback_classmethod_add,
  METH_VARARGS | METH_CLASS,
- ""},
+ pyrna_draw_cursor_add_doc},
 {"draw_cursor_remove",
  (PyCFunction)pyrna_callback_classmethod_remove,
  METH_VARARGS | METH_CLASS,
- ""},
+ pyrna_draw_cursor_remove_doc},
 {NULL, NULL, 0, NULL},
 };

___
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] [6485941d7a8] retopo_transform: Merge branch 'master' into retopo_transform

2022-07-29 Thread jon denning
Commit: 6485941d7a8158381288ce044b657e2c147ff73a
Author: jon denning
Date:   Fri Jul 29 13:51:49 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB6485941d7a8158381288ce044b657e2c147ff73a

Merge branch 'master' into retopo_transform

===



===



___
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] [4f33dcff780] retopo_transform: Merge branch 'active_modal_operator' into retopo_transform

2022-07-29 Thread jon denning
Commit: 4f33dcff78028358f09ddcfc28aff9b4aad2bbd0
Author: jon denning
Date:   Tue Jul 26 10:00:23 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB4f33dcff78028358f09ddcfc28aff9b4aad2bbd0

Merge branch 'active_modal_operator' into retopo_transform

===



===



___
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] [eee25a175ad] retopo_transform: Merge branch 'master' into retopo_transform

2022-07-29 Thread jon denning
Commit: eee25a175ad3c0736878918bacd4995e67195ec0
Author: jon denning
Date:   Wed Jul 27 14:31:45 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBeee25a175ad3c0736878918bacd4995e67195ec0

Merge branch 'master' into retopo_transform

===



===



___
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] [66c6cf0d712] retopo_transform: Added operator to determine if operator is actively modal

2022-07-29 Thread jon denning
Commit: 66c6cf0d7120737a90c9762a38188f7d4d49ad01
Author: jon denning
Date:   Tue Jul 26 09:50:35 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB66c6cf0d7120737a90c9762a38188f7d4d49ad01

Added operator to determine if operator is actively modal

===

M   source/blender/makesrna/intern/rna_wm_api.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_window.c

===

diff --git a/source/blender/makesrna/intern/rna_wm_api.c 
b/source/blender/makesrna/intern/rna_wm_api.c
index b82458c4442..c57583d0969 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -714,6 +714,11 @@ void RNA_api_window(StructRNA *srna)
   FunctionRNA *func;
   PropertyRNA *parm;
 
+  func = RNA_def_function(srna, "is_operator_modal", 
"WM_active_modal_operator_test");
+  RNA_def_function_ui_description(func, "Test if an operator is actively 
running modal.");
+  parm = RNA_def_boolean(func, "result", 0, "", "Operator running modal");
+  RNA_def_function_return(func, parm);
+
   func = RNA_def_function(srna, "cursor_warp", "WM_cursor_warp");
   parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
   RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
diff --git a/source/blender/windowmanager/WM_api.h 
b/source/blender/windowmanager/WM_api.h
index 44c5b86857d..f7d67274766 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -310,6 +310,11 @@ void WM_paint_cursor_remove_by_type(struct wmWindowManager 
*wm,
 void (*free)(void *));
 void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *region);
 
+/**
+ * Determines whether an operator is actively running modal.
+ */
+bool WM_active_modal_operator_test(struct wmWindow *win);
+
 /**
  * This function requires access to the GHOST_SystemHandle (g_system).
  */
diff --git a/source/blender/windowmanager/intern/wm_window.c 
b/source/blender/windowmanager/intern/wm_window.c
index a1ebe1fc76f..148b4419aaf 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -2000,6 +2000,22 @@ void WM_init_native_pixels(bool do_it)
 
 /** \} */
 
+/*  */
+/** \name Operator API
+ * \{ */
+
+bool WM_active_modal_operator_test(struct wmWindow *win)
+{
+  LISTBASE_FOREACH (wmEventHandler *, handler_base, >modalhandlers) {
+if (handler_base->type == WM_HANDLER_TYPE_OP) {
+  return true;
+}
+  }
+  return false;
+}
+
+/** \} */
+
 /*  */
 /** \name Cursor API
  * \{ */

___
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] [fd39da1df60] retopo_transform: Merge branch 'master' into retopo_transform

2022-07-29 Thread jon denning
Commit: fd39da1df6069f31849f08d057c112c1895b4d4b
Author: jon denning
Date:   Tue Jul 26 10:00:14 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBfd39da1df6069f31849f08d057c112c1895b4d4b

Merge branch 'master' into retopo_transform

===



===



___
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] [dbdab681cfe] retopo_transform: Added operator to determine if operator is actively modal

2022-07-29 Thread jon denning
Commit: dbdab681cfe4dea8f1dc417f0027166dde10e6dc
Author: jon denning
Date:   Tue Jul 26 09:52:53 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBdbdab681cfe4dea8f1dc417f0027166dde10e6dc

Added operator to determine if operator is actively modal

Differential Revision: https://developer.blender.org/D15546

===



===



___
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] [3ac5a52d6ea] retopo_transform: Retopology Snapping Mode now working

2022-07-25 Thread jon denning
Commit: 3ac5a52d6eaa87733fff3a882761b8bea5917525
Author: jon denning
Date:   Tue Jul 26 00:24:37 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB3ac5a52d6eaa87733fff3a882761b8bea5917525

Retopology Snapping Mode now working

===

M   source/blender/editors/transform/transform_snap.c

===

diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index c9377ddfd8c..2dcd95b87c6 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -867,13 +867,14 @@ static void initSnappingRetopoMode(TransInfo *t)
 
   /* Enable all possible targets.  The targets will be filtered based on snap 
method. */
   t->tsnap.source_select = SCE_SNAP_SOURCE_ACTIVE;
+  t->tsnap.targetSnap = TargetSnapActive;
   t->tsnap.target_select &= ~(SCE_SNAP_TARGET_NOT_ACTIVE | 
SCE_SNAP_TARGET_NOT_EDITED |
   SCE_SNAP_TARGET_NOT_NONEDITED);
-  t->tsnap.mode = t->tsnap.mode &
-  ~(SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID | 
SCE_SNAP_MODE_VOLUME);
+  t->tsnap.flag |= (SCE_SNAP_TO_INCLUDE_EDITED | 
SCE_SNAP_TO_INCLUDE_NONEDITED);
+  t->tsnap.flag &= ~(SCE_SNAP_NOT_TO_ACTIVE);
+  t->tsnap.mode &= ~(SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID | 
SCE_SNAP_MODE_VOLUME);
   t->tsnap.project = true;
-
-  setSnappingCallback(t);
+  t->tsnap.flag |= SCE_SNAP_PROJECT;
 }
 
 void initSnapping(TransInfo *t, wmOperator *op)
@@ -972,7 +973,7 @@ void initSnapping(TransInfo *t, wmOperator *op)
 t->tsnap.target_select = SCE_SNAP_TARGET_ALL;
 t->tsnap.align = ((t->tsnap.flag & SCE_SNAP_ROTATE) != 0);
 t->tsnap.project = ((t->tsnap.flag & SCE_SNAP_PROJECT) != 0);
-t->tsnap.peel = ((t->tsnap.flag & SCE_SNAP_PROJECT) != 0);
+t->tsnap.peel = ((t->tsnap.flag & SCE_SNAP_PEEL_OBJECT) != 0);
 SET_FLAG_FROM_TEST(t->tsnap.target_select,
(ts->snap_flag & SCE_SNAP_NOT_TO_ACTIVE),
SCE_SNAP_TARGET_NOT_ACTIVE);

___
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] [d57ce54e305] retopo_transform: UX-related tweaks

2022-07-25 Thread jon denning
Commit: d57ce54e305adbae212a0b073cb31dc79e1228df
Author: jon denning
Date:   Mon Jul 25 10:35:38 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBd57ce54e305adbae212a0b073cb31dc79e1228df

UX-related tweaks

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/editors/transform/transform_ops.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 728ce3f377f..78f76a65950 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6849,8 +6849,11 @@ class VIEW3D_PT_snapping(Panel):
 col_snapto_nonedited = col.column(align=True, heading="Snap To 
Non-Edited")
 col_snapto_nonedited.prop_enum(tool_settings, "snap_elements", 
'FACE')
 col_snapto_nonedited.prop_enum(tool_settings, "snap_elements", 
'FACE_NEAREST')
+# row = col_snapto_nonedited.row(align=True)
+# row.enabled = False
+# row.prop_enum(tool_settings, "snap_elements", 'FACE_NEAREST')
 
-if snap_elements - {'INCREMENT', 'FACE_NEAREST'}:
+if not retopo_mode and snap_elements - {'INCREMENT', 'FACE_NEAREST'}:
 col_snapwith = col.column(align=True)
 col_snapwith.label(text='Snap With')
 col_snapwith.row().prop(tool_settings, "snap_target", expand=True)
diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index 7c5569f1a10..3058d092abe 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -691,8 +691,7 @@ void Transform_Properties(struct wmOperatorType *ot, int 
flags)
  "use_snap_retopology_mode",
  true,
  "Target: Retopology Mode",
- "Snap grabbed geometry to vertices and edges of 
edited objects (if "
- "enabled) and to faces of non-edited objects (if 
enabled)");
+ "Optimize snapping options for retopology work");
   RNA_def_property_flag(prop, PROP_HIDDEN);
 
   /* Face Nearest options */
diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index 5efad44a3ef..c9377ddfd8c 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -866,9 +866,14 @@ static void initSnappingRetopoMode(TransInfo *t)
   }
 
   /* Enable all possible targets.  The targets will be filtered based on snap 
method. */
+  t->tsnap.source_select = SCE_SNAP_SOURCE_ACTIVE;
   t->tsnap.target_select &= ~(SCE_SNAP_TARGET_NOT_ACTIVE | 
SCE_SNAP_TARGET_NOT_EDITED |
   SCE_SNAP_TARGET_NOT_NONEDITED);
+  t->tsnap.mode = t->tsnap.mode &
+  ~(SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID | 
SCE_SNAP_MODE_VOLUME);
   t->tsnap.project = true;
+
+  setSnappingCallback(t);
 }
 
 void initSnapping(TransInfo *t, wmOperator *op)
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index ba8b090..7ab48a648b5 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3402,9 +3402,8 @@ static void rna_def_tool_settings(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "use_snap_retopology_mode", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", 
SCE_SNAP_RETOPOLOGY_MODE);
-  RNA_def_property_ui_text(prop,
-   "Retopology Target Mode",
-   "When enabled, snapping options are optimized for 
retopology work");
+  RNA_def_property_ui_text(
+  prop, "Retopology Snapping Mode", "Optimize snapping options for 
retopology work");
   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header 
redraw */
 
   prop = RNA_def_property(srna, "use_snap_translate", PROP_BOOLEAN, PROP_NONE);

___
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] [60a8ade18aa] retopo_transform: Merge branch 'master' into retopo_transform

2022-07-25 Thread jon denning
Commit: 60a8ade18aa71de448fc5a93873f8d7cba0b8b48
Author: jon denning
Date:   Mon Jul 25 10:38:16 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB60a8ade18aa71de448fc5a93873f8d7cba0b8b48

Merge branch 'master' into retopo_transform

===



===



___
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] [8ab91edd912] retopo_transform: Merge branch 'master' into retopo_transform

2022-07-25 Thread jon denning
Commit: 8ab91edd912947b220366d6534a989bed5955662
Author: jon denning
Date:   Tue Jul 26 00:25:37 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB8ab91edd912947b220366d6534a989bed5955662

Merge branch 'master' into retopo_transform

===



===



___
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] [73aa6b8185e] retopo_transform: snap menu says "Tool" when retopo tool is active

2022-07-25 Thread jon denning
Commit: 73aa6b8185ea3ffe9a7ec6c801286bacb1540cac
Author: jon denning
Date:   Fri Jul 22 11:39:19 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB73aa6b8185ea3ffe9a7ec6c801286bacb1540cac

snap menu says "Tool" when retopo tool is active

===

M   release/scripts/startup/bl_ui/space_view3d.py

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index ed655fb91de..b1956ebac53 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -619,7 +619,11 @@ class VIEW3D_HT_header(Header):
 if show_snap:
 snap_items = 
bpy.types.ToolSettings.bl_rna.properties["snap_elements"].enum_items
 snap_elements = tool_settings.snap_elements
-if len(snap_elements) == 1:
+active_tool = 
context.workspace.tools.from_space_view3d_mode(context.mode, create=False)
+if active_tool.idname.startswith('retopology'):
+text = "Tool"
+icon = 'NONE'
+elif len(snap_elements) == 1:
 text = ""
 for elem in snap_elements:
 icon = snap_items[elem].icon

___
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] [a735b2c335c] retopo_transform: Merge branch 'master' into retopo_transform

2022-07-25 Thread jon denning
Commit: a735b2c335c2a11dc4bf717ee821a5ae605a91e4
Author: jon denning
Date:   Fri Jul 22 11:41:35 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBa735b2c335c2a11dc4bf717ee821a5ae605a91e4

Merge branch 'master' into retopo_transform

===



===



___
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] [afe11eff8a9] retopo_transform: tweaked snap options and snap option descriptions

2022-07-20 Thread jon denning
Commit: afe11eff8a96656dc456d075270ce473b81ee8e3
Author: jon denning
Date:   Wed Jul 20 17:12:13 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBafe11eff8a96656dc456d075270ce473b81ee8e3

tweaked snap options and snap option descriptions

- retopo mode changes layout and options under snap menu
- retopo mode auto sets defaults on options not shown in menu
- reworked descriptions of snap options

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/transform/transform_snap_object.cc
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index f352c8fbec7..ab2ad3c3502 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -632,6 +632,14 @@ class VIEW3D_HT_header(Header):
 row = layout.row(align=True)
 row.prop(tool_settings, "use_snap", text="")
 
+if object_mode == 'EDIT' and obj.type == 'MESH':
+row.prop(
+tool_settings,
+"use_snap_retopology_mode",
+text="",
+icon='MOD_MESHDEFORM',
+)
+
 sub = row.row(align=True)
 sub.popover(
 panel="VIEW3D_PT_snapping",
@@ -6810,45 +6818,65 @@ class VIEW3D_PT_snapping(Panel):
 obj = context.active_object
 object_mode = obj.mode if obj else 'OBJECT'
 show_target_options = object_mode == 'EDIT' and obj.type not in 
{'LATTICE', 'META', 'FONT'}
+multiple_objects = len(context.objects_in_mode) > 1
+retopo_mode = object_mode == 'EDIT' and 
tool_settings.use_snap_retopology_mode
 
 layout = self.layout
 col = layout.column()
 
-if snap_elements != {'INCREMENT'} and show_target_options:
+if show_target_options:
 col.prop(
 tool_settings,
 "use_snap_retopology_mode",
-text="Use Retopology Mode",
+text="Retopology Mode",
 # icon='MOD_MESHDEFORM',
 )
 
-col.label(text="Snap To")
-col.prop(tool_settings, "snap_elements", expand=True)
+if not retopo_mode:
+col_snapto = col.column(align=True, heading="Snap To")
+col_snapto.prop(tool_settings, "snap_elements", expand=True)
+else:
+col_snapto_edited = col.column(align=True, heading="Snap To 
Edited")
+col_snapto_edited.prop_enum(tool_settings, "snap_elements", 
'VERTEX')
+col_snapto_edited.prop_enum(tool_settings, "snap_elements", 'EDGE')
+col_snapto_edited.prop_enum(tool_settings, "snap_elements", 
'EDGE_MIDPOINT')
+col_snapto_edited.prop_enum(tool_settings, "snap_elements", 
'EDGE_PERPENDICULAR')
 
-if 'INCREMENT' in snap_elements:
-col.prop(tool_settings, "use_snap_grid_absolute")
+col_snapto_nonedited = col.column(align=True, heading="Snap To 
Non-Edited")
+col_snapto_nonedited.prop_enum(tool_settings, "snap_elements", 
'FACE')
+col_snapto_nonedited.prop_enum(tool_settings, "snap_elements", 
'FACE_NEAREST')
 
 if snap_elements - {'INCREMENT', 'FACE_NEAREST'}:
-col.label(text="Snap With")
-row = col.row(align=True)
-row.prop(tool_settings, "snap_target", expand=True)
+col_snapwith = col.column(align=True)
+col_snapwith.label(text='Snap With')
+col_snapwith.row().prop(tool_settings, "snap_target", expand=True)
 
 if snap_elements != {'INCREMENT'}:
-col.label(text="Target Selection")
-col_targetsel = col.column(align=True)
-if show_target_options:
-col_targetsel.prop(
-tool_settings,
-"use_snap_self",
-text="Include Active",
-icon='EDITMODE_HLT',
-)
-col_targetsel.prop(
-tool_settings,
-"use_snap_edit",
-text="Include Edited",
-icon='OUTLINER_DATA_MESH',
-)
+col_targetsel = col.column(align=True, heading="Target Selection")
+if not retopo_mode and show_target_options:
+if not multiple_objec

[Bf-blender-cvs] [4ebe1c3e69a] retopo_transform: Merge branch 'master' into retopo_transform

2022-07-20 Thread jon denning
Commit: 4ebe1c3e69a28e8431e53979f198251804290827
Author: jon denning
Date:   Mon Jul 18 12:13:45 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB4ebe1c3e69a28e8431e53979f198251804290827

Merge branch 'master' into retopo_transform

===



===



___
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] [698efac59e4] retopo_transform: Merge branch 'master' into retopo_transform

2022-07-20 Thread jon denning
Commit: 698efac59e4151df84c3c26b7e18275cf338ffbd
Author: jon denning
Date:   Wed Jul 20 17:13:36 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB698efac59e4151df84c3c26b7e18275cf338ffbd

Merge branch 'master' into retopo_transform

===



===



___
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] [887713d08de] retopo_transform: using correct argument now

2022-07-16 Thread jon denning
Commit: 887713d08deb577017e3da451264d1216e531918
Author: jon denning
Date:   Sat Jul 16 10:30:45 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB887713d08deb577017e3da451264d1216e531918

using correct argument now

===

M   source/blender/editors/transform/transform_snap.c
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index 4a82c5a00fa..35a344ba9e6 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -917,7 +917,7 @@ void initSnapping(TransInfo *t, wmOperator *op)
SCE_SNAP_TARGET_NOT_NONEDITED);
   }
 
-  if ((prop = RNA_struct_find_property(op->ptr, "use_snap_selectable")) &&
+  if ((prop = RNA_struct_find_property(op->ptr, 
"use_snap_selectable_only")) &&
   RNA_property_is_set(op->ptr, prop)) {
 SET_FLAG_FROM_TEST(t->tsnap.target_select,
RNA_property_boolean_get(op->ptr, prop),
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 530b18aa8df..85d3cf02e12 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3394,7 +3394,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
   prop, "Snap onto Non-edited", "Snap onto objects not in Edit Mode (Edit 
Mode Only)");
   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header 
redraw */
 
-  prop = RNA_def_property(srna, "use_snap_selectable", PROP_BOOLEAN, 
PROP_NONE);
+  prop = RNA_def_property(srna, "use_snap_selectable_only", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", 
SCE_SNAP_TO_ONLY_SELECTABLE);
   RNA_def_property_ui_text(
   prop, "Snap onto Selectable Only", "Snap only onto objects that are 
selectable");

___
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] [089870ab3a8] retopo_transform: reorg+cleaned snap menu, removed dbg prints, reorg edge snap methods

2022-07-16 Thread jon denning
Commit: 089870ab3a8fdf40139a6737c25dc0662fca24f5
Author: jon denning
Date:   Thu Jul 7 14:50:26 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB089870ab3a8fdf40139a6737c25dc0662fca24f5

reorg+cleaned snap menu, removed dbg prints, reorg edge snap methods

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform_mode_translate.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/transform/transform_snap_object.cc
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 3201dee5b37..a71fc8d959c 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6814,75 +6814,72 @@ class VIEW3D_PT_snapping(Panel):
 snap_elements = tool_settings.snap_elements
 obj = context.active_object
 object_mode = obj.mode if obj else 'OBJECT'
+show_target_options = object_mode == 'EDIT' and obj.type not in 
{'LATTICE', 'META', 'FONT'}
 
 layout = self.layout
 col = layout.column()
-col.active = tool_settings.use_snap
 
-col.label(text="Snap To")
+if snap_elements != {'INCREMENT'} and show_target_options:
+col.prop(
+tool_settings,
+"use_snap_retopology_mode",
+text="Use Retopology Mode",
+# icon='MOD_MESHDEFORM',
+)
 
+col.label(text="Snap To")
 col.prop(tool_settings, "snap_elements", expand=True)
 
-col.separator()
+# col.separator()
 if 'INCREMENT' in snap_elements:
 col.prop(tool_settings, "use_snap_grid_absolute")
 
+if snap_elements - {'INCREMENT', 'FACE_NEAREST'}:
+col.label(text="Snap With")
+row = col.row(align=True)
+row.prop(tool_settings, "snap_target", expand=True)
+
 if snap_elements != {'INCREMENT'}:
-if snap_elements != {'FACE_NEAREST'}:
-col.label(text="Snap With")
-row = col.row(align=True)
-row.prop(tool_settings, "snap_target", expand=True)
-
-if obj:
-show_target_options = object_mode == 'EDIT' and obj.type not 
in {'LATTICE', 'META', 'FONT'}
-col.label(text="Target Selection")
-col_targetsel = col.column(align=True)
-if show_target_options:
-col_targetsel.prop(
-tool_settings,
-"use_snap_self",
-text="Include Active",
-icon='EDITMODE_HLT',
-)
-col_targetsel.prop(
-tool_settings,
-"use_snap_edit",
-text="Include Edited",
-icon='OUTLINER_DATA_MESH',
-)
-col_targetsel.prop(
-tool_settings,
-"use_snap_nonedit",
-text="Include Non-Edited",
-icon='OUTLINER_OB_MESH',
-)
+col.label(text="Target Selection")
+col_targetsel = col.column(align=True)
+if show_target_options:
 col_targetsel.prop(
 tool_settings,
-"use_snap_selectable",
-text="Exclude Non-Selectable",
-icon='RESTRICT_SELECT_OFF',
+"use_snap_self",
+text="Include Active",
+icon='EDITMODE_HLT',
 )
-if show_target_options:
-col_targetsel.prop(
-tool_settings,
-"use_snap_retopology_mode",
-text="Use Retopology Mode",
-icon='MOD_MESHDEFORM',
-)
-
-if object_mode in {'OBJECT', 'POSE', 'EDIT', 'WEIGHT_PAINT'}:
-col.prop(tool_settings, "use_snap_align_rotation")
-
-col.prop(tool_settings, "use_snap_backface_culling")
+col_targetsel.prop(
+tool_settings,
+"use_snap_edit",
+text="Include Edited",
+icon='OUTLINER_DATA_MESH

[Bf-blender-cvs] [8d284d48544] retopo_transform: merged in master

2022-07-16 Thread jon denning
Commit: 8d284d485447984089c3494b8eb69e9c3ea60553
Author: jon denning
Date:   Tue Jul 5 17:01:42 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB8d284d485447984089c3494b8eb69e9c3ea60553

merged in master

===



===

diff --cc release/scripts/startup/bl_ui/space_view3d.py
index 869748a6452,5a38c4175a8..6b932e3df24
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@@ -6781,19 -6830,33 +6833,41 @@@ class VIEW3D_PT_snapping(Panel)
  row.prop(tool_settings, "snap_target", expand=True)
  
  if obj:
 +show_target_options = object_mode == 'EDIT' and obj.type not 
in {'LATTICE', 'META', 'FONT'}
  col.label(text="Target Selection")
  col_targetsel = col.column(align=True)
 -if object_mode == 'EDIT' and obj.type not in {'LATTICE', 
'META', 'FONT'}:
 +if show_target_options:
- # active_use_self = True
- # active_use_self &= not 
(tool_settings.use_proportional_edit and obj.type == 'MESH')
- # active_use_self &= tool_settings.use_snap_edit
- col_targetsel.prop(tool_settings, "use_snap_self", 
text="Include Active", icon='EDITMODE_HLT')
- col_targetsel.prop(tool_settings, "use_snap_edit", 
text="Include Edited", icon='OUTLINER_DATA_MESH')
- col_targetsel.prop(tool_settings, "use_snap_nonedit", 
text="Include Non-Edited", icon='OUTLINER_OB_MESH')
- col_targetsel.prop(tool_settings, "use_snap_selectable", 
text="Exclude Non-Selectable", icon='RESTRICT_SELECT_OFF')
+ col_targetsel.prop(
+ tool_settings,
+ "use_snap_self",
+ text="Include Active",
+ icon='EDITMODE_HLT',
+ )
+ col_targetsel.prop(
+ tool_settings,
+ "use_snap_edit",
+ text="Include Edited",
+ icon='OUTLINER_DATA_MESH',
+ )
+ col_targetsel.prop(
+ tool_settings,
+ "use_snap_nonedit",
+ text="Include Non-Edited",
+ icon='OUTLINER_OB_MESH',
+ )
+ col_targetsel.prop(
+ tool_settings,
+ "use_snap_selectable",
+ text="Exclude Non-Selectable",
+ icon='RESTRICT_SELECT_OFF',
+ )
 +if show_target_options:
- col_targetsel.prop(tool_settings, 
"use_snap_retopology_mode", text="Use Retopology Mode", icon='MOD_MESHDEFORM')
++col_targetsel.prop(
++tool_settings,
++"use_snap_retopology_mode",
++text="Use Retopology Mode",
++icon='MOD_MESHDEFORM',
++)
  
  if object_mode in {'OBJECT', 'POSE', 'EDIT', 'WEIGHT_PAINT'}:
  col.prop(tool_settings, "use_snap_align_rotation")
diff --cc source/blender/editors/transform/transform_snap.c
index ff65f78742a,22d062a71dc..e7556c23888
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@@ -128,12 -128,11 +128,11 @@@ bool activeSnap(const TransInfo *t
  
  bool activeSnap_SnappingIndividual(const TransInfo *t)
  {
-   if (t->tsnap.mode & SCE_SNAP_MODE_FACE_NEAREST) {
- // Face Nearest snapping always snaps individual vertices
 -  if (activeSnap(t) && t->tsnap.mode & SCE_SNAP_MODE_FACE_NEAREST) {
++  if (activeSnap(t) && (t->tsnap.mode & SCE_SNAP_MODE_FACE_NEAREST)) {
  return true;
}
  
-   if (t->tsnap.mode & SCE_SNAP_MODE_FACE_RAYCAST && !t->tsnap.project) {
 -  if (!t->tsnap.project) {
++  if ((t->tsnap.mode & SCE_SNAP_MODE_FACE_RAYCAST) && !t->tsnap.project) {
  return false;
}
  
@@@ -511,13 -509,10 +509,14 @@@ void applySnappingIndividual(TransInfo 
  continue;
}
  
 -  /* If both face ray-cast and face nearest methods are enabled, start 
with face ray-cast and
 -   * fallback to face nearest ray-cast does not hit. */
 -  bool hit = applyFaceProject(t, tc, td);
 +  /* If both face raycast and face nearest methods are enabled, start 
with face raycast a

[Bf-blender-cvs] [db317f070e7] retopo_transform: clean up before split

2022-07-16 Thread jon denning
Commit: db317f070e7e542111fc42c0d0cf555e06d084fc
Author: jon denning
Date:   Thu Jul 7 15:09:23 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBdb317f070e7e542111fc42c0d0cf555e06d084fc

clean up before split

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/editors/transform/transform_snap_object.cc

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 5f790b31afb..71d801c6c7f 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6828,7 +6828,6 @@ class VIEW3D_PT_snapping(Panel):
 col.label(text="Snap To")
 col.prop(tool_settings, "snap_elements", expand=True)
 
-# col.separator()
 if 'INCREMENT' in snap_elements:
 col.prop(tool_settings, "use_snap_grid_absolute")
 
diff --git a/source/blender/editors/transform/transform_snap_object.cc 
b/source/blender/editors/transform/transform_snap_object.cc
index db02031513b..f195a13fb6c 100644
--- a/source/blender/editors/transform/transform_snap_object.cc
+++ b/source/blender/editors/transform/transform_snap_object.cc
@@ -3426,31 +3426,6 @@ static eSnapMode 
transform_snap_context_project_view3d_mixed_impl(SnapObjectCont
   const bool use_retopo_mode = params->snap_target_select & 
SCE_SNAP_TARGET_RETOPOLOGY_MODE;
   const bool use_occlusion_test = params->use_occlusion_test && 
!XRAY_ENABLED(v3d);
 
-  /* Note: if both face raycast and face nearest are enabled, first find 
result of nearest, then
-   * override with raycast. */
-  if ((snap_to_flag & SCE_SNAP_MODE_FACE_NEAREST) && !has_hit) {
-has_hit = nearestWorldObjects(
-sctx, params, init_co, prev_co, loc, no, , _eval, obmat);
-
-if (has_hit) {
-  retval = SCE_SNAP_MODE_FACE_NEAREST;
-
-  copy_v3_v3(r_loc, loc);
-  if (r_no) {
-copy_v3_v3(r_no, no);
-  }
-  if (r_ob) {
-*r_ob = ob_eval;
-  }
-  if (r_obmat) {
-copy_m4_m4(r_obmat, obmat);
-  }
-  if (r_index) {
-*r_index = index;
-  }
-}
-  }
-
   if (snap_to_flag & SCE_SNAP_MODE_FACE_RAYCAST || use_occlusion_test) {
 float ray_start[3], ray_normal[3];
 if (!ED_view3d_win_to_ray_clipped_ex(

___
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] [298711d1589] retopo_transform: Merge branch 'master' into transform_api

2022-07-16 Thread jon denning
Commit: 298711d15894a1249bec11fd64efd0f4e3bcaa8f
Author: jon denning
Date:   Thu Jul 7 10:30:30 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB298711d15894a1249bec11fd64efd0f4e3bcaa8f

Merge branch 'master' into transform_api

===



===



___
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] [a66e20f984f] retopo_transform: merged in master

2022-07-16 Thread jon denning
Commit: a66e20f984f403e65cc8a6f1cf829ef8bef98ab1
Author: jon denning
Date:   Sat Jul 16 06:46:21 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBa66e20f984f403e65cc8a6f1cf829ef8bef98ab1

merged in master

===



===

diff --cc source/blender/editors/transform/transform_ops.c
index 8acea5a0a88,7c94241f3e3..7c5569f1a10
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@@ -678,19 -681,11 +682,18 @@@ void Transform_Properties(struct wmOper
RNA_def_property_flag(prop, PROP_HIDDEN);
prop = RNA_def_boolean(ot->srna, "use_snap_edit", true, "Target: 
Include Edit", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
-   prop = RNA_def_boolean(
-   ot->srna, "use_snap_nonedit", false, "Target: Include Non-Edited", 
"");
+   prop = RNA_def_boolean(ot->srna, "use_snap_nonedit", true, "Target: 
Include Non-Edited", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
prop = RNA_def_boolean(
-   ot->srna, "use_snap_selectable", true, "Target: Exclude 
Non-Selectable", "");
+   ot->srna, "use_snap_selectable_only", false, "Target: Exclude 
Non-Selectable", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
 +  prop = RNA_def_boolean(ot->srna,
 + "use_snap_retopology_mode",
 + true,
 + "Target: Retopology Mode",
 + "Snap grabbed geometry to vertices and edges of 
edited objects (if "
 + "enabled) and to faces of non-edited objects (if 
enabled)");
 +  RNA_def_property_flag(prop, PROP_HIDDEN);
  
/* Face Nearest options */
prop = RNA_def_boolean(

___
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] [cc761cdae6e] retopo_transform: Merge branch 'master' into retopo_transform

2022-07-16 Thread jon denning
Commit: cc761cdae6e595e6937f8b7fc95499f1eba83095
Author: jon denning
Date:   Sat Jul 16 06:53:04 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBcc761cdae6e595e6937f8b7fc95499f1eba83095

Merge branch 'master' into retopo_transform

===



===



___
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] [a2938c86ca0] retopo_transform: using new property name

2022-07-16 Thread jon denning
Commit: a2938c86ca092ddd30295472fe5d87554a30416f
Author: jon denning
Date:   Sat Jul 16 06:52:19 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBa2938c86ca092ddd30295472fe5d87554a30416f

using new property name

===

M   release/scripts/startup/bl_ui/space_view3d.py

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index bd0959a17a7..f352c8fbec7 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6857,7 +6857,7 @@ class VIEW3D_PT_snapping(Panel):
 )
 col_targetsel.prop(
 tool_settings,
-"use_snap_selectable",
+"use_snap_selectable_only",
 text="Exclude Non-Selectable",
 icon='RESTRICT_SELECT_OFF',
 )

___
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] [7502bc583c6] retopo_transform: Merge branch 'master' into transform_api

2022-07-16 Thread jon denning
Commit: 7502bc583c6dfb39dd9e548f47c8e427cfaec6d0
Author: jon denning
Date:   Thu Jul 7 14:51:22 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB7502bc583c6dfb39dd9e548f47c8e427cfaec6d0

Merge branch 'master' into transform_api

===



===



___
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] [1b9e31f0043] retopo_transform: exposed fallback option to Gizmo type

2022-07-16 Thread jon denning
Commit: 1b9e31f0043358dee8345a6a2bd7c580d5b59c05
Author: jon denning
Date:   Wed Jun 8 10:05:18 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB1b9e31f0043358dee8345a6a2bd7c580d5b59c05

exposed fallback option to Gizmo type

Differential Revision: https://developer.blender.org/D15154

===

M   source/blender/makesrna/intern/rna_wm_gizmo.c

===

diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c 
b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 6c3d96726bb..0e307f5b424 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -1398,6 +1398,11 @@ static void rna_def_gizmogroup(BlenderRNA *brna)
0,
"Tool Init",
"Postpone running until tool operator run (when used with a tool)"},
+  {WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP,
+   "TOOL_FALLBACK_KEYMAP",
+   0,
+   "Use fallback tools keymap",
+   "Add fallback tools keymap to this gizmo type."},
   {WM_GIZMOGROUPTYPE_VR_REDRAWS,
"VR_REDRAWS",
0,

___
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] [ed8f2bbf5c9] retopo_transform: Merge branch 'D15153-cursor_relative' into transform_api

2022-07-16 Thread jon denning
Commit: ed8f2bbf5c9257ee282a41dc1acd936feb1db6f1
Author: jon denning
Date:   Wed Jun 8 10:38:14 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBed8f2bbf5c9257ee282a41dc1acd936feb1db6f1

Merge branch 'D15153-cursor_relative' into transform_api

===



===



___
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] [9e88cfbe0ca] retopo_transform: added retopo mode, updated transform ops

2022-07-16 Thread jon denning
Commit: 9e88cfbe0ca254909cf3c1c45ac18195d6559e83
Author: jon denning
Date:   Tue Jun 28 11:46:00 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB9e88cfbe0ca254909cf3c1c45ac18195d6559e83

added retopo mode, updated transform ops

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform_mode_translate.c
M   source/blender/editors/transform/transform_ops.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/transform/transform_snap_object.cc
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_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 142a4baf701..869748a6452 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6765,7 +6765,9 @@ class VIEW3D_PT_snapping(Panel):
 layout = self.layout
 col = layout.column()
 col.active = tool_settings.use_snap
+
 col.label(text="Snap To")
+
 col.prop(tool_settings, "snap_elements", expand=True)
 
 col.separator()
@@ -6779,9 +6781,10 @@ class VIEW3D_PT_snapping(Panel):
 row.prop(tool_settings, "snap_target", expand=True)
 
 if obj:
+show_target_options = object_mode == 'EDIT' and obj.type not 
in {'LATTICE', 'META', 'FONT'}
 col.label(text="Target Selection")
 col_targetsel = col.column(align=True)
-if object_mode == 'EDIT' and obj.type not in {'LATTICE', 
'META', 'FONT'}:
+if show_target_options:
 # active_use_self = True
 # active_use_self &= not 
(tool_settings.use_proportional_edit and obj.type == 'MESH')
 # active_use_self &= tool_settings.use_snap_edit
@@ -6789,6 +6792,8 @@ class VIEW3D_PT_snapping(Panel):
 col_targetsel.prop(tool_settings, "use_snap_edit", 
text="Include Edited", icon='OUTLINER_DATA_MESH')
 col_targetsel.prop(tool_settings, "use_snap_nonedit", 
text="Include Non-Edited", icon='OUTLINER_OB_MESH')
 col_targetsel.prop(tool_settings, "use_snap_selectable", 
text="Exclude Non-Selectable", icon='RESTRICT_SELECT_OFF')
+if show_target_options:
+col_targetsel.prop(tool_settings, 
"use_snap_retopology_mode", text="Use Retopology Mode", icon='MOD_MESHDEFORM')
 
 if object_mode in {'OBJECT', 'POSE', 'EDIT', 'WEIGHT_PAINT'}:
 col.prop(tool_settings, "use_snap_align_rotation")
diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index d9e23b98c66..0e0bdae792b 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1979,6 +1979,9 @@ void transformApply(bContext *C, TransInfo *t)
 {
   t->context = C;
 
+  /* TODO(gfxcoder): removed debug print */
+  printf("\n\ntransformApply\n");
+
   if (t->redraw == TREDRAW_HARD) {
 selectConstraint(t);
 if (t->transform) {
diff --git a/source/blender/editors/transform/transform_mode_translate.c 
b/source/blender/editors/transform/transform_mode_translate.c
index 65690f9069d..3f3efa54b6b 100644
--- a/source/blender/editors/transform/transform_mode_translate.c
+++ b/source/blender/editors/transform/transform_mode_translate.c
@@ -469,6 +469,8 @@ static void applyTranslation(TransInfo *t, const int 
UNUSED(mval[2]))
   add_v3_v3(global_dir, values_ofs);
 }
 
+/* TODO(gfxcoder): removed debug print */
+printf("applyTranslation -> applySnappingAsGroup()\n");
 t->tsnap.snapElem = SCE_SNAP_MODE_NONE;
 applySnappingAsGroup(t, global_dir);
 transform_snap_grid(t, global_dir);
@@ -514,6 +516,8 @@ static void applyTranslation(TransInfo *t, const int 
UNUSED(mval[2]))
   mul_v3_m3v3(t->values_final, t->spacemtx_inv, global_dir);
   headerTranslation(t, (t->con.mode & CON_APPLY) ? t->values_final : 
global_dir, str);
 
+  /* TODO(gfxcoder): removed debug print */
+  printf("applyTranslation -> recalcData()\n");
   recalcData(t);
   ED_area_status_text(t->area, str);
 }
diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index e0d6ecac6f9..6f0e4ffcf35 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -656,7 +656,7 @@ void Transform_Properties(struct wmOpe

[Bf-blender-cvs] [405bbb06f20] retopo_transform: Merge branch 'D15154-gizmogroup_fallback' into transform_api

2022-07-16 Thread jon denning
Commit: 405bbb06f20df4fc8a836f416163673a3ba74b96
Author: jon denning
Date:   Wed Jun 8 10:38:29 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB405bbb06f20df4fc8a836f416163673a3ba74b96

Merge branch 'D15154-gizmogroup_fallback' into transform_api

===



===



___
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] [8791762af0a] retopo_transform: exposed cursor_warp_relative through api

2022-07-16 Thread jon denning
Commit: 8791762af0abe0bf6164b08f08566bded307eaba
Author: jon denning
Date:   Wed Jun 8 10:08:04 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB8791762af0abe0bf6164b08f08566bded307eaba

exposed cursor_warp_relative through api

Differential Revision: https://developer.blender.org/D15153

===

M   source/blender/makesrna/intern/rna_wm_api.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_cursors.c
M   source/blender/windowmanager/intern/wm_window.c

===

diff --git a/source/blender/makesrna/intern/rna_wm_api.c 
b/source/blender/makesrna/intern/rna_wm_api.c
index b9f36d35ee8..b0858ad4513 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -727,6 +727,13 @@ void RNA_api_window(StructRNA *srna)
   RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
   RNA_def_function_ui_description(func, "Set the cursor position");
 
+  func = RNA_def_function(srna, "cursor_warp_relative", 
"WM_cursor_warp_relative");
+  parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "Offset of x", 
INT_MIN, INT_MAX);
+  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+  parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "Offset of y", 
INT_MIN, INT_MAX);
+  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+  RNA_def_function_ui_description(func, "Offset the cursor position");
+
   func = RNA_def_function(srna, "cursor_set", "WM_cursor_set");
   parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_items(parm, rna_enum_window_cursor_items);
diff --git a/source/blender/windowmanager/WM_api.h 
b/source/blender/windowmanager/WM_api.h
index ac06ababfd4..cbf21f49132 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -314,6 +314,7 @@ void WM_paint_cursor_tag_redraw(struct wmWindow *win, 
struct ARegion *region);
  * This function requires access to the GHOST_SystemHandle (g_system).
  */
 void WM_cursor_warp(struct wmWindow *win, int x, int y);
+void WM_cursor_warp_relative(struct wmWindow *win, int x, int y);
 /**
  * Set x, y to values we can actually position the cursor to.
  */
diff --git a/source/blender/windowmanager/intern/wm_cursors.c 
b/source/blender/windowmanager/intern/wm_cursors.c
index fc992ef069d..3cb1b240524 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -279,14 +279,6 @@ void WM_cursor_grab_disable(wmWindow *win, const int 
mouse_ungrab_xy[2])
   }
 }
 
-static void wm_cursor_warp_relative(wmWindow *win, int x, int y)
-{
-  /* NOTE: don't use wmEvent coords because of continuous grab T36409. */
-  int cx, cy;
-  wm_cursor_position_get(win, , );
-  WM_cursor_warp(win, cx + x, cy + y);
-}
-
 bool wm_cursor_arrow_move(wmWindow *win, const wmEvent *event)
 {
   /* TODO: give it a modal keymap? Hard coded for now */
@@ -296,19 +288,19 @@ bool wm_cursor_arrow_move(wmWindow *win, const wmEvent 
*event)
 float fac = GHOST_GetNativePixelSize(win->ghostwin);
 
 if (event->type == EVT_UPARROWKEY) {
-  wm_cursor_warp_relative(win, 0, fac);
+  WM_cursor_warp_relative(win, 0, fac);
   return 1;
 }
 if (event->type == EVT_DOWNARROWKEY) {
-  wm_cursor_warp_relative(win, 0, -fac);
+  WM_cursor_warp_relative(win, 0, -fac);
   return 1;
 }
 if (event->type == EVT_LEFTARROWKEY) {
-  wm_cursor_warp_relative(win, -fac, 0);
+  WM_cursor_warp_relative(win, -fac, 0);
   return 1;
 }
 if (event->type == EVT_RIGHTARROWKEY) {
-  wm_cursor_warp_relative(win, fac, 0);
+  WM_cursor_warp_relative(win, fac, 0);
   return 1;
 }
   }
diff --git a/source/blender/windowmanager/intern/wm_window.c 
b/source/blender/windowmanager/intern/wm_window.c
index c0427f9be9a..82ac0fc369c 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -2022,6 +2022,16 @@ void WM_cursor_warp(wmWindow *win, int x, int y)
   }
 }
 
+void WM_cursor_warp_relative(wmWindow *win, int x, int y)
+{
+  if (win && win->ghostwin) {
+/* NOTE: don't use wmEvent coords because of continuous grab T36409. */
+int cx, cy;
+wm_cursor_position_get(win, , );
+WM_cursor_warp(win, cx + x, cy + y);
+  }
+}
+
 void WM_cursor_compatible_xy(wmWindow *win, int *x, int *y)
 {
   float f = GHOST_GetNativePixelSize(win->ghostwin);

___
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] [af9c969768b] retopo_transform: Merge branch 'master' into D14591-transform_snap_nearest

2022-07-16 Thread jon denning
Commit: af9c969768b28dfd6df6b23df6e8a6913db224c5
Author: jon denning
Date:   Tue Jun 7 09:32:37 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBaf9c969768b28dfd6df6b23df6e8a6913db224c5

Merge branch 'master' into D14591-transform_snap_nearest

===



===



___
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] [ddce8e9ea38] retopo_transform: Merge branch 'master' into transform_api

2022-07-16 Thread jon denning
Commit: ddce8e9ea382c80017dd679a5a6f9f3db39dff9f
Author: jon denning
Date:   Wed Jun 8 10:37:56 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBddce8e9ea382c80017dd679a5a6f9f3db39dff9f

Merge branch 'master' into transform_api

===



===

diff --cc source/blender/blenloader/intern/versioning_300.c
index 29ff7d7a0ae,57240b93ab1..23d844c1256
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@@ -3067,12 -3057,40 +3057,48 @@@ void blo_do_versions_300(FileData *fd, 
}
  }
  
+ /* Use the curves type enum for the set spline type node, instead of a 
special one. */
+ FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
+   if (ntree->type == NTREE_GEOMETRY) {
+ LISTBASE_FOREACH (bNode *, node, >nodes) {
+   if (node->type == GEO_NODE_CURVE_SPLINE_TYPE) {
+ NodeGeometryCurveSplineType *storage = 
(NodeGeometryCurveSplineType *)node->storage;
+ switch (storage->spline_type) {
+   case 0: /* GEO_NODE_SPLINE_TYPE_BEZIER */
+ storage->spline_type = CURVE_TYPE_BEZIER;
+ break;
+   case 1: /* GEO_NODE_SPLINE_TYPE_NURBS */
+ storage->spline_type = CURVE_TYPE_NURBS;
+ break;
+   case 2: /* GEO_NODE_SPLINE_TYPE_POLY */
+ storage->spline_type = CURVE_TYPE_POLY;
+ break;
+ }
+   }
+ }
+   }
+ }
+ FOREACH_NODETREE_END;
++
 +LISTBASE_FOREACH (Scene *, scene, >scenes) {
 +  ToolSettings *tool_settings = scene->toolsettings;
 +  /* Minimum of snap steps for face nearest is 1. */
 +  tool_settings->snap_face_nearest_steps = 1;
 +  /* Set snap to edited and nonedited as default. */
 +  tool_settings->snap_flag |= SCE_SNAP_TO_INCLUDE_EDITED | 
SCE_SNAP_TO_INCLUDE_NONEDITED;
 +}
}
+ 
+   /**
+* Versioning code until next subversion bump goes here.
+*
+* \note Be sure to check when bumping the version:
+* - "versioning_userdef.c", #blo_do_versions_userdef
+* - "versioning_userdef.c", #do_versions_theme
+*
+* \note Keep this message at the bottom of the function.
+*/
+   {
+ /* Keep this block, even when empty. */
+   }
  }

___
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] [b818008ddf0] retopo_transform: addressed reviewer comments, updated versioning (untested)

2022-07-16 Thread jon denning
Commit: b818008ddf0a4dcbf9b0f993c21504a30fbf54c0
Author: jon denning
Date:   Tue Jun 7 11:12:28 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBb818008ddf0a4dcbf9b0f993c21504a30fbf54c0

addressed reviewer comments, updated versioning (untested)

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/editors/transform/transform_ops.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/transform/transform_snap_object.cc
M   source/blender/makesdna/DNA_scene_defaults.h
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_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index d1aeeb80b94..e0e38f6e765 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6780,15 +6780,15 @@ class VIEW3D_PT_snapping(Panel):
 
 if obj:
 col.label(text="Target Selection")
-targetselection = col.column(align=True)
+col_targetsel = col.column(align=True)
 if object_mode == 'EDIT' and obj.type not in {'LATTICE', 
'META', 'FONT'}:
 # active_use_self = True
 # active_use_self &= not 
(tool_settings.use_proportional_edit and obj.type == 'MESH')
 # active_use_self &= tool_settings.use_snap_edit
-targetselection.prop(tool_settings, "use_snap_self", 
text="Include Active", icon='EDITMODE_HLT')
-targetselection.prop(tool_settings, "use_snap_edit", 
text="Include Edited", icon='OUTLINER_DATA_MESH')
-targetselection.prop(tool_settings, "use_snap_nonedit", 
text="Include Non-edited", icon='OUTLINER_OB_MESH')
-targetselection.prop(tool_settings, "use_snap_selectable", 
text="Exclude Non-Selectable", icon='RESTRICT_SELECT_OFF')
+col_targetsel.prop(tool_settings, "use_snap_self", 
text="Include Active", icon='EDITMODE_HLT')
+col_targetsel.prop(tool_settings, "use_snap_edit", 
text="Include Edited", icon='OUTLINER_DATA_MESH')
+col_targetsel.prop(tool_settings, "use_snap_nonedit", 
text="Include Non-edited", icon='OUTLINER_OB_MESH')
+col_targetsel.prop(tool_settings, "use_snap_selectable", 
text="Exclude Non-Selectable", icon='RESTRICT_SELECT_OFF')
 
 if object_mode in {'OBJECT', 'POSE', 'EDIT', 'WEIGHT_PAINT'}:
 col.prop(tool_settings, "use_snap_align_rotation")
diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index 76d12cc1109..29ff7d7a0ae 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -3066,5 +3066,13 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 SEQ_for_each_callback(>seqbase, version_merge_still_offsets, NULL);
   }
 }
+
+LISTBASE_FOREACH (Scene *, scene, >scenes) {
+  ToolSettings *tool_settings = scene->toolsettings;
+  /* Minimum of snap steps for face nearest is 1. */
+  tool_settings->snap_face_nearest_steps = 1;
+  /* Set snap to edited and nonedited as default. */
+  tool_settings->snap_flag |= SCE_SNAP_TO_INCLUDE_EDITED | 
SCE_SNAP_TO_INCLUDE_NONEDITED;
+}
   }
 }
diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index 1098e8cb90c..73404811992 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -663,10 +663,10 @@ void Transform_Properties(struct wmOperatorType *ot, int 
flags)
 RNA_def_boolean(ot->srna, "use_snap_project", false, "Project Individual 
Elements", "");
 
 if (flags & P_GEO_SNAP) {
-  /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid
-   * previous ambiguity of "target" (now, "source" is geometry to be moved 
and "target" is
-   * geometry to which moved geometry is snapped).  Use "Source snap 
point" and "Point on
-   * source that will snap to target" for name and description, 
respectively. */
+  /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid 
previous ambiguity of
+   * "target" (now, "source" is geometry to be moved and "target" i

[Bf-blender-cvs] [af29d103c69] retopo_transform: sync icons

2022-07-16 Thread jon denning
Commit: af29d103c69ab3682d5fa501ee751a390750f8c4
Author: jon denning
Date:   Wed Jun 8 09:42:57 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBaf29d103c69ab3682d5fa501ee751a390750f8c4

sync icons

===

M   release/datafiles/blender_icons16/icon16_force_boid.dat
R100release/datafiles/blender_icons16/icon16_snap_surface.dat   
release/datafiles/blender_icons16/icon16_snap_face_nearest.dat
M   release/datafiles/blender_icons32/icon32_force_boid.dat
R100release/datafiles/blender_icons32/icon32_snap_surface.dat   
release/datafiles/blender_icons32/icon32_snap_face_nearest.dat

===

diff --git a/release/datafiles/blender_icons16/icon16_force_boid.dat 
b/release/datafiles/blender_icons16/icon16_force_boid.dat
index 71f89bd7c04..f719054d84a 100644
Binary files a/release/datafiles/blender_icons16/icon16_force_boid.dat and 
b/release/datafiles/blender_icons16/icon16_force_boid.dat differ
diff --git a/release/datafiles/blender_icons16/icon16_snap_surface.dat 
b/release/datafiles/blender_icons16/icon16_snap_face_nearest.dat
similarity index 100%
rename from release/datafiles/blender_icons16/icon16_snap_surface.dat
rename to release/datafiles/blender_icons16/icon16_snap_face_nearest.dat
diff --git a/release/datafiles/blender_icons32/icon32_force_boid.dat 
b/release/datafiles/blender_icons32/icon32_force_boid.dat
index 7fc7cb5ee8c..9043989024b 100644
Binary files a/release/datafiles/blender_icons32/icon32_force_boid.dat and 
b/release/datafiles/blender_icons32/icon32_force_boid.dat differ
diff --git a/release/datafiles/blender_icons32/icon32_snap_surface.dat 
b/release/datafiles/blender_icons32/icon32_snap_face_nearest.dat
similarity index 100%
rename from release/datafiles/blender_icons32/icon32_snap_surface.dat
rename to release/datafiles/blender_icons32/icon32_snap_face_nearest.dat

___
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] [ca336c600b8] retopo_transform: revert transform API changes (moved to another patch)

2022-07-16 Thread jon denning
Commit: ca336c600b86b93bca7d0f78c25cbe40106c10ae
Author: jon denning
Date:   Tue Jun 7 16:25:15 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBca336c600b86b93bca7d0f78c25cbe40106c10ae

revert transform API changes (moved to another patch)

===

M   source/blender/editors/transform/transform_ops.c

===

diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index cb5d9e6c3d0..472b2b36750 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -566,17 +566,6 @@ static bool transform_poll_property(const bContext 
*UNUSED(C),
 }
   }
 
-  /* Snapping. */
-  {
-PropertyRNA *prop_snap = RNA_struct_find_property(op->ptr, "snap");
-if (prop_snap && (prop_snap != prop) &&
-(RNA_property_boolean_get(op->ptr, prop_snap) == false)) {
-  if (STRPREFIX(prop_id, "snap") || STRPREFIX(prop_id, "use_snap")) {
-return false;
-  }
-}
-  }
-
   return true;
 }
 
@@ -659,17 +648,11 @@ void Transform_Properties(struct wmOperatorType *ot, int 
flags)
 prop = RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
 RNA_def_property_flag(prop, PROP_HIDDEN);
 
-prop = RNA_def_enum(
-ot->srna, "snap_elements", rna_enum_snap_element_items, 0, "Snap to 
Elements", "");
-RNA_def_property_flag(prop, PROP_ENUM_FLAG);
-
-RNA_def_boolean(ot->srna, "use_snap_project", false, "Project Individual 
Elements", "");
-
 if (flags & P_GEO_SNAP) {
-  /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid 
previous ambiguity of
-   * "target" (now, "source" is geometry to be moved and "target" is 
geometry to which moved
-   * geometry is snapped).  Use "Source snap point" and "Point on source 
that will snap to
-   * target" for name and description, respectively. */
+  /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid
+   * previous ambiguity of "target" (now, "source" is geometry to be moved 
and "target" is
+   * geometry to which moved geometry is snapped).  Use "Source snap 
point" and "Point on
+   * source that will snap to target" for name and description, 
respectively. */
   prop = RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_source_items, 
0, "Target", "");
   RNA_def_property_flag(prop, PROP_HIDDEN);
   prop = RNA_def_float_vector(
@@ -677,7 +660,8 @@ void Transform_Properties(struct wmOperatorType *ot, int 
flags)
   RNA_def_property_flag(prop, PROP_HIDDEN);
 
   if (flags & P_ALIGN_SNAP) {
-RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", 
"");
+prop = RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point 
Normal", "");
+RNA_def_property_flag(prop, PROP_HIDDEN);
 prop = RNA_def_float_vector(
 ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", 
-FLT_MAX, FLT_MAX);
 RNA_def_property_flag(prop, PROP_HIDDEN);

___
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] [8d813f2eed8] retopo_transform: added snapping options to transform api

2022-07-16 Thread jon denning
Commit: 8d813f2eed8b5139acd670f1d7a33e5a0f449d81
Author: jon denning
Date:   Wed Jun 8 09:45:03 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB8d813f2eed8b5139acd670f1d7a33e5a0f449d81

added snapping options to transform api

===

M   source/blender/editors/transform/transform_ops.c

===

diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index 472b2b36750..e0d6ecac6f9 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -566,6 +566,17 @@ static bool transform_poll_property(const bContext 
*UNUSED(C),
 }
   }
 
+  /* Snapping. */
+  {
+PropertyRNA *prop_snap = RNA_struct_find_property(op->ptr, "snap");
+if (prop_snap && (prop_snap != prop) &&
+(RNA_property_boolean_get(op->ptr, prop_snap) == false)) {
+  if (STRPREFIX(prop_id, "snap") || STRPREFIX(prop_id, "use_snap")) {
+return false;
+  }
+}
+  }
+
   return true;
 }
 
@@ -648,13 +659,31 @@ void Transform_Properties(struct wmOperatorType *ot, int 
flags)
 prop = RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
 RNA_def_property_flag(prop, PROP_HIDDEN);
 
+prop = RNA_def_enum(
+ot->srna, "snap_elements", rna_enum_snap_element_items, 0, "Snap to 
Elements", "");
+RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+
+RNA_def_boolean(ot->srna, "use_snap_project", false, "Project Individual 
Elements", "");
+
 if (flags & P_GEO_SNAP) {
-  /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid
-   * previous ambiguity of "target" (now, "source" is geometry to be moved 
and "target" is
-   * geometry to which moved geometry is snapped).  Use "Source snap 
point" and "Point on
-   * source that will snap to target" for name and description, 
respectively. */
-  prop = RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_source_items, 
0, "Target", "");
+  /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid 
previous ambiguity of
+   * "target" (now, "source" is geometry to be moved and "target" is 
geometry to which moved
+   * geometry is snapped).  Use "Source snap point" and "Point on source 
that will snap to
+   * target" for name and description, respectively. */
+  prop = RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_source_items, 
0, "Snap With", "");
   RNA_def_property_flag(prop, PROP_HIDDEN);
+
+  /* Target selection. */
+  prop = RNA_def_boolean(ot->srna, "use_snap_self", true, "Target: Include 
Active", "");
+  RNA_def_property_flag(prop, PROP_HIDDEN);
+  prop = RNA_def_boolean(ot->srna, "use_snap_edit", true, "Target: Include 
Edit", "");
+  RNA_def_property_flag(prop, PROP_HIDDEN);
+  prop = RNA_def_boolean(ot->srna, "use_snap_nonedit", true, "Target: 
Include Non-Edited", "");
+  RNA_def_property_flag(prop, PROP_HIDDEN);
+  prop = RNA_def_boolean(
+  ot->srna, "use_snap_selectable", true, "Target: Exclude 
Non-Selectable", "");
+  RNA_def_property_flag(prop, PROP_HIDDEN);
+
   prop = RNA_def_float_vector(
   ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", 
-FLT_MAX, FLT_MAX);
   RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -667,6 +696,11 @@ void Transform_Properties(struct wmOperatorType *ot, int 
flags)
 RNA_def_property_flag(prop, PROP_HIDDEN);
   }
 }
+else {
+  prop = RNA_def_boolean(
+  ot->srna, "use_snap_selectable", true, "Target: Exclude 
Non-Selectable", "");
+  RNA_def_property_flag(prop, PROP_HIDDEN);
+}
   }
 
   if (flags & P_GPENCIL_EDIT) {

___
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] [139a651434b] retopo_transform: explicit tests against 0 rather than implicit bool coversion

2022-07-16 Thread jon denning
Commit: 139a651434ba67ada560a37ec9fd93bcc0f0094d
Author: jon denning
Date:   Tue Jun 7 11:56:06 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB139a651434ba67ada560a37ec9fd93bcc0f0094d

explicit tests against 0 rather than implicit bool coversion

===

M   source/blender/editors/transform/transform_snap.c

===

diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index 2e3611b5182..dfe290c6425 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -734,10 +734,10 @@ static eSnapTargetSelect snap_select_target_get(TransInfo 
*t)
 
   eSnapTargetSelect ret = SCE_SNAP_TARGET_ALL;
 
-  bool use_snap_active = !(t->tsnap.target_select & 
SCE_SNAP_TARGET_NOT_ACTIVE);
-  bool use_snap_edit = !(t->tsnap.target_select & SCE_SNAP_TARGET_NOT_EDITED);
-  bool use_snap_nonedit = !(t->tsnap.target_select & 
SCE_SNAP_TARGET_NOT_NONEDITED);
-  bool use_snap_selectable_only = (t->tsnap.target_select & 
SCE_SNAP_TARGET_ONLY_SELECTABLE);
+  bool use_snap_active = (t->tsnap.target_select & SCE_SNAP_TARGET_NOT_ACTIVE) 
== 0;
+  bool use_snap_edit = (t->tsnap.target_select & SCE_SNAP_TARGET_NOT_EDITED) 
== 0;
+  bool use_snap_nonedit = (t->tsnap.target_select & 
SCE_SNAP_TARGET_NOT_NONEDITED) == 0;
+  bool use_snap_selectable_only = (t->tsnap.target_select & 
SCE_SNAP_TARGET_ONLY_SELECTABLE) != 0;
 
   if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE) && !(t->options & 
CTX_CAMERA)) {
 if (base_act && (base_act->object->mode & OB_MODE_PARTICLE_EDIT)) {

___
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] [62f813754df] retopo_transform: minor change to capitalization of label

2022-07-16 Thread jon denning
Commit: 62f813754df01e7d16fe96ee32d67582c4766804
Author: jon denning
Date:   Tue Jun 7 16:10:26 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB62f813754df01e7d16fe96ee32d67582c4766804

minor change to capitalization of label

===

M   release/scripts/startup/bl_ui/space_view3d.py

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index e0e38f6e765..142a4baf701 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6787,7 +6787,7 @@ class VIEW3D_PT_snapping(Panel):
 # active_use_self &= tool_settings.use_snap_edit
 col_targetsel.prop(tool_settings, "use_snap_self", 
text="Include Active", icon='EDITMODE_HLT')
 col_targetsel.prop(tool_settings, "use_snap_edit", 
text="Include Edited", icon='OUTLINER_DATA_MESH')
-col_targetsel.prop(tool_settings, "use_snap_nonedit", 
text="Include Non-edited", icon='OUTLINER_OB_MESH')
+col_targetsel.prop(tool_settings, "use_snap_nonedit", 
text="Include Non-Edited", icon='OUTLINER_OB_MESH')
 col_targetsel.prop(tool_settings, "use_snap_selectable", 
text="Exclude Non-Selectable", icon='RESTRICT_SELECT_OFF')
 
 if object_mode in {'OBJECT', 'POSE', 'EDIT', 'WEIGHT_PAINT'}:

___
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] [cbeb70bdae1] retopo_transform: replaced static_cast with enum operator

2022-07-16 Thread jon denning
Commit: cbeb70bdae1d586a5efe2bd8941f72e011df3516
Author: jon denning
Date:   Tue Jun 7 12:09:04 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBcbeb70bdae1d586a5efe2bd8941f72e011df3516

replaced static_cast with enum operator

===

M   source/blender/editors/transform/transform_snap_object.cc

===

diff --git a/source/blender/editors/transform/transform_snap_object.cc 
b/source/blender/editors/transform/transform_snap_object.cc
index 5ec23bd318f..afb73128d56 100644
--- a/source/blender/editors/transform/transform_snap_object.cc
+++ b/source/blender/editors/transform/transform_snap_object.cc
@@ -3113,16 +3113,16 @@ static void snap_obj_fn(SnapObjectContext *sctx,
 case OB_FONT: {
   const Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob_eval);
   if (mesh_eval) {
-retval = static_cast(retval | snapMesh(sctx,
-  params,
-  ob_eval,
-  mesh_eval,
-  obmat,
-  false,
-  dt->dist_px,
-  dt->r_loc,
-  dt->r_no,
-  dt->r_index));
+retval |= snapMesh(sctx,
+   params,
+   ob_eval,
+   mesh_eval,
+   obmat,
+   false,
+   dt->dist_px,
+   dt->r_loc,
+   dt->r_no,
+   dt->r_index);
   }
   break;
 }

___
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] [491ada0a382] retopo_transform: revert some transform_ops.c

2022-07-16 Thread jon denning
Commit: 491ada0a382b45e9b4aed5fa3942c6de5725d268
Author: jon denning
Date:   Tue Jun 7 16:13:04 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB491ada0a382b45e9b4aed5fa3942c6de5725d268

revert some transform_ops.c

===

M   source/blender/editors/transform/transform_ops.c

===

diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index 4c87df758e1..cb5d9e6c3d0 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -657,6 +657,7 @@ void Transform_Properties(struct wmOperatorType *ot, int 
flags)
   if (flags & P_SNAP) {
 // TODO: rename `snap` to `use_snap`?
 prop = RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
+RNA_def_property_flag(prop, PROP_HIDDEN);
 
 prop = RNA_def_enum(
 ot->srna, "snap_elements", rna_enum_snap_element_items, 0, "Snap to 
Elements", "");
@@ -670,7 +671,7 @@ void Transform_Properties(struct wmOperatorType *ot, int 
flags)
* geometry is snapped).  Use "Source snap point" and "Point on source 
that will snap to
* target" for name and description, respectively. */
   prop = RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_source_items, 
0, "Target", "");
-  // RNA_def_property_flag(prop, PROP_HIDDEN);
+  RNA_def_property_flag(prop, PROP_HIDDEN);
   prop = RNA_def_float_vector(
   ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", 
-FLT_MAX, FLT_MAX);
   RNA_def_property_flag(prop, PROP_HIDDEN);

___
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] [59e6dc8a930] retopo_transform: minor variable name change

2022-07-16 Thread jon denning
Commit: 59e6dc8a9307e313bcdfbf90f5d0a8ef92073cae
Author: jon denning
Date:   Tue Jun 7 11:44:56 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB59e6dc8a9307e313bcdfbf90f5d0a8ef92073cae

minor variable name change

===

M   source/blender/editors/transform/transform_ops.c

===

diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index 73404811992..21a0db37dad 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -568,8 +568,9 @@ static bool transform_poll_property(const bContext 
*UNUSED(C),
 
   /* Snapping. */
   {
-PropertyRNA *prop_pet = RNA_struct_find_property(op->ptr, "snap");
-if (prop_pet && (prop_pet != prop) && (RNA_property_boolean_get(op->ptr, 
prop_pet) == false)) {
+PropertyRNA *prop_snap = RNA_struct_find_property(op->ptr, "snap");
+if (prop_snap && (prop_snap != prop) &&
+(RNA_property_boolean_get(op->ptr, prop_snap) == false)) {
   if (STRPREFIX(prop_id, "snap") || STRPREFIX(prop_id, "use_snap")) {
 return false;
   }

___
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] [6410fe04929] retopo_transform: improved comments

2022-07-16 Thread jon denning
Commit: 6410fe04929b3dcec8a4fcc244d62a41cebdf3f9
Author: jon denning
Date:   Tue Jun 7 11:22:55 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB6410fe04929b3dcec8a4fcc244d62a41cebdf3f9

improved comments

===

M   source/blender/editors/include/ED_transform_snap_object_context.h

===

diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h 
b/source/blender/editors/include/ED_transform_snap_object_context.h
index f9de6604a68..151bf877460 100644
--- a/source/blender/editors/include/ED_transform_snap_object_context.h
+++ b/source/blender/editors/include/ED_transform_snap_object_context.h
@@ -59,9 +59,10 @@ struct SnapObjectParams {
   bool use_occlusion_test : true;
   /* exclude back facing geometry from snapping */
   bool use_backface_culling : true;
-  short face_nearest_steps; /* break nearest face snapping into steps */
-  bool keep_on_same_target; /* nearest face snapping should snap only to 
target source was
-   initially near */
+  /* Break nearest face snapping into steps to improve transformations across 
U-shaped targets. */
+  short face_nearest_steps;
+  /* Enable to force nearest face snapping to snap to target the source was 
initially near. */
+  bool keep_on_same_target;
 };
 
 typedef struct SnapObjectContext SnapObjectContext;

___
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] [59adee83e7c] retopo_transform: Transform Snap: added nearest face snap mode, added snapping options, lightly refactored snapping code.

2022-07-16 Thread Jon Denning
Commit: 59adee83e7cd1e312a28d8dc96a5ced04ca2036e
Author: Jon Denning
Date:   Fri Jun 3 10:48:04 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB59adee83e7cd1e312a28d8dc96a5ced04ca2036e

Transform Snap: added nearest face snap mode, added snapping options, lightly 
refactored snapping code.

This diff adds a new face nearest snapping mode, adds new snapping options, and 
(lightly) refactors code around snapping.

The new face nearest snapping mode will snap transformed geometry to the 
nearest surface in world space.  In contrast, the original face snapping mode 
uses projection (raycasting) to snap source to target geometry.  Face snapping 
therefore only works with what is visible, while nearest face snapping can snap 
geometry to occluded parts of the scene.  This new mode is critical for 
retopology work, where some of the target mesh might be occluded.

The nearest face snapping mode has two options: "Snap to Same Target" and "Face 
Nearest Steps".  When the Snap to Same Object option is enabled, the selected 
source geometry will stay near the target that it is nearest before editing 
started, which prevents the source geometry from snapping to other targets.  
The Face Nearest Steps divides the overall transformation for each vertex into 
`n` smaller transformations, then applies those `n` transformations with 
surface snapping interlacing e [...]

The new snapping options allow the artist to better control which target 
objects (objects to which the edited geometry is snapped) are considered when 
snapping.  In particular, the only option for filtering target objects was a 
"Project onto Self", which allowed the currently edited mesh to be considered 
as a target.  Now, the artist can choose any combination of the following to be 
considered as a target: the active object, any edited object that isn't active 
(see note below), any non-ed [...]

The Snapping Options dropdown has been lightly reorganized to allow for the 
additional options.

Included in this patch:

  - Refactored the snap-related `#define`s into `enum`s, and refactored 
enum-related `char`, `short`, and `int` to use the appropriate enum instead.
  - Snap target selection is more controllable for artist with additional 
snapping options.
  - Renamed a few of the snap-related functions to better reflect what they 
actually do now.  For example, `applySnapping` implies that this handles the 
snapping, while `applyProject` implies something entirely different is done 
there.  However, better names would be `applySnappingAsGroup` and 
`applySnappingIndividual`, respectively, where `applySnappingIndividual` 
previously only does Face snapping.
  - Added an initial coordinate parameter to snapping functions so that the 
nearest target before transforming can be determined (for "Snap to Same 
Object"), and so the transformation can be broken into smaller steps (for "Face 
Nearest Steps").
  - Separated the BVH Tree getter code from mesh/edit mesh to its own function 
to reduce code duplication.
  - Added icon for nearest face snapping.
  - Updated `startup.blend` so face nearest steps starts at 1, and the snap 
target selection options have reasonable defaults (include self, include 
edited, include nonedited)
  - The original "Project onto Self" was actually not correct!  This option 
should be called "Project onto Active" instead, but that only matters when 
editing multiple meshes at the same time.  This patch makes this change.

Not included in this patch / future updates:

  - Snapping "Target" is a confusing named, as "Target" is used as both the 
transformed items (or `SCE_SNAP_TARGET_CLOSEST`, etc.) and for the objects to 
which the transformed items are snapped (especially Shrinkwrap modifier).  I 
plan to submit another patch to make this clearer after this is accepted.
  - Many of the functions do not specify in which space the point info 
(coordinates and normal) is defined.
  - Target selection code could be simplified by separating it from the uber 
`snap_flag` variable.
  - The snapping dropdown is feeling very disorganized.  Also, since enabling 
both the Face Projection and the Face Nearest methods does not make sense, 
perhaps the switch between these methods could be a checkbox (similar to 
snapping to relative or absolute grid).

Differential Revision: https://developer.blender.org/D14591

===

M   release/datafiles/blender_icons.svg
A   release/datafiles/blender_icons16/icon16_snap_surface.dat
A   release/datafiles/blender_icons32/icon32_snap_surface.dat
M   release/datafiles/startup.blend
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/curve/editcurve.c
M   source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
M   sour

[Bf-blender-cvs] [add307d4298] retopo_transform: added comment

2022-07-16 Thread jon denning
Commit: add307d42981187e5752a593ea26abeeecc549ef
Author: jon denning
Date:   Tue Jun 7 11:46:22 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBadd307d42981187e5752a593ea26abeeecc549ef

added comment

===

M   source/blender/editors/transform/transform_ops.c

===

diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index 21a0db37dad..4c87df758e1 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -655,6 +655,7 @@ void Transform_Properties(struct wmOperatorType *ot, int 
flags)
   }
 
   if (flags & P_SNAP) {
+// TODO: rename `snap` to `use_snap`?
 prop = RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
 
 prop = RNA_def_enum(

___
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] [0b25d923e53] retopo_transform: use face raycast initially with face nearest as fallback

2022-07-16 Thread jon denning
Commit: 0b25d923e53c896e5e121a9c7aeb5592cf6a7d67
Author: jon denning
Date:   Tue Jun 7 09:31:48 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB0b25d923e53c896e5e121a9c7aeb5592cf6a7d67

use face raycast initially with face nearest as fallback

===

M   source/blender/editors/include/ED_transform.h
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/source/blender/editors/include/ED_transform.h 
b/source/blender/editors/include/ED_transform.h
index 24fda1042ac..82cc518f029 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -24,7 +24,7 @@ void transform_operatortypes(void);
 /*  Macros & Prototypes *** */
 
 /* MODE AND NUMINPUT FLAGS */
-typedef enum eTfmMode {
+typedef enum {
   TFM_INIT = -1,
   TFM_DUMMY,
   TFM_TRANSLATION,
diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 8e0ea82bb32..fa99da2fe1f 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1580,7 +1580,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator 
*op)
 if (transformModeUseSnap(t)) {
   if (!(t->modifiers & MOD_SNAP) != !(t->tsnap.flag & SCE_SNAP)) {
 /* Type is #eSnapFlag, but type must match various snap attributes in 
#ToolSettings. */
-char *snap_flag_ptr;
+short *snap_flag_ptr;
 
 wmMsgParams_RNA msg_key_params = {{0}};
 RNA_pointer_create(>scene->id, _ToolSettings, ts, 
_key_params.ptr);
diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index 3649e69281d..e69e996ca71 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -368,10 +368,10 @@ eRedrawFlag handleSnapping(TransInfo *t, const wmEvent 
*event)
   return status;
 }
 
-static void applyFaceProject(TransInfo *t, TransDataContainer *tc, TransData 
*td)
+static bool applyFaceProject(TransInfo *t, TransDataContainer *tc, TransData 
*td)
 {
   if (!(t->tsnap.mode & SCE_SNAP_MODE_FACE_RAYCAST)) {
-return;
+return false;
   }
 
   float iloc[3], loc[3], no[3];
@@ -388,7 +388,7 @@ static void applyFaceProject(TransInfo *t, 
TransDataContainer *tc, TransData *td
 
   if (ED_view3d_project_float_global(t->region, iloc, mval_fl, 
V3D_PROJ_TEST_NOP) !=
   V3D_PROJ_RET_OK) {
-return;
+return false;
   }
 
   eSnapMode hit = ED_transform_snap_object_project_view3d(
@@ -410,7 +410,7 @@ static void applyFaceProject(TransInfo *t, 
TransDataContainer *tc, TransData *td
   loc,
   no);
   if (hit != SCE_SNAP_MODE_FACE_RAYCAST) {
-return;
+return false;
   }
 
 #if 0
@@ -440,6 +440,7 @@ static void applyFaceProject(TransInfo *t, 
TransDataContainer *tc, TransData *td
 
 /* TODO: support constraints for rotation too? see #ElementRotation. */
   }
+  return true;
 }
 
 static void applyFaceNearest(TransInfo *t, TransDataContainer *tc, TransData 
*td)
@@ -532,13 +533,17 @@ void applySnappingIndividual(TransInfo *t)
   if ((t->flag & T_PROP_EDIT) && (td->factor == 0.0f)) {
 continue;
   }
-}
 
-applyFaceProject(t, tc, td);
-applyFaceNearest(t, tc, td);
+  /* If both face raycast and face nearest methods are enabled, start with 
face raycast and
+   * fallback to face nearest raycast does not hit. */
+  bool hit = applyFaceProject(t, tc, td);
+  if (!hit) {
+applyFaceNearest(t, tc, td);
+  }
 #if 0 /* TODO: support this? */
   constraintTransLim(t, td);
 #endif
+}
   }
 }
 
@@ -863,7 +868,7 @@ static void initSnappingMode(TransInfo *t)
 void initSnapping(TransInfo *t, wmOperator *op)
 {
   ToolSettings *ts = t->settings;
-  eSnapTarget snap_target = ts->snap_target;
+  eSnapSourceSelect snap_source = ts->snap_target;
 
   resetSnapping(t);
   t->tsnap.mode = snap_mode_from_spacetype(t);
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 86045fe2cdb..3524d61a52c 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -152,7 +152,7 @@ const EnumPropertyItem rna_enum_snap_element_items[] = {
 {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to 
vertices"},
 {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"},
 {SCE_SNAP_MODE_FACE_RAYCAST,
- "FACE",
+ "FACE", /* TODO(@gfxcoder)

[Bf-blender-cvs] [a863ba191d8] retopo_transform: Merge branch 'master' into D14591-transform_snap_nearest_old

2022-07-16 Thread jon denning
Commit: a863ba191d862cc8ad7e98e20df3433eb856ec25
Author: jon denning
Date:   Mon Jun 6 17:11:32 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBa863ba191d862cc8ad7e98e20df3433eb856ec25

Merge branch 'master' into D14591-transform_snap_nearest_old

===



===

diff --cc source/blender/editors/include/ED_transform_snap_object_context.h
index 71d7930222e,20353c21f93..f9de6604a68
--- a/source/blender/editors/include/ED_transform_snap_object_context.h
+++ b/source/blender/editors/include/ED_transform_snap_object_context.h
@@@ -26,15 -26,7 +26,6 @@@ struct View3D
  /* transform_snap_object.cc */
  
  /* ED_transform_snap_object_*** API */
- typedef enum eSnapTargetSelect {
-   SCE_SNAP_TARGET_ALL = 0,
-   SCE_SNAP_TARGET_NOT_SELECTED = (1 << 0),
-   SCE_SNAP_TARGET_NOT_ACTIVE = (1 << 1),
-   SCE_SNAP_TARGET_NOT_EDITED = (1 << 2),
-   SCE_SNAP_TARGET_ONLY_SELECTABLE = (1 << 3),
-   SCE_SNAP_TARGET_NOT_NONEDITED = (1 << 4),
- } eSnapTargetSelect;
--
  typedef enum eSnapEditType {
SNAP_GEOM_FINAL = 0,
SNAP_GEOM_CAGE = 1,
diff --cc source/blender/editors/transform/transform.h
index d46918e516b,e5ce1842a8e..b42a8d4913b
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@@ -301,14 -301,14 +301,14 @@@ typedef struct TransSnap 
/* Method(s) used for snapping source to target */
eSnapMode mode;
/* Part of source to snap to target */
-   eSnapTarget target;
-   /* Determines which objects are possible target, #eSnapTargetSelect */
-   char target_select;
+   eSnapSourceSelect source_select;
+   /* Determines which objects are possible target */
+   eSnapTargetSelect target_select;
bool align;
bool project;
 -  bool snap_self;
bool peel;
bool use_backface_culling;
 +  short face_nearest_steps;
eTSnap status;
/* Snapped Element Type (currently for objects only). */
eSnapMode snapElem;
diff --cc source/blender/editors/transform/transform_ops.c
index a56341d227f,cd8a2f17554..1098e8cb90c
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@@ -655,15 -645,15 +655,20 @@@ void Transform_Properties(struct wmOper
  
if (flags & P_SNAP) {
  prop = RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
 -RNA_def_property_flag(prop, PROP_HIDDEN);
 +
 +prop = RNA_def_enum(
 +ot->srna, "snap_elements", rna_enum_snap_element_items, 0, "Snap to 
Elements", "");
 +RNA_def_property_flag(prop, PROP_ENUM_FLAG);
 +
 +RNA_def_boolean(ot->srna, "use_snap_project", false, "Project Individual 
Elements", "");
  
  if (flags & P_GEO_SNAP) {
-   RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_target_items, 0, 
"Target", "");
+   /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid
+* previous ambiguity of "target" (now, "source" is geometry to be 
moved and "target" is
+* geometry to which moved geometry is snapped).  Use "Source snap 
point" and "Point on
+* source that will snap to target" for name and description, 
respectively. */
+   prop = RNA_def_enum(ot->srna, "snap_target", 
rna_enum_snap_source_items, 0, "Target", "");
 -  RNA_def_property_flag(prop, PROP_HIDDEN);
++  // RNA_def_property_flag(prop, PROP_HIDDEN);
prop = RNA_def_float_vector(
ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", 
-FLT_MAX, FLT_MAX);
RNA_def_property_flag(prop, PROP_HIDDEN);
diff --cc source/blender/editors/transform/transform_snap.c
index 98ced64ded8,400c351a5d5..3649e69281d
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@@ -413,132 -349,87 +413,132 @@@ static void applyFaceProject(TransInfo 
  return;
}
  
 +#if 0
 +  if (tc->use_local_mat) {
 +mul_m4_v3(tc->imat, loc);
 +  }
 +#endif
 +
float tvec[3];
 -  int i;
 +  sub_v3_v3v3(tvec, loc, iloc);
  
 -  /* XXX FLICKER IN OBJECT MODE */
 -  FOREACH_TRANS_DATA_CONTAINER (t, tc) {
 -TransData *td = tc->data;
 -for (i = 0; i < tc->data_len; i++, td++) {
 -  float iloc[3], loc[3], no[3];
 -  float mval_fl[2];
 -  if (td->flag & TD_SKIP) {
 -continue;
 -  }
 +  mul_m3_v3(td->smtx, tvec);
  
 -  if ((t->flag & T_PROP_EDIT) && (td->factor == 0.0f)) {
 -continue;
 -  }
 +  add_v3_v3(td->loc, tvec);
  
 -  copy_v3_v3(iloc, td->loc);
 -  if (tc->use_local_mat) {
 -mul_m4_v3(tc->ma

[Bf-blender-cvs] [f6063935227] retopo_transform: sync with work on laptop

2022-07-16 Thread jon denning
Commit: f6063935227f0b97f1f635a50486139c09ba04dc
Author: jon denning
Date:   Fri Jun 3 11:53:52 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBf6063935227f0b97f1f635a50486139c09ba04dc

sync with work on laptop

===

M   source/blender/editors/transform/transform_ops.c
M   source/blender/editors/transform/transform_snap.c

===

diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index 600f525b428..a56341d227f 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -566,6 +566,16 @@ static bool transform_poll_property(const bContext 
*UNUSED(C),
 }
   }
 
+  /* Snapping. */
+  {
+PropertyRNA *prop_pet = RNA_struct_find_property(op->ptr, "snap");
+if (prop_pet && (prop_pet != prop) && (RNA_property_boolean_get(op->ptr, 
prop_pet) == false)) {
+  if (STRPREFIX(prop_id, "snap") || STRPREFIX(prop_id, "use_snap")) {
+return false;
+  }
+}
+  }
+
   return true;
 }
 
@@ -645,18 +655,21 @@ void Transform_Properties(struct wmOperatorType *ot, int 
flags)
 
   if (flags & P_SNAP) {
 prop = RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
-RNA_def_property_flag(prop, PROP_HIDDEN);
+
+prop = RNA_def_enum(
+ot->srna, "snap_elements", rna_enum_snap_element_items, 0, "Snap to 
Elements", "");
+RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+
+RNA_def_boolean(ot->srna, "use_snap_project", false, "Project Individual 
Elements", "");
 
 if (flags & P_GEO_SNAP) {
-  prop = RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_target_items, 
0, "Target", "");
-  RNA_def_property_flag(prop, PROP_HIDDEN);
+  RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_target_items, 0, 
"Target", "");
   prop = RNA_def_float_vector(
   ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", 
-FLT_MAX, FLT_MAX);
   RNA_def_property_flag(prop, PROP_HIDDEN);
 
   if (flags & P_ALIGN_SNAP) {
-prop = RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point 
Normal", "");
-RNA_def_property_flag(prop, PROP_HIDDEN);
+RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", 
"");
 prop = RNA_def_float_vector(
 ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", 
-FLT_MAX, FLT_MAX);
 RNA_def_property_flag(prop, PROP_HIDDEN);
diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index 26a833fcaf0..98ced64ded8 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -816,12 +816,7 @@ static eSnapTargetSelect snap_select_target_get(TransInfo 
*t)
 
 static void initSnappingMode(TransInfo *t)
 {
-  ToolSettings *ts = t->settings;
-  t->tsnap.mode = snap_mode_from_spacetype(t);
-  t->tsnap.target_select = snap_select_target_get(t);
-  t->tsnap.face_nearest_steps = max_ii(ts->snap_face_nearest_steps, 1);
-
-  if ((t->spacetype != SPACE_VIEW3D) || !(ts->snap_mode & 
SCE_SNAP_MODE_FACE_RAYCAST)) {
+  if ((t->spacetype != SPACE_VIEW3D) || !(t->tsnap.mode & 
SCE_SNAP_MODE_FACE_RAYCAST)) {
 /* Force project off when not supported. */
 t->tsnap.project = false;
   }
@@ -867,11 +862,15 @@ static void initSnappingMode(TransInfo *t)
 
 void initSnapping(TransInfo *t, wmOperator *op)
 {
-  resetSnapping(t);
-  t->tsnap.flag = snap_flag_from_spacetype(t);
   ToolSettings *ts = t->settings;
   eSnapTarget snap_target = ts->snap_target;
 
+  resetSnapping(t);
+  t->tsnap.mode = snap_mode_from_spacetype(t);
+  t->tsnap.flag = snap_flag_from_spacetype(t);
+  t->tsnap.target_select = snap_select_target_get(t);
+  t->tsnap.face_nearest_steps = max_ii(ts->snap_face_nearest_steps, 1);
+
   /* if snap property exists */
   PropertyRNA *prop;
   if (op && (prop = RNA_struct_find_property(op->ptr, "snap")) &&
@@ -879,6 +878,11 @@ void initSnapping(TransInfo *t, wmOperator *op)
 if (RNA_property_boolean_get(op->ptr, prop)) {
   t->modifiers |= MOD_SNAP;
 
+  if ((prop = RNA_struct_find_property(op->ptr, "snap_elements")) &&
+  RNA_property_is_set(op->ptr, prop)) {
+t->tsnap.mode = RNA_property_enum_get(op->ptr, prop);
+

[Bf-blender-cvs] [f8b389b1218] retopo_transform: Merge branch 'master' into arcpatch-D14591

2022-07-16 Thread jon denning
Commit: f8b389b1218da8153542254e6668b4ba59130b12
Author: jon denning
Date:   Fri Jun 3 11:53:34 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rBf8b389b1218da8153542254e6668b4ba59130b12

Merge branch 'master' into arcpatch-D14591

===



===

diff --cc source/blender/editors/include/ED_view3d.h
index d64015fb873,8695e03a57f..bd69d4779d2
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@@ -7,7 -7,7 +7,8 @@@
  
  #pragma once
  
+ #include "BLI_utildefines.h"
 +#include "DNA_scene_types.h"
  
  #ifdef __cplusplus
  extern "C" {

___
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] [ccdf189d3c5] master: Documentation: Update Docs for Gizmo

2022-07-13 Thread jon denning
Commit: ccdf189d3c5c3b90dbb95b704f684f1cd1bd192c
Author: jon denning
Date:   Wed Jul 13 08:43:57 2022 -0400
Branches: master
https://developer.blender.org/rBccdf189d3c5c3b90dbb95b704f684f1cd1bd192c

Documentation: Update Docs for Gizmo

This patch updates the documentation for arguments regarding the `Gizmo`
type.

- Corrected `select_id` doc for draw_preset_ functions. `-1` indicates
  that no selection ID is to be written, but previous docs incorrectly
  specified `0` instead.
- Added missing doc for `target` argument for `target_set_handler`
  function.

Reviewed by: Aaron Carlisle (Blendify)

Differential Revision: https://developer.blender.org/D14834

===

M   source/blender/makesrna/intern/rna_wm_gizmo_api.c
M   source/blender/python/intern/bpy_rna_gizmo.c

===

diff --git a/source/blender/makesrna/intern/rna_wm_gizmo_api.c 
b/source/blender/makesrna/intern/rna_wm_gizmo_api.c
index 419dfa68305..760121d2279 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo_api.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo_api.c
@@ -211,7 +211,15 @@ void RNA_api_gizmo(StructRNA *srna)
   RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
   RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
   RNA_def_property_ui_text(parm, "", "The matrix to transform");
-  RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", 
"", -1, INT_MAX);
+  RNA_def_int(func,
+  "select_id",
+  -1,
+  -1,
+  INT_MAX,
+  "ID to use when gizmo is selectable.  Use -1 when not selecting",
+  "",
+  -1,
+  INT_MAX);
 
   /* draw_preset_box */
   func = RNA_def_function(srna, "draw_preset_arrow", 
"rna_gizmo_draw_preset_arrow");
@@ -221,7 +229,15 @@ void RNA_api_gizmo(StructRNA *srna)
   RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
   RNA_def_property_ui_text(parm, "", "The matrix to transform");
   RNA_def_enum(func, "axis", rna_enum_object_axis_items, 2, "", "Arrow 
Orientation");
-  RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", 
"", -1, INT_MAX);
+  RNA_def_int(func,
+  "select_id",
+  -1,
+  -1,
+  INT_MAX,
+  "ID to use when gizmo is selectable.  Use -1 when not selecting",
+  "",
+  -1,
+  INT_MAX);
 
   func = RNA_def_function(srna, "draw_preset_circle", 
"rna_gizmo_draw_preset_circle");
   RNA_def_function_ui_description(func, "Draw a box");
@@ -230,7 +246,15 @@ void RNA_api_gizmo(StructRNA *srna)
   RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
   RNA_def_property_ui_text(parm, "", "The matrix to transform");
   RNA_def_enum(func, "axis", rna_enum_object_axis_items, 2, "", "Arrow 
Orientation");
-  RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", 
"", -1, INT_MAX);
+  RNA_def_int(func,
+  "select_id",
+  -1,
+  -1,
+  INT_MAX,
+  "ID to use when gizmo is selectable.  Use -1 when not selecting",
+  "",
+  -1,
+  INT_MAX);
 
   /*  */
   /* Other Shapes */
@@ -243,7 +267,15 @@ void RNA_api_gizmo(StructRNA *srna)
   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
   parm = RNA_def_int(func, "face_map", 0, 0, INT_MAX, "Face map index", "", 0, 
INT_MAX);
   RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-  RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", 
"", -1, INT_MAX);
+  RNA_def_int(func,
+  "select_id",
+  -1,
+  -1,
+  INT_MAX,
+  "ID to use when gizmo is selectable.  Use -1 when not selecting",
+  "",
+  -1,
+  INT_MAX);
 
   /*  */
   /* Property API */
diff --git a/source/blender/python/intern/bpy_rna_gizmo.c 
b/source/blender/python/intern/bpy_rna_gizmo.c
index 61f439e5152..32ef7865e84 100644
--- a/source/blender/python/intern/bpy_rna_gizmo.c
+++ b/source/blender/python/intern/bpy_rna_gizmo.c
@@ -314,6 +314,8 @@ PyDoc_STRVAR(
 "\n"
 "   Assigns callbacks to a gizmos property.\n"
 "\n"
+"   :arg target: Target property name.\n"
+"   :type target: string\n"
 "   :arg get: Function that returns the value for this property (single 
value or sequence).\n"
 "   :type get: callable\n"
 "   :arg set: Function that takes a single value argument and applies 
it.\n"

___
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] [441dd08dba3] master: Expose option for fallback tools keymap in GizmoGroup type

2022-07-13 Thread jon denning
Commit: 441dd08dba34d22e8a34d54b252e8cdd38f2c56c
Author: jon denning
Date:   Wed Jul 13 08:30:40 2022 -0400
Branches: master
https://developer.blender.org/rB441dd08dba34d22e8a34d54b252e8cdd38f2c56c

Expose option for fallback tools keymap in GizmoGroup type

This patch allows new GizmoGroup classes to support tool fallback keymap.

With this patch, when new gizmo groups add `'TOOL_FALLBACK_KEYMAP'` to
its `bl_options`, the fallback tools are added to the group. This
allows a `WorkSpaceTool` (for example) to have selection be a fallback
tool if the user LeftMouse drags away from other gizmos in the group.

Reviewed by: Campbell Barton (campbellbarton)

Differential Revision: https://developer.blender.org/D15154

===

M   source/blender/makesrna/intern/rna_wm_gizmo.c

===

diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c 
b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 6c3d96726bb..0e307f5b424 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -1398,6 +1398,11 @@ static void rna_def_gizmogroup(BlenderRNA *brna)
0,
"Tool Init",
"Postpone running until tool operator run (when used with a tool)"},
+  {WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP,
+   "TOOL_FALLBACK_KEYMAP",
+   0,
+   "Use fallback tools keymap",
+   "Add fallback tools keymap to this gizmo type."},
   {WM_GIZMOGROUPTYPE_VR_REDRAWS,
"VR_REDRAWS",
0,

___
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] [c484599687b] master: Expose snap options in transform operators

2022-07-13 Thread jon denning
Commit: c484599687ba1757e3092f7fe2ffd0db56e9cbb6
Author: jon denning
Date:   Wed Jul 13 07:07:43 2022 -0400
Branches: master
https://developer.blender.org/rBc484599687ba1757e3092f7fe2ffd0db56e9cbb6

Expose snap options in transform operators

This commit exposes snap options in transform operators. These options
are needed for Python tools to control snapping without requiring the
tool settings to be adjusted.

The newly exposed options are:

- `snap_elements` for choosing which element(s) of target the source
  geometry should snap to (ex: Face Raycast).
- `use_snap_self`, `use_snap_edit`, `use_snap_nonedit`,
  `use_snap_selectable_only` for controlling target selection.
- `use_snap_project` for controlling Face Raycast snapping.
- `use_snap_to_same_target` and `snap_face_nearest_steps` for
  controlling Face Nearest snapping.

Reviewed by: Campbell Barton (campbellbarton)

Differential Revision: https://developer.blender.org/D15398

===

M   source/blender/editors/transform/transform_ops.c

===

diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index a64eff8f981..7c94241f3e3 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -566,6 +566,17 @@ static bool transform_poll_property(const bContext 
*UNUSED(C),
 }
   }
 
+  /* Snapping. */
+  {
+PropertyRNA *prop_snap = RNA_struct_find_property(op->ptr, "snap");
+if (prop_snap && (prop_snap != prop) &&
+(RNA_property_boolean_get(op->ptr, prop_snap) == false)) {
+  if (STRPREFIX(prop_id, "snap") || STRPREFIX(prop_id, "use_snap")) {
+return false;
+  }
+}
+  }
+
   return true;
 }
 
@@ -644,28 +655,63 @@ void Transform_Properties(struct wmOperatorType *ot, int 
flags)
   }
 
   if (flags & P_SNAP) {
-prop = RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
+prop = RNA_def_boolean(ot->srna, "snap", false, "Use Snapping Options", 
"");
 RNA_def_property_flag(prop, PROP_HIDDEN);
 
+prop = RNA_def_enum(ot->srna,
+"snap_elements",
+rna_enum_snap_element_items,
+SCE_SNAP_MODE_INCREMENT,
+"Snap to Elements",
+"");
+RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+
+RNA_def_boolean(ot->srna, "use_snap_project", false, "Project Individual 
Elements", "");
+
 if (flags & P_GEO_SNAP) {
-  /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid
-   * previous ambiguity of "target" (now, "source" is geometry to be moved 
and "target" is
-   * geometry to which moved geometry is snapped).  Use "Source snap 
point" and "Point on
-   * source that will snap to target" for name and description, 
respectively. */
-  prop = RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_source_items, 
0, "Target", "");
+  /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid 
previous ambiguity of
+   * "target" (now, "source" is geometry to be moved and "target" is 
geometry to which moved
+   * geometry is snapped).  Use "Source snap point" and "Point on source 
that will snap to
+   * target" for name and description, respectively. */
+  prop = RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_source_items, 
0, "Snap With", "");
+  RNA_def_property_flag(prop, PROP_HIDDEN);
+
+  /* Target selection. */
+  prop = RNA_def_boolean(ot->srna, "use_snap_self", true, "Target: Include 
Active", "");
   RNA_def_property_flag(prop, PROP_HIDDEN);
+  prop = RNA_def_boolean(ot->srna, "use_snap_edit", true, "Target: Include 
Edit", "");
+  RNA_def_property_flag(prop, PROP_HIDDEN);
+  prop = RNA_def_boolean(ot->srna, "use_snap_nonedit", true, "Target: 
Include Non-Edited", "");
+  RNA_def_property_flag(prop, PROP_HIDDEN);
+  prop = RNA_def_boolean(
+  ot->srna, "use_snap_selectable_only", false, "Target: Exclude 
Non-Selectable", "");
+  RNA_def_property_flag(prop, PROP_HIDDEN);
+
+  /* Face Nearest options */
+  prop = RNA_def_boolean(
+  ot->srna, "use_snap_to_same_target", false, "Snap to Same Target", 
"");
+  RNA_def_property_flag(prop, PROP_HIDDEN);
+  prop = RNA_def_int(
+  ot->s

[Bf-blender-cvs] [3354ec3fb3f] master: Fix T99334: Ignore edit-related snap options in Object mode

2022-07-06 Thread jon denning
Commit: 3354ec3fb3f6c0785c7c1ad9d84bae1c58d1628f
Author: jon denning
Date:   Wed Jul 6 16:21:56 2022 -0400
Branches: master
https://developer.blender.org/rB3354ec3fb3f6c0785c7c1ad9d84bae1c58d1628f

Fix T99334: Ignore edit-related snap options in Object mode

When in Object Mode, any of the active- and edit-related snapping
options (Include Active, Include Edited, Include Non-Edited) should be
ignored when in Object Mode, otherwise snapping could be effectively
disabled.

This commit forces snap code to ignore the active- and edit-related
options when in Object Mode.

Reviewed By: Germano Cavalcante (mano-wii)

Differential Revision: https://developer.blender.org/D15366

===

M   source/blender/editors/transform/transform_snap_object.cc

===

diff --git a/source/blender/editors/transform/transform_snap_object.cc 
b/source/blender/editors/transform/transform_snap_object.cc
index 817474f795e..479214ee2d3 100644
--- a/source/blender/editors/transform/transform_snap_object.cc
+++ b/source/blender/editors/transform/transform_snap_object.cc
@@ -492,39 +492,39 @@ static bool snap_object_is_snappable(const 
SnapObjectContext *sctx,
 return false;
   }
 
-  /* get base attributes */
+  /* Get attributes of potential target. */
   const bool is_active = (base_act == base);
   const bool is_selected = (base->flag & BASE_SELECTED) || (base->flag_legacy 
& BA_WAS_SEL);
   const bool is_edited = (base->object->mode == OB_MODE_EDIT);
   const bool is_selectable = (base->flag & BASE_SELECTABLE);
+  /* Get attributes of state. */
   const bool is_in_object_mode = (base_act == NULL) || (base_act->object->mode 
== OB_MODE_OBJECT);
 
-  if (is_edited) {
-if (is_active) {
-  if (snap_target_select & SCE_SNAP_TARGET_NOT_ACTIVE) {
-return false;
-  }
-}
-else {
-  if (snap_target_select & SCE_SNAP_TARGET_NOT_EDITED) {
-return false;
-  }
+  if (is_in_object_mode) {
+/* Handle target selection options that make sense for object mode. */
+if ((snap_target_select & SCE_SNAP_TARGET_NOT_SELECTED) && is_selected) {
+  /* What is selectable or not is part of the object and depends on the 
mode. */
+  return false;
 }
   }
-
-  if ((snap_target_select & SCE_SNAP_TARGET_NOT_NONEDITED) && !is_edited) {
-return false;
+  else {
+/* Handle target selection options that make sense for edit/pose mode. */
+if ((snap_target_select & SCE_SNAP_TARGET_NOT_ACTIVE) && is_active) {
+  return false;
+}
+if ((snap_target_select & SCE_SNAP_TARGET_NOT_EDITED) && is_edited && 
!is_active) {
+  /* Base is edited, but not active. */
+  return false;
+}
+if ((snap_target_select & SCE_SNAP_TARGET_NOT_NONEDITED) && !is_edited) {
+  return false;
+}
   }
 
   if ((snap_target_select & SCE_SNAP_TARGET_ONLY_SELECTABLE) && 
!is_selectable) {
 return false;
   }
 
-  if ((snap_target_select & SCE_SNAP_TARGET_NOT_SELECTED) && is_in_object_mode 
&& is_selected) {
-/* What is selectable or not is part of the object and depends on the 
mode. */
-return false;
-  }
-
   return true;
 }

___
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] [011327224ec] master: Transform Snap: nearest face snap mode, snapping options, refactoring.

2022-06-29 Thread jon denning
Commit: 011327224ecec1312e0780865a1fb0dc83830a30
Author: jon denning
Date:   Wed Jun 29 20:52:00 2022 -0400
Branches: master
https://developer.blender.org/rB011327224ecec1312e0780865a1fb0dc83830a30

Transform Snap: nearest face snap mode, snapping options, refactoring.

This commit adds a new face nearest snapping mode, adds new snapping
options, and (lightly) refactors code around snapping.

The new face nearest snapping mode will snap transformed geometry to the
nearest surface in world space. In contrast, the original face snapping
mode uses projection (raycasting) to snap source to target geometry.
Face snapping therefore only works with what is visible, while nearest
face snapping can snap geometry to occluded parts of the scene. This new
mode is critical for retopology work, where some of the target mesh
might be occluded (ex: sliding an edge loop that wraps around the
backside of target mesh).

The nearest face snapping mode has two options: "Snap to Same Target"
and "Face Nearest Steps". When the Snap to Same Object option is
enabled, the selected source geometry will stay near the target that it
is nearest before editing started, which prevents the source geometry
from snapping to other targets. The Face Nearest Steps divides the
overall transformation for each vertex into n smaller transformations,
then applies those n transformations with surface snapping interlacing
each step. This steps option handles transformations that cross U-shaped
targets better.

The new snapping options allow the artist to better control which target
objects (objects to which the edited geometry is snapped) are considered
when snapping. In particular, the only option for filtering target
objects was a "Project onto Self", which allowed the currently edited
mesh to be considered as a target. Now, the artist can choose any
combination of the following to be considered as a target: the active
object, any edited object that isn't active (see note below), any non-
edited object. Additionally, the artist has another snapping option to
exclude objects that are not selectable as potential targets.

The Snapping Options dropdown has been lightly reorganized to allow for
the additional options.

Included in this patch:

- Snap target selection is more controllable for artist with additional
  snapping options.
- Renamed a few of the snap-related functions to better reflect what
  they actually do now. For example, `applySnapping` implies that this
  handles the snapping, while `applyProject` implies something entirely
  different is done there. However, better names would be
  `applySnappingAsGroup` and `applySnappingIndividual`, respectively,
  where `applySnappingIndividual` previously only does Face snapping.
- Added an initial coordinate parameter to snapping functions so that
  the nearest target before transforming can be determined(for "Snap to
  Same Object"), and so the transformation can be broken into smaller
  steps (for "Face Nearest Steps").
- Separated the BVH Tree getter code from mesh/edit mesh to its own
  function to reduce code duplication.
- Added icon for nearest face snapping.
- The original "Project onto Self" was actually not correct! This option
  should be called "Project onto Active" instead, but that only matters
  when editing multiple meshes at the same time. This patch makes this
  change in the UI.

Reviewed By: Campbell Barton, Germano Cavalcante

Differential Revision: https://developer.blender.org/D14591

===

M   release/datafiles/blender_icons.svg
A   release/datafiles/blender_icons16/icon16_snap_face_nearest.dat
A   release/datafiles/blender_icons32/icon32_snap_face_nearest.dat
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/editors/curve/editcurve.c
M   source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
M   source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
M   source/blender/editors/include/ED_transform_snap_object_context.h
M   source/blender/editors/include/UI_icons.h
M   source/blender/editors/mesh/editmesh_extrude.c
M   source/blender/editors/mesh/editmesh_utils.c
M   source/blender/editors/space_view3d/view3d_cursor_snap.c
M   source/blender/editors/space_view3d/view3d_edit.c
M   source/blender/editors/space_view3d/view3d_gizmo_ruler.c
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_constraints.c
M   source/blender/editors/transform/transform_convert_armature.c
M   source/blender/editors/transform/transform_convert_curve.c
M   source/blender/editors/transform/transform_convert_lattice.c
M   source/blender/edit

[Bf-blender-cvs] [3772dda4ab1] master: Refactor: Snap-related. Clarified attribute names and refactored #defines into enums

2022-06-06 Thread jon denning
Commit: 3772dda4ab1b071676a051e76324262a0d90dd49
Author: jon denning
Date:   Mon Jun 6 10:28:14 2022 -0400
Branches: master
https://developer.blender.org/rB3772dda4ab1b071676a051e76324262a0d90dd49

Refactor: Snap-related.  Clarified attribute names and refactored #defines into 
enums

The transformation snapping code contains a bunch of `#define`s, some 
ambiguously or incorrectly named attributes.  This patch contains refactored 
code to improve this.  This patch does (should) not change functionality of 
snapping.

Clarified ambiguously / incorrectly named attributes.

  - "Target" is used to refer to the part of the source that is to be snapped 
(Active, Median, Center, Closest), but several other areas of Blender use the 
term "target" to refer to the thing being snapped to and "source" to refer to 
the thing getting snapped.  Moreover, the implications of the previous terms do 
not match the descriptions.  For example: `SCE_SNAP_TARGET_CENTER` does not 
snap the grabbed geometry to the center of the target, but instead "Snap 
transforamtion center onto target".
  - "Select" refers to the condition for an object to be a possible target for 
snapping.
  - `SCE_SNAP_MODE_FACE` is renamed to `SCE_SNAP_MODE_FACE_RAYCAST` to better 
describe its affect and to make way for other face snapping methods (ex: 
nearest).

Refactored related `#define` into `enum`s.  In particular, constants relating 
to...

  - `ToolSettings.snap_flag` are now in `enum eSnapFlag`
  - `ToolSettings.snap_mode` are now in `enum eSnapMode`
  - `ToolSettings.snap_source` (was `snap_target`) are now in `enum 
eSnapSourceSelect`
  - `ToolSettings.snap_flag` (`SCE_SNAP_NO_SELF`) and `TransSnap.target_select` 
are now in `enum eSnapTargetSelect`

As the terms became more consistent and the constants were packed together into 
meaningful enumerations, some of the attribute names seemed ambiguous.  For 
example, it is unclear whether `SnapObjectParams.snap_select` referred to the 
target or the source.  This patch also adds a small amount of clarity.

This patch also swaps out generic types (ex: `char`, `short`, `ushort`) and 
unclear hard coded numbers (ex: `0`) used with snap-related enumerations with 
the actual `enum`s and values.

Note: I did leave myself some comments to follow-up with further refactoring.  
Specifically, using "target" and "source" consistently will mean the Python API 
will need to change (ex: `ToolSettings.snap_target` is not 
`ToolSettings.snap_source`).  If the API is going to change, it would be good 
to make sure that the used terms are descriptive enough.  For example, 
`bpy.ops.transform.translate` uses a `snap` argument to determine if snapping 
should be enabled while transforming.  Perhaps ` [...]

This patch is (mostly) a subset of D14591, as suggested by @mano-wii.

Task T69342 proposes to separate the `Absolute Grid Snap` option out from 
`Increment` snapping method into its own method.  Also, there might be reason 
to create additional snapping methods or options.  (Indeed, D14591 heads in 
this direction).  This patch can work along with these suggestions, as this 
patch is trying to clarify the snapping code and to prompt more work in this 
area.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D15037

===

M   source/blender/editors/curve/editcurve.c
M   source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
M   source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/include/ED_gizmo_library.h
M   source/blender/editors/include/ED_transform_snap_object_context.h
M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/mesh/editmesh_utils.c
M   source/blender/editors/space_view3d/view3d_cursor_snap.c
M   source/blender/editors/space_view3d/view3d_edit.c
M   source/blender/editors/space_view3d/view3d_gizmo_ruler.c
M   source/blender/editors/space_view3d/view3d_navigate_walk.c
M   source/blender/editors/space_view3d/view3d_placement.c
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_mode.c
M   source/blender/editors/transform/transform_mode.h
M   source/blender/editors/transform/transform_mode_translate.c
M   source/blender/editors/transform/transform_ops.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/transform/transform_snap.h
M   source/blender/editors/transform/transform_snap_object.cc
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/RNA_enum_items.h
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/makesrna/intern/rna_scene_

[Bf-blender-cvs] [26cda38985f] master: Docs: Clarify docs for BMesh methods

2022-05-05 Thread jon denning
Commit: 26cda38985f98b8ddf57cf7f65b9f08793873765
Author: jon denning
Date:   Thu May 5 11:08:01 2022 -0400
Branches: master
https://developer.blender.org/rB26cda38985f98b8ddf57cf7f65b9f08793873765

Docs: Clarify docs for BMesh methods

The previous docs for `normal_update` methods of `BMVert`, `BMEdge`,
`BMFace`, and `BMesh` were not clear on some behaviors.  These
behaviors are listed in D14370.  This commit updates the docs to be
clearer.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D14370

===

M   source/blender/python/bmesh/bmesh_py_types.c

===

diff --git a/source/blender/python/bmesh/bmesh_py_types.c 
b/source/blender/python/bmesh/bmesh_py_types.c
index baa2b0deb71..64cd59ea635 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -1262,7 +1262,12 @@ static PyObject *bpy_bmesh_select_flush(BPy_BMesh *self, 
PyObject *value)
 PyDoc_STRVAR(bpy_bmesh_normal_update_doc,
  ".. method:: normal_update()\n"
  "\n"
- "   Update mesh normals.\n");
+ "   Update normals of mesh faces and verts.\n"
+ "\n"
+ "   .. note::\n"
+ "\n"
+ "  The normal of any vertex where :attr:`is_wire` is True 
will be a zero vector.\n");
+
 static PyObject *bpy_bmesh_normal_update(BPy_BMesh *self)
 {
   BPY_BM_CHECK_OBJ(self);
@@ -1611,7 +1616,12 @@ static PyObject *bpy_bmvert_calc_shell_factor(BPy_BMVert 
*self)
 PyDoc_STRVAR(bpy_bmvert_normal_update_doc,
  ".. method:: normal_update()\n"
  "\n"
- "   Update vertex normal.\n");
+ "   Update vertex normal.\n"
+ "   This does not update the normals of adjoining faces.\n"
+ "\n"
+ "   .. note::\n"
+ "\n"
+ "  The vertex normal will be a zero vector if vertex 
:attr:`is_wire` is True.\n");
 static PyObject *bpy_bmvert_normal_update(BPy_BMVert *self)
 {
   BPY_BM_CHECK_OBJ(self);
@@ -1776,7 +1786,11 @@ static PyObject *bpy_bmedge_other_vert(BPy_BMEdge *self, 
BPy_BMVert *value)
 PyDoc_STRVAR(bpy_bmedge_normal_update_doc,
  ".. method:: normal_update()\n"
  "\n"
- "   Update edges vertex normals.\n");
+ "   Update normals of all connected faces and the edge verts.\n"
+ "\n"
+ "   .. note::\n"
+ "\n"
+ "  The normal of edge vertex will be a zero vector if vertex 
:attr:`is_wire` is True.\n");
 static PyObject *bpy_bmedge_normal_update(BPy_BMEdge *self)
 {
   BPY_BM_CHECK_OBJ(self);
@@ -2012,7 +2026,8 @@ static PyObject *bpy_bmface_calc_center_bounds(BPy_BMFace 
*self)
 PyDoc_STRVAR(bpy_bmface_normal_update_doc,
  ".. method:: normal_update()\n"
  "\n"
- "   Update face's normal.\n");
+ "   Update face normal based on the positions of the face 
verts.\n"
+ "   This does not update the normals of face verts.\n");
 static PyObject *bpy_bmface_normal_update(BPy_BMFace *self)
 {
   BPY_BM_CHECK_OBJ(self);

___
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] [81de1e7d4d2] draw-deferred-compilation-experiment: Text Editor: add Python 3.10 soft keywords to `builtinfunc` list

2022-04-21 Thread Jon Denning
Commit: 81de1e7d4d272d2c163b6fc94b3d4d92b596caed
Author: Jon Denning
Date:   Thu Apr 21 12:30:14 2022 +1000
Branches: draw-deferred-compilation-experiment
https://developer.blender.org/rB81de1e7d4d272d2c163b6fc94b3d4d92b596caed

Text Editor: add Python 3.10 soft keywords to `builtinfunc` list

Python 3.10 has added "soft keywords" [0] to their list of identifiers.
This patch adds these soft keywords to the list of builtin functions
that the text editor searches for when highlighting Python code.

The only soft keywords that Python 3.10 current has are: `match`,
`case`, and `_`, but more will likely be added in future versions.

Currently, the `_` soft keyword is ignored from highlighting. It is a
wildcard matching pattern when used with `case` (similar to `default`
for `switch`es in C/C++), but `_` is far more often used in other
contexts where highlighting the `_` might seem strange. For example,
ignoring elements when unpacking tuples (`_, g, _, a = color`).

This patch also updates the commented Python code for creating the list
of keywords, for convenience.

Before:

{F13012878}

After:

{F13012880}

Example from PEP-636 [1]

Note: These soft keywords are only reserved under specific contexts.
However, in order for the text editor to know when the keywords are used
in the appropriate contexts, the text editor would need a full-blown
Python grammar [2] parser. So, for now, these keywords are simply added
in along with the other keywords in order to highlight them in the text
editor.

[0]: https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
[1]: https://peps.python.org/pep-0636/#matching-specific-values
[2]: https://docs.python.org/3/reference/grammar.html

Ref D14707

===

M   source/blender/editors/space_text/text_format_py.c

===

diff --git a/source/blender/editors/space_text/text_format_py.c 
b/source/blender/editors/space_text/text_format_py.c
index 4048e181fde..6658ac5a83c 100644
--- a/source/blender/editors/space_text/text_format_py.c
+++ b/source/blender/editors/space_text/text_format_py.c
@@ -33,24 +33,33 @@ static int txtfmt_py_find_builtinfunc(const char *string)
   int i, len;
   /* list is from...
* ", ".join(['"%s"' % kw
-   *for kw in  __import__("keyword").kwlist
-   *if kw not in {"False", "None", "True", "def", "class"}])
+   *for kw in sorted(__import__("keyword").kwlist + 
__import__("keyword").softkwlist)
+   *if kw not in {"False", "None", "True", "def", "class", "_"}])
*
* ... and for this code:
-   * print("\n".join(['else if (STR_LITERAL_STARTSWITH(string, "%s", len)) i = 
len;' % kw
-   *  for kw in  __import__("keyword").kwlist
-   *  if kw not in {"False", "None", "True", "def", "class"}]))
+   * import keyword
+   * ignore = {"False", "None", "True", "def", "class", "_"}
+   * keywords = sorted(set(keyword.kwlist + keyword.softkwlist) - ignore)
+   * longest = max(len(kw) for kw in keywords)
+   * first  = 'if(STR_LITERAL_STARTSWITH(string, "%s",%s len)) { i = 
len;'
+   * middle = '} else if (STR_LITERAL_STARTSWITH(string, "%s",%s len)) { i = 
len;'
+   * last   = '} else %s   { i = 
0;'
+   * print("\n".join([(first if i==0 else middle) % (kw, ' '*(longest - 
len(kw)))
+   * for (i, kw) in enumerate(keywords)]) + "\n" +
+   *   last % (' '*(longest-2)) + "\n" +
+   *   "}")
*/
 
   /* Keep aligned args for readability. */
   /* clang-format off */
 
-  if(STR_LITERAL_STARTSWITH(string, "assert",   len)) { i = len;
+  if(STR_LITERAL_STARTSWITH(string, "and",  len)) { i = len;
+  } else if (STR_LITERAL_STARTSWITH(string, "as",   len)) { i = len;
+  } else if (STR_LITERAL_STARTSWITH(string, "assert",   len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "async",len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "await",len)) { i = len;
-  } else if (STR_LITERAL_STARTSWITH(string, "and",  len)) { i = len;
-  } else if (STR_LITERAL_STARTSWITH(string, "as",   len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "break",len)) { i = len;
+  } else if (STR_LITERAL_STARTSWITH(string, "case", len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "continue", len)) { i = len;
   } else if (STR_LITERAL_STARTS

[Bf-blender-cvs] [c6ed879f9aa] master: Text Editor: add Python 3.10 soft keywords to `builtinfunc` list

2022-04-20 Thread Jon Denning
Commit: c6ed879f9aa7cd863f146cc7104f16cfe8a73e8a
Author: Jon Denning
Date:   Thu Apr 21 12:30:14 2022 +1000
Branches: master
https://developer.blender.org/rBc6ed879f9aa7cd863f146cc7104f16cfe8a73e8a

Text Editor: add Python 3.10 soft keywords to `builtinfunc` list

Python 3.10 has added "soft keywords" [0] to their list of identifiers.
This patch adds these soft keywords to the list of builtin functions
that the text editor searches for when highlighting Python code.

The only soft keywords that Python 3.10 current has are: `match`,
`case`, and `_`, but more will likely be added in future versions.

Currently, the `_` soft keyword is ignored from highlighting. It is a
wildcard matching pattern when used with `case` (similar to `default`
for `switch`es in C/C++), but `_` is far more often used in other
contexts where highlighting the `_` might seem strange. For example,
ignoring elements when unpacking tuples (`_, g, _, a = color`).

This patch also updates the commented Python code for creating the list
of keywords, for convenience.

Before:

{F13012878}

After:

{F13012880}

Example from PEP-636 [1]

Note: These soft keywords are only reserved under specific contexts.
However, in order for the text editor to know when the keywords are used
in the appropriate contexts, the text editor would need a full-blown
Python grammar [2] parser. So, for now, these keywords are simply added
in along with the other keywords in order to highlight them in the text
editor.

[0]: https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
[1]: https://peps.python.org/pep-0636/#matching-specific-values
[2]: https://docs.python.org/3/reference/grammar.html

Ref D14707

===

M   source/blender/editors/space_text/text_format_py.c

===

diff --git a/source/blender/editors/space_text/text_format_py.c 
b/source/blender/editors/space_text/text_format_py.c
index 4048e181fde..6658ac5a83c 100644
--- a/source/blender/editors/space_text/text_format_py.c
+++ b/source/blender/editors/space_text/text_format_py.c
@@ -33,24 +33,33 @@ static int txtfmt_py_find_builtinfunc(const char *string)
   int i, len;
   /* list is from...
* ", ".join(['"%s"' % kw
-   *for kw in  __import__("keyword").kwlist
-   *if kw not in {"False", "None", "True", "def", "class"}])
+   *for kw in sorted(__import__("keyword").kwlist + 
__import__("keyword").softkwlist)
+   *if kw not in {"False", "None", "True", "def", "class", "_"}])
*
* ... and for this code:
-   * print("\n".join(['else if (STR_LITERAL_STARTSWITH(string, "%s", len)) i = 
len;' % kw
-   *  for kw in  __import__("keyword").kwlist
-   *  if kw not in {"False", "None", "True", "def", "class"}]))
+   * import keyword
+   * ignore = {"False", "None", "True", "def", "class", "_"}
+   * keywords = sorted(set(keyword.kwlist + keyword.softkwlist) - ignore)
+   * longest = max(len(kw) for kw in keywords)
+   * first  = 'if(STR_LITERAL_STARTSWITH(string, "%s",%s len)) { i = 
len;'
+   * middle = '} else if (STR_LITERAL_STARTSWITH(string, "%s",%s len)) { i = 
len;'
+   * last   = '} else %s   { i = 
0;'
+   * print("\n".join([(first if i==0 else middle) % (kw, ' '*(longest - 
len(kw)))
+   * for (i, kw) in enumerate(keywords)]) + "\n" +
+   *   last % (' '*(longest-2)) + "\n" +
+   *   "}")
*/
 
   /* Keep aligned args for readability. */
   /* clang-format off */
 
-  if(STR_LITERAL_STARTSWITH(string, "assert",   len)) { i = len;
+  if(STR_LITERAL_STARTSWITH(string, "and",  len)) { i = len;
+  } else if (STR_LITERAL_STARTSWITH(string, "as",   len)) { i = len;
+  } else if (STR_LITERAL_STARTSWITH(string, "assert",   len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "async",len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "await",len)) { i = len;
-  } else if (STR_LITERAL_STARTSWITH(string, "and",  len)) { i = len;
-  } else if (STR_LITERAL_STARTSWITH(string, "as",   len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "break",len)) { i = len;
+  } else if (STR_LITERAL_STARTSWITH(string, "case", len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, "continue", len)) { i = len;
   } else if (STR_LITERAL_STARTSWITH(string, &quo

[Bf-blender-cvs] [e0394761b95] master: GPUShader: Expose name for debugging & identifying shaders

2021-09-13 Thread Jon Denning
Commit: e0394761b954759f8723bdc8f4a1686bf70954ed
Author: Jon Denning
Date:   Mon Sep 13 16:12:12 2021 +1000
Branches: master
https://developer.blender.org/rBe0394761b954759f8723bdc8f4a1686bf70954ed

GPUShader: Expose name for debugging & identifying shaders

Added optional `name` argument to `GPUShader` constructor
(defaults to `pyGPUShader`), and added `name` getter to `GPUShader`.

Ref D12393

Reviewed By: campbellbarton, jbakker

===

M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/intern/gpu_shader.cc
M   source/blender/python/gpu/gpu_py_shader.c

===

diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index f834ee5b234..62b748b7edf 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -54,7 +54,8 @@ GPUShader *GPU_shader_create_from_python(const char *vertcode,
  const char *fragcode,
  const char *geomcode,
  const char *libcode,
- const char *defines);
+ const char *defines,
+ const char *name);
 GPUShader *GPU_shader_create_ex(const char *vertcode,
 const char *fragcode,
 const char *geomcode,
@@ -85,6 +86,8 @@ void GPU_shader_free(GPUShader *shader);
 void GPU_shader_bind(GPUShader *shader);
 void GPU_shader_unbind(void);
 
+const char *GPU_shader_get_name(GPUShader *shader);
+
 /* Returns true if transform feedback was successfully enabled. */
 bool GPU_shader_transform_feedback_enable(GPUShader *shader, struct GPUVertBuf 
*vertbuf);
 void GPU_shader_transform_feedback_disable(GPUShader *shader);
diff --git a/source/blender/gpu/intern/gpu_shader.cc 
b/source/blender/gpu/intern/gpu_shader.cc
index c754a649924..9340d311472 100644
--- a/source/blender/gpu/intern/gpu_shader.cc
+++ b/source/blender/gpu/intern/gpu_shader.cc
@@ -229,7 +229,8 @@ GPUShader *GPU_shader_create_from_python(const char 
*vertcode,
  const char *fragcode,
  const char *geomcode,
  const char *libcode,
- const char *defines)
+ const char *defines,
+ const char *name)
 {
   char *libcodecat = nullptr;
 
@@ -240,6 +241,9 @@ GPUShader *GPU_shader_create_from_python(const char 
*vertcode,
 libcode = libcodecat = BLI_strdupcat(libcode, 
datatoc_gpu_shader_colorspace_lib_glsl);
   }
 
+  /* Use pyGPUShader as default name for shader. */
+  const char *shname = name != nullptr ? name : "pyGPUShader";
+
   GPUShader *sh = GPU_shader_create_ex(vertcode,
fragcode,
geomcode,
@@ -249,7 +253,7 @@ GPUShader *GPU_shader_create_from_python(const char 
*vertcode,
GPU_SHADER_TFB_NONE,
nullptr,
0,
-   "pyGPUShader");
+   shname);
 
   MEM_SAFE_FREE(libcodecat);
   return sh;
@@ -368,6 +372,17 @@ void GPU_shader_unbind(void)
 
 /** \} */
 
+/*  */
+/** \name Shader name
+ * \{ */
+
+const char *GPU_shader_get_name(GPUShader *shader)
+{
+  return unwrap(shader)->name_get();
+}
+
+/** \} */
+
 /*  */
 /** \name Transform feedback
  *
diff --git a/source/blender/python/gpu/gpu_py_shader.c 
b/source/blender/python/gpu/gpu_py_shader.c
index 95e505b1343..1bdf9766c1b 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -105,12 +105,13 @@ static PyObject *pygpu_shader__tp_new(PyTypeObject 
*UNUSED(type), PyObject *args
 const char *geocode;
 const char *libcode;
 const char *defines;
+const char *name;
   } params = {0};
 
   static const char *_keywords[] = {
-  "vertexcode", "fragcode", "geocode", "libcode", "defines", NULL};
+  "vertexcode", "fragcode", "geocode", "libcode", "defines", "name", NULL};
 
-  static _PyArg_Parser _parser = {"ss|$sss:GPUShader.__new__", _keywords, 0};
+  static _PyArg_Parser _parser = {"ss|$:GPUShader.__new__", _keywords, 0};
   if (!_PyArg_ParseTupleAndKeywordsFast(args,
 kwd

[Bf-blender-cvs] [db6b3801b37] master: Update command line argument description for --addons

2021-09-09 Thread Jon Denning
Commit: db6b3801b37adb2b0b5859dac70e8936234fca32
Author: Jon Denning
Date:   Fri Sep 10 14:34:29 2021 +1000
Branches: master
https://developer.blender.org/rBdb6b3801b37adb2b0b5859dac70e8936234fca32

Update command line argument description for --addons

Changed doc string for Blender `--addons` command line argument
to explain what it does rather than just describing what it expects.

Reviewed By: Blendify

Ref D12445

===

M   source/creator/creator_args.c

===

diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 85ba4eca307..943646daa81 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -1920,7 +1920,7 @@ static int arg_handle_python_use_system_env_set(int 
UNUSED(argc),
 
 static const char arg_handle_addons_set_doc[] =
 "\n"
-"\tComma separated list of add-ons (no spaces).";
+"\tComma separated list (no spaces) of add-ons to enable in addition to 
any default add-ons.";
 static int arg_handle_addons_set(int argc, const char **argv, void *data)
 {
   /* workaround for scripts not getting a bpy.context.scene, causes internal 
errors elsewhere */

___
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