[Bf-blender-cvs] [947dc920835] master: BMesh: assert when a mesh has two kinds of shake-key data

2021-01-05 Thread Campbell Barton
Commit: 947dc920835bcd9116a9a03e5958526509c58ff4
Author: Campbell Barton
Date:   Wed Jan 6 18:03:42 2021 +1100
Branches: master
https://developer.blender.org/rB947dc920835bcd9116a9a03e5958526509c58ff4

BMesh: assert when a mesh has two kinds of shake-key data

Assert with comment to avoid confusion caused by
mixing two kinds of shape-key data.

This problem was exposed when investigating T84364.

===

M   source/blender/bmesh/intern/bmesh_mesh_convert.c

===

diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.c 
b/source/blender/bmesh/intern/bmesh_mesh_convert.c
index c30f71e029f..ba413c3c547 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.c
@@ -239,6 +239,24 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const 
struct BMeshFromMeshPar
  * Shape keys are also already integrated into the state of the evaluated
  * mesh, so considering them here would kind of apply them twice. */
 tot_shape_keys = BLI_listbase_count(&me->key->block);
+
+/* Original meshes must never contain a shape-key custom-data layers.
+ *
+ * This may happen if and object's mesh data is accidentally
+ * set to the output from the modifier stack, causing it to be an 
"original" ID,
+ * even though the data isn't fully compatible (hence this assert).
+ *
+ * This results in:
+ * - The newly created #BMesh having twice the number of custom-data 
layers.
+ * - When converting the #BMesh back to a regular mesh,
+ *   At least one of the extra shape-key blocks will be created in 
#Mesh.key
+ *   depending on the value of #CustomDataLayer.uid.
+ *
+ * We could support mixing both kinds of data if there is a compelling 
use-case for it.
+ * At the moment it's simplest to assume all original meshes use the 
key-block and meshes
+ * that are evaluated (through the modifier stack for example) use 
custom-data layers.
+ */
+BLI_assert(!CustomData_has_layer(&me->vdata, CD_SHAPEKEY));
   }
   if (is_new == false) {
 tot_shape_keys = min_ii(tot_shape_keys, 
CustomData_number_of_layers(&bm->vdata, CD_SHAPEKEY));

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [986be2c8927] vfx-clip-ui-update: Merge branch 'clip_ui_update' into vfx-clip-ui-update

2021-01-05 Thread Aaron Carlisle
Commit: 986be2c8927c32be0ef1aad99f6125876aad8e17
Author: Aaron Carlisle
Date:   Tue Jan 5 22:57:53 2021 -0500
Branches: vfx-clip-ui-update
https://developer.blender.org/rB986be2c8927c32be0ef1aad99f6125876aad8e17

Merge branch 'clip_ui_update' into vfx-clip-ui-update

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [41be1d2d8cf] vfx-clip-ui-update: UI: Tracking: Remove operator options exposed as props

2021-01-05 Thread Aaron Carlisle
Commit: 41be1d2d8cff3f297792211b97e126fae80458a6
Author: Aaron Carlisle
Date:   Tue Jan 5 22:54:09 2021 -0500
Branches: vfx-clip-ui-update
https://developer.blender.org/rB41be1d2d8cff3f297792211b97e126fae80458a6

UI: Tracking: Remove operator options exposed as props

In the movie clip editor, some options of operators are exposed as properties 
and are shown in the toolbar.
Other areas of Blender do not do this making the movie clip editor break 
paradigm.
This change is needed to migrate the current toolbar to a new active tool based 
toolbar

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

===

M   release/scripts/startup/bl_ui/space_clip.py
M   source/blender/blenkernel/intern/tracking.c
M   source/blender/blenloader/intern/versioning_260.c
M   source/blender/editors/space_clip/tracking_ops.c
M   source/blender/editors/space_clip/tracking_ops_orient.c
M   source/blender/makesdna/DNA_tracking_types.h
M   source/blender/makesrna/intern/rna_tracking.c

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 35fd7333cf4..f17e09c3234 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -577,14 +577,7 @@ class CLIP_PT_tools_cleanup(CLIP_PT_tracking_panel, Panel):
 layout.use_property_split = True
 layout.use_property_decorate = False
 
-clip = context.space_data.clip
-settings = clip.tracking.settings
-
 col = layout.column()
-col.prop(settings, "clean_frames", text="Frames")
-col.prop(settings, "clean_error", text="Error")
-col.prop(settings, "clean_action", text="Type")
-col.separator()
 col.operator("clip.clean_tracks")
 col.operator("clip.filter_tracks")
 
@@ -614,9 +607,6 @@ class CLIP_PT_tools_orientation(CLIP_PT_tracking_panel, 
Panel):
 layout.use_property_split = True
 layout.use_property_decorate = False
 
-sc = context.space_data
-settings = sc.clip.tracking.settings
-
 col = layout.column(align=True)
 
 row = col.row(align=True)
@@ -637,8 +627,6 @@ class CLIP_PT_tools_orientation(CLIP_PT_tracking_panel, 
Panel):
 row.operator("clip.set_scale")
 row.operator("clip.apply_solution_scale", text="Apply Scale")
 
-col.prop(settings, "distance")
-
 
 class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, Panel):
 bl_space_type = 'CLIP_EDITOR'
@@ -664,7 +652,6 @@ class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, 
Panel):
 sc = context.space_data
 clip = sc.clip
 tracking_object = clip.tracking.objects.active
-settings = sc.clip.tracking.settings
 
 col = layout.column()
 
@@ -673,7 +660,6 @@ class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, 
Panel):
 col.separator()
 
 col.operator("clip.set_solution_scale", text="Set Scale")
-col.prop(settings, "object_distance")
 
 
 class CLIP_PT_objects(CLIP_PT_clip_view_panel, Panel):
diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index e5f9d59270e..5d0e393e1a3 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -336,8 +336,6 @@ void BKE_tracking_settings_init(MovieTracking *tracking)
   tracking->settings.default_search_size = 71;
   tracking->settings.default_algorithm_flag |= TRACK_ALGORITHM_FLAG_USE_BRUTE;
   tracking->settings.default_weight = 1.0f;
-  tracking->settings.dist = 1;
-  tracking->settings.object_distance = 1;
   tracking->settings.refine_camera_intrinsics = REFINE_NO_INTRINSICS;
 
   tracking->stabilization.scaleinf = 1.0f;
diff --git a/source/blender/blenloader/intern/versioning_260.c 
b/source/blender/blenloader/intern/versioning_260.c
index 767f24cf175..ae7bcc9660b 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -948,10 +948,6 @@ void blo_do_versions_260(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 
 clip->proxy.build_tc_flag |= IMB_TC_RECORD_RUN_NO_GAPS;
 
-if (!tracking->settings.object_distance) {
-  tracking->settings.object_distance = 1.0f;
-}
-
 if (BLI_listbase_is_empty(&tracking->objects)) {
   BKE_tracking_object_add(tracking, "Camera");
 }
diff --git a/source/blender/editors/space_clip/tracking_ops.c 
b/source/blender/editors/space_clip/tracking_ops.c
index 49313005c43..4b8ee5fe985 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -1818,26 +1818,6 @@ static int clean_tracks_exec(bContext *C, wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
-static int clean_tracks_invoke(bContext *C, wmOperator *op, c

[Bf-blender-cvs] [04549c64acd] vfx-clip-ui-update: UI: Tracking: Move Object Scale to objects panel

2021-01-05 Thread Aaron Carlisle
Commit: 04549c64acd18c0fafb1266a438b4ee17ced2548
Author: Aaron Carlisle
Date:   Tue Jan 5 22:54:10 2021 -0500
Branches: vfx-clip-ui-update
https://developer.blender.org/rB04549c64acd18c0fafb1266a438b4ee17ced2548

UI: Tracking: Move Object Scale to objects panel

This moves the scale property from the rather hidden toolbar panel to the 
sidebar panel.
This also moves the two set scale operators to the same location.
This change is needed to migrate the current toolbar to a new active tool based 
toolbar

This revision depends on D9805

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

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index f17e09c3234..a7c6ff2da9f 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -607,6 +607,9 @@ class CLIP_PT_tools_orientation(CLIP_PT_tracking_panel, 
Panel):
 layout.use_property_split = True
 layout.use_property_decorate = False
 
+clip = context.space_data.clip
+tracking_object = clip.tracking.objects.active
+
 col = layout.column(align=True)
 
 row = col.row(align=True)
@@ -624,44 +627,13 @@ class CLIP_PT_tools_orientation(CLIP_PT_tracking_panel, 
Panel):
 col = layout.column()
 
 row = col.row(align=True)
-row.operator("clip.set_scale")
+if tracking_object.is_camera:
+row.operator("clip.set_scale")
+else:
+row.operator("clip.set_solution_scale", text="Set Scale")
 row.operator("clip.apply_solution_scale", text="Apply Scale")
 
 
-class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, Panel):
-bl_space_type = 'CLIP_EDITOR'
-bl_region_type = 'TOOLS'
-bl_label = "Object"
-bl_category = "Solve"
-
-@classmethod
-def poll(cls, context):
-sc = context.space_data
-if CLIP_PT_reconstruction_panel.poll(context) and sc.mode == 
'TRACKING':
-clip = sc.clip
-
-tracking_object = clip.tracking.objects.active
-
-return not tracking_object.is_camera
-
-return False
-
-def draw(self, context):
-layout = self.layout
-
-sc = context.space_data
-clip = sc.clip
-tracking_object = clip.tracking.objects.active
-
-col = layout.column()
-
-col.prop(tracking_object, "scale")
-
-col.separator()
-
-col.operator("clip.set_solution_scale", text="Set Scale")
-
-
 class CLIP_PT_objects(CLIP_PT_clip_view_panel, Panel):
 bl_space_type = 'CLIP_EDITOR'
 bl_region_type = 'UI'
@@ -671,9 +643,12 @@ class CLIP_PT_objects(CLIP_PT_clip_view_panel, Panel):
 
 def draw(self, context):
 layout = self.layout
+layout.use_property_split = True
+layout.use_property_decorate = False
 
 sc = context.space_data
 tracking = sc.clip.tracking
+tracking_object = sc.clip.tracking.objects.active
 
 row = layout.row()
 row.template_list("CLIP_UL_tracking_objects", "", tracking, "objects",
@@ -684,6 +659,10 @@ class CLIP_PT_objects(CLIP_PT_clip_view_panel, Panel):
 sub.operator("clip.tracking_object_new", icon='ADD', text="")
 sub.operator("clip.tracking_object_remove", icon='REMOVE', text="")
 
+if not tracking_object.is_camera:
+col = layout.row()
+row.prop(tracking_object, "scale")
+
 
 class CLIP_PT_track(CLIP_PT_tracking_panel, Panel):
 bl_space_type = 'CLIP_EDITOR'
@@ -1746,7 +1725,6 @@ classes = (
 CLIP_PT_tools_cleanup,
 CLIP_PT_tools_geometry,
 CLIP_PT_tools_orientation,
-CLIP_PT_tools_object,
 CLIP_PT_objects,
 CLIP_PT_plane_track,
 CLIP_PT_track_settings,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5a267dc1bb0] vfx-clip-ui-update: Update to master

2021-01-05 Thread Aaron Carlisle
Commit: 5a267dc1bb0bfa2c2a466924b3520cb3f50581bd
Author: Aaron Carlisle
Date:   Tue Jan 5 22:49:20 2021 -0500
Branches: vfx-clip-ui-update
https://developer.blender.org/rB5a267dc1bb0bfa2c2a466924b3520cb3f50581bd

Update to master

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 35fd7333cf4..10db09cd1e6 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -387,7 +387,7 @@ class CLIP_PT_tracking_settings(CLIP_PT_tracking_panel, 
Panel):
 bl_category = "Track"
 
 def draw_header_preset(self, _context):
-CLIP_PT_tracking_settings_presets.draw_panel_header(self.layout)
+CLIP_PT_track_defaults_presets.draw_panel_header(self.layout)
 
 def draw(self, context):
 layout = self.layout
@@ -426,30 +426,6 @@ class CLIP_PT_tracking_settings(CLIP_PT_tracking_panel, 
Panel):
  text="Copy from Active Track")
 
 
-class CLIP_PT_tracking_settings_extras(CLIP_PT_tracking_panel, Panel):
-bl_label = "Tracking Settings Extra"
-bl_parent_id = "CLIP_PT_tracking_settings"
-bl_space_type = 'CLIP_EDITOR'
-bl_region_type = 'TOOLS'
-bl_options = {'DEFAULT_CLOSED'}
-
-def draw(self, context):
-layout = self.layout
-layout.use_property_split = True
-layout.use_property_decorate = False
-
-sc = context.space_data
-clip = sc.clip
-settings = clip.tracking.settings
-
-col = layout.column()
-col.prop(settings, "default_weight")
-col = layout.column(align=True)
-col.prop(settings, "default_correlation_min")
-col.prop(settings, "default_margin")
-col.prop(settings, "use_default_mask")
-
-
 class CLIP_PT_tools_tracking(CLIP_PT_tracking_panel, Panel):
 bl_space_type = 'CLIP_EDITOR'
 bl_region_type = 'TOOLS'
@@ -745,8 +721,18 @@ class CLIP_PT_track(CLIP_PT_tracking_panel, Panel):
 row.prop(act_track, "use_alpha_preview",
  text="", toggle=True, icon='IMAGE_ALPHA')
 
-layout.prop(act_track, "weight")
-layout.prop(act_track, "weight_stab")
+col = layout.column()
+col.prop(act_track, "weight")
+col.prop(act_track, "weight_stab")
+
+col = layout.column()
+col.prop(act_track, "motion_model")
+col.prop(act_track, "pattern_match", text="Match")
+
+col.separator()
+
+col.prop(act_track, "use_brute")
+col.prop(act_track, "use_normalization")
 
 if act_track.has_bundle:
 label_text = "Average Error: %.2f px" % (act_track.average_error)
@@ -764,95 +750,139 @@ class CLIP_PT_track(CLIP_PT_tracking_panel, Panel):
 row.prop(act_track, "color", text="")
 
 
-class CLIP_PT_plane_track(CLIP_PT_tracking_panel, Panel):
+class CLIP_PT_track_extras(CLIP_PT_tracking_panel, Panel):
 bl_space_type = 'CLIP_EDITOR'
 bl_region_type = 'UI'
 bl_category = "Track"
-bl_label = "Plane Track"
+bl_label = "Extra Settings"
+bl_parent_id = 'CLIP_PT_track'
 bl_options = {'DEFAULT_CLOSED'}
 
+@classmethod
+def poll(cls, context):
+clip = context.space_data.clip
+
+return clip.tracking.tracks.active
+
 def draw(self, context):
 layout = self.layout
 layout.use_property_split = True
-layout.use_property_decorate = False  # No animation.
+layout.use_property_decorate = False
 
 clip = context.space_data.clip
-active_track = clip.tracking.plane_tracks.active
-
-if not active_track:
-layout.active = False
-layout.label(text="No active plane track")
-return
+active = clip.tracking.tracks.active
+settings = clip.tracking.settings
 
-layout.prop(active_track, "name")
-layout.prop(active_track, "use_auto_keying")
-layout.template_ID(
-active_track, "image", new="image.new", open="image.open")
+col = layout.column(align=True)
+col.prop(active, "correlation_min")
+col.prop(active, "margin")
 
-row = layout.row()
-row.active = active_track.image is not None
-row.prop(active_track, "image_opacity", text="Opacity")
+col = layout.column()
+col.prop(active, "use_mask")
+col.prop(active, "frames_limit")
+col.prop(settings, "speed")
 
 
-class CLIP_PT_track_settings(CLIP_PT_tracking_panel, Panel):
+class CLIP_PT_track_defaults(CLIP_PT_tracking_panel, Panel):
+bl_label = "Default Track Settings"
 bl_space_type = 'CLIP_EDITOR'
 bl_region_type = 'UI'
 bl_category = "Track"
-bl_label = "Tracking Settings"
 bl_options = {'DEFAULT_CLOSED'}
 
+def draw_header_preset(self, _context)

[Bf-blender-cvs] [68d948a4f9b] vfx-clip-ui-update: Merge branch 'arcpatch-D9806' into vfx-clip-ui-update

2021-01-05 Thread Aaron Carlisle
Commit: 68d948a4f9bfc6c71a7caf1294eef07783db990a
Author: Aaron Carlisle
Date:   Tue Jan 5 22:56:20 2021 -0500
Branches: vfx-clip-ui-update
https://developer.blender.org/rB68d948a4f9bfc6c71a7caf1294eef07783db990a

Merge branch 'arcpatch-D9806' into vfx-clip-ui-update

===



===

diff --cc release/scripts/startup/bl_ui/space_clip.py
index 1da6c66b722,a7c6ff2da9f..de5d2de5082
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@@ -1792,12 -1725,12 +1771,11 @@@ classes = 
  CLIP_PT_tools_cleanup,
  CLIP_PT_tools_geometry,
  CLIP_PT_tools_orientation,
- CLIP_PT_tools_object,
  CLIP_PT_objects,
  CLIP_PT_plane_track,
 -CLIP_PT_track_settings,
 -CLIP_PT_track_settings_extras,
  CLIP_PT_tracking_camera,
  CLIP_PT_tracking_lens,
 +CLIP_PT_tracking_solve,
  CLIP_PT_marker,
  CLIP_PT_proxy,
  CLIP_PT_footage,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d457da7fa61] vfx-clip-ui-update: UI: Tracking: Solve panel to Sidebar

2021-01-05 Thread Aaron Carlisle
Commit: d457da7fa611fd73ce1b2c6bcb8c57b1ccba99ab
Author: Aaron Carlisle
Date:   Tue Jan 5 19:27:07 2021 -0500
Branches: vfx-clip-ui-update
https://developer.blender.org/rBd457da7fa611fd73ce1b2c6bcb8c57b1ccba99ab

UI: Tracking: Solve panel to Sidebar

This change moves the Solve panel to Sidebar
I was thinking it might be a good idea to split up the properties,
keyframe settings to Objects, Tripod and intrinsics to camera.
However because they are interlaced I left them together.

This change is needed to migrate the current toolbar to a new active tool based 
toolbar

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

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index f17e09c3234..52f0c238546 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -530,36 +530,9 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
 
 clip = context.space_data.clip
 tracking = clip.tracking
-settings = tracking.settings
 tracking_object = tracking.objects.active
-camera = clip.tracking.camera
 
 col = layout.column()
-col.prop(settings, "use_tripod_solver", text="Tripod")
-col = layout.column()
-col.active = not settings.use_tripod_solver
-col.prop(settings, "use_keyframe_selection", text="Keyframe")
-
-col = layout.column(align=True)
-col.active = (not settings.use_tripod_solver and
-  not settings.use_keyframe_selection)
-col.prop(tracking_object, "keyframe_a")
-col.prop(tracking_object, "keyframe_b")
-
-col = layout.column(heading="Refine", align=True)
-col.active = tracking_object.is_camera
-col.prop(settings, "refine_intrinsics_focal_length", text="Focal 
Length")
-col.prop(settings, "refine_intrinsics_principal_point", text="Optical 
Center")
-
-col.prop(settings, "refine_intrinsics_radial_distortion", text="Radial 
Distortion")
-
-row = col.row()
-row.active = (camera.distortion_model == 'BROWN')
-row.prop(settings, "refine_intrinsics_tangential_distortion", 
text="Tangential Distortion")
-
-col = layout.column(align=True)
-col.scale_y = 2.0
-
 col.operator("clip.solve_camera",
  text="Solve Camera Motion" if tracking_object.is_camera
  else "Solve Object Motion")
@@ -937,6 +910,48 @@ class CLIP_PT_tracking_lens(Panel):
 col.prop(camera, "brown_p2")
 
 
+class CLIP_PT_tracking_solve(CLIP_PT_tracking_panel, Panel):
+bl_space_type = 'CLIP_EDITOR'
+bl_region_type = 'UI'
+bl_category = "Track"
+bl_label = "Solve"
+bl_options = {'DEFAULT_CLOSED'}
+
+def draw(self, context):
+layout = self.layout
+layout.use_property_split = True
+layout.use_property_decorate = False
+
+clip = context.space_data.clip
+tracking = clip.tracking
+settings = tracking.settings
+tracking_object = tracking.objects.active
+camera = clip.tracking.camera
+
+col = layout.column()
+col.prop(settings, "use_tripod_solver", text="Tripod")
+col = layout.column()
+col.active = not settings.use_tripod_solver
+col.prop(settings, "use_keyframe_selection", text="Keyframe")
+
+col = layout.column(align=True)
+col.active = (not settings.use_tripod_solver and
+  not settings.use_keyframe_selection)
+col.prop(tracking_object, "keyframe_a")
+col.prop(tracking_object, "keyframe_b")
+
+col = layout.column(heading="Refine", align=True)
+col.active = tracking_object.is_camera
+col.prop(settings, "refine_intrinsics_focal_length", text="Focal 
Length")
+col.prop(settings, "refine_intrinsics_principal_point", text="Optical 
Center")
+
+col.prop(settings, "refine_intrinsics_radial_distortion", text="Radial 
Distortion")
+
+row = col.row()
+row.active = (camera.distortion_model == 'BROWN')
+row.prop(settings, "refine_intrinsics_tangential_distortion", 
text="Tangential Distortion")
+
+
 class CLIP_PT_marker(CLIP_PT_tracking_panel, Panel):
 bl_space_type = 'CLIP_EDITOR'
 bl_region_type = 'UI'
@@ -1753,6 +1768,7 @@ classes = (
 CLIP_PT_track_settings_extras,
 CLIP_PT_tracking_camera,
 CLIP_PT_tracking_lens,
+CLIP_PT_tracking_solve,
 CLIP_PT_marker,
 CLIP_PT_proxy,
 CLIP_PT_footage,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d1377f7ab14] vfx-clip-ui-update: Merge branch 'arcpatch-D9807' into vfx-clip-ui-update

2021-01-05 Thread Aaron Carlisle
Commit: d1377f7ab14a2a9e3f6abe85a450f4f724de57bd
Author: Aaron Carlisle
Date:   Tue Jan 5 22:52:24 2021 -0500
Branches: vfx-clip-ui-update
https://developer.blender.org/rBd1377f7ab14a2a9e3f6abe85a450f4f724de57bd

Merge branch 'arcpatch-D9807' into vfx-clip-ui-update

===



===

diff --cc release/scripts/startup/bl_ui/space_clip.py
index 52f0c238546,10db09cd1e6..1da6c66b722
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@@ -1764,11 -1794,8 +1795,9 @@@ classes = 
  CLIP_PT_tools_object,
  CLIP_PT_objects,
  CLIP_PT_plane_track,
- CLIP_PT_track_settings,
- CLIP_PT_track_settings_extras,
  CLIP_PT_tracking_camera,
  CLIP_PT_tracking_lens,
 +CLIP_PT_tracking_solve,
  CLIP_PT_marker,
  CLIP_PT_proxy,
  CLIP_PT_footage,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ad0c747cc93] vfx-clip-ui-update: Merge branch 'master' into clip_prop_remove

2021-01-05 Thread Aaron Carlisle
Commit: ad0c747cc93a904fe74d891b6bdcf46739f95fe0
Author: Aaron Carlisle
Date:   Tue Jan 5 18:55:04 2021 -0500
Branches: vfx-clip-ui-update
https://developer.blender.org/rBad0c747cc93a904fe74d891b6bdcf46739f95fe0

Merge branch 'master' into clip_prop_remove

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [41ff87e8dde] vfx-clip-ui-update: Remove missed prop

2021-01-05 Thread Aaron Carlisle
Commit: 41ff87e8ddefa1c51bb69462c29bbcc21a28c479
Author: Aaron Carlisle
Date:   Wed Dec 9 22:33:36 2020 -0500
Branches: vfx-clip-ui-update
https://developer.blender.org/rB41ff87e8ddefa1c51bb69462c29bbcc21a28c479

Remove missed prop

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 5bb0832c4a7..ee7616471b0 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -607,9 +607,6 @@ class CLIP_PT_tools_orientation(CLIP_PT_tracking_panel, 
Panel):
 layout.use_property_split = True
 layout.use_property_decorate = False
 
-sc = context.space_data
-settings = sc.clip.tracking.settings
-
 col = layout.column(align=True)
 
 row = col.row(align=True)
@@ -630,8 +627,6 @@ class CLIP_PT_tools_orientation(CLIP_PT_tracking_panel, 
Panel):
 row.operator("clip.set_scale")
 row.operator("clip.apply_solution_scale", text="Apply Scale")
 
-col.prop(settings, "distance")
-
 
 class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, Panel):
 bl_space_type = 'CLIP_EDITOR'

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6b4cf810ac2] vfx-clip-ui-update: UI: Tracking: Remove operator options exposed as props

2021-01-05 Thread Aaron Carlisle
Commit: 6b4cf810ac2f8abbd1d82474b05b2d66f017134e
Author: Aaron Carlisle
Date:   Wed Dec 9 22:04:42 2020 -0500
Branches: vfx-clip-ui-update
https://developer.blender.org/rB6b4cf810ac2f8abbd1d82474b05b2d66f017134e

UI: Tracking: Remove operator options exposed as props

In the movie clip editor, some options of operators are exposed as
properties and are shown in the toolbar.
Other areas of Blender do not do this making the movie clip editor break
paradigm.
This change is needed to migrate the current toolbar to a new active
tool based toolbar

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

===

M   release/scripts/startup/bl_ui/space_clip.py
M   source/blender/blenkernel/intern/tracking.c
M   source/blender/blenloader/intern/versioning_260.c
M   source/blender/editors/space_clip/tracking_ops.c
M   source/blender/editors/space_clip/tracking_ops_orient.c
M   source/blender/makesdna/DNA_tracking_types.h
M   source/blender/makesrna/intern/rna_tracking.c

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index a0cf22877d5..5bb0832c4a7 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -577,14 +577,7 @@ class CLIP_PT_tools_cleanup(CLIP_PT_tracking_panel, Panel):
 layout.use_property_split = True
 layout.use_property_decorate = False
 
-clip = context.space_data.clip
-settings = clip.tracking.settings
-
 col = layout.column()
-col.prop(settings, "clean_frames", text="Frames")
-col.prop(settings, "clean_error", text="Error")
-col.prop(settings, "clean_action", text="Type")
-col.separator()
 col.operator("clip.clean_tracks")
 col.operator("clip.filter_tracks")
 
@@ -664,7 +657,6 @@ class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, 
Panel):
 sc = context.space_data
 clip = sc.clip
 tracking_object = clip.tracking.objects.active
-settings = sc.clip.tracking.settings
 
 col = layout.column()
 
@@ -673,7 +665,6 @@ class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, 
Panel):
 col.separator()
 
 col.operator("clip.set_solution_scale", text="Set Scale")
-col.prop(settings, "object_distance")
 
 
 class CLIP_PT_objects(CLIP_PT_clip_view_panel, Panel):
diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index e083f7ceec0..1f70ba4d2ec 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -336,8 +336,6 @@ void BKE_tracking_settings_init(MovieTracking *tracking)
   tracking->settings.default_search_size = 71;
   tracking->settings.default_algorithm_flag |= TRACK_ALGORITHM_FLAG_USE_BRUTE;
   tracking->settings.default_weight = 1.0f;
-  tracking->settings.dist = 1;
-  tracking->settings.object_distance = 1;
   tracking->settings.refine_camera_intrinsics = REFINE_NO_INTRINSICS;
 
   tracking->stabilization.scaleinf = 1.0f;
diff --git a/source/blender/blenloader/intern/versioning_260.c 
b/source/blender/blenloader/intern/versioning_260.c
index c33f2a8cad5..489c9e5a86e 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -944,10 +944,6 @@ void blo_do_versions_260(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 
 clip->proxy.build_tc_flag |= IMB_TC_RECORD_RUN_NO_GAPS;
 
-if (!tracking->settings.object_distance) {
-  tracking->settings.object_distance = 1.0f;
-}
-
 if (BLI_listbase_is_empty(&tracking->objects)) {
   BKE_tracking_object_add(tracking, "Camera");
 }
diff --git a/source/blender/editors/space_clip/tracking_ops.c 
b/source/blender/editors/space_clip/tracking_ops.c
index 4d3e6cf4d6a..059ecbfc8eb 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -1818,26 +1818,6 @@ static int clean_tracks_exec(bContext *C, wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
-static int clean_tracks_invoke(bContext *C, wmOperator *op, const wmEvent 
*UNUSED(event))
-{
-  SpaceClip *sc = CTX_wm_space_clip(C);
-  MovieClip *clip = ED_space_clip_get_clip(sc);
-
-  if (!RNA_struct_property_is_set(op->ptr, "frames")) {
-RNA_int_set(op->ptr, "frames", clip->tracking.settings.clean_frames);
-  }
-
-  if (!RNA_struct_property_is_set(op->ptr, "error")) {
-RNA_float_set(op->ptr, "error", clip->tracking.settings.clean_error);
-  }
-
-  if (!RNA_struct_property_is_set(op->ptr, "action")) {
-RNA_enum_set(op->ptr, "action", clip->tracking.settings.clean_action);
-  }
-
-  return clean_tracks_exec(C, op);
-}
-
 void CLIP_OT_clean_tracks(wmOperatorType *ot)
 {
   static const EnumPropertyItem actions_items[

[Bf-blender-cvs] [0be22cfcaa0] vfx-clip-ui-update: UI: Update Clip Tracking menus

2021-01-05 Thread Aaron Carlisle
Commit: 0be22cfcaa085912d59776b24d8a387da4919368
Author: Aaron Carlisle
Date:   Tue Dec 8 01:26:23 2020 -0500
Branches: vfx-clip-ui-update
https://developer.blender.org/rB0be22cfcaa085912d59776b24d8a387da4919368

UI: Update Clip Tracking menus

- Add operators that previously could only be found in panels
- Re order menus to match other menus
- Organize Code

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

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index a0cf22877d5..b6304ced9eb 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -303,11 +303,11 @@ class CLIP_MT_masking_editor_menus(Menu):
 
 if clip:
 layout.menu("MASK_MT_select")
-layout.menu("CLIP_MT_clip")  # XXX - remove?
+layout.menu("CLIP_MT_clip")
 layout.menu("MASK_MT_add")
 layout.menu("MASK_MT_mask")
 else:
-layout.menu("CLIP_MT_clip")  # XXX - remove?
+layout.menu("CLIP_MT_clip")
 
 
 class CLIP_PT_clip_view_panel:
@@ -1321,10 +1321,17 @@ class CLIP_MT_clip(Menu):
 layout.operator("clip.open")
 
 if clip:
+layout.operator("clip.set_scene_frames")
+layout.operator("clip.set_center_principal")
 layout.operator("clip.prefetch")
 layout.operator("clip.reload")
 layout.menu("CLIP_MT_proxy")
 
+layout.separator()
+
+layout.operator("clip.set_viewport_background")
+layout.operator("clip.setup_tracking_scene")
+
 
 class CLIP_MT_proxy(Menu):
 bl_label = "Proxy"
@@ -1336,65 +1343,155 @@ class CLIP_MT_proxy(Menu):
 layout.operator("clip.delete_proxy")
 
 
-class CLIP_MT_track(Menu):
-bl_label = "Track"
+class CLIP_MT_track_transform(Menu):
+bl_label = "Transform"
 
 def draw(self, _context):
 layout = self.layout
 
-layout.operator("clip.clear_solution")
-layout.operator("clip.solve_camera")
+layout.operator("transform.translate")
+layout.operator("transform.rotate")
+layout.operator("transform.resize")
+
 
-layout.separator()
-props = layout.operator("clip.clear_track_path", text="Clear After")
-props.clear_active = False
-props.action = 'REMAINED'
+class CLIP_MT_track_motion(Menu):
+bl_label = "Track Motion"
 
-props = layout.operator("clip.clear_track_path", text="Clear Before")
+def draw(self, _context):
+layout = self.layout
+
+props = layout.operator("clip.track_markers", text="Backwards")
+props.backwards = True
+props.sequence = True
+
+props = layout.operator("clip.track_markers", text="Frame Backwards")
+props.backwards = True
+props.sequence = False
+
+props = layout.operator("clip.track_markers", text="Forwards")
+props.backwards = False
+props.sequence = True
+
+props = layout.operator("clip.track_markers", text="Frame Forwards")
+props.backwards = False
+props.sequence = False
+
+
+class CLIP_MT_track_clear(Menu):
+bl_label = "Clear"
+
+def draw(self, _context):
+layout = self.layout
+
+props = layout.operator("clip.clear_track_path", text="Before")
 props.clear_active = False
 props.action = 'UPTO'
 
-props = layout.operator("clip.clear_track_path", text="Clear Track 
Path")
+props = layout.operator("clip.clear_track_path", text="After")
+props.clear_active = False
+props.action = 'REMAINED'
+
+props = layout.operator("clip.clear_track_path", text="Track Path")
 props.clear_active = False
 props.action = 'ALL'
 
 layout.separator()
-layout.operator("clip.join_tracks")
 
-layout.separator()
+layout.operator("clip.clear_solution", text="Solution")
+
+
+class CLIP_MT_track_refine(Menu):
+bl_label = "Refine"
+
+def draw(self, _context):
+layout = self.layout
+
+props = layout.operator("clip.refine_markers", text="Backwards")
+props.backwards = True
+
+props = layout.operator("clip.refine_markers", text="Fowards")
+props.backwards = False
+
+
+class CLIP_MT_track_animation(Menu):
+bl_label = "Animation"
+
+def draw(self, _context):
+layout = self.layout
+
+layout.operator("clip.keyframe_insert")
+layout.operator("clip.keyframe_delete")
+
+
+class CLIP_MT_track_visibility(Menu):
+bl_label = "Show/Hide"
+
+def draw(self, _context):
+layout = self.layout
+
+layout.operator("clip.hide_tracks_clear")
+layout.operator("clip.hide_tracks", text="Hide Selected").unselected =

[Bf-blender-cvs] [5424b4821d2] master: Fix T83094: Alternate rows in the Sequencer are green (macOS)

2021-01-05 Thread Yevgeny Makarov
Commit: 5424b4821d28c4ea42b4f195869de1e1620e6889
Author: Yevgeny Makarov
Date:   Tue Jan 5 14:21:54 2021 -0600
Branches: master
https://developer.blender.org/rB5424b4821d28c4ea42b4f195869de1e1620e6889

Fix T83094: Alternate rows in the Sequencer are green (macOS)

The issue is that `UI_GetThemeColorBlendShade4fv()` creates a color
with alpha, but there is not any background underneath to blend in with.

The solution is just to draw an opaque background first, which also
halves the number of rects to draw. Note that the brighter rows get
very slightly darker after this change.

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

===

M   source/blender/editors/space_sequencer/sequencer_draw.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index d6e1a0c833b..f792f75bf96 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1880,6 +1880,10 @@ static void draw_seq_backdrop(View2D *v2d)
   uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 
2, GPU_FETCH_FLOAT);
   immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 
+  /* View backdrop. */
+  immUniformThemeColorShade(TH_BACK, -25);
+  immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
+
   /* Darker overlay over the view backdrop. */
   immUniformThemeColorShade(TH_BACK, -20);
   immRectf(pos, v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0);
@@ -1887,22 +1891,18 @@ static void draw_seq_backdrop(View2D *v2d)
   /* Alternating horizontal stripes. */
   i = max_ii(1, ((int)v2d->cur.ymin) - 1);
 
-  float col_alternating[4];
-  UI_GetThemeColor4fv(TH_ROW_ALTERNATE, col_alternating);
+  GPU_blend(GPU_BLEND_ALPHA);
+  immUniformThemeColor(TH_ROW_ALTERNATE);
 
   while (i < v2d->cur.ymax) {
 if (i & 1) {
-  immUniformThemeColorBlendShade(TH_BACK, TH_ROW_ALTERNATE, 
col_alternating[3], -25);
-}
-else {
-  immUniformThemeColorShade(TH_BACK, -25);
+  immRectf(pos, v2d->cur.xmin, i, v2d->cur.xmax, i + 1);
 }
-
-immRectf(pos, v2d->cur.xmin, i, v2d->cur.xmax, i + 1);
-
 i++;
   }
 
+  GPU_blend(GPU_BLEND_NONE);
+
   /* Lines separating the horizontal bands. */
   i = max_ii(1, ((int)v2d->cur.ymin) - 1);
   int line_len = (int)v2d->cur.ymax - i + 1;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2ed60552095] master: Fix T79146: Sculpt Mode lags until the entire mesh is visible

2021-01-05 Thread Pablo Dobarro
Commit: 2ed605520959eca9c0ab3c497c85578e138936b4
Author: Pablo Dobarro
Date:   Tue Jan 5 20:23:25 2021 +0100
Branches: master
https://developer.blender.org/rB2ed605520959eca9c0ab3c497c85578e138936b4

Fix T79146: Sculpt Mode lags until the entire mesh is visible

This was caused when the BKE_pbvh_draw_cb function was used with
update_only_visible set to false. In that case, all nodes with the flag
were updating, but the update flag was only cleared for visible nodes.
This was causing constant updates per redraw in no visible nodes until
they enter the view frustum and their flag was cleared.

In order to fix this and prevent it from happening again:
 - Updating the buffers, flushing the updates and clearing the flags are
now part of the same function. It does not make sense to do these in
separate places.

 - The BKE_pbvh_draw_cb function was refactored so the
pbvh_update_draw_buffers is only called once. It should now be easier to
understand what the function does when it is used to update only visible
nodes or all nodes.

Reviewed By: mont29

Maniphest Tasks: T79146

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

===

M   source/blender/blenkernel/intern/pbvh.c

===

diff --git a/source/blender/blenkernel/intern/pbvh.c 
b/source/blender/blenkernel/intern/pbvh.c
index 47d2ae8e283..8a98780d918 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1365,6 +1365,17 @@ static void pbvh_update_draw_buffers(PBVH *pbvh, 
PBVHNode **nodes, int totnode,
   TaskParallelSettings settings;
   BKE_pbvh_parallel_range_settings(&settings, true, totnode);
   BLI_task_parallel_range(0, totnode, &data, pbvh_update_draw_buffer_cb, 
&settings);
+
+  for (int i = 0; i < totnode; i++) {
+PBVHNode *node = nodes[i];
+
+if (node->flag & PBVH_UpdateDrawBuffers) {
+  /* Flush buffers uses OpenGL, so not in parallel. */
+  GPU_pbvh_buffers_update_flush(node->draw_buffers);
+}
+
+node->flag &= ~(PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers);
+  }
 }
 
 static int pbvh_flush_bb(PBVH *pbvh, PBVHNode *node, int flag)
@@ -2704,49 +2715,35 @@ void BKE_pbvh_draw_cb(PBVH *pbvh,
 {
   PBVHNode **nodes;
   int totnode;
+  int update_flag = 0;
 
-  const int update_flag = PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers;
-
-  if (!update_only_visible) {
-/* Update all draw buffers, also those outside the view. */
-BKE_pbvh_search_gather(
-pbvh, update_search_cb, POINTER_FROM_INT(update_flag), &nodes, 
&totnode);
-
-if (totnode) {
-  pbvh_update_draw_buffers(pbvh, nodes, totnode, update_flag);
-}
-
-MEM_SAFE_FREE(nodes);
+  /* Search for nodes that need updates. */
+  if (update_only_visible) {
+/* Get visible nodes with draw updates. */
+PBVHDrawSearchData data = {.frustum = update_frustum, .accum_update_flag = 
0};
+BKE_pbvh_search_gather(pbvh, pbvh_draw_search_cb, &data, &nodes, &totnode);
+update_flag = data.accum_update_flag;
   }
-
-  /* Gather visible nodes. */
-  PBVHDrawSearchData data = {.frustum = update_frustum, .accum_update_flag = 
0};
-  BKE_pbvh_search_gather(pbvh, pbvh_draw_search_cb, &data, &nodes, &totnode);
-
-  if (update_only_visible && (data.accum_update_flag & update_flag)) {
-/* Update draw buffers in visible nodes. */
-pbvh_update_draw_buffers(pbvh, nodes, totnode, data.accum_update_flag);
+  else {
+/* Get all nodes with draw updates, also those outside the view. */
+const int search_flag = PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers;
+BKE_pbvh_search_gather(
+pbvh, update_search_cb, POINTER_FROM_INT(search_flag), &nodes, 
&totnode);
+update_flag = PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers;
   }
 
-  /* Draw. */
-  for (int a = 0; a < totnode; a++) {
-PBVHNode *node = nodes[a];
-
-if (node->flag & PBVH_UpdateDrawBuffers) {
-  /* Flush buffers uses OpenGL, so not in parallel. */
-  GPU_pbvh_buffers_update_flush(node->draw_buffers);
-}
-
-node->flag &= ~(PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers);
+  /* Update draw buffers. */
+  if (totnode != 0 && (update_flag & (PBVH_RebuildDrawBuffers | 
PBVH_UpdateDrawBuffers))) {
+pbvh_update_draw_buffers(pbvh, nodes, totnode, update_flag);
   }
-
   MEM_SAFE_FREE(nodes);
 
+  /* Draw visible nodes. */
   PBVHDrawSearchData draw_data = {.frustum = draw_frustum, .accum_update_flag 
= 0};
   BKE_pbvh_search_gather(pbvh, pbvh_draw_search_cb, &draw_data, &nodes, 
&totnode);
 
-  for (int a = 0; a < totnode; a++) {
-PBVHNode *node = nodes[a];
+  for (int i = 0; i < totnode; i++) {
+PBVHNode *node = nodes[i];
 if (!(node->flag & PBVH_FullyHidden)) {
   draw_fn(user_data, node->draw_buffers);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mail

[Bf-blender-cvs] [c20e4827144] master: Fix T78681: "Add Primitive" icons are cropped in tool header

2021-01-05 Thread Hans Goudey
Commit: c20e4827144d26e4260f817512e60531fb61c8d2
Author: Hans Goudey
Date:   Tue Jan 5 13:00:35 2021 -0600
Branches: master
https://developer.blender.org/rBc20e4827144d26e4260f817512e60531fb61c8d2

Fix T78681: "Add Primitive" icons are cropped in tool header

The issue can be simply resolved by moving the primitives and plus
icons slightly. They still bump up against the top and bottom of the
header but it looks much better now.

===

M   release/datafiles/icons/ops.mesh.primitive_cone_add_gizmo.dat
M   release/datafiles/icons/ops.mesh.primitive_cube_add_gizmo.dat
M   release/datafiles/icons/ops.mesh.primitive_cylinder_add_gizmo.dat
M   release/datafiles/icons/ops.mesh.primitive_grid_add_gizmo.dat
M   release/datafiles/icons/ops.mesh.primitive_sphere_add_gizmo.dat
M   release/datafiles/icons/ops.mesh.primitive_torus_add_gizmo.dat

===

diff --git a/release/datafiles/icons/ops.mesh.primitive_cone_add_gizmo.dat 
b/release/datafiles/icons/ops.mesh.primitive_cone_add_gizmo.dat
index b416a693283..211622ce37f 100644
Binary files a/release/datafiles/icons/ops.mesh.primitive_cone_add_gizmo.dat 
and b/release/datafiles/icons/ops.mesh.primitive_cone_add_gizmo.dat differ
diff --git a/release/datafiles/icons/ops.mesh.primitive_cube_add_gizmo.dat 
b/release/datafiles/icons/ops.mesh.primitive_cube_add_gizmo.dat
index 5df7d19817e..2befbb101f2 100644
Binary files a/release/datafiles/icons/ops.mesh.primitive_cube_add_gizmo.dat 
and b/release/datafiles/icons/ops.mesh.primitive_cube_add_gizmo.dat differ
diff --git a/release/datafiles/icons/ops.mesh.primitive_cylinder_add_gizmo.dat 
b/release/datafiles/icons/ops.mesh.primitive_cylinder_add_gizmo.dat
index 5033ac2d477..17ba3e6a1e1 100644
Binary files 
a/release/datafiles/icons/ops.mesh.primitive_cylinder_add_gizmo.dat and 
b/release/datafiles/icons/ops.mesh.primitive_cylinder_add_gizmo.dat differ
diff --git a/release/datafiles/icons/ops.mesh.primitive_grid_add_gizmo.dat 
b/release/datafiles/icons/ops.mesh.primitive_grid_add_gizmo.dat
index da83e7d9553..7d45bca4ba6 100644
Binary files a/release/datafiles/icons/ops.mesh.primitive_grid_add_gizmo.dat 
and b/release/datafiles/icons/ops.mesh.primitive_grid_add_gizmo.dat differ
diff --git a/release/datafiles/icons/ops.mesh.primitive_sphere_add_gizmo.dat 
b/release/datafiles/icons/ops.mesh.primitive_sphere_add_gizmo.dat
index 16d1a7346f2..b10e6ca35b2 100644
Binary files a/release/datafiles/icons/ops.mesh.primitive_sphere_add_gizmo.dat 
and b/release/datafiles/icons/ops.mesh.primitive_sphere_add_gizmo.dat differ
diff --git a/release/datafiles/icons/ops.mesh.primitive_torus_add_gizmo.dat 
b/release/datafiles/icons/ops.mesh.primitive_torus_add_gizmo.dat
index 7323e6f4c30..d29ded9d930 100644
Binary files a/release/datafiles/icons/ops.mesh.primitive_torus_add_gizmo.dat 
and b/release/datafiles/icons/ops.mesh.primitive_torus_add_gizmo.dat differ

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4ade409a878] master: Cleanup: Reduce variable scope

2021-01-05 Thread Hans Goudey
Commit: 4ade409a8789b74ddb7000873a73de952472d17d
Author: Hans Goudey
Date:   Tue Jan 5 12:22:23 2021 -0600
Branches: master
https://developer.blender.org/rB4ade409a8789b74ddb7000873a73de952472d17d

Cleanup: Reduce variable scope

===

M   source/blender/editors/mesh/editmesh_tools.c

===

diff --git a/source/blender/editors/mesh/editmesh_tools.c 
b/source/blender/editors/mesh/editmesh_tools.c
index 89a4ee05fa4..18b5713e736 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1166,7 +1166,6 @@ static bool edbm_connect_vert_pair(BMEditMesh *em, struct 
Mesh *me, wmOperator *
   int len = 0;
   bool check_degenerate = true;
 
-  BMVert **verts;
   bool checks_succeded = true;
 
   /* sanity check */
@@ -1174,7 +1173,7 @@ static bool edbm_connect_vert_pair(BMEditMesh *em, struct 
Mesh *me, wmOperator *
 return false;
   }
 
-  verts = MEM_mallocN(sizeof(*verts) * verts_len, __func__);
+  BMVert **verts = MEM_mallocN(sizeof(*verts) * verts_len, __func__);
   {
 BMIter iter;
 BMVert *v;
@@ -2510,9 +2509,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, 
wmOperator *op)
 Object *obedit = objects[ob_index];
 Mesh *me = obedit->data;
 BMEditMesh *em = BKE_editmesh_from_object(obedit);
-ModifierData *md;
 bool mirrx = false, mirry = false, mirrz = false;
-int i;
 float clip_dist = 0.0f;
 const bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
 
@@ -2528,7 +2525,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, 
wmOperator *op)
 /* if there is a mirror modifier with clipping, flag the verts that
  * are within tolerance of the plane(s) of reflection
  */
-for (md = obedit->modifiers.first; md; md = md->next) {
+LISTBASE_FOREACH (ModifierData *, md, &obedit->modifiers) {
   if (md->type == eModifierType_Mirror && (md->mode & 
eModifierMode_Realtime)) {
 MirrorModifierData *mmd = (MirrorModifierData *)md;
 
@@ -2548,7 +2545,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, 
wmOperator *op)
   }
 }
 
-for (i = 0; i < repeat; i++) {
+for (int i = 0; i < repeat; i++) {
   if (!EDBM_op_callf(
   em,
   op,
@@ -3276,16 +3273,14 @@ static const EnumPropertyItem 
*merge_type_itemf(bContext *C,
 PropertyRNA *UNUSED(prop),
 bool *r_free)
 {
-  Object *obedit;
-  EnumPropertyItem *item = NULL;
-  int totitem = 0;
-
   if (!C) { /* needed for docs */
 return merge_type_items;
   }
 
-  obedit = CTX_data_edit_object(C);
+  Object *obedit = CTX_data_edit_object(C);
   if (obedit && obedit->type == OB_MESH) {
+EnumPropertyItem *item = NULL;
+int totitem = 0;
 BMEditMesh *em = BKE_editmesh_from_object(obedit);
 
 /* Only active object supported:
@@ -4011,10 +4006,9 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator 
*op)
   BMEdge *be;
   BMOperator bmop;
   float isect = 0.0f;
-  int len = 0, isected, i;
+  int isected, i;
   short numcuts = 1;
   const short mode = RNA_int_get(op->ptr, "type");
-  BMOpSlot *slot_edge_percents;
 
   /* allocd vars */
   float(*screen_vert_coords)[2], (*sco)[2], (*mouse_path)[2];
@@ -4029,7 +4023,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator 
*op)
 return OPERATOR_CANCELLED;
   }
 
-  len = RNA_collection_length(op->ptr, "path");
+  const int len = RNA_collection_length(op->ptr, "path");
 
   if (len < 2) {
 BKE_report(op->reports, RPT_ERROR, "Mouse path too short");
@@ -4070,7 +4064,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator 
*op)
   }
 
   /* store percentage of edge cut for KNIFE_EXACT here.*/
-  slot_edge_percents = BMO_slot_get(bmop.slots_in, "edge_percents");
+  BMOpSlot *slot_edge_percents = BMO_slot_get(bmop.slots_in, "edge_percents");
   BM_ITER_MESH (be, &iter, bm, BM_EDGES_OF_MESH) {
 bool is_cut = false;
 if (BM_elem_flag_test(be, BM_ELEM_SELECT)) {
@@ -4168,14 +4162,11 @@ enum {
 static Base *mesh_separate_tagged(
 Main *bmain, Scene *scene, ViewLayer *view_layer, Base *base_old, BMesh 
*bm_old)
 {
-  Base *base_new;
   Object *obedit = base_old->object;
-  BMesh *bm_new;
-
-  bm_new = BM_mesh_create(&bm_mesh_allocsize_default,
-  &((struct BMeshCreateParams){
-  .use_toolflags = true,
-  }));
+  BMesh *bm_new = BM_mesh_create(&bm_mesh_allocsize_default,
+ &((struct BMeshCreateParams){
+ .use_toolflags = true,
+ }));
   BM_mesh_elem_toolflags_ensure(bm_new); /* needed for 'duplicate' bmo */
 
   CustomData_copy(&bm_old->vdata, &bm_new->vdata, CD_MASK_BMESH.vmask, 
CD_CALLOC, 0);
@@ -4190,7 +4181,7 @@ static 

[Bf-blender-cvs] [3373d14b1b0] master: Fix T83925: Crash when rendering on the CPU with OptiX denoiser enabled

2021-01-05 Thread Patrick Mours
Commit: 3373d14b1b05b2ee5dc88efff5dc8b1a5fe20f36
Author: Patrick Mours
Date:   Tue Jan 5 18:37:31 2021 +0100
Branches: master
https://developer.blender.org/rB3373d14b1b05b2ee5dc88efff5dc8b1a5fe20f36

Fix T83925: Crash when rendering on the CPU with OptiX denoiser enabled

Rendering on the CPU uses the Embree BVH layout, whether the OptiX denoiser is 
enabled or not.
This means the "build_bvh" function gets a "BVHEmbree" object to fill and not a 
"BVHMulti" as it
was assuming before, which caused crashes due to memory geting overwritten 
incorrectly. This
fixes that by redirecting Embree BVH builds to the Embree device.

Manifest Tasks: T83925

===

M   intern/cycles/device/device_multi.cpp

===

diff --git a/intern/cycles/device/device_multi.cpp 
b/intern/cycles/device/device_multi.cpp
index e5b138917ff..44959577fb5 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -248,11 +248,14 @@ class MultiDevice : public Device {
   void build_bvh(BVH *bvh, Progress &progress, bool refit) override
   {
 /* Try to build and share a single acceleration structure, if possible */
-if (bvh->params.bvh_layout == BVH_LAYOUT_BVH2) {
+if (bvh->params.bvh_layout == BVH_LAYOUT_BVH2 || bvh->params.bvh_layout == 
BVH_LAYOUT_EMBREE) {
   devices.back().device->build_bvh(bvh, progress, refit);
   return;
 }
 
+assert(bvh->params.bvh_layout == BVH_LAYOUT_MULTI_OPTIX ||
+   bvh->params.bvh_layout == BVH_LAYOUT_MULTI_OPTIX_EMBREE);
+
 BVHMulti *const bvh_multi = static_cast(bvh);
 bvh_multi->sub_bvhs.resize(devices.size());

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [491a9e9ec49] master: Cleanup: Undo code: `poll` function.

2021-01-05 Thread Bastien Montagne
Commit: 491a9e9ec496185887caae319a5e11c48e5c12a5
Author: Bastien Montagne
Date:   Tue Jan 5 17:57:57 2021 +0100
Branches: master
https://developer.blender.org/rB491a9e9ec496185887caae319a5e11c48e5c12a5

Cleanup: Undo code: `poll` function.

Remove obviously outdated comment, and explictely set `poll` to `NULL`
in the one case it is not actually defined (sculpt undo).

===

M   source/blender/editors/sculpt_paint/paint_curve_undo.c
M   source/blender/editors/sculpt_paint/sculpt_undo.c

===

diff --git a/source/blender/editors/sculpt_paint/paint_curve_undo.c 
b/source/blender/editors/sculpt_paint/paint_curve_undo.c
index a3daef19f11..7ce7e73cbf2 100644
--- a/source/blender/editors/sculpt_paint/paint_curve_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_curve_undo.c
@@ -148,7 +148,6 @@ static void paintcurve_undosys_foreach_ID_ref(UndoStep 
*us_p,
 void ED_paintcurve_undosys_type(UndoType *ut)
 {
   ut->name = "Paint Curve";
-  /* don't poll for now */
   ut->poll = paintcurve_undosys_poll;
   ut->step_encode_init = paintcurve_undosys_step_encode_init;
   ut->step_encode = paintcurve_undosys_step_encode;
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c 
b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 9677152cf7e..5bbe18935cc 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1570,6 +1570,7 @@ void ED_sculpt_undo_geometry_end(struct Object *ob)
 void ED_sculpt_undosys_type(UndoType *ut)
 {
   ut->name = "Sculpt";
+  ut->poll = NULL; /* No poll from context for now. */
   ut->step_encode_init = sculpt_undosys_step_encode_init;
   ut->step_encode = sculpt_undosys_step_encode;
   ut->step_decode = sculpt_undosys_step_decode;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [90a26f900c1] master: Cleanup: UndoType: use `size_t` for memory size of structs.

2021-01-05 Thread Bastien Montagne
Commit: 90a26f900c18f12e5d41590fb9ce1ea4933c4989
Author: Bastien Montagne
Date:   Tue Jan 5 17:32:46 2021 +0100
Branches: master
https://developer.blender.org/rB90a26f900c18f12e5d41590fb9ce1ea4933c4989

Cleanup: UndoType: use `size_t` for memory size of structs.

===

M   source/blender/blenkernel/BKE_undo_system.h

===

diff --git a/source/blender/blenkernel/BKE_undo_system.h 
b/source/blender/blenkernel/BKE_undo_system.h
index b13a0580a55..fff6c73fafa 100644
--- a/source/blender/blenkernel/BKE_undo_system.h
+++ b/source/blender/blenkernel/BKE_undo_system.h
@@ -142,7 +142,10 @@ typedef struct UndoType {
 
   bool use_context;
 
-  int step_size;
+  /**
+   * The size of the undo struct 'inherited' from #UndoStep for that specific 
type. Used for
+   * generic allocation in BKE's `undo_system.c`. */
+  size_t step_size;
 } UndoType;
 
 /* Expose since we need to perform operations on specific undo types (rarely). 
*/

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [601d896fc66] sculpt-dev: Fix crash with custom input curves versioning

2021-01-05 Thread Pablo Dobarro
Commit: 601d896fc66c21d94d2e54234e4325ab5cdf76b1
Author: Pablo Dobarro
Date:   Tue Jan 5 18:12:32 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rB601d896fc66c21d94d2e54234e4325ab5cdf76b1

Fix crash with custom input curves versioning

===

M   source/blender/blenkernel/intern/brush.c
M   source/blender/blenloader/intern/versioning_290.c
M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/source/blender/blenkernel/intern/brush.c 
b/source/blender/blenkernel/intern/brush.c
index 32713863299..21de0f7b72f 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -270,14 +270,16 @@ static void brush_reset_input_curve(CurveMapping *cumap)
 
 void BKE_brush_default_input_curves_set(Brush *brush)
 {
-  if (!brush->pressure_size_curve) {
-brush->pressure_size_curve = BKE_curvemapping_add(1, 0, 0, 1, 1);
+  if (brush->pressure_size_curve) {
+BKE_curvemapping_free(brush->pressure_size_curve);
   }
+  brush->pressure_size_curve = BKE_curvemapping_add(1, 0, 0, 1, 1);
   brush_reset_input_curve(brush->pressure_size_curve);
 
-  if (!brush->pressure_strength_curve) {
-brush->pressure_strength_curve = BKE_curvemapping_add(1, 0, 0, 1, 1);
+  if (brush->pressure_strength_curve) {
+BKE_curvemapping_free(brush->pressure_strength_curve);
   }
+  brush->pressure_strength_curve = BKE_curvemapping_add(1, 0, 0, 1, 1);
   brush_reset_input_curve(brush->pressure_strength_curve);
 }
 
diff --git a/source/blender/blenloader/intern/versioning_290.c 
b/source/blender/blenloader/intern/versioning_290.c
index 80a6eff30a3..eface1d24fc 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -1491,12 +1491,12 @@ void blo_do_versions_290(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
*/
   {
 /* Keep this block, even when empty. */
-LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
-  if (!br->pressure_size_curve || !br->pressure_strength_curve) {
+if (!DNA_struct_elem_find(fd->filesdna, "Brush", "CurveMapping", 
"*pressure_size_curve")) {
+  LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
 BKE_brush_default_input_curves_set(br);
   }
 }
-
+
 if (!DNA_struct_find(fd->filesdna, "NodeSetAlpha")) {
   LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
 bNodeTree *nodetree = scene->nodetree;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index f6fc3199ae7..5ac035b56a2 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2310,8 +2310,8 @@ static float brush_strength(const Sculpt *sd,
 
   float pressure = BKE_brush_use_alpha_pressure(brush) ? cache->pressure : 
1.0f;
   if (brush->pressure_strength_curve) {
-BKE_curvemapping_init(brush->pressure_strength_curve);
   }
+  BKE_curvemapping_init(brush->pressure_strength_curve);
   pressure = BKE_brush_use_alpha_pressure(brush) && 
brush->pressure_strength_curve ?
  BKE_curvemapping_evaluateF(brush->pressure_strength_curve, 0, 
cache->pressure) :
  pressure;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c237a48104c] sculpt-dev: Fix warnings and windows build

2021-01-05 Thread Pablo Dobarro
Commit: c237a48104c913e9583b8eeb1f7700c63e2c1d11
Author: Pablo Dobarro
Date:   Tue Jan 5 17:53:50 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rBc237a48104c913e9583b8eeb1f7700c63e2c1d11

Fix warnings and windows build

===

M   source/blender/editors/sculpt_paint/sculpt_face_set.c
M   source/blender/editors/sculpt_paint/sculpt_gradient.c

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c 
b/source/blender/editors/sculpt_paint/sculpt_face_set.c
index 7c676e40daa..270cf93d576 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c
@@ -1473,7 +1473,7 @@ static void sculpt_face_set_extrude_id(Object *ob, 
SculptSession *ss, const int
   BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
 const int face_index = BM_elem_index_get(f);
 const int face_set_id = ss->face_sets[face_index];
-BM_elem_select_set(bm, f, face_set_id == active_face_set_id);
+BM_elem_select_set(bm, (BMElem *)f, face_set_id == active_face_set_id);
 BM_elem_flag_set(f, BM_ELEM_TAG, face_set_id == active_face_set_id);
   }
   BM_mesh_select_flush(bm);
diff --git a/source/blender/editors/sculpt_paint/sculpt_gradient.c 
b/source/blender/editors/sculpt_paint/sculpt_gradient.c
index a9bb389fab9..daa4680cd38 100644
--- a/source/blender/editors/sculpt_paint/sculpt_gradient.c
+++ b/source/blender/editors/sculpt_paint/sculpt_gradient.c
@@ -116,7 +116,7 @@ static void sculpt_gradient_apply_task_cb(void *__restrict 
userdata,
 
 break;
   case SCULPT_GRADIENT_RADIAL: {
-const float dist = len_v2v2_int(projected_co, 
gcontext->line_points[0]);
+const float dist = len_v2v2(projected_co, gcontext->line_points[0]);
 gradient_value = dist / gcontext->line_length;
   } break;
   case SCULPT_GRADIENT_ANGLE:
@@ -151,7 +151,7 @@ static int sculpt_gradient_update_exec(bContext *C, 
wmOperator *op, const wmEven
   gcontext->line_points[0][1] = RNA_int_get(op->ptr, "ystart");
   gcontext->line_points[1][0] = RNA_int_get(op->ptr, "xend");
   gcontext->line_points[1][1] = RNA_int_get(op->ptr, "yend");
-  gcontext->line_length = len_v2v2_int(gcontext->line_points[0], 
gcontext->line_points[1]);
+  gcontext->line_length = len_v2v2(gcontext->line_points[0], 
gcontext->line_points[1]);
 
   SculptThreadedTaskData data = {
   .sd = sd,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [29078186f81] sculpt-dev: Merge branch 'master' into sculpt-dev

2021-01-05 Thread Pablo Dobarro
Commit: 29078186f813f98d48b1c516905594048f7b0ccd
Author: Pablo Dobarro
Date:   Tue Jan 5 17:52:46 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rB29078186f813f98d48b1c516905594048f7b0ccd

Merge branch 'master' into sculpt-dev

===



===

diff --cc source/blender/blenkernel/intern/mesh_fair.cc
index d5c1d21d97a,75dd396d10a..858653eda97
--- a/source/blender/blenkernel/intern/mesh_fair.cc
+++ b/source/blender/blenkernel/intern/mesh_fair.cc
@@@ -420,14 -350,17 +420,13 @@@ class UniformVertexWeight : public Vert
UniformVertexWeight(FairingContext *fairing_context)
{
  const int totvert = fairing_context->vertex_count_get();
 +fairing_context_ = fairing_context;
  vertex_weights_.reserve(totvert);
 +cached_.reserve(totvert);
  for (int i = 0; i < totvert; i++) {
 -  const int tot_loop = fairing_context->vertex_loop_map_get(i)->count;
 -  if (tot_loop != 0) {
 -vertex_weights_[i] = 1.0f / tot_loop;
 -  }
 -  else {
 -vertex_weights_[i] = FLT_MAX;
 -  }
 +  cached_[i] = false;
  }
}
-   ~UniformVertexWeight() = default;
  
float weight_at_index(const int index) override
{
@@@ -457,14 -376,44 +456,13 @@@ class VoronoiVertexWeight : public Vert
   public:
VoronoiVertexWeight(FairingContext *fairing_context)
{
 -
  const int totvert = fairing_context->vertex_count_get();
  vertex_weights_.reserve(totvert);
 +cached_.reserve(totvert);
  for (int i = 0; i < totvert; i++) {
 -
 -  float area = 0.0f;
 -  float a[3];
 -  copy_v3_v3(a, fairing_context->vertex_deformation_co_get(i));
 -  const float acute_threshold = M_PI_2;
 -
 -  MeshElemMap *vlmap_elem = fairing_context->vertex_loop_map_get(i);
 -  for (int l = 0; l < vlmap_elem->count; l++) {
 -const int l_index = vlmap_elem->indices[l];
 -
 -float b[3], c[3], d[3];
 -fairing_context->adjacents_coords_from_loop(l_index, b, c);
 -
 -if (angle_v3v3v3(c, fairing_context->vertex_deformation_co_get(i), b) 
< acute_threshold) {
 -  calc_circumcenter(d, a, b, c);
 -}
 -else {
 -  add_v3_v3v3(d, b, c);
 -  mul_v3_fl(d, 0.5f);
 -}
 -
 -float t[3];
 -add_v3_v3v3(t, a, b);
 -mul_v3_fl(t, 0.5f);
 -area += area_tri_v3(a, t, d);
 -
 -add_v3_v3v3(t, a, c);
 -mul_v3_fl(t, 0.5f);
 -area += area_tri_v3(a, d, t);
 -  }
 -
 -  vertex_weights_[i] = area != 0.0f ? 1.0f / area : 1e12;
 +  cached_[i] = false;
  }
}
-   ~VoronoiVertexWeight() = default;
  
float weight_at_index(const int index) override
{
diff --cc source/blender/blenloader/intern/versioning_290.c
index b583326cd01,de59075559d..80a6eff30a3
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@@ -1491,10 -1490,22 +1491,28 @@@ void blo_do_versions_290(FileData *fd, 
 */
{
  /* Keep this block, even when empty. */
 +LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
 +  if (!br->pressure_size_curve || !br->pressure_strength_curve) {
 +BKE_brush_default_input_curves_set(br);
 +  }
 +}
++
+ if (!DNA_struct_find(fd->filesdna, "NodeSetAlpha")) {
+   LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ bNodeTree *nodetree = scene->nodetree;
+ if (nodetree == NULL) {
+   continue;
+ }
+ 
+ LISTBASE_FOREACH (bNode *, node, &nodetree->nodes) {
+   if (node->type != CMP_NODE_SETALPHA) {
+ continue;
+   }
+   NodeSetAlpha *storage = MEM_callocN(sizeof(NodeSetAlpha), 
"NodeSetAlpha");
+   storage->mode = CMP_NODE_SETALPHA_MODE_REPLACE_ALPHA;
+   node->storage = storage;
+ }
+   }
+ }
}
  }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [166c0db3f94] master: Fix T83915: Subdivision Surface modifier causes visual artifacts in Cycles rendered viewport - CPU and OptiX

2021-01-05 Thread Patrick Mours
Commit: 166c0db3f9412925b501b7172875cb8ee2eb6958
Author: Patrick Mours
Date:   Tue Jan 5 14:39:29 2021 +0100
Branches: master
https://developer.blender.org/rB166c0db3f9412925b501b7172875cb8ee2eb6958

Fix T83915: Subdivision Surface modifier causes visual artifacts in Cycles 
rendered viewport - CPU and OptiX

Changing the geometry in the current scene caused the primitive offsets for all 
geometry to
change, but the values would not be updated in all bottom-level BVH structures. 
Rendering
artifacts and crashes where the result. This fixes that by ensuring all BVH 
structures are
updated when the primitive offsets change.

===

M   intern/cycles/bvh/bvh_embree.cpp
M   intern/cycles/render/geometry.cpp
M   intern/cycles/render/geometry.h

===

diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp
index b874bda7186..c082478e5b1 100644
--- a/intern/cycles/bvh/bvh_embree.cpp
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -682,6 +682,7 @@ void BVHEmbree::refit(Progress &progress)
 if (mesh->num_triangles() > 0) {
   RTCGeometry geom = rtcGetGeometry(scene, geom_id);
   set_tri_vertex_buffer(geom, mesh, true);
+  rtcSetGeometryUserData(geom, (void *)mesh->optix_prim_offset);
   rtcCommitGeometry(geom);
 }
   }
@@ -690,6 +691,7 @@ void BVHEmbree::refit(Progress &progress)
 if (hair->num_curves() > 0) {
   RTCGeometry geom = rtcGetGeometry(scene, geom_id + 1);
   set_curve_vertex_buffer(geom, hair, true);
+  rtcSetGeometryUserData(geom, (void *)hair->optix_prim_offset);
   rtcCommitGeometry(geom);
 }
   }
diff --git a/intern/cycles/render/geometry.cpp 
b/intern/cycles/render/geometry.cpp
index 64b98a91853..6fc217f2d76 100644
--- a/intern/cycles/render/geometry.cpp
+++ b/intern/cycles/render/geometry.cpp
@@ -280,6 +280,15 @@ void Geometry::tag_update(Scene *scene, bool rebuild)
   scene->object_manager->need_update = true;
 }
 
+void Geometry::tag_bvh_update(bool rebuild)
+{
+  tag_modified();
+
+  if (rebuild) {
+need_update_rebuild = true;
+  }
+}
+
 /* Geometry Manager */
 
 GeometryManager::GeometryManager()
@@ -915,7 +924,7 @@ void GeometryManager::device_update_attributes(Device 
*device,
   scene->object_manager->device_update_mesh_offsets(device, dscene, scene);
 }
 
-void GeometryManager::mesh_calc_offset(Scene *scene)
+void GeometryManager::mesh_calc_offset(Scene *scene, BVHLayout bvh_layout)
 {
   size_t vert_size = 0;
   size_t tri_size = 0;
@@ -930,6 +939,14 @@ void GeometryManager::mesh_calc_offset(Scene *scene)
   size_t optix_prim_size = 0;
 
   foreach (Geometry *geom, scene->geometry) {
+if (geom->optix_prim_offset != optix_prim_size) {
+  /* Need to rebuild BVH in OptiX, since refit only allows modified mesh 
data there */
+  const bool has_optix_bvh = bvh_layout == BVH_LAYOUT_OPTIX ||
+ bvh_layout == BVH_LAYOUT_MULTI_OPTIX ||
+ bvh_layout == BVH_LAYOUT_MULTI_OPTIX_EMBREE;
+  geom->tag_bvh_update(has_optix_bvh);
+}
+
 if (geom->geometry_type == Geometry::MESH || geom->geometry_type == 
Geometry::VOLUME) {
   Mesh *mesh = static_cast(geom);
 
@@ -1526,7 +1543,9 @@ void GeometryManager::device_update(Device *device,
   /* Device update. */
   device_free(device, dscene);
 
-  mesh_calc_offset(scene);
+  const BVHLayout bvh_layout = 
BVHParams::best_bvh_layout(scene->params.bvh_layout,
+  
device->get_bvh_layout_mask());
+  mesh_calc_offset(scene, bvh_layout);
   if (true_displacement_used) {
 scoped_callback_timer timer([scene](double time) {
   if (scene->update_stats) {
@@ -1553,8 +1572,6 @@ void GeometryManager::device_update(Device *device,
   }
 
   /* Update displacement. */
-  BVHLayout bvh_layout = BVHParams::best_bvh_layout(scene->params.bvh_layout,
-
device->get_bvh_layout_mask());
   bool displacement_done = false;
   size_t num_bvh = 0;
 
diff --git a/intern/cycles/render/geometry.h b/intern/cycles/render/geometry.h
index d3daf0cc809..b124e950ad2 100644
--- a/intern/cycles/render/geometry.h
+++ b/intern/cycles/render/geometry.h
@@ -157,6 +157,8 @@ class Geometry : public Node {
 
   /* Updates */
   void tag_update(Scene *scene, bool rebuild);
+
+  void tag_bvh_update(bool rebuild);
 };
 
 /* Geometry Manager */
@@ -198,7 +200,7 @@ class GeometryManager {
  vector &object_attributes);
 
   /* Compute verts/triangles/curves offsets in global arrays. */
-  void mesh_calc_offset(Scene *scene);
+  void mesh_calc_offset(Scene *scene, BVHLayout bvh_layout);
 
   void device_update_object(Device *device, DeviceScene *dscene, Scene *scene, 
Progress &progress);


[Bf-blender-cvs] [e7f75a358af] temp-gpencil-interpolate: Merge branch 'master' into temp-gpencil-interpolate

2021-01-05 Thread Antonio Vazquez
Commit: e7f75a358af5f5705dcbe8b0506bb2332b95c038
Author: Antonio Vazquez
Date:   Tue Jan 5 17:19:04 2021 +0100
Branches: temp-gpencil-interpolate
https://developer.blender.org/rBe7f75a358af5f5705dcbe8b0506bb2332b95c038

Merge branch 'master' into temp-gpencil-interpolate

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e01fb743147] greasepencil-object: Merge branch 'master' into greasepencil-object

2021-01-05 Thread Antonio Vazquez
Commit: e01fb743147a86a2c57cfc0a5463ab0a36087ad2
Author: Antonio Vazquez
Date:   Tue Jan 5 17:17:35 2021 +0100
Branches: greasepencil-object
https://developer.blender.org/rBe01fb743147a86a2c57cfc0a5463ab0a36087ad2

Merge branch 'master' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [da9d471e1d9] master: Fix T84389: RGB Curves node shows "tone" option outside of compositor

2021-01-05 Thread Philipp Oeser
Commit: da9d471e1d9ac451929340cfe8aa5a8c5b268a75
Author: Philipp Oeser
Date:   Tue Jan 5 16:43:59 2021 +0100
Branches: master
https://developer.blender.org/rBda9d471e1d9ac451929340cfe8aa5a8c5b268a75

Fix T84389: RGB Curves node shows "tone" option outside of compositor

Since the introduction in rB4de7c0c3105a, the option is only used in the
compositor, it has no effect elsewhere [texture nodes, shader nodes].

Now only show the option for the compositor.

Maniphest Tasks: T84389

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

===

M   source/blender/editors/space_node/drawnode.c

===

diff --git a/source/blender/editors/space_node/drawnode.c 
b/source/blender/editors/space_node/drawnode.c
index 6c4aa1fd767..1333c9ed215 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -189,7 +189,10 @@ static void node_buts_curvecol(uiLayout *layout, bContext 
*UNUSED(C), PointerRNA
 cumap->flag &= ~CUMA_DRAW_SAMPLE;
   }
 
-  uiTemplateCurveMapping(layout, ptr, "mapping", 'c', false, false, false, 
true);
+  /* "Tone" (Standard/Filmlike) only used in the Compositor. */
+  bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
+  uiTemplateCurveMapping(
+  layout, ptr, "mapping", 'c', false, false, false, (ntree->type == 
NTREE_COMPOSIT));
 }
 
 static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA 
*ptr)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [583006d0ef1] master: Cleanup: clang tidy

2021-01-05 Thread Jacques Lucke
Commit: 583006d0ef1a0b71c66dfab9c37cc4de27cf81d4
Author: Jacques Lucke
Date:   Tue Jan 5 17:04:02 2021 +0100
Branches: master
https://developer.blender.org/rB583006d0ef1a0b71c66dfab9c37cc4de27cf81d4

Cleanup: clang tidy

===

M   source/blender/blenkernel/intern/cryptomatte.cc
M   source/blender/blenkernel/intern/icons.cc
M   source/blender/blenkernel/intern/mesh_fair.cc
M   source/blender/blenkernel/intern/volume.cc
M   source/blender/compositor/operations/COM_ColorExposureOperation.cpp
M   source/blender/editors/object/object_bake_api.c
M   source/blender/editors/object/object_modifier.c
M   source/blender/nodes/geometry/node_geometry_util.hh
M   
source/blender/nodes/geometry/nodes/node_geo_point_distribute_poisson_disk.cc

===

diff --git a/source/blender/blenkernel/intern/cryptomatte.cc 
b/source/blender/blenkernel/intern/cryptomatte.cc
index 3ed66960162..1dd71dacc46 100644
--- a/source/blender/blenkernel/intern/cryptomatte.cc
+++ b/source/blender/blenkernel/intern/cryptomatte.cc
@@ -121,13 +121,13 @@ CryptomatteSession *BKE_cryptomatte_init(void)
 
 void BKE_cryptomatte_finish(CryptomatteSession *session)
 {
-  BLI_assert(session != NULL);
+  BLI_assert(session != nullptr);
   session->finish();
 }
 
 void BKE_cryptomatte_free(CryptomatteSession *session)
 {
-  BLI_assert(session != NULL);
+  BLI_assert(session != nullptr);
   delete session;
 }
 
@@ -157,7 +157,7 @@ uint32_t BKE_cryptomatte_object_hash(CryptomatteSession 
*session, const Object *
 
 uint32_t BKE_cryptomatte_material_hash(CryptomatteSession *session, const 
Material *material)
 {
-  if (material == NULL) {
+  if (material == nullptr) {
 return 0.0f;
   }
   return cryptomatte_hash(&session->materials, &material->id);
@@ -166,7 +166,7 @@ uint32_t BKE_cryptomatte_material_hash(CryptomatteSession 
*session, const Materi
 uint32_t BKE_cryptomatte_asset_hash(CryptomatteSession *session, const Object 
*object)
 {
   const Object *asset_object = object;
-  while (asset_object->parent != NULL) {
+  while (asset_object->parent != nullptr) {
 asset_object = asset_object->parent;
   }
   return cryptomatte_hash(&session->assets, &asset_object->id);
diff --git a/source/blender/blenkernel/intern/icons.cc 
b/source/blender/blenkernel/intern/icons.cc
index fbf69357478..cba1726a1b9 100644
--- a/source/blender/blenkernel/intern/icons.cc
+++ b/source/blender/blenkernel/intern/icons.cc
@@ -92,10 +92,10 @@ std::mutex gIconMutex;
 static GHash *gCachedPreviews = nullptr;
 
 /* Queue of icons for deferred deletion. */
-typedef struct DeferredIconDeleteNode {
+struct DeferredIconDeleteNode {
   struct DeferredIconDeleteNode *next;
   int icon_id;
-} DeferredIconDeleteNode;
+};
 /* Protected by gIconMutex. */
 static LockfreeLinkList g_icon_delete_queue;
 
diff --git a/source/blender/blenkernel/intern/mesh_fair.cc 
b/source/blender/blenkernel/intern/mesh_fair.cc
index ccd1434b60b..75dd396d10a 100644
--- a/source/blender/blenkernel/intern/mesh_fair.cc
+++ b/source/blender/blenkernel/intern/mesh_fair.cc
@@ -361,7 +361,6 @@ class UniformVertexWeight : public VertexWeight {
   }
 }
   }
-  ~UniformVertexWeight() = default;
 
   float weight_at_index(const int index) override
   {
@@ -415,7 +414,6 @@ class VoronoiVertexWeight : public VertexWeight {
   vertex_weights_[i] = area != 0.0f ? 1.0f / area : 1e12;
 }
   }
-  ~VoronoiVertexWeight() = default;
 
   float weight_at_index(const int index) override
   {
diff --git a/source/blender/blenkernel/intern/volume.cc 
b/source/blender/blenkernel/intern/volume.cc
index 67727d87161..eadb01c43fc 100644
--- a/source/blender/blenkernel/intern/volume.cc
+++ b/source/blender/blenkernel/intern/volume.cc
@@ -252,7 +252,7 @@ static struct VolumeFileCache {
   }
 
   /* Cache contents */
-  typedef std::unordered_set EntrySet;
+  using EntrySet = std::unordered_set;
   EntrySet cache;
   /* Mutex for multithreaded access. */
   std::mutex mutex;
diff --git 
a/source/blender/compositor/operations/COM_ColorExposureOperation.cpp 
b/source/blender/compositor/operations/COM_ColorExposureOperation.cpp
index 8a475432cc8..a11039852a1 100644
--- a/source/blender/compositor/operations/COM_ColorExposureOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorExposureOperation.cpp
@@ -18,12 +18,12 @@
 
 #include "COM_ColorExposureOperation.h"
 
-ExposureOperation::ExposureOperation() : NodeOperation()
+ExposureOperation::ExposureOperation()
 {
   this->addInputSocket(COM_DT_COLOR);
   this->addInputSocket(COM_DT_VALUE);
   this->addOutputSocket(COM_DT_COLOR);
-  this->m_inputProgram = NULL;
+  this->m_inputProgram = nullptr;
 }
 
 void ExposureOperation::initExecution()
@@ -52,6 +52,6 @@ void ExposureOperation::executePixelSampled(float output[4],
 
 void ExposureOperation::deinitExecution()
 {
-  this->m_inputProgram = NULL;
-  this->m_inputExp

[Bf-blender-cvs] [39f99fd05c3] master: Fix: tried to set error message on modifier that does not exist

2021-01-05 Thread Jacques Lucke
Commit: 39f99fd05c353137130afd7fb101c9a78106d47b
Author: Jacques Lucke
Date:   Tue Jan 5 16:50:10 2021 +0100
Branches: master
https://developer.blender.org/rB39f99fd05c353137130afd7fb101c9a78106d47b

Fix: tried to set error message on modifier that does not exist

Without this, the example file in T83730 crashes in a debug build
when deleting the hair edit bake in the particle settings.

===

M   source/blender/blenkernel/intern/pointcache.c

===

diff --git a/source/blender/blenkernel/intern/pointcache.c 
b/source/blender/blenkernel/intern/pointcache.c
index 8ee8821eeb6..17434ee8023 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -653,7 +653,10 @@ static void ptcache_cloth_error(const ID *owner_id, void 
*cloth_v, const char *m
 {
   ClothModifierData *clmd = cloth_v;
   BLI_assert(GS(owner_id->name) == ID_OB);
-  BKE_modifier_set_error((Object *)owner_id, &clmd->modifier, "%s", message);
+  if (clmd->hairdata == NULL) {
+/* If there is hair data, this modifier does not actually exist on the 
object. */
+BKE_modifier_set_error((Object *)owner_id, &clmd->modifier, "%s", message);
+  }
 }
 
 static int ptcache_dynamicpaint_totpoint(void *sd, int UNUSED(cfra))

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9dbea1db66d] master: Compositor: Alpha Mode

2021-01-05 Thread Jeroen Bakker
Commit: 9dbea1db66da5e277e8279811d66096751f38d29
Author: Jeroen Bakker
Date:   Tue Jan 5 16:16:18 2021 +0100
Branches: master
https://developer.blender.org/rB9dbea1db66da5e277e8279811d66096751f38d29

Compositor: Alpha Mode

{D9211} introduced pre-multiplying the color for the keying node. This
pre-multiplication should also be done by other keying nodes and should be
the default operation for alpha node.

This patch will change the logic of keying nodes (Cryptomatte Node,
Channel Matte, Chroma Matte, Color Matte, Difference Matte, Distance
Matte, Luminance Matte) and breaks old files.

The Set alpha node has a mode parameter. This parameter changes
the logic to `Apply Mask` the alpha on the RGBA channels of the input color
or only replace the alpha channel (old behavior).

The replace mode is automatically set for older files. When adding
new files the the multiply mode is set.

Reviewed By: Sergey Sharybin

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

===

M   source/blender/blenloader/intern/versioning_290.c
M   source/blender/compositor/CMakeLists.txt
M   source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
M   source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
M   source/blender/compositor/nodes/COM_ColorMatteNode.cpp
M   source/blender/compositor/nodes/COM_CryptomatteNode.cpp
M   source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
M   source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
M   source/blender/compositor/nodes/COM_KeyingNode.cpp
M   source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
M   source/blender/compositor/nodes/COM_SetAlphaNode.cpp
M   source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
M   source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
M   source/blender/compositor/operations/COM_ColorMatteOperation.cpp
M   source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
M   source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
R073source/blender/compositor/operations/COM_KeyingSetAlphaOperation.cpp
source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cpp
R080source/blender/compositor/operations/COM_KeyingSetAlphaOperation.h  
source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h
R067source/blender/compositor/operations/COM_SetAlphaOperation.cpp  
source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cpp
R093source/blender/compositor/operations/COM_SetAlphaOperation.h
source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h
M   source/blender/editors/space_node/drawnode.c
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/composite/nodes/node_composite_setalpha.c

===

diff --git a/source/blender/blenloader/intern/versioning_290.c 
b/source/blender/blenloader/intern/versioning_290.c
index 63ef436d8e2..de59075559d 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -1490,5 +1490,22 @@ void blo_do_versions_290(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
*/
   {
 /* Keep this block, even when empty. */
+if (!DNA_struct_find(fd->filesdna, "NodeSetAlpha")) {
+  LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+bNodeTree *nodetree = scene->nodetree;
+if (nodetree == NULL) {
+  continue;
+}
+
+LISTBASE_FOREACH (bNode *, node, &nodetree->nodes) {
+  if (node->type != CMP_NODE_SETALPHA) {
+continue;
+  }
+  NodeSetAlpha *storage = MEM_callocN(sizeof(NodeSetAlpha), 
"NodeSetAlpha");
+  storage->mode = CMP_NODE_SETALPHA_MODE_REPLACE_ALPHA;
+  node->storage = storage;
+}
+  }
+}
   }
 }
diff --git a/source/blender/compositor/CMakeLists.txt 
b/source/blender/compositor/CMakeLists.txt
index 26d29f72efb..19eeb90c822 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -355,8 +355,6 @@ set(SRC
   operations/COM_KeyingDespillOperation.h
   operations/COM_KeyingOperation.cpp
   operations/COM_KeyingOperation.h
-  operations/COM_KeyingSetAlphaOperation.cpp
-  operations/COM_KeyingSetAlphaOperation.h
 
   operations/COM_ColorSpillOperation.cpp
   operations/COM_ColorSpillOperation.h
@@ -461,8 +459,10 @@ set(SRC
   operations/COM_MapRangeOperation.h
   operations/COM_MapValueOperation.cpp
   operations/COM_MapValueOperation.h
-  operations/COM_SetAlphaOperation.cpp
-  operations/COM_SetAlphaOperation.h
+  operations/COM_SetAlphaMultiplyOperation.cpp
+  operations/COM_SetAlphaMultiplyOperation.h
+  operations/COM_SetAlphaReplaceOperation.cpp
+  operations/COM

[Bf-blender-cvs] [357e5195754] master: Fix T83282: division by zero when creating psys tasks

2021-01-05 Thread Jacques Lucke
Commit: 357e519575411cc338acfe899fde6e5ea3476801
Author: Jacques Lucke
Date:   Tue Jan 5 16:17:21 2021 +0100
Branches: master
https://developer.blender.org/rB357e519575411cc338acfe899fde6e5ea3476801

Fix T83282: division by zero when creating psys tasks

===

M   source/blender/blenkernel/intern/particle_system.c

===

diff --git a/source/blender/blenkernel/intern/particle_system.c 
b/source/blender/blenkernel/intern/particle_system.c
index 71df28c8b42..ad98079bc27 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -475,15 +475,15 @@ void psys_tasks_create(ParticleThreadContext *ctx,
 {
   ParticleTask *tasks;
   int numtasks = min_ii(BLI_system_thread_count() * 4, endpart - startpart);
-  float particles_per_task = (float)(endpart - startpart) / (float)numtasks, 
p, pnext;
-  int i;
+  float particles_per_task = numtasks > 0 ? (float)(endpart - startpart) / 
(float)numtasks : 0;
 
   tasks = MEM_callocN(sizeof(ParticleTask) * numtasks, "ParticleThread");
   *r_numtasks = numtasks;
   *r_tasks = tasks;
 
-  p = (float)startpart;
-  for (i = 0; i < numtasks; i++, p = pnext) {
+  float pnext;
+  float p = (float)startpart;
+  for (int i = 0; i < numtasks; i++, p = pnext) {
 pnext = p + particles_per_task;
 
 tasks[i].ctx = ctx;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [cffa39358fa] master: Cleanup: Compositor comment style

2021-01-05 Thread Jeroen Bakker
Commit: cffa39358faa0c365cf12f9dc72eb138d823767a
Author: Jeroen Bakker
Date:   Tue Jan 5 15:44:09 2021 +0100
Branches: master
https://developer.blender.org/rBcffa39358faa0c365cf12f9dc72eb138d823767a

Cleanup: Compositor comment style

===

M   source/blender/compositor/intern/COM_SingleThreadedOperation.h
M   source/blender/compositor/operations/COM_AlphaOverKeyOperation.h
M   source/blender/compositor/operations/COM_AlphaOverMixedOperation.h
M   source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h
M   source/blender/compositor/operations/COM_AntiAliasOperation.h
M   source/blender/compositor/operations/COM_BilateralBlurOperation.h
M   source/blender/compositor/operations/COM_BokehBlurOperation.h
M   source/blender/compositor/operations/COM_BokehImageOperation.h
M   source/blender/compositor/operations/COM_BoxMaskOperation.h
M   source/blender/compositor/operations/COM_BrightnessOperation.h
M   source/blender/compositor/operations/COM_CalculateMeanOperation.h
M   
source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h
M   source/blender/compositor/operations/COM_ChangeHSVOperation.h
M   source/blender/compositor/operations/COM_ChannelMatteOperation.h
M   source/blender/compositor/operations/COM_ChromaMatteOperation.h
M   source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h
M   source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h
M   source/blender/compositor/operations/COM_ColorCorrectionOperation.h
M   source/blender/compositor/operations/COM_ColorCurveOperation.h
M   source/blender/compositor/operations/COM_ColorExposureOperation.h
M   source/blender/compositor/operations/COM_ColorMatteOperation.h
M   source/blender/compositor/operations/COM_ColorRampOperation.h
M   source/blender/compositor/operations/COM_ColorSpillOperation.h
M   source/blender/compositor/operations/COM_ConvertColorProfileOperation.h
M   source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h
M   source/blender/compositor/operations/COM_DifferenceMatteOperation.h
M   source/blender/compositor/operations/COM_DilateErodeOperation.h
M   source/blender/compositor/operations/COM_DirectionalBlurOperation.h
M   source/blender/compositor/operations/COM_DisplaceOperation.h
M   source/blender/compositor/operations/COM_DisplaceSimpleOperation.h
M   source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h
M   source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h
M   source/blender/compositor/operations/COM_EllipseMaskOperation.h
M   source/blender/compositor/operations/COM_GammaCorrectOperation.h
M   source/blender/compositor/operations/COM_GammaOperation.h
M   source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h
M   source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h
M   source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h
M   source/blender/compositor/operations/COM_GaussianXBlurOperation.h
M   source/blender/compositor/operations/COM_GaussianYBlurOperation.h
M   source/blender/compositor/operations/COM_GlareThresholdOperation.h
M   
source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h
M   source/blender/compositor/operations/COM_InpaintOperation.h
M   source/blender/compositor/operations/COM_InvertOperation.h
M   source/blender/compositor/operations/COM_LuminanceMatteOperation.h
M   source/blender/compositor/operations/COM_MapRangeOperation.h
M   source/blender/compositor/operations/COM_MapUVOperation.h
M   source/blender/compositor/operations/COM_MapValueOperation.h
M   source/blender/compositor/operations/COM_MathBaseOperation.h
M   source/blender/compositor/operations/COM_MixOperation.h
M   source/blender/compositor/operations/COM_MovieClipAttributeOperation.h
M   source/blender/compositor/operations/COM_NormalizeOperation.h
M   
source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h
M   source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
M   source/blender/compositor/operations/COM_SetColorOperation.h
M   source/blender/compositor/operations/COM_SetSamplerOperation.h
M   source/blender/compositor/operations/COM_SetValueOperation.h
M   source/blender/compositor/operations/COM_SetVectorOperation.h
M   source/blender/compositor/operations/COM_TonemapOperation.h
M   
source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h
M   source/blender/compositor/operations/COM_VectorBlurOperation.h
M   source/blender/compositor/operations/COM_VectorCurveOperation.h
M   source/blender/compositor/operations/COM_ZCombineOperation.h

===

[Bf-blender-cvs] [36ae6e66c10] master: Fix T84367: Fix crash when showing invalid/legacy constraints

2021-01-05 Thread Philipp Oeser
Commit: 36ae6e66c1068b5579c725c3353d39afe96c9d29
Author: Philipp Oeser
Date:   Mon Jan 4 14:14:13 2021 +0100
Branches: master
https://developer.blender.org/rB36ae6e66c1068b5579c725c3353d39afe96c9d29

Fix T84367: Fix crash when showing invalid/legacy constraints

Exposed by rBeaa44afe703e.

Definition for CONSTRAINT_TYPE_NULL is not totally clear (it is set for
constraints without data, see an old comment from Ton), but for these, a
TypeInfo cannot be fetched.

Avoid processing those constraints in UI code, just do nothing instead.

Maniphest Tasks: T84367

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

===

M   source/blender/editors/interface/interface_templates.c

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index a035ab86579..e9a6809f170 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2301,6 +2301,11 @@ static void object_constraint_panel_id(void *md_link, 
char *r_name)
   bConstraint *con = (bConstraint *)md_link;
   const bConstraintTypeInfo *cti = 
BKE_constraint_typeinfo_from_type(con->type);
 
+  /* Cannot get TypeInfo for invalid/legacy constraints. */
+  if (cti == NULL) {
+return;
+  }
+
   strcpy(r_name, CONSTRAINT_TYPE_PANEL_PREFIX);
   strcat(r_name, cti->structName);
 }
@@ -2310,6 +2315,11 @@ static void bone_constraint_panel_id(void *md_link, char 
*r_name)
   bConstraint *con = (bConstraint *)md_link;
   const bConstraintTypeInfo *cti = 
BKE_constraint_typeinfo_from_type(con->type);
 
+  /* Cannot get TypeInfo for invalid/legacy constraints. */
+  if (cti == NULL) {
+return;
+  }
+
   strcpy(r_name, CONSTRAINT_BONE_TYPE_PANEL_PREFIX);
   strcat(r_name, cti->structName);
 }
@@ -2340,6 +2350,10 @@ void uiTemplateConstraints(uiLayout *UNUSED(layout), 
bContext *C, bool use_bone_
 UI_panels_free_instanced(C, region);
 bConstraint *con = (constraints == NULL) ? NULL : constraints->first;
 for (int i = 0; con; i++, con = con->next) {
+  /* Dont show invalid/legacy constraints. */
+  if (con->type == CONSTRAINT_TYPE_NULL) {
+continue;
+  }
   /* Dont show temporary constraints (AutoIK and targetless IK 
constraints). */
   if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
 bKinematicConstraint *data = con->data;
@@ -2369,6 +2383,10 @@ void uiTemplateConstraints(uiLayout *UNUSED(layout), 
bContext *C, bool use_bone_
 /* Assuming there's only one group of instanced panels, update the custom 
data pointers. */
 Panel *panel = region->panels.first;
 LISTBASE_FOREACH (bConstraint *, con, constraints) {
+  /* Dont show invalid/legacy constraints. */
+  if (con->type == CONSTRAINT_TYPE_NULL) {
+continue;
+  }
   /* Dont show temporary constraints (AutoIK and targetless IK 
constraints). */
   if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
 bKinematicConstraint *data = con->data;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1f41bdc6f37] master: Eevee Cryptomatte: Store hashes in render result meta data

2021-01-05 Thread Jeroen Bakker
Commit: 1f41bdc6f37fd091bb5649436f68335b10ade51f
Author: Jeroen Bakker
Date:   Tue Jan 5 14:59:45 2021 +0100
Branches: master
https://developer.blender.org/rB1f41bdc6f37fd091bb5649436f68335b10ade51f

Eevee Cryptomatte: Store hashes in render result meta data

Stores cryptomatte hashes as meta data to the render result. Compositors could
use this for lookup on names in stead of hashes.

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

===

M   source/blender/blenkernel/BKE_cryptomatte.h
M   source/blender/blenkernel/intern/cryptomatte.cc
M   source/blender/draw/engines/basic/basic_engine.c
M   source/blender/draw/engines/eevee/eevee_cryptomatte.c
M   source/blender/draw/engines/eevee/eevee_engine.c
M   source/blender/draw/engines/eevee/eevee_private.h
M   source/blender/draw/engines/eevee/eevee_render.c
M   source/blender/draw/engines/eevee/eevee_renderpasses.c
M   source/blender/draw/engines/external/external_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/image/image_engine.c
M   source/blender/draw/engines/overlay/overlay_engine.c
M   source/blender/draw/engines/select/select_engine.c
M   source/blender/draw/engines/workbench/workbench_engine.c
M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_manager.c

===

diff --git a/source/blender/blenkernel/BKE_cryptomatte.h 
b/source/blender/blenkernel/BKE_cryptomatte.h
index 433c25084ad..3abaf5256df 100644
--- a/source/blender/blenkernel/BKE_cryptomatte.h
+++ b/source/blender/blenkernel/BKE_cryptomatte.h
@@ -24,19 +24,30 @@
 #pragma once
 
 #include "BLI_sys_types.h"
+#include "DNA_layer_types.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-struct Main;
+struct CryptomatteSession;
 struct Material;
+struct ID;
+struct Main;
 struct Object;
+struct RenderResult;
+
+struct CryptomatteSession *BKE_cryptomatte_init(void);
+void BKE_cryptomatte_finish(struct CryptomatteSession *session);
+void BKE_cryptomatte_free(struct CryptomatteSession *session);
 
 uint32_t BKE_cryptomatte_hash(const char *name, int name_len);
-uint32_t BKE_cryptomatte_object_hash(const struct Object *object);
-uint32_t BKE_cryptomatte_material_hash(const struct Material *material);
-uint32_t BKE_cryptomatte_asset_hash(const struct Object *object);
+uint32_t BKE_cryptomatte_object_hash(struct CryptomatteSession *session,
+ const struct Object *object);
+uint32_t BKE_cryptomatte_material_hash(struct CryptomatteSession *session,
+   const struct Material *material);
+uint32_t BKE_cryptomatte_asset_hash(struct CryptomatteSession *session,
+const struct Object *object);
 float BKE_cryptomatte_hash_to_float(uint32_t cryptomatte_hash);
 
 char *BKE_cryptomatte_entries_to_matte_id(struct NodeCryptomatte 
*node_storage);
@@ -44,6 +55,12 @@ void BKE_cryptomatte_matte_id_to_entries(const struct Main 
*bmain,
  struct NodeCryptomatte *node_storage,
  const char *matte_id);
 
+void BKE_cryptomatte_store_metadata(struct CryptomatteSession *session,
+struct RenderResult *render_result,
+const ViewLayer *view_layer,
+eViewLayerCryptomatteFlags 
cryptomatte_layer,
+const char *cryptomatte_layer_name);
+
 #ifdef __cplusplus
 }
-#endif
+#endif
\ No newline at end of file
diff --git a/source/blender/blenkernel/intern/cryptomatte.cc 
b/source/blender/blenkernel/intern/cryptomatte.cc
index 4bbeb088628..3ed66960162 100644
--- a/source/blender/blenkernel/intern/cryptomatte.cc
+++ b/source/blender/blenkernel/intern/cryptomatte.cc
@@ -22,8 +22,10 @@
  */
 
 #include "BKE_cryptomatte.h"
+#include "BKE_image.h"
 #include "BKE_main.h"
 
+#include "DNA_layer_types.h"
 #include "DNA_material_types.h"
 #include "DNA_node_types.h"
 #include "DNA_object_types.h"
@@ -32,48 +34,142 @@
 #include "BLI_dynstr.h"
 #include "BLI_hash_mm3.h"
 #include "BLI_listbase.h"
+#include "BLI_set.hh"
 #include "BLI_string.h"
 
 #include "MEM_guardedalloc.h"
 
 #include 
+#include 
 #include 
 #include 
 
-static uint32_t cryptomatte_hash(const ID *id)
+enum CryptomatteLayerState {
+  EMPTY,
+  FILLED,
+  CLOSED,
+};
+
+struct CryptomatteLayer {
+  CryptomatteLayerState state = CryptomatteLayerState::EMPTY;
+  blender::Set names;
+  std::stringstream manifest;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+  MEM_CXX_CLASS_ALLOC_FUNCS("cryptomatte:CryptomatteLayer")
+#endif
+
+  void add_hash(std::string name, uint32_t cryptomatte_hash)
+  {
+BLI_assert(state != CryptomatteLayerState::CLOSED);
+const bool first_item = names.is_empty();
+if (!na

[Bf-blender-cvs] [7cd6f667e33] master: Fix T84053: Mask overlay in image editor not working

2021-01-05 Thread Jeroen Bakker
Commit: 7cd6f667e33e60f3d53e465023bb75f90f499b07
Author: Jeroen Bakker
Date:   Tue Jan 5 13:43:32 2021 +0100
Branches: master
https://developer.blender.org/rB7cd6f667e33e60f3d53e465023bb75f90f499b07

Fix T84053: Mask overlay in image editor not working

The mask overlay wasn't part of the overlay engine. The reasoning nehind
this was that more editors used the mask overlay and most of them used
old drawing code. This patch adds the mask overlay drawing to the draw
overlay engine. This code path will only be used by the image editor
VSE, Compositor and Movie Clip editor will still use the previous
method.

During this patch some alternatives have been researched:
1. `ED_mask_draw_region`: this would lead to different code paths when
   drawing in the image editor, and some hacks to retrieve the correct
   framebuffer.
2. Add mask drawing to image engine: Would lead to incorrect color
   management when viewing the mask.
3. Add mask drawing to image engine and overlay engine: Would lead to
   duplicated code.
4. Add mask drawing to overlay engine and for combined overlay select
   the correct framebuffer.

Option 4 was chosen as the exception (switching framebuffers) can be
done without hacks. The code stays clean.

===

M   source/blender/draw/CMakeLists.txt
M   source/blender/draw/engines/overlay/overlay_edit_uv.c
M   source/blender/draw/engines/overlay/overlay_private.h
M   source/blender/draw/engines/overlay/overlay_shader.c
A   source/blender/draw/engines/overlay/shaders/edit_uv_image_mask_frag.glsl
R100
source/blender/draw/engines/overlay/shaders/edit_uv_stencil_image_vert.glsl 
source/blender/draw/engines/overlay/shaders/edit_uv_image_vert.glsl
M   source/blender/draw/tests/shaders_test.cc
M   source/blender/editors/space_image/space_image.c

===

diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index a6cc9fddd69..9b716d3 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -379,7 +379,8 @@ 
data_to_c_simple(engines/overlay/shaders/edit_uv_verts_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/edit_uv_verts_frag.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/edit_uv_faces_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/edit_uv_face_dots_vert.glsl SRC)
-data_to_c_simple(engines/overlay/shaders/edit_uv_stencil_image_vert.glsl SRC)
+data_to_c_simple(engines/overlay/shaders/edit_uv_image_vert.glsl SRC)
+data_to_c_simple(engines/overlay/shaders/edit_uv_image_mask_frag.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/edit_uv_stretching_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/edit_uv_tiled_image_borders_vert.glsl 
SRC)
 data_to_c_simple(engines/overlay/shaders/extra_frag.glsl SRC)
diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.c 
b/source/blender/draw/engines/overlay/overlay_edit_uv.c
index 045a38ef374..edc817ac7c1 100644
--- a/source/blender/draw/engines/overlay/overlay_edit_uv.c
+++ b/source/blender/draw/engines/overlay/overlay_edit_uv.c
@@ -26,11 +26,14 @@
 
 #include "BKE_editmesh.h"
 #include "BKE_image.h"
+#include "BKE_mask.h"
 #include "BKE_paint.h"
 
 #include "DNA_brush_types.h"
 #include "DNA_mesh_types.h"
 
+#include "DEG_depsgraph_query.h"
+
 #include "ED_image.h"
 
 #include "IMB_imbuf_types.h"
@@ -70,6 +73,27 @@ static OVERLAY_UVLineStyle 
edit_uv_line_style_from_space_image(const SpaceImage
   }
 }
 
+/* TODO(jbakker): the GPU texture should be cached with the mask. */
+static GPUTexture *edit_uv_mask_texture(
+Mask *mask, const int width, const int height_, const float aspx, const 
float aspy)
+{
+  const int height = (float)height_ * (aspy / aspx);
+  MaskRasterHandle *handle;
+  float *buffer = MEM_mallocN(sizeof(float) * height * width, __func__);
+
+  /* Initialize rasterization handle. */
+  handle = BKE_maskrasterize_handle_new();
+  BKE_maskrasterize_handle_init(handle, mask, width, height, true, true, true);
+
+  BKE_maskrasterize_buffer(handle, width, height, buffer);
+
+  /* Free memory. */
+  BKE_maskrasterize_handle_free(handle);
+  GPUTexture *texture = GPU_texture_create_2d(mask->id.name, width, height, 1, 
GPU_R16F, buffer);
+  MEM_freeN(buffer);
+  return texture;
+}
+
 /*  */
 /** \name Internal API
  * \{ */
@@ -93,6 +117,7 @@ void OVERLAY_edit_uv_init(OVERLAY_Data *vedata)
   const bool has_edit_object = (draw_ctx->object_edit) != NULL;
   const bool is_paint_mode = sima->mode == SI_MODE_PAINT;
   const bool is_view_mode = sima->mode == SI_MODE_VIEW;
+  const bool is_mask_mode = sima->mode == SI_MODE_MASK;
   const bool is_edit_mode = draw_ctx->object_mode == OB_MODE_EDIT;
   const bool do_uv_overlay = is_image_type && is_uv_editor && has_edit_object;
   const bool show_modified_uvs = sima->flag & SI_DRA

[Bf-blender-cvs] [f41de6dc46a] master: Fix T84404: Crash when using Skin Resize in mesh without Skin modifier

2021-01-05 Thread Germano Cavalcante
Commit: f41de6dc46ad0849d93b72580fefffdde4546cba
Author: Germano Cavalcante
Date:   Tue Jan 5 09:45:22 2021 -0300
Branches: master
https://developer.blender.org/rBf41de6dc46ad0849d93b72580fefffdde4546cba

Fix T84404: Crash when using Skin Resize in mesh without Skin modifier

Caused by rB54ee4109143b

Before that commit `TD_SKIP` was marked for all vertices.

Now skip the whole operation as all vertices are skipped.

===

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

===

diff --git a/source/blender/editors/transform/transform_convert_mesh_skin.c 
b/source/blender/editors/transform/transform_convert_mesh_skin.c
index f2c35bb1048..4c42ed6ca1e 100644
--- a/source/blender/editors/transform/transform_convert_mesh_skin.c
+++ b/source/blender/editors/transform/transform_convert_mesh_skin.c
@@ -52,6 +52,7 @@ static void mesh_skin_transdata_create(TransDataBasic *td, 
BMEditMesh *em, BMVer
 {
   BLI_assert(BM_elem_flag_test(eve, BM_ELEM_HIDDEN) == 0);
   MVertSkin *vs = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, 
CD_MVERT_SKIN);
+  td->flag = 0;
   if (vs) {
 copy_v3_v3(td->iloc, vs->radius);
 td->loc = vs->radius;
@@ -60,8 +61,6 @@ static void mesh_skin_transdata_create(TransDataBasic *td, 
BMEditMesh *em, BMVer
 td->flag |= TD_SKIP;
   }
 
-  td->flag = 0;
-
   if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
 td->flag |= TD_SELECTED;
   }
@@ -93,6 +92,10 @@ void createTransMeshSkin(TransInfo *t)
  * transform data is created by selected vertices.
  */
 
+if (!CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN)) {
+  continue;
+}
+
 /* Support other objects using PET to adjust these, unless connected is 
enabled. */
 if ((!prop_mode || (prop_mode & T_PROP_CONNECTED)) && (bm->totvertsel == 
0)) {
   continue;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fab772860d9] master: Asset browser: workspace in the wrong category

2021-01-05 Thread Philipp Oeser
Commit: fab772860d95a24e9989a40f72487b82af5dc388
Author: Philipp Oeser
Date:   Mon Dec 21 14:57:36 2020 +0100
Branches: master
https://developer.blender.org/rBfab772860d95a24e9989a40f72487b82af5dc388

Asset browser: workspace in the wrong category

Workspaces [FILTER_ID_WS] were in the `Environment` category
IDFilterBoolean, whereas they are in the `Miscellaneous` category in
`rna_def_fileselect_asset_params`.

Make this consistent ['Miscellaneous'] in both cases.

(note this was already done in rB2c317457cbf2 for the file browser case)

Spotted while looking into T83983.

Maniphest Tasks: T83983

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

===

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

===

diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index a748508c996..2ee84f70752 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -6293,13 +6293,13 @@ static void rna_def_fileselect_asset_params(BlenderRNA 
*brna)
ICON_IMAGE_DATA,
"Images & Sounds",
"Show images, movie clips, sounds and masks"},
-  {FILTER_ID_CA | FILTER_ID_LA | FILTER_ID_LP | FILTER_ID_SPK | 
FILTER_ID_WO | FILTER_ID_WS,
+  {FILTER_ID_CA | FILTER_ID_LA | FILTER_ID_LP | FILTER_ID_SPK | 
FILTER_ID_WO,
"ENVIRONMENTS",
ICON_WORLD_DATA,
"Environment",
"Show worlds, lights, cameras and speakers"},
   {FILTER_ID_BR | FILTER_ID_GD | FILTER_ID_PA | FILTER_ID_PAL | 
FILTER_ID_PC | FILTER_ID_TXT |
-   FILTER_ID_VF | FILTER_ID_CF,
+   FILTER_ID_VF | FILTER_ID_CF | FILTER_ID_WS,
"MISC",
ICON_GREASEPENCIL,
"Miscellaneous",

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [acfa7b102b9] master: Sculpt: use distance threshold for dyntopo symmetrize

2021-01-05 Thread Campbell Barton
Commit: acfa7b102b97e4c823bd9dad1f214d6b33d02f44
Author: Campbell Barton
Date:   Tue Jan 5 23:18:20 2021 +1100
Branches: master
https://developer.blender.org/rBacfa7b102b97e4c823bd9dad1f214d6b33d02f44

Sculpt: use distance threshold for dyntopo symmetrize

This was only used for non-dyntopo symmetrize.
There is no reason to use a hard-coded value in this case.

===

M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 5a75f4e9cb7..7b3dc5cd8e3 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -8196,7 +8196,7 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator 
*op)
(BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"symmetrize input=%avef direction=%i dist=%f 
use_shapekey=%b",
sd->symmetrize_direction,
-   0.1f,
+   dist,
true);
   SCULPT_dynamic_topology_triangulate(ss->bm);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e4884d224cc] master: Cleanup: remove redundant RNA_types.h header from UI_interface.h

2021-01-05 Thread Campbell Barton
Commit: e4884d224ccaa544d9c07ed9e547dd60d8196f0a
Author: Campbell Barton
Date:   Tue Jan 5 23:04:51 2021 +1100
Branches: master
https://developer.blender.org/rBe4884d224ccaa544d9c07ed9e547dd60d8196f0a

Cleanup: remove redundant RNA_types.h header from UI_interface.h

===

M   source/blender/editors/include/UI_interface.h
M   source/blender/python/intern/bpy_rna_ui.c

===

diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index e83108b97ce..9ea6099ff11 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -25,7 +25,6 @@
 
 #include "BLI_compiler_attrs.h"
 #include "BLI_sys_types.h" /* size_t */
-#include "RNA_types.h"
 #include "UI_interface_icons.h"
 
 #ifdef __cplusplus
@@ -36,6 +35,7 @@ extern "C" {
 
 struct ARegion;
 struct AutoComplete;
+struct EnumPropertyItem;
 struct FileSelectParams;
 struct ID;
 struct IDProperty;
@@ -1132,7 +1132,7 @@ uiBut *uiDefIconButR_prop(uiBlock *block,
   short width,
   short height,
   struct PointerRNA *ptr,
-  PropertyRNA *prop,
+  struct PropertyRNA *prop,
   int index,
   float min,
   float max,
@@ -1674,7 +1674,7 @@ struct uiButExtraOpIcon 
*UI_but_extra_operator_icon_add(uiBut *but,
 short opcontext,
 int icon);
 struct wmOperatorType *UI_but_extra_operator_icon_optype_get(struct 
uiButExtraOpIcon *extra_icon);
-PointerRNA *UI_but_extra_operator_icon_opptr_get(struct uiButExtraOpIcon 
*extra_icon);
+struct PointerRNA *UI_but_extra_operator_icon_opptr_get(struct 
uiButExtraOpIcon *extra_icon);
 
 /* Autocomplete
  *
@@ -1901,7 +1901,7 @@ void uiLayoutSetContextPointer(uiLayout *layout, const 
char *name, struct Pointe
 struct bContextStore *uiLayoutGetContextStore(uiLayout *layout);
 void uiLayoutContextCopy(uiLayout *layout, struct bContextStore *context);
 struct wmOperatorType *UI_but_operatortype_get_from_enum_menu(struct uiBut 
*but,
-  PropertyRNA 
**r_prop);
+  struct 
PropertyRNA **r_prop);
 struct MenuType *UI_but_menutype_get(uiBut *but);
 struct PanelType *UI_but_paneltype_get(uiBut *but);
 void UI_menutype_draw(struct bContext *C, struct MenuType *mt, struct uiLayout 
*layout);
@@ -2004,7 +2004,7 @@ void uiTemplateIDPreview(uiLayout *layout,
  const bool hide_buttons);
 void uiTemplateIDTabs(uiLayout *layout,
   struct bContext *C,
-  PointerRNA *ptr,
+  struct PointerRNA *ptr,
   const char *propname,
   const char *newop,
   const char *menu,
@@ -2100,7 +2100,7 @@ void uiTemplateCryptoPicker(uiLayout *layout, struct 
PointerRNA *ptr, const char
 void uiTemplateLayers(uiLayout *layout,
   struct PointerRNA *ptr,
   const char *propname,
-  PointerRNA *used_ptr,
+  struct PointerRNA *used_ptr,
   const char *used_propname,
   int active_layer);
 void uiTemplateImage(uiLayout *layout,
@@ -2113,7 +2113,9 @@ void uiTemplateImage(uiLayout *layout,
 void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, bool 
color_management);
 void uiTemplateImageStereo3d(uiLayout *layout, struct PointerRNA 
*stereo3d_format_ptr);
 void uiTemplateImageViews(uiLayout *layout, struct PointerRNA *imaptr);
-void uiTemplateImageFormatViews(uiLayout *layout, PointerRNA *imfptr, 
PointerRNA *ptr);
+void uiTemplateImageFormatViews(uiLayout *layout,
+struct PointerRNA *imfptr,
+struct PointerRNA *ptr);
 void uiTemplateImageLayers(uiLayout *layout,
struct bContext *C,
struct Image *ima,
@@ -2197,8 +2199,8 @@ void uiTemplateTrack(struct uiLayout *layout, struct 
PointerRNA *ptr, const char
 void uiTemplateMarker(struct uiLayout *layout,
   struct PointerRNA *ptr,
   const char *propname,
-  PointerRNA *userptr,
-  PointerRNA *trackptr,
+  struct PointerRNA *userptr,
+  struct PointerRNA *trackptr,
   bool compact);
 void uiTemplateMovieclipInformation(struct uiLayout *layout,
 struct PointerRNA *ptr,
@@ -2277,7 +2279,7 @@ void uiItemFullO_ptr(uiLayou

[Bf-blender-cvs] [1f6846fa4e3] master: Cleanup: remove UNUSED(..) from public function declarations

2021-01-05 Thread Campbell Barton
Commit: 1f6846fa4e3d957b438630afc167d5ac539723f4
Author: Campbell Barton
Date:   Tue Jan 5 23:08:15 2021 +1100
Branches: master
https://developer.blender.org/rB1f6846fa4e3d957b438630afc167d5ac539723f4

Cleanup: remove UNUSED(..) from public function declarations

This doesn't serve any purpose and can become out of sync
with the function it's self without reporting warnings.

===

M   intern/guardedalloc/intern/mallocn_intern.h
M   source/blender/blenlib/BLI_edgehash.h
M   source/blender/bmesh/intern/bmesh_edgeloop.h
M   source/blender/bmesh/intern/bmesh_interp.h
M   source/blender/draw/engines/workbench/workbench_private.h
M   source/blender/draw/intern/DRW_render.h
M   source/blender/editors/include/ED_keyframes_draw.h
M   source/blender/editors/interface/interface_intern.h
M   source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.h
M   source/blender/nodes/composite/node_composite_util.h

===

diff --git a/intern/guardedalloc/intern/mallocn_intern.h 
b/intern/guardedalloc/intern/mallocn_intern.h
index 8fc3e432157..aa956150484 100644
--- a/intern/guardedalloc/intern/mallocn_intern.h
+++ b/intern/guardedalloc/intern/mallocn_intern.h
@@ -118,27 +118,27 @@ void MEM_lockfree_freeN(void *vmemh);
 void *MEM_lockfree_dupallocN(const void *vmemh) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT;
 void *MEM_lockfree_reallocN_id(void *vmemh,
size_t len,
-   const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+   const char *str) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
 ATTR_ALLOC_SIZE(2);
 void *MEM_lockfree_recallocN_id(void *vmemh,
 size_t len,
-const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+const char *str) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
 ATTR_ALLOC_SIZE(2);
-void *MEM_lockfree_callocN(size_t len, const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+void *MEM_lockfree_callocN(size_t len, const char *str) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
 ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2);
 void *MEM_lockfree_calloc_arrayN(size_t len,
  size_t size,
- const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+ const char *str) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
 ATTR_ALLOC_SIZE(1, 2) ATTR_NONNULL(3);
-void *MEM_lockfree_mallocN(size_t len, const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+void *MEM_lockfree_mallocN(size_t len, const char *str) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
 ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2);
 void *MEM_lockfree_malloc_arrayN(size_t len,
  size_t size,
- const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+ const char *str) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
 ATTR_ALLOC_SIZE(1, 2) ATTR_NONNULL(3);
 void *MEM_lockfree_mallocN_aligned(size_t len,
size_t alignment,
-   const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+   const char *str) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
 ATTR_ALLOC_SIZE(1) ATTR_NONNULL(3);
 void MEM_lockfree_printmemlist_pydict(void);
 void MEM_lockfree_printmemlist(void);
@@ -161,27 +161,27 @@ void MEM_guarded_freeN(void *vmemh);
 void *MEM_guarded_dupallocN(const void *vmemh) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT;
 void *MEM_guarded_reallocN_id(void *vmemh,
   size_t len,
-  const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+  const char *str) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
 ATTR_ALLOC_SIZE(2);
 void *MEM_guarded_recallocN_id(void *vmemh,
size_t len,
-   const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+   const char *str) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
 ATTR_ALLOC_SIZE(2);
-void *MEM_guarded_callocN(size_t len, const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+void *MEM_guarded_callocN(size_t len, const char *str) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
 ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2);
 void *MEM_guarded_calloc_arrayN(size_t len,
 size_t size,
-const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+const char *str) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
 ATTR_ALLOC_SIZE(1, 2) ATTR_NONNULL(3);
-void *MEM_guarded_mallocN(size_t len, const char *UNUSED(str)) ATTR_MALLOC 
ATTR_WARN_UNUSED_RESULT
+void *MEM_guarded

[Bf-blender-cvs] [105d385e4b7] master: Fix T84364: Sculpt symmetrize fails with shape keys

2021-01-05 Thread Campbell Barton
Commit: 105d385e4b73f353350a3a1894eb0d9e933130c3
Author: Campbell Barton
Date:   Tue Jan 5 22:27:49 2021 +1100
Branches: master
https://developer.blender.org/rB105d385e4b73f353350a3a1894eb0d9e933130c3

Fix T84364: Sculpt symmetrize fails with shape keys

Use the BMesh symmetrize operator instead of using the modifier code.

While we could support shape-keys with the existing code used by the
mirror modifier, we'd need to add code-paths for evaluated mesh & bmesh
conversion to handle shape-keys differently just for this one case,
since we want to avoid copying & processing shape-keys layers for
evaluated meshes in general.

===

M   source/blender/blenkernel/BKE_mesh_mirror.h
M   source/blender/blenkernel/intern/mesh_mirror.c
M   source/blender/editors/object/object_remesh.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/modifiers/intern/MOD_mirror.c

===

diff --git a/source/blender/blenkernel/BKE_mesh_mirror.h 
b/source/blender/blenkernel/BKE_mesh_mirror.h
index 2c6920a18bf..a91f0787e68 100644
--- a/source/blender/blenkernel/BKE_mesh_mirror.h
+++ b/source/blender/blenkernel/BKE_mesh_mirror.h
@@ -23,27 +23,30 @@
  * \ingroup bke
  */
 
-#include "BLI_utildefines.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+struct Main;
+struct Mesh;
 struct MirrorModifierData;
-struct ModifierEvalContext;
 struct Object;
 
-struct Mesh *BKE_mesh_mirror_bisect_on_mirror_plane(struct MirrorModifierData 
*mmd,
-const struct Mesh *mesh,
-int axis,
-const float plane_co[3],
-float plane_no[3]);
-
-struct Mesh *BKE_mesh_mirror_apply_mirror_on_axis(struct MirrorModifierData 
*mmd,
-  const struct 
ModifierEvalContext *UNUSED(ctx),
-  struct Object *ob,
-  const struct Mesh *mesh,
-  int axis);
+struct Mesh *BKE_mesh_mirror_bisect_on_mirror_plane_for_modifier(struct 
MirrorModifierData *mmd,
+ const struct 
Mesh *mesh,
+ int axis,
+ const float 
plane_co[3],
+ float 
plane_no[3]);
+
+void BKE_mesh_mirror_apply_mirror_on_axis(struct Main *bmain,
+  struct Mesh *mesh,
+  const int axis,
+  const float dist);
+
+struct Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(struct 
MirrorModifierData *mmd,
+   struct Object 
*ob,
+   const struct 
Mesh *mesh,
+   int axis);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/intern/mesh_mirror.c 
b/source/blender/blenkernel/intern/mesh_mirror.c
index 46764a56e60..a22b52d68d5 100644
--- a/source/blender/blenkernel/intern/mesh_mirror.c
+++ b/source/blender/blenkernel/intern/mesh_mirror.c
@@ -41,11 +41,11 @@
 
 #include "MOD_modifiertypes.h"
 
-Mesh *BKE_mesh_mirror_bisect_on_mirror_plane(MirrorModifierData *mmd,
- const Mesh *mesh,
- int axis,
- const float plane_co[3],
- float plane_no[3])
+Mesh *BKE_mesh_mirror_bisect_on_mirror_plane_for_modifier(MirrorModifierData 
*mmd,
+  const Mesh *mesh,
+  int axis,
+  const float 
plane_co[3],
+  float plane_no[3])
 {
   bool do_bisect_flip_axis = ((axis == 0 && mmd->flag & 
MOD_MIR_BISECT_FLIP_AXIS_X) ||
   (axis == 1 && mmd->flag & 
MOD_MIR_BISECT_FLIP_AXIS_Y) ||
@@ -97,11 +97,47 @@ Mesh 
*BKE_mesh_mirror_bisect_on_mirror_plane(MirrorModifierData *mmd,
   return result;
 }
 
-Mesh *BKE_mesh_mirror_apply_mirror_on_axis(MirrorModifierData *mmd,
-   const ModifierEvalContext 
*UNUSED(ctx),
-   Object *ob,
-   const Mesh *mesh,
-   int axis)
+void B

[Bf-blender-cvs] [72411048772] master: Enabled Physics Particle Instance test

2021-01-05 Thread Himanshi Kalra
Commit: 724110487721226812a111cb147b85622f2c19e4
Author: Himanshi Kalra
Date:   Tue Jan 5 16:16:08 2021 +0530
Branches: master
https://developer.blender.org/rB724110487721226812a111cb147b85622f2c19e4

Enabled Physics Particle Instance test

===

M   tests/python/CMakeLists.txt

===

diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index acf8010d13c..f33bb81d6b0 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -245,14 +245,13 @@ add_blender_test(
   --run-all-tests
 )
 
-# Particle Instance disabling currently broken in master
-# add_blender_test(
-#   physics_particle_instance
-#   ${TEST_SRC_DIR}/physics/physics_particle_instance.blend
-#   --python ${TEST_PYTHON_DIR}/physics_particle_instance.py
-#   --
-#   --run-all-tests
-# )
+add_blender_test(
+  physics_particle_instance
+  ${TEST_SRC_DIR}/physics/physics_particle_instance.blend
+  --python ${TEST_PYTHON_DIR}/physics_particle_instance.py
+  --
+  --run-all-tests
+)
 
 add_blender_test(
   constraints

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8fbbc419da3] tracking_average: Tracking: Expose track average in the menu

2021-01-05 Thread Sergey Sharybin
Commit: 8fbbc419da320f9dbc0141de92626a96ee7a46fa
Author: Sergey Sharybin
Date:   Tue Jan 5 11:01:17 2021 +0100
Branches: tracking_average
https://developer.blender.org/rB8fbbc419da320f9dbc0141de92626a96ee7a46fa

Tracking: Expose track average in the menu

Patch by Sebastian Koenig, thanks!

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 1d338bf2c3a..7b1f6c123b7 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -1525,6 +1525,7 @@ class CLIP_MT_tracking_context_menu(Menu):
 layout.separator()
 
 layout.operator("clip.join_tracks")
+layout.operator("clip.average_tracks")
 
 layout.separator()

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d9aefc6b453] tracking_proportional_editing: Tracking: Tweak order of pivot and proportional editing

2021-01-05 Thread Sergey Sharybin
Commit: d9aefc6b453b0f3e45675ef26bb9fa4dabd18e9c
Author: Sergey Sharybin
Date:   Tue Jan 5 10:47:12 2021 +0100
Branches: tracking_proportional_editing
https://developer.blender.org/rBd9aefc6b453b0f3e45675ef26bb9fa4dabd18e9c

Tracking: Tweak order of pivot and proportional editing

Matches other editors. Was a mistake in the original code.

Patch by Sebastian Koenig, thanks!

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index a0a67ba084d..3f8599552e7 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -207,10 +207,6 @@ class CLIP_HT_header(Header):
 
 row = layout.row()
 row.prop(sc, "pivot_point", text="", icon_only=True)
-row = layout.row(align=True)
-icon = 'LOCKED' if sc.lock_selection else 'UNLOCKED'
-row.prop(sc, "lock_selection", icon=icon, text="")
-row.popover(panel='CLIP_PT_display')
 
 # Proportional Editing
 row = layout.row(align=True)
@@ -230,6 +226,11 @@ class CLIP_HT_header(Header):
 panel="CLIP_PT_proportional_edit",
 )
 
+row = layout.row(align=True)
+icon = 'LOCKED' if sc.lock_selection else 'UNLOCKED'
+row.prop(sc, "lock_selection", icon=icon, text="")
+row.popover(panel='CLIP_PT_display')
+
 elif sc.view == 'GRAPH':
 row = layout.row(align=True)
 row.prop(sc, "show_graph_only_selected", text="")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c0a8dd943f3] master: Fix T84018: bulk selection (box, circle, lasso) - unwarranted selection of islands in vertex mode if "UV Sync Selection" is on

2021-01-05 Thread Philipp Oeser
Commit: c0a8dd943f3de2b1c4bdb86790714946fd9c8976
Author: Philipp Oeser
Date:   Tue Dec 22 11:42:55 2020 +0100
Branches: master
https://developer.blender.org/rBc0a8dd943f3de2b1c4bdb86790714946fd9c8976

Fix T84018: bulk selection (box, circle, lasso) - unwarranted selection
of islands in vertex mode if "UV Sync Selection" is on

Caused by rB72b422c1e101: UV: support select linked with sync-select in
vert/edge modes

If you had island selection mode enabled in the UV editor with UV Sync
Selection off, and switch UV Sync Selection on, then in vertex selection
mode all bulk selection ops (box, circle, lasso) will be selecting whole
islands.

Prior to culprit commit, for sync selection ON plus island selection ON,
BM_uv_vert_map_create would always return a NULL vmap (it was called
with `use_select` = True, no faces tagged selected). After said commit,
for sync selection ON plus island selection ON, BM_uv_vert_map_create
would return a valid vmap (it is now called with `use_select` = False,
no faces tagged selected - but if `use_select` is False, all UVs will be
added here).

If I am not mistaken, it is never wanted to actually select islands with
box/lasso/circle when sync selection is turned ON [after all you dont
have the UI for it showing], so solution is now to check for this
earlier and not even call uv_select_linked_multi in those cases. (Maybe
in the future this can be unified and we dont need separate selection
modes fo UV and 3D?)

Maniphest Tasks: T84018

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

===

M   source/blender/editors/uvedit/uvedit_select.c

===

diff --git a/source/blender/editors/uvedit/uvedit_select.c 
b/source/blender/editors/uvedit/uvedit_select.c
index 499260127da..bfb01cb073e 100644
--- a/source/blender/editors/uvedit/uvedit_select.c
+++ b/source/blender/editors/uvedit/uvedit_select.c
@@ -2878,6 +2878,8 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
   const bool use_edge = ((ts->uv_flag & UV_SYNC_SELECTION) ?
  (ts->selectmode == SCE_SELECT_EDGE) :
  (ts->uv_selectmode == UV_SELECT_EDGE));
+  const bool use_select_linked = !(ts->uv_flag & UV_SYNC_SELECTION) &&
+ (ts->uv_selectmode == UV_SELECT_ISLAND);
 
   /* get rectangle from operator */
   WM_operator_properties_border_to_rctf(op, &rectf);
@@ -2981,7 +2983,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
 }
   }
 }
-if (has_selected && ts->uv_selectmode == UV_SELECT_ISLAND) {
+if (has_selected && use_select_linked) {
   UvNearestHit hit = {
   .ob = obedit,
   .efa = efa,
@@ -3089,6 +3091,8 @@ static int uv_circle_select_exec(bContext *C, wmOperator 
*op)
   const bool use_edge = ((ts->uv_flag & UV_SYNC_SELECTION) ?
  (ts->selectmode == SCE_SELECT_EDGE) :
  (ts->uv_selectmode == UV_SELECT_EDGE));
+  const bool use_select_linked = !(ts->uv_flag & UV_SYNC_SELECTION) &&
+ (ts->uv_selectmode == UV_SELECT_ISLAND);
 
   /* get operator properties */
   x = RNA_int_get(op->ptr, "x");
@@ -3188,7 +3192,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator 
*op)
 }
   }
 }
-if (has_selected && ts->uv_selectmode == UV_SELECT_ISLAND) {
+if (has_selected && use_select_linked) {
   UvNearestHit hit = {
   .ob = obedit,
   .efa = efa,
@@ -3276,6 +3280,8 @@ static bool do_lasso_select_mesh_uv(bContext *C,
   const bool use_edge = ((ts->uv_flag & UV_SYNC_SELECTION) ?
  (ts->selectmode == SCE_SELECT_EDGE) :
  (ts->uv_selectmode == UV_SELECT_EDGE));
+  const bool use_select_linked = !(ts->uv_flag & UV_SYNC_SELECTION) &&
+ (ts->uv_selectmode == UV_SELECT_ISLAND);
 
   const bool select = (sel_op != SEL_OP_SUB);
   const bool use_pre_deselect = SEL_OP_USE_PRE_DESELECT(sel_op);
@@ -3370,7 +3376,7 @@ static bool do_lasso_select_mesh_uv(bContext *C,
 }
   }
 }
-if (has_selected && ts->uv_selectmode == UV_SELECT_ISLAND) {
+if (has_selected && use_select_linked) {
   UvNearestHit hit = {
   .ob = obedit,
   .efa = efa,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b5290af821d] tracking_average: Tracking: Fix wrong interpolation at the end of markers array

2021-01-05 Thread Sergey Sharybin
Commit: b5290af821d45f139f217d21f1d28ee427ca22af
Author: Sergey Sharybin
Date:   Tue Jan 5 10:26:34 2021 +0100
Branches: tracking_average
https://developer.blender.org/rBb5290af821d45f139f217d21f1d28ee427ca22af

Tracking: Fix wrong interpolation at the end of markers array

===

M   source/blender/blenkernel/intern/tracking.c
M   source/blender/blenkernel/intern/tracking_test.cc

===

diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index e41d8e5a162..68f311bc19c 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1587,6 +1587,10 @@ bool BKE_tracking_marker_get_interpolated(struct 
MovieTrackingTrack *track,
   if (closest_marker == NULL) {
 return false;
   }
+  if (closest_marker->framenr == framenr && (closest_marker->flag & 
MARKER_DISABLED) == 0) {
+*r_marker = *closest_marker;
+return true;
+  }
 
   const MovieTrackingMarker *left_marker = get_usable_marker_for_interpolation(
   track, closest_marker, -1);
diff --git a/source/blender/blenkernel/intern/tracking_test.cc 
b/source/blender/blenkernel/intern/tracking_test.cc
index d3ce3ff82fc..13e1a7353c0 100644
--- a/source/blender/blenkernel/intern/tracking_test.cc
+++ b/source/blender/blenkernel/intern/tracking_test.cc
@@ -134,6 +134,13 @@ TEST_F(TrackingTest, BKE_tracking_marker_get_interpolated)
   EXPECT_V2_NEAR(interpolated_marker.pos, float2(1.333f, 3.666f), 
1e-6f);
 }
 
+{
+  MovieTrackingMarker interpolated_marker;
+  EXPECT_TRUE(BKE_tracking_marker_get_interpolated(&track, 9, 
&interpolated_marker));
+  EXPECT_EQ(interpolated_marker.framenr, 9);
+  EXPECT_V2_NEAR(interpolated_marker.pos, float2(1.88f, 1.444f), 
1e-6f);
+}
+
 BKE_tracking_track_free(&track);
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dc4014c6763] master: Cleanup: Enum for mask overlay mode

2021-01-05 Thread Jeroen Bakker
Commit: dc4014c6763e1e1fb21a5bbe3ec063166ad2ec80
Author: Jeroen Bakker
Date:   Tue Jan 5 10:12:22 2021 +0100
Branches: master
https://developer.blender.org/rBdc4014c6763e1e1fb21a5bbe3ec063166ad2ec80

Cleanup: Enum for mask overlay mode

===

M   source/blender/editors/include/ED_mask.h
M   source/blender/editors/mask/mask_draw.c
M   source/blender/makesdna/DNA_mask_types.h

===

diff --git a/source/blender/editors/include/ED_mask.h 
b/source/blender/editors/include/ED_mask.h
index f683495608a..bcf52da3f69 100644
--- a/source/blender/editors/include/ED_mask.h
+++ b/source/blender/editors/include/ED_mask.h
@@ -27,6 +27,8 @@
 extern "C" {
 #endif
 
+#include "DNA_mask_types.h"
+
 struct Depsgraph;
 struct KeyframeEditData;
 struct MaskLayer;
@@ -70,7 +72,7 @@ void ED_mask_draw_region(struct Depsgraph *depsgraph,
  struct ARegion *region,
  const char draw_flag,
  const char draw_type,
- const char overlay_mode,
+ const eMaskOverlayMode overlay_mode,
  const int width_i,
  const int height_i,
  const float aspx,
diff --git a/source/blender/editors/mask/mask_draw.c 
b/source/blender/editors/mask/mask_draw.c
index c757b6f0cc3..89fd2fa9b62 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -674,7 +674,7 @@ void ED_mask_draw_region(
 ARegion *region,
 const char draw_flag,
 const char draw_type,
-const char overlay_mode,
+const eMaskOverlayMode overlay_mode,
 /* convert directly into aspect corrected vars */
 const int width_i,
 const int height_i,
diff --git a/source/blender/makesdna/DNA_mask_types.h 
b/source/blender/makesdna/DNA_mask_types.h
index 296f5bceb81..79ac655300e 100644
--- a/source/blender/makesdna/DNA_mask_types.h
+++ b/source/blender/makesdna/DNA_mask_types.h
@@ -225,10 +225,10 @@ enum {
 };
 
 /* MaskSpaceInfo->overlay_mode */
-enum {
+typedef enum eMaskOverlayMode {
   MASK_OVERLAY_ALPHACHANNEL = 0,
   MASK_OVERLAY_COMBINED = 1,
-};
+} eMaskOverlayMode;
 
 /* masklay->blend */
 enum {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7d152bedc5f] master: Fix T84216: Drawing a paintcurve [vertexpaint / weightpaint] fails

2021-01-05 Thread Philipp Oeser
Commit: 7d152bedc5f172d77915d1377f0a8ca3a627e583
Author: Philipp Oeser
Date:   Mon Dec 28 17:39:12 2020 +0100
Branches: master
https://developer.blender.org/rB7d152bedc5f172d77915d1377f0a8ca3a627e583

Fix T84216: Drawing a paintcurve [vertexpaint / weightpaint] fails

Caused by rB35e3dc9192e7.

Above commit moved 'Weight Paint' & 'Vertex Paint' keymap also before
'Paint Curve' keymap.
This way, paintcurve.add_point_slide would be overriden by:
- paint.vertex_paint (inverted)
- paint.weight_sample

Now move 'Paint Curve' above again.

Reviewers: campbellbarton

Maniphest Tasks: T84216

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

===

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

===

diff --git a/source/blender/editors/space_view3d/space_view3d.c 
b/source/blender/editors/space_view3d/space_view3d.c
index 3761f4ad7c6..82a20451d26 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -392,6 +392,10 @@ static void view3d_main_region_init(wmWindowManager *wm, 
ARegion *region)
   keymap = WM_keymap_ensure(wm->defaultconf, "Paint Vertex Selection (Weight, 
Vertex)", 0, 0);
   WM_event_add_keymap_handler(®ion->handlers, keymap);
 
+  /* Before 'Weight/Vertex Paint' so adding curve points is not overriden. */
+  keymap = WM_keymap_ensure(wm->defaultconf, "Paint Curve", 0, 0);
+  WM_event_add_keymap_handler(®ion->handlers, keymap);
+
   /* Before 'Pose' so weight paint menus aren't overridden by pose menus. */
   keymap = WM_keymap_ensure(wm->defaultconf, "Weight Paint", 0, 0);
   WM_event_add_keymap_handler(®ion->handlers, keymap);
@@ -406,9 +410,6 @@ static void view3d_main_region_init(wmWindowManager *wm, 
ARegion *region)
   keymap = WM_keymap_ensure(wm->defaultconf, "Object Mode", 0, 0);
   WM_event_add_keymap_handler(®ion->handlers, keymap);
 
-  keymap = WM_keymap_ensure(wm->defaultconf, "Paint Curve", 0, 0);
-  WM_event_add_keymap_handler(®ion->handlers, keymap);
-
   keymap = WM_keymap_ensure(wm->defaultconf, "Curve", 0, 0);
   WM_event_add_keymap_handler(®ion->handlers, keymap);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [36b0c0e1d7b] tracking_average: Tracking: Implement tracks average operator

2021-01-05 Thread Sergey Sharybin
Commit: 36b0c0e1d7bb58aece606f7baa8393fcb6b2b440
Author: Sergey Sharybin
Date:   Thu Nov 28 11:14:32 2019 +0100
Branches: tracking_average
https://developer.blender.org/rB36b0c0e1d7bb58aece606f7baa8393fcb6b2b440

Tracking: Implement tracks average operator

Average selected tracks into the new one. This can be used to improve
stability of tracking on blurry or non-very-sharp feature shapes.

Averaging happens for all position, pattern corners and search area.
Disabled markers do not take effect on averaging. Keyframed flag is
copied from source.

Gaps in the source tracks will be linearly interpolated, to reduce
result track jump. Note that this only applies to gaps "inbetween".
This means that if an input track doesn't have markers in the
beginning/end of it, there is nothing to interpolate with and the
result track will jump.

Available from the Track panel, under the Merge category.

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

===

M   release/scripts/startup/bl_ui/space_clip.py
M   source/blender/blenkernel/BKE_tracking.h
M   source/blender/blenkernel/intern/tracking.c
M   source/blender/editors/space_clip/clip_intern.h
M   source/blender/editors/space_clip/space_clip.c
M   source/blender/editors/space_clip/tracking_ops.c

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 35fd7333cf4..1d338bf2c3a 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -502,7 +502,9 @@ class CLIP_PT_tools_tracking(CLIP_PT_tracking_panel, Panel):
 col = layout.column(align=True)
 row = col.row(align=True)
 row.label(text="Merge:")
-row.operator("clip.join_tracks", text="Join Tracks")
+sub = row.column()
+sub.operator("clip.join_tracks", text="Join Tracks")
+sub.operator("clip.average_tracks", text="Average Tracks")
 
 
 class CLIP_PT_tools_plane_tracking(CLIP_PT_tracking_panel, Panel):
diff --git a/source/blender/blenkernel/BKE_tracking.h 
b/source/blender/blenkernel/BKE_tracking.h
index 5da8d969f1e..c2544c06514 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -89,6 +89,23 @@ struct MovieTrackingTrack 
*BKE_tracking_track_duplicate(struct MovieTrackingTrac
 void BKE_tracking_track_unique_name(struct ListBase *tracksbase, struct 
MovieTrackingTrack *track);
 void BKE_tracking_track_free(struct MovieTrackingTrack *track);
 
+void BKE_tracking_track_first_last_frame_get(const struct MovieTrackingTrack 
*track,
+ int *r_first_frame,
+ int *r_last_frame);
+
+void BKE_tracking_tracks_first_last_frame_minmax(/*const*/ struct 
MovieTrackingTrack **tracks,
+ const int num_tracks,
+ int *r_first_frame,
+ int *r_last_frame);
+
+int BKE_tracking_count_selected_tracks_in_list(const struct ListBase 
*tracks_list);
+int BKE_tracking_count_selected_tracks_in_active_object(/*const*/ struct 
MovieTracking *tracking);
+
+/* Get array of selected tracks from the current active object in the tracking 
structure.
+ * If nothing is selected then the result is nullptr and `r_num_tracks` is set 
to 0. */
+struct MovieTrackingTrack **BKE_tracking_selected_tracks_in_active_object(
+struct MovieTracking *tracking, int *r_num_tracks);
+
 void BKE_tracking_track_flag_set(struct MovieTrackingTrack *track, int area, 
int flag);
 void BKE_tracking_track_flag_clear(struct MovieTrackingTrack *track, int area, 
int flag);
 
@@ -96,10 +113,15 @@ bool BKE_tracking_track_has_marker_at_frame(struct 
MovieTrackingTrack *track, in
 bool BKE_tracking_track_has_enabled_marker_at_frame(struct MovieTrackingTrack 
*track, int framenr);
 
 void BKE_tracking_track_path_clear(struct MovieTrackingTrack *track, int 
ref_frame, int action);
+
 void BKE_tracking_tracks_join(struct MovieTracking *tracking,
   struct MovieTrackingTrack *dst_track,
   struct MovieTrackingTrack *src_track);
 
+void BKE_tracking_tracks_average(struct MovieTrackingTrack *dst_track,
+ /*const*/ struct MovieTrackingTrack 
**src_tracks,
+ const int num_src_tracks);
+
 struct MovieTrackingTrack *BKE_tracking_track_get_named(struct MovieTracking 
*tracking,
 struct 
MovieTrackingObject *object,
 const char *name);
diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index bc892c7dd88..e41d8e5a162 10064

[Bf-blender-cvs] [59b586b3376] tracking_average: Tracking: Add interpolated accessor for markers

2021-01-05 Thread Sergey Sharybin
Commit: 59b586b3376eef39b1079af945f1d6fa29eba3eb
Author: Sergey Sharybin
Date:   Mon Dec 28 17:28:28 2020 +0100
Branches: tracking_average
https://developer.blender.org/rB59b586b3376eef39b1079af945f1d6fa29eba3eb

Tracking: Add interpolated accessor for markers

Allows to get marker position interpolated through out a gap.

Currently unused, but is covered with test. Aimed to be used for
track average operator.

===

M   source/blender/blenkernel/BKE_tracking.h
M   source/blender/blenkernel/intern/tracking.c
M   source/blender/blenkernel/intern/tracking_test.cc

===

diff --git a/source/blender/blenkernel/BKE_tracking.h 
b/source/blender/blenkernel/BKE_tracking.h
index 4dbc22ae18f..5da8d969f1e 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -139,6 +139,17 @@ struct MovieTrackingMarker 
*BKE_tracking_marker_get_exact(struct MovieTrackingTr
 struct MovieTrackingMarker *BKE_tracking_marker_ensure(struct 
MovieTrackingTrack *track,
int framenr);
 
+/* Get marker position, possibly interpolating interpolating gap between 
keyframed/tracked markers.
+ *
+ * The result marker frame number is set to the requested frame number. Its 
flags are 0 if the
+ * marker is interpolated, and is set to original marker flag if there were no 
interpolation
+ * involved.
+ *
+ * Returns truth if the result is usable. */
+bool BKE_tracking_marker_get_interpolated(struct MovieTrackingTrack *track,
+  const int framenr,
+  struct MovieTrackingMarker 
*r_marker);
+
 void BKE_tracking_marker_pattern_minmax(const struct MovieTrackingMarker 
*marker,
 float min[2],
 float max[2]);
diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index e5f9d59270e..bc892c7dd88 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1389,6 +1389,80 @@ MovieTrackingMarker 
*BKE_tracking_marker_ensure(MovieTrackingTrack *track, int f
   return marker;
 }
 
+static const MovieTrackingMarker *get_usable_marker_for_interpolation(
+struct MovieTrackingTrack *track,
+const MovieTrackingMarker *anchor_marker,
+const int direction)
+{
+  BLI_assert(direction == -1 || direction == 1);
+
+  const MovieTrackingMarker *last_marker = track->markers + track->markersnr - 
1;
+  const MovieTrackingMarker *current_marker = anchor_marker;
+
+  while (current_marker >= track->markers && current_marker <= last_marker) {
+if ((current_marker->flag & MARKER_DISABLED) == 0) {
+  return current_marker;
+}
+current_marker += direction;
+  }
+
+  return NULL;
+}
+
+bool BKE_tracking_marker_get_interpolated(struct MovieTrackingTrack *track,
+  const int framenr,
+  struct MovieTrackingMarker *r_marker)
+{
+  const MovieTrackingMarker *closest_marker = BKE_tracking_marker_get(track, 
framenr);
+  if (closest_marker == NULL) {
+return false;
+  }
+
+  const MovieTrackingMarker *left_marker = get_usable_marker_for_interpolation(
+  track, closest_marker, -1);
+  if (left_marker == NULL) {
+return false;
+  }
+
+  const MovieTrackingMarker *right_marker = 
get_usable_marker_for_interpolation(
+  track, closest_marker + 1, 1);
+  if (right_marker == NULL) {
+return false;
+  }
+
+  if (left_marker == right_marker) {
+*r_marker = *left_marker;
+return true;
+  }
+
+  const float factor = (float)(framenr - left_marker->framenr) /
+   (right_marker->framenr - left_marker->framenr);
+
+  interp_v2_v2v2(r_marker->pos, left_marker->pos, right_marker->pos, factor);
+
+  for (int i = 0; i < 4; i++) {
+interp_v2_v2v2(r_marker->pattern_corners[i],
+   left_marker->pattern_corners[i],
+   right_marker->pattern_corners[i],
+   factor);
+  }
+
+  interp_v2_v2v2(r_marker->search_min, left_marker->search_min, 
right_marker->search_min, factor);
+  interp_v2_v2v2(r_marker->search_max, left_marker->search_max, 
right_marker->search_max, factor);
+
+  r_marker->framenr = framenr;
+  r_marker->flag = 0;
+
+  if (framenr == left_marker->framenr) {
+r_marker->flag = left_marker->flag;
+  }
+  else if (framenr == right_marker->framenr) {
+r_marker->flag = right_marker->flag;
+  }
+
+  return true;
+}
+
 void BKE_tracking_marker_pattern_minmax(const MovieTrackingMarker *marker,
 float min[2],
 float max[2])
diff --git a/source/blender/blenkernel/intern/tracking_test.cc 
b/source/blender/blenkernel/intern/tr

[Bf-blender-cvs] [6c079d528d1] tracking_proportional_editing: Tracking: Implement proportional editing

2021-01-05 Thread Sergey Sharybin
Commit: 6c079d528d1fa03abbe31a1fd5e225e24682d0cd
Author: Sergey Sharybin
Date:   Thu Dec 31 15:13:50 2020 +0100
Branches: tracking_proportional_editing
https://developer.blender.org/rB6c079d528d1fa03abbe31a1fd5e225e24682d0cd

Tracking: Implement proportional editing

Disclaimer: the user interface and interaction is not final. There
are known sharp corners, which are planned to be addressed while
the patch is being tested by people.

The idea is to avoid sudden jumps of track path when artists detects
track got slid away from the feature and one re-positions track back.
The implementation is based on a proportional editing, which allows
to control whether to transform single marker or whether to propagate
transform to markers from neighbour frames. The proportional editing
also allows to control propagation curve. The propagation will stop
at the end of tracked segment.

To test the new functionality:

1. Enable proportional editing
2. Enable "Connected Only". This is essential, as otherwise the new
   functionality is not enabled.
3. Grab marker.

Open topics:
- Make the functionality more discoverable.
- Make visualization of how far propagation goes more clear.
- Make defaults more usable.

Technical TODO:
- Most likely CANCEL of the transform does not properly restore the
  full state prior to the transform. This needs to be solved.

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

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   release/scripts/startup/bl_ui/space_clip.py
M   source/blender/editors/transform/transform_constraints.c
M   source/blender/editors/transform/transform_convert.c
M   source/blender/editors/transform/transform_convert_tracking.c

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index d3990851e2c..2ea6eb5786a 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2830,6 +2830,7 @@ def km_clip_editor(params):
 ("clip.copy_tracks", {"type": 'C', "value": 'PRESS', "ctrl": True}, 
None),
 ("clip.paste_tracks", {"type": 'V', "value": 'PRESS', "ctrl": True}, 
None),
 *_template_items_context_menu("CLIP_MT_tracking_context_menu", 
params.context_menu_event),
+*_template_items_proportional_editing(connected=False),
 ])
 
 if params.legacy:
diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 35fd7333cf4..a0a67ba084d 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -125,6 +125,24 @@ class CLIP_PT_clip_display(Panel):
 col.prop(clip, "display_aspect", text="Display Aspect Ratio")
 
 
+class CLIP_PT_proportional_edit(Panel):
+bl_space_type = 'CLIP_EDITOR'
+bl_region_type = 'HEADER'
+bl_label = "Proportional Editing"
+bl_ui_units_x = 8
+
+def draw(self, context):
+layout = self.layout
+tool_settings = context.tool_settings
+col = layout.column()
+col.active = tool_settings.use_proportional_edit
+
+col.prop(tool_settings, "use_proportional_connected")
+col.separator()
+
+col.prop(tool_settings, "proportional_edit_falloff", expand=True)
+
+
 class CLIP_HT_header(Header):
 bl_space_type = 'CLIP_EDITOR'
 
@@ -181,6 +199,7 @@ class CLIP_HT_header(Header):
 
 if sc.view == 'CLIP':
 r = active_object.reconstruction
+tool_settings = context.tool_settings
 
 if r.is_valid and sc.view == 'CLIP':
 layout.label(text="Solve error: %.2f px" %
@@ -193,6 +212,24 @@ class CLIP_HT_header(Header):
 row.prop(sc, "lock_selection", icon=icon, text="")
 row.popover(panel='CLIP_PT_display')
 
+# Proportional Editing
+row = layout.row(align=True)
+row.prop(
+tool_settings,
+"use_proportional_edit",
+icon_only=True,
+icon='PROP_CON' if 
tool_settings.use_proportional_connected else 'PROP_ON',
+)
+sub = row.row(align=True)
+sub.active = tool_settings.use_proportional_edit
+sub.prop_with_popover(
+tool_settings,
+"proportional_edit_falloff",
+text="",
+icon_only=True,
+panel="CLIP_PT_proportional_edit",
+)
+
 elif sc.view == 'GRAPH':
 row = layout.row(align=True)
 row.prop(sc, "show_graph_only_selected", text="")
@@ -1781,6 +1818,7 @@ cl

[Bf-blender-cvs] [ffb07a40218] tracking_proportional_editing: Tracking: Re-duplicate logic used to count and initialize data

2021-01-05 Thread Sergey Sharybin
Commit: ffb07a40218a90f57aaa1bc047e4b12a9aa22eeb
Author: Sergey Sharybin
Date:   Thu Dec 31 12:01:29 2020 +0100
Branches: tracking_proportional_editing
https://developer.blender.org/rBffb07a40218a90f57aaa1bc047e4b12a9aa22eeb

Tracking: Re-duplicate logic used to count and initialize data

Allows to easily implement more comprehensive checks about which
markers get added to the transformation context.

No user measurable changes are expected, purely house-keeping to
ease an upcoming development.

===

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

===

diff --git a/source/blender/editors/transform/transform_convert_tracking.c 
b/source/blender/editors/transform/transform_convert_tracking.c
index 59dd5766f45..be4ffa5dfce 100644
--- a/source/blender/editors/transform/transform_convert_tracking.c
+++ b/source/blender/editors/transform/transform_convert_tracking.c
@@ -74,6 +74,15 @@ enum transDataTracking_Mode {
  * \{ */
 
 typedef struct TransformInitContext {
+  SpaceClip *space_clip;
+  TransDataContainer *tc;
+
+  /* MOTE: There popinters will be nullptr during counting step.
+   * This means, that the transformation data initialization functions are to 
increment
+   * `tc->data_len` instead of filling in the transformation data when these 
pointers are nullptr.
+   * For simplicitly, check the `current.td` against nullptr.
+   * Do not `tc->data_len` when filling in the transformation data.
+   */
   struct {
 TransData *td;
 TransData2D *td2d;
@@ -94,6 +103,11 @@ static void markerToTransDataInit(TransformInitContext 
*init_context,
   TransData2D *td2d = init_context->current.td2d;
   TransDataTracking *tdt = init_context->current.tdt;
 
+  if (td == NULL) {
+init_context->tc->data_len++;
+return;
+  }
+
   int anchor = area == TRACK_AREA_POINT && off;
 
   tdt->flag = marker->flag;
@@ -219,6 +233,20 @@ static void trackToTransData(TransformInitContext 
*init_context,
   marker->flag &= ~(MARKER_DISABLED | MARKER_TRACKED);
 }
 
+static void trackToTransDataIfNeeded(TransformInitContext *init_context,
+ const int framenr,
+ MovieTrackingTrack *track,
+ const float aspect[2])
+{
+  if (!TRACK_VIEW_SELECTED(init_context->space_clip, track)) {
+return;
+  }
+  if (track->flag & TRACK_LOCKED) {
+return;
+  }
+  trackToTransData(init_context, framenr, track, aspect);
+}
+
 static void planeMarkerToTransDataInit(TransformInitContext *init_context,
MovieTrackingPlaneTrack *plane_track,
MovieTrackingPlaneMarker *plane_marker,
@@ -229,6 +257,11 @@ static void 
planeMarkerToTransDataInit(TransformInitContext *init_context,
   TransData2D *td2d = init_context->current.td2d;
   TransDataTracking *tdt = init_context->current.tdt;
 
+  if (td == NULL) {
+init_context->tc->data_len++;
+return;
+  }
+
   tdt->flag = plane_marker->flag;
   tdt->mode = transDataTracking_ModePlaneTracks;
   tdt->plane_track = plane_track;
@@ -276,6 +309,17 @@ static void planeTrackToTransData(TransformInitContext 
*init_context,
   plane_marker->flag &= ~PLANE_MARKER_TRACKED;
 }
 
+static void planeTrackToTransDataIfNeeded(TransformInitContext *init_context,
+  const int framenr,
+  MovieTrackingPlaneTrack *plane_track,
+  const float aspect[2])
+{
+  if (!PLANE_TRACK_VIEW_SELECTED(plane_track)) {
+return;
+  }
+  planeTrackToTransData(init_context, framenr, plane_track, aspect);
+}
+
 static void transDataTrackingFree(TransInfo *UNUSED(t),
   TransDataContainer *UNUSED(tc),
   TransCustomData *custom_data)
@@ -293,80 +337,52 @@ static void transDataTrackingFree(TransInfo *UNUSED(t),
 
 static void createTransTrackingTracksData(bContext *C, TransInfo *t)
 {
-  TransData *td;
-  TransData2D *td2d;
-  SpaceClip *sc = CTX_wm_space_clip(C);
-  MovieClip *clip = ED_space_clip_get_clip(sc);
-  ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
-  ListBase *plane_tracks_base = 
BKE_tracking_get_active_plane_tracks(&clip->tracking);
-  MovieTrackingTrack *track;
-  MovieTrackingPlaneTrack *plane_track;
-  TransDataTracking *tdt;
-  int framenr = ED_space_clip_get_clip_frame_number(sc);
+  SpaceClip *space_clip = CTX_wm_space_clip(C);
+  MovieClip *clip = ED_space_clip_get_clip(space_clip);
+  const ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
+  const ListBase *plane_tracks_base = 
BKE_tracking_get_active_plane_tracks(&clip->tracking);
+  const int framenr = ED_space_clip_get_clip_frame_number(space_clip);
 
   TransDataContainer *tc = TRANS_DATA_CON

[Bf-blender-cvs] [b8e4f11a097] tracking_proportional_editing: Tracking: Fix wrong projection for post-draw pass

2021-01-05 Thread Sergey Sharybin
Commit: b8e4f11a097d01a6a9fa5af4aff7a2d41420d10b
Author: Sergey Sharybin
Date:   Thu Dec 31 15:09:26 2020 +0100
Branches: tracking_proportional_editing
https://developer.blender.org/rBb8e4f11a097d01a6a9fa5af4aff7a2d41420d10b

Tracking: Fix wrong projection for post-draw pass

Allows to draw proportional editing circle at a proper location.

===

M   source/blender/editors/space_clip/space_clip.c

===

diff --git a/source/blender/editors/space_clip/space_clip.c 
b/source/blender/editors/space_clip/space_clip.c
index b17a0ba03d5..33c4bf7c255 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -987,7 +987,10 @@ static void clip_main_region_draw(const bContext *C, 
ARegion *region)
   }
 
   /* callback */
+  GPU_matrix_push_projection();
+  wmOrtho2(region->v2d.cur.xmin, region->v2d.cur.xmax, region->v2d.cur.ymin, 
region->v2d.cur.ymax);
   ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
+  GPU_matrix_pop_projection();
 
   /* reset view matrix */
   UI_view2d_view_restore(C);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1e08000b738] tracking_proportional_editing: Tracking: Simplify transform code

2021-01-05 Thread Sergey Sharybin
Commit: 1e08000b738d9353f28bd82e4910514c5f075964
Author: Sergey Sharybin
Date:   Tue Dec 29 16:51:31 2020 +0100
Branches: tracking_proportional_editing
https://developer.blender.org/rB1e08000b738d9353f28bd82e4910514c5f075964

Tracking: Simplify transform code

Reduce amount of duplicated pointer offset logic: advance transform
data pointers deep in the loop rather than have offset duplicated in
the outer loop.

Array size calculation still has duplicated, but that is another story.

===

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

===

diff --git a/source/blender/editors/transform/transform_convert_tracking.c 
b/source/blender/editors/transform/transform_convert_tracking.c
index c3f48adca68..59dd5766f45 100644
--- a/source/blender/editors/transform/transform_convert_tracking.c
+++ b/source/blender/editors/transform/transform_convert_tracking.c
@@ -73,9 +73,15 @@ enum transDataTracking_Mode {
  *
  * \{ */
 
-static void markerToTransDataInit(TransData *td,
-  TransData2D *td2d,
-  TransDataTracking *tdt,
+typedef struct TransformInitContext {
+  struct {
+TransData *td;
+TransData2D *td2d;
+TransDataTracking *tdt;
+  } current;
+} TransformInitContext;
+
+static void markerToTransDataInit(TransformInitContext *init_context,
   MovieTrackingTrack *track,
   MovieTrackingMarker *marker,
   int area,
@@ -84,8 +90,13 @@ static void markerToTransDataInit(TransData *td,
   const float off[2],
   const float aspect[2])
 {
+  TransData *td = init_context->current.td;
+  TransData2D *td2d = init_context->current.td2d;
+  TransDataTracking *tdt = init_context->current.tdt;
+
   int anchor = area == TRACK_AREA_POINT && off;
 
+  tdt->flag = marker->flag;
   tdt->mode = transDataTracking_ModeTracks;
 
   if (anchor) {
@@ -143,23 +154,20 @@ static void markerToTransDataInit(TransData *td,
 
   unit_m3(td->mtx);
   unit_m3(td->smtx);
+
+  init_context->current.td++;
+  init_context->current.td2d++;
+  init_context->current.tdt++;
 }
 
-static void trackToTransData(const int framenr,
- TransData *td,
- TransData2D *td2d,
- TransDataTracking *tdt,
+static void trackToTransData(TransformInitContext *init_context,
+ const int framenr,
  MovieTrackingTrack *track,
  const float aspect[2])
 {
   MovieTrackingMarker *marker = BKE_tracking_marker_ensure(track, framenr);
 
-  tdt->flag = marker->flag;
-  marker->flag &= ~(MARKER_DISABLED | MARKER_TRACKED);
-
-  markerToTransDataInit(td++,
-td2d++,
-tdt++,
+  markerToTransDataInit(init_context,
 track,
 marker,
 TRACK_AREA_POINT,
@@ -170,16 +178,14 @@ static void trackToTransData(const int framenr,
 
   if (track->flag & SELECT) {
 markerToTransDataInit(
-td++, td2d++, tdt++, track, marker, TRACK_AREA_POINT, marker->pos, 
NULL, NULL, aspect);
+init_context, track, marker, TRACK_AREA_POINT, marker->pos, NULL, 
NULL, aspect);
   }
 
   if (track->pat_flag & SELECT) {
 int a;
 
 for (a = 0; a < 4; a++) {
-  markerToTransDataInit(td++,
-td2d++,
-tdt++,
+  markerToTransDataInit(init_context,
 track,
 marker,
 TRACK_AREA_PAT,
@@ -191,9 +197,7 @@ static void trackToTransData(const int framenr,
   }
 
   if (track->search_flag & SELECT) {
-markerToTransDataInit(td++,
-  td2d++,
-  tdt++,
+markerToTransDataInit(init_context,
   track,
   marker,
   TRACK_AREA_SEARCH,
@@ -202,9 +206,7 @@ static void trackToTransData(const int framenr,
   NULL,
   aspect);
 
-markerToTransDataInit(td++,
-  td2d++,
-  tdt++,
+markerToTransDataInit(init_context,
   track,
   marker,
   TRACK_AREA_SEARCH,
@@ -213,15 +215,21 @@ static void trackToTransData(const int framenr,
   NULL,
   aspect);
   }
+
+  marker->flag &= ~(MARKER_DISABLED | MARKER_TRACKED);
 }
 
-static void planeMarkerToTransDataInit(TransData *td,
-   TransData2D *td2d,
-   TransDataTrack