[Bf-blender-cvs] [564673b8ea2] master: Fix T71137: curve minimum twist producing wrong geometry

2023-01-25 Thread Campbell Barton
Commit: 564673b8ea2860cc0d0b3a0f673a315693d3f5eb
Author: Campbell Barton
Date:   Thu Jan 26 16:05:21 2023 +1100
Branches: master
https://developer.blender.org/rB564673b8ea2860cc0d0b3a0f673a315693d3f5eb

Fix T71137: curve minimum twist producing wrong geometry

Only one point should be used to create a reference rotation for other
points to follow. Using two caused the resulting twist to be
asymmetric, especially noticeable on symmetrical, cyclic curves.

An update to [0] which broke curve_to_mesh & deform_modifiers tests,
now this change only applies to cyclic curves as the final result was
much greater for non-cyclic curves because of a difference between how
end-point directions are calculated (see code-comments for details).

Alternate fix to D11886 which caused T101843.

[0]: 36a82314a0f5de65b54f6d8343a2899ed4e37010.

===

M   source/blender/blenkernel/intern/curve.cc

===

diff --git a/source/blender/blenkernel/intern/curve.cc 
b/source/blender/blenkernel/intern/curve.cc
index 744ef0e8009..61dc8a22077 100644
--- a/source/blender/blenkernel/intern/curve.cc
+++ b/source/blender/blenkernel/intern/curve.cc
@@ -2250,6 +2250,19 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
   BevPoint *bevp2, *bevp1, *bevp0; /* Standard for all make_bevel_list_3D_* 
functions. */
   int nr;
   float q[4];
+  const bool is_cyclic = bl->poly != -1;
+  /* NOTE(@campbellbarton): For non-cyclic curves only initialize the first 
direction
+   * (via `vec_to_quat`), necessary for symmetry, see T71137.
+   * Otherwise initialize the first and second points before propagating 
rotation forward.
+   * This is historical as changing this can cause significantly different 
output.
+   * Specifically: `deform_modifiers` test: (`CurveMeshDeform`).
+   *
+   * While it would seem correct to only use the first point for non-cyclic 
curves as well
+   * the end-points direction is initialized from the input handles (instead 
of the directions
+   * between points), there is often a bigger difference in the first and 
second directions
+   * than you'd otherwise expect. So using only the first direction breaks 
compatibility
+   * enough it's best to leave it as-is. */
+  const int nr_init = bl->nr - (is_cyclic ? 1 : 2);
 
   bevel_list_calc_bisect(bl);
 
@@ -2260,7 +2273,8 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
   nr = bl->nr;
   while (nr--) {
 
-if (nr + 3 > bl->nr) { /* first time and second time, otherwise first 
point adjusts last */
+if (nr >= nr_init) {
+  /* Initialize the rotation, otherwise propagate the previous rotation 
forward. */
   vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
 }
 else {

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


[Bf-blender-cvs] [c1beaea80f9] master: Fix T103587: Redo panel doesn't appear for spin operator

2023-01-25 Thread Campbell Barton
Commit: c1beaea80f97026442a2b81e51ea80ce9dfc492d
Author: Campbell Barton
Date:   Thu Jan 26 11:01:32 2023 +1100
Branches: master
https://developer.blender.org/rBc1beaea80f97026442a2b81e51ea80ce9dfc492d

Fix T103587: Redo panel doesn't appear for spin operator

Regression in [0] which cleared the redo-panel if an operator added
its own undo step. This worked for sculpt to fix T101743, but caused
the redo-panel to be cleared for actions who's undo steps where created
by nested operators (which is the case for the spin operator).

Fix by checking an undo-step is added without registering an operator.

[0]: f68e50a263b8a970075c8fd540a985f2798e1d13

===

M   source/blender/windowmanager/intern/wm_event_system.cc

===

diff --git a/source/blender/windowmanager/intern/wm_event_system.cc 
b/source/blender/windowmanager/intern/wm_event_system.cc
index bf549cd00c9..c1ee3d522b6 100644
--- a/source/blender/windowmanager/intern/wm_event_system.cc
+++ b/source/blender/windowmanager/intern/wm_event_system.cc
@@ -944,6 +944,14 @@ static intptr_t wm_operator_undo_active_id(const 
wmWindowManager *wm)
   return -1;
 }
 
+static intptr_t wm_operator_register_active_id(const wmWindowManager *wm)
+{
+  if (wm->operators.last) {
+return intptr_t(wm->operators.last);
+  }
+  return -1;
+}
+
 bool WM_operator_poll(bContext *C, wmOperatorType *ot)
 {
 
@@ -1078,9 +1086,14 @@ static bool wm_operator_register_check(wmWindowManager 
*wm, wmOperatorType *ot)
 /**
  * \param has_undo_step: True when an undo step was added,
  * needed when the operator doesn't use #OPTYPE_UNDO, #OPTYPE_UNDO_GROUPED but 
adds an undo step.
+ * \param has_register: True when an operator was registered.
  */
-static void wm_operator_finished(
-bContext *C, wmOperator *op, const bool repeat, const bool store, const 
bool has_undo_step)
+static void wm_operator_finished(bContext *C,
+ wmOperator *op,
+ const bool repeat,
+ const bool store,
+ const bool has_undo_step,
+ const bool has_register)
 {
   wmWindowManager *wm = CTX_wm_manager(C);
   enum {
@@ -1088,6 +1101,7 @@ static void wm_operator_finished(
 SET,
 CLEAR,
   } hud_status = NOP;
+  const bool do_register = (repeat == false) && wm_operator_register_check(wm, 
op->type);
 
   op->customdata = nullptr;
 
@@ -1112,8 +1126,14 @@ static void wm_operator_finished(
   }
 }
 else if (has_undo_step) {
-  if (repeat == 0) {
-hud_status = CLEAR;
+  /* An undo step was added but the operator wasn't registered (and won't 
register it's self),
+   * therefor a redo panel wouldn't redo this action but the previous 
registered action,
+   * causing the "redo" to remove/loose this operator. See: T101743.
+   * Register check is needed so nested operator calls don't clear the 
HUD. See: T103587. */
+  if (!(has_register || do_register)) {
+if (repeat == 0) {
+  hud_status = CLEAR;
+}
   }
 }
   }
@@ -1125,7 +1145,7 @@ static void wm_operator_finished(
   MEM_freeN(buf);
 }
 
-if (wm_operator_register_check(wm, op->type)) {
+if (do_register) {
   /* Take ownership of reports (in case python provided own). */
   op->reports->flag |= RPT_FREE;
 
@@ -1177,6 +1197,8 @@ static int wm_operator_exec(bContext *C, wmOperator *op, 
const bool repeat, cons
   }
 
   const intptr_t undo_id_prev = wm_operator_undo_active_id(wm);
+  const intptr_t register_id_prev = wm_operator_register_active_id(wm);
+
   if (op->type->exec) {
 if (op->type->flag & OPTYPE_UNDO) {
   wm->op_undo_depth++;
@@ -1199,8 +1221,10 @@ static int wm_operator_exec(bContext *C, wmOperator *op, 
const bool repeat, cons
 
   if (retval & OPERATOR_FINISHED) {
 const bool has_undo_step = (undo_id_prev != 
wm_operator_undo_active_id(wm));
+const bool has_register = (register_id_prev != 
wm_operator_register_active_id(wm));
 
-wm_operator_finished(C, op, repeat, store && wm->op_undo_depth == 0, 
has_undo_step);
+wm_operator_finished(
+C, op, repeat, store && wm->op_undo_depth == 0, has_undo_step, 
has_register);
   }
   else if (repeat == 0) {
 /* WARNING: modal from exec is bad practice, but avoid crashing. */
@@ -1442,6 +1466,7 @@ static int wm_operator_invoke(bContext *C,
   if (WM_operator_poll(C, ot)) {
 wmWindowManager *wm = CTX_wm_manager(C);
 const intptr_t undo_id_prev = wm_operator_undo_active_id(wm);
+const intptr_t register_id_prev = wm_operator_register_active_id(wm);
 
 /* If `reports == nullptr`, they'll be initialized. */
 wmOperator *op = wm_operator_create(wm, ot, properties, reports);
@@ -1511,8 +1536,9 @@ static int wm_operator_invoke(bContext *C,
 }
 else if (retval & OPERATOR_F

[Bf-blender-cvs] [f5d94f97e41] master: Fix T104132: Vertex colors no longer displaying in Workbench

2023-01-25 Thread Miguel Pozo
Commit: f5d94f97e41e71b69927965ac7a66a6188217495
Author: Miguel Pozo
Date:   Wed Jan 25 23:01:00 2023 +0100
Branches: master
https://developer.blender.org/rBf5d94f97e41e71b69927965ac7a66a6188217495

Fix T104132: Vertex colors no longer displaying in Workbench

===

M   
source/blender/draw/engines/workbench/shaders/workbench_material_lib.glsl

===

diff --git 
a/source/blender/draw/engines/workbench/shaders/workbench_material_lib.glsl 
b/source/blender/draw/engines/workbench/shaders/workbench_material_lib.glsl
index 59e30b310bb..b663c029d5e 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_material_lib.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_material_lib.glsl
@@ -12,7 +12,7 @@ void workbench_material_data_get(int handle,
   vec4 data = materials_data[uint(handle) & 0xFFFu];
   color = data.rgb;
   if (materialIndex == 0) {
-color_interp = vertex_color;
+color = vertex_color;
   }
 #else

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


[Bf-blender-cvs] [fa57c691f66] master: USD IO CI Tests

2023-01-25 Thread Michael Kowalski
Commit: fa57c691f663bf4b446ccf0f91ce82ed9a2078b2
Author: Michael Kowalski
Date:   Wed Jan 25 14:51:39 2023 -0500
Branches: master
https://developer.blender.org/rBfa57c691f663bf4b446ccf0f91ce82ed9a2078b2

USD IO CI Tests

Various new CI tests for USD Import / Export functionalty:

Import:
 - Added mesh import tests for topology types and multiple UV sets. (Python)

Export:
 - Added a verification tests for mesh topology. (C++)
 - Added a test to make sure UsdPreviewSurface export conversion of materials
is correct. (C++)

Reviewed by: Sybren and Hans.

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

===

M   source/blender/blenloader/tests/blendfile_loading_base_test.cc
M   source/blender/io/usd/CMakeLists.txt
M   source/blender/io/usd/intern/usd_capi_export.cc
M   source/blender/io/usd/intern/usd_capi_import.cc
M   source/blender/io/usd/intern/usd_writer_material.cc
M   source/blender/io/usd/intern/usd_writer_material.h
A   source/blender/io/usd/tests/usd_export_test.cc
M   tests/python/bl_usd_import_test.py

===

diff --git a/source/blender/blenloader/tests/blendfile_loading_base_test.cc 
b/source/blender/blenloader/tests/blendfile_loading_base_test.cc
index 6f190ce427e..6613c65c42a 100644
--- a/source/blender/blenloader/tests/blendfile_loading_base_test.cc
+++ b/source/blender/blenloader/tests/blendfile_loading_base_test.cc
@@ -103,8 +103,8 @@ void BlendfileLoadingBaseTest::TearDownTestCase()
 void BlendfileLoadingBaseTest::TearDown()
 {
   BKE_mball_cubeTable_free();
-  depsgraph_free();
   blendfile_free();
+  depsgraph_free();
 
   testing::Test::TearDown();
 }
diff --git a/source/blender/io/usd/CMakeLists.txt 
b/source/blender/io/usd/CMakeLists.txt
index ebd292782c0..862bd41c087 100644
--- a/source/blender/io/usd/CMakeLists.txt
+++ b/source/blender/io/usd/CMakeLists.txt
@@ -163,13 +163,18 @@ target_link_libraries(bf_usd INTERFACE ${TBB_LIBRARIES})
 if(WITH_GTESTS)
   set(TEST_SRC
 tests/usd_stage_creation_test.cc
+tests/usd_export_test.cc
 tests/usd_tests_common.cc
 tests/usd_tests_common.h
+
+intern/usd_writer_material.h
   )
   if(USD_IMAGING_HEADERS)
 list(APPEND TEST_SRC tests/usd_imaging_test.cc)
   endif()
 
+  include_directories(intern)
+
   set(TEST_INC
   )
   set(TEST_LIB
diff --git a/source/blender/io/usd/intern/usd_capi_export.cc 
b/source/blender/io/usd/intern/usd_capi_export.cc
index 28da9e388c5..1d33ca3a13c 100644
--- a/source/blender/io/usd/intern/usd_capi_export.cc
+++ b/source/blender/io/usd/intern/usd_capi_export.cc
@@ -66,7 +66,9 @@ static void export_startjob(void *customdata,
   data->start_time = timeit::Clock::now();
 
   G.is_rendering = true;
-  WM_set_locked_interface(data->wm, true);
+  if (data->wm) {
+WM_set_locked_interface(data->wm, true);
+  }
   G.is_break = false;
 
   /* Construct the depsgraph for exporting. */
@@ -160,7 +162,9 @@ static void export_endjob(void *customdata)
   }
 
   G.is_rendering = false;
-  WM_set_locked_interface(data->wm, false);
+  if (data->wm) {
+WM_set_locked_interface(data->wm, false);
+  }
   report_job_duration(data);
 }
 
diff --git a/source/blender/io/usd/intern/usd_capi_import.cc 
b/source/blender/io/usd/intern/usd_capi_import.cc
index 66319a7f04e..fb870eb154c 100644
--- a/source/blender/io/usd/intern/usd_capi_import.cc
+++ b/source/blender/io/usd/intern/usd_capi_import.cc
@@ -207,6 +207,7 @@ static void import_startjob(void *customdata, bool *stop, 
bool *do_update, float
   if (!stage) {
 WM_reportf(RPT_ERROR, "USD Import: unable to open stage to read %s", 
data->filepath);
 data->import_ok = false;
+data->error_code = USD_ARCHIVE_FAIL;
 return;
   }
 
diff --git a/source/blender/io/usd/intern/usd_writer_material.cc 
b/source/blender/io/usd/intern/usd_writer_material.cc
index 98cd4036fd0..7e744b74f61 100644
--- a/source/blender/io/usd/intern/usd_writer_material.cc
+++ b/source/blender/io/usd/intern/usd_writer_material.cc
@@ -748,4 +748,16 @@ static void export_texture(bNode *node,
   }
 }
 
+const pxr::TfToken token_for_input(const char *input_name)
+{
+  const InputSpecMap &input_map = preview_surface_input_map();
+  const InputSpecMap::const_iterator it = input_map.find(input_name);
+
+  if (it == input_map.end()) {
+return pxr::TfToken();
+  }
+
+  return it->second.input_name;
+}
+
 }  // namespace blender::io::usd
diff --git a/source/blender/io/usd/intern/usd_writer_material.h 
b/source/blender/io/usd/intern/usd_writer_material.h
index fdfd13871ff..c6123b3cce2 100644
--- a/source/blender/io/usd/intern/usd_writer_material.h
+++ b/source/blender/io/usd/intern/usd_writer_material.h
@@ -14,6 +14,10 @@ namespace blender::io::usd {
 
 struct USDExporterContext;
 
+/* Returns a USDPreviewSurface token name for a given Blender shader Socket 
name,
+ * or an empty TfToken if the input name is not found in the map

[Bf-blender-cvs] [feae1c7d055] master: Gitea: update issue template with new scoped labels and other tweaks

2023-01-25 Thread Brecht Van Lommel
Commit: feae1c7d055f8817a9f0cedbb9a1432aede7f9cb
Author: Brecht Van Lommel
Date:   Wed Jan 25 13:54:51 2023 +0100
Branches: master
https://developer.blender.org/rBfeae1c7d055f8817a9f0cedbb9a1432aede7f9cb

Gitea: update issue template with new scoped labels and other tweaks

===

M   .gitea/issue_template/bug.yaml
M   .gitea/issue_template/design.yaml
M   .gitea/issue_template/todo.yaml
M   .gitea/pull_request_template.yaml

===

diff --git a/.gitea/issue_template/bug.yaml b/.gitea/issue_template/bug.yaml
index 9c4618c3223..4e3c550dae9 100644
--- a/.gitea/issue_template/bug.yaml
+++ b/.gitea/issue_template/bug.yaml
@@ -1,13 +1,15 @@
 name: Bug Report
 about: File a bug report
 labels:
-  - bug
+  - "type::Report"
+  - "status::Needs Triage"
+  - "priority::Normal"
 body:
   - type: markdown
 attributes:
   value: |
 ### Instructions
-First time reporting? See 
[tips](https://wiki.blender.org/wiki/Process/Bug_Reports) and [walkthrough 
video](https://www.youtube.com/watch?v=JTD0OJq_rF4).
+First time reporting? See 
[tips](https://wiki.blender.org/wiki/Process/Bug_Reports).
 
 * Use **Help > Report a Bug** in Blender to fill system 
information and exact Blender version.
 * Test [daily builds](https://builder.blender.org/) to verify 
if the issue is already fixed.
@@ -19,6 +21,7 @@ body:
 id: body
 attributes:
   label: "Description"
+  hide_label: true
   value: |
**System Information**
Operating system:
diff --git a/.gitea/issue_template/design.yaml 
b/.gitea/issue_template/design.yaml
index 8c2c6deef29..a1dcd8b0eda 100644
--- a/.gitea/issue_template/design.yaml
+++ b/.gitea/issue_template/design.yaml
@@ -1,9 +1,10 @@
 name: Design
 about: Create a design task (for developers only)
 labels:
-  - design
+  - "type::Design"
 body:
   - type: textarea
 id: body
 attributes:
   label: "Description"
+  hide_label: true
diff --git a/.gitea/issue_template/todo.yaml b/.gitea/issue_template/todo.yaml
index e7fecf043ca..58e848c3e18 100644
--- a/.gitea/issue_template/todo.yaml
+++ b/.gitea/issue_template/todo.yaml
@@ -1,9 +1,10 @@
 name: To Do
 about: Create a to do task (for developers only)
 labels:
-  - todo
+  - "type::To Do"
 body:
   - type: textarea
 id: body
 attributes:
   label: "Description"
+  hide_label: true
diff --git a/.gitea/pull_request_template.yaml 
b/.gitea/pull_request_template.yaml
index 6affe8cf8d2..a6f1f2db20f 100644
--- a/.gitea/pull_request_template.yaml
+++ b/.gitea/pull_request_template.yaml
@@ -14,6 +14,7 @@ body:
 id: body
 attributes:
   label: "Description"
+  hide_label: true
   value: |
Description of the problem that is addressed in the patch.

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


[Bf-blender-cvs] [6e0d58a68a8] master: Cleanup: Edit Mesh: Decrease variable scope, use bool instead of int

2023-01-25 Thread Hans Goudey
Commit: 6e0d58a68a866d632a6427d51f7ad41002566248
Author: Hans Goudey
Date:   Wed Jan 25 12:56:05 2023 -0600
Branches: master
https://developer.blender.org/rB6e0d58a68a866d632a6427d51f7ad41002566248

Cleanup: Edit Mesh: Decrease variable scope, use bool instead of int

===

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

===

diff --git a/source/blender/editors/mesh/editmesh_utils.c 
b/source/blender/editors/mesh/editmesh_utils.c
index f54284ef81a..c0815257afa 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -63,10 +63,8 @@ BMBackup EDBM_redo_state_store(BMEditMesh *em)
 
 void EDBM_redo_state_restore(BMBackup *backup, BMEditMesh *em, bool 
recalc_looptri)
 {
-  BMesh *tmpbm;
-
   BM_mesh_data_free(em->bm);
-  tmpbm = BM_mesh_copy(backup->bmcopy);
+  BMesh *tmpbm = BM_mesh_copy(backup->bmcopy);
   *em->bm = *tmpbm;
   MEM_freeN(tmpbm);
   tmpbm = NULL;
@@ -208,11 +206,9 @@ bool EDBM_op_call_and_selectf(BMEditMesh *em,
   const char *fmt,
   ...)
 {
-  BMOpSlot *slot_select_out;
   BMesh *bm = em->bm;
   BMOperator bmop;
   va_list list;
-  char hflag;
 
   va_start(list, fmt);
 
@@ -224,8 +220,8 @@ bool EDBM_op_call_and_selectf(BMEditMesh *em,
 
   BMO_op_exec(bm, &bmop);
 
-  slot_select_out = BMO_slot_get(bmop.slots_out, select_slot_out);
-  hflag = slot_select_out->slot_subtype.elem & BM_ALL_NOLOOP;
+  BMOpSlot *slot_select_out = BMO_slot_get(bmop.slots_out, select_slot_out);
+  char hflag = slot_select_out->slot_subtype.elem & BM_ALL_NOLOOP;
   BLI_assert(hflag != 0);
 
   if (select_extend == false) {
@@ -269,14 +265,12 @@ bool EDBM_op_call_silentf(BMEditMesh *em, const char 
*fmt, ...)
 void EDBM_mesh_make(Object *ob, const int select_mode, const bool 
add_key_index)
 {
   Mesh *me = ob->data;
-  BMesh *bm;
-
-  bm = BKE_mesh_to_bmesh(me,
- ob,
- add_key_index,
- &((struct BMeshCreateParams){
- .use_toolflags = true,
- }));
+  BMesh *bm = BKE_mesh_to_bmesh(me,
+ob,
+add_key_index,
+&((struct BMeshCreateParams){
+.use_toolflags = true,
+}));
 
   if (me->edit_mesh) {
 /* this happens when switching shape keys */
@@ -456,21 +450,15 @@ UvVertMap *BM_uv_vert_map_create(BMesh *bm, const bool 
use_select, const bool us
   BMFace *efa;
   BMLoop *l;
   BMIter iter, liter;
-  /* vars from original func */
-  UvVertMap *vmap;
-  UvMapVert *buf;
-  const float(*luv)[2];
   uint a;
-  int totverts, i, totuv, totfaces;
   const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, 
CD_PROP_FLOAT2);
-  bool *winding = NULL;
   BLI_buffer_declare_static(vec2f, tf_uv_buf, BLI_BUFFER_NOP, 
BM_DEFAULT_NGON_STACK_SIZE);
 
   BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE);
 
-  totfaces = bm->totface;
-  totverts = bm->totvert;
-  totuv = 0;
+  const int totfaces = bm->totface;
+  const int totverts = bm->totvert;
+  int totuv = 0;
 
   /* generate UvMapVert array */
   BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
@@ -482,13 +470,15 @@ UvVertMap *BM_uv_vert_map_create(BMesh *bm, const bool 
use_select, const bool us
   if (totuv == 0) {
 return NULL;
   }
-  vmap = (UvVertMap *)MEM_callocN(sizeof(*vmap), "UvVertMap");
+  UvVertMap *vmap = (UvVertMap *)MEM_callocN(sizeof(*vmap), "UvVertMap");
   if (!vmap) {
 return NULL;
   }
 
   vmap->vert = (UvMapVert **)MEM_callocN(sizeof(*vmap->vert) * totverts, 
"UvMapVert_pt");
-  buf = vmap->buf = (UvMapVert *)MEM_callocN(sizeof(*vmap->buf) * totuv, 
"UvMapVert");
+  UvMapVert *buf = vmap->buf = (UvMapVert *)MEM_callocN(sizeof(*vmap->buf) * 
totuv, "UvMapVert");
+
+  bool *winding = NULL;
   if (use_winding) {
 winding = MEM_callocN(sizeof(*winding) * totfaces, "winding");
   }
@@ -506,6 +496,7 @@ UvVertMap *BM_uv_vert_map_create(BMesh *bm, const bool 
use_select, const bool us
 tf_uv = (float(*)[2])BLI_buffer_reinit_data(&tf_uv_buf, vec2f, 
efa->len);
   }
 
+  int i;
   BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
 buf->loop_of_poly_index = i;
 buf->poly_index = a;
@@ -516,7 +507,7 @@ UvVertMap *BM_uv_vert_map_create(BMesh *bm, const bool 
use_select, const bool us
 buf++;
 
 if (use_winding) {
-  luv = BM_ELEM_CD_GET_FLOAT2_P(l, cd_loop_uv_offset);
+  const float(*luv)[2] = BM_ELEM_CD_GET_FLOAT2_P(l, cd_loop_uv_offset);
   copy_v2_v2(tf_uv[i], *luv);
 }
   }
@@ -1263,14 +1254,10 @@ UvElement *BM_uv_element_get_head(UvElementMap 
*element_map, UvElement *child)
 
 BMFace *EDBM_uv_active_face_get(BMEditMesh *em, const bo

[Bf-blender-cvs] [9ad051140c1] master: Revert "Fix T71137: curve minimum twist producing wrong geometry"

2023-01-25 Thread Ray Molenkamp
Commit: 9ad051140c102c76dbebe03d4a238b733034cfba
Author: Ray Molenkamp
Date:   Wed Jan 25 10:58:42 2023 -0700
Branches: master
https://developer.blender.org/rB9ad051140c102c76dbebe03d4a238b733034cfba

Revert "Fix T71137: curve minimum twist producing wrong geometry"

This reverts commit 36a82314a0f5de65b54f6d8343a2899ed4e37010.
as it has broken tests for the last day and a half, it likely just
needs a test file update, but we can't keep this failing longer
than it already has.

===

M   source/blender/blenkernel/intern/curve.cc

===

diff --git a/source/blender/blenkernel/intern/curve.cc 
b/source/blender/blenkernel/intern/curve.cc
index 51902169366..744ef0e8009 100644
--- a/source/blender/blenkernel/intern/curve.cc
+++ b/source/blender/blenkernel/intern/curve.cc
@@ -2260,7 +2260,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
   nr = bl->nr;
   while (nr--) {
 
-if (nr + 1 >= bl->nr) { /* First time, otherwise first point adjusts last. 
*/
+if (nr + 3 > bl->nr) { /* first time and second time, otherwise first 
point adjusts last */
   vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
 }
 else {

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


[Bf-blender-cvs] [2f9346bc0af] master: Fix T104071: Mix up in Realize Instances tooltip text

2023-01-25 Thread Sibo Van Gool
Commit: 2f9346bc0af6c801bee15a6ddcf56369b4e4b3d9
Author: Sibo Van Gool
Date:   Wed Jan 25 11:42:10 2023 -0600
Branches: master
https://developer.blender.org/rB2f9346bc0af6c801bee15a6ddcf56369b4e4b3d9

Fix T104071: Mix up in Realize Instances tooltip text

A mistake in the node type descriptions gave the node a description for
the reverse curve node.

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

===

M   source/blender/nodes/NOD_static_types.h

===

diff --git a/source/blender/nodes/NOD_static_types.h 
b/source/blender/nodes/NOD_static_types.h
index 33fc7249fad..6b8b917f3e0 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -384,11 +384,11 @@ DefNode(GeometryNode, GEO_NODE_POINTS_TO_VOLUME, 
def_geo_points_to_volume, "POIN
 DefNode(GeometryNode, GEO_NODE_POINTS, 0, "POINTS", Points, "Points", 
"Generate a point cloud with positions and radii defined by fields")
 DefNode(GeometryNode, GEO_NODE_PROXIMITY, def_geo_proximity, "PROXIMITY", 
Proximity, "Geometry Proximity", "Compute the closest location on the target 
geometry")
 DefNode(GeometryNode, GEO_NODE_RAYCAST, def_geo_raycast, "RAYCAST", Raycast, 
"Raycast", "Cast rays from the context geometry onto a target geometry, and 
retrieve information from each hit point")
-DefNode(GeometryNode, GEO_NODE_REALIZE_INSTANCES, 
def_geo_realize_instances,"REALIZE_INSTANCES", RealizeInstances, "Realize 
Instances", "Change the direction of the curve by swapping each spline's start 
and end data")
+DefNode(GeometryNode, GEO_NODE_REALIZE_INSTANCES, 
def_geo_realize_instances,"REALIZE_INSTANCES", RealizeInstances, "Realize 
Instances", "Convert instances into real geometry data")
 DefNode(GeometryNode, GEO_NODE_REMOVE_ATTRIBUTE, 0, "REMOVE_ATTRIBUTE", 
RemoveAttribute, "Remove Named Attribute", "Delete an attribute with a 
specified name from a geometry. Typically used to optimize performance")
 DefNode(GeometryNode, GEO_NODE_REPLACE_MATERIAL, 0, "REPLACE_MATERIAL", 
ReplaceMaterial, "Replace Material", "Swap one material with another")
 DefNode(GeometryNode, GEO_NODE_RESAMPLE_CURVE, def_geo_curve_resample, 
"RESAMPLE_CURVE", ResampleCurve, "Resample Curve", "Generate a poly spline for 
each input spline")
-DefNode(GeometryNode, GEO_NODE_REVERSE_CURVE, 0, "REVERSE_CURVE", 
ReverseCurve, "Reverse Curve", "Swap the start and end of splines")
+DefNode(GeometryNode, GEO_NODE_REVERSE_CURVE, 0, "REVERSE_CURVE", 
ReverseCurve, "Reverse Curve", "Change the direction of curves by swapping 
their start and end data")
 DefNode(GeometryNode, GEO_NODE_ROTATE_INSTANCES, 0, "ROTATE_INSTANCES", 
RotateInstances, "Rotate Instances", "Rotate geometry instances in local or 
global space")
 DefNode(GeometryNode, GEO_NODE_SAMPLE_CURVE, def_geo_curve_sample, 
"SAMPLE_CURVE", SampleCurve, "Sample Curve", "Retrieve data from a point on a 
curve at a certain distance from its start")
 DefNode(GeometryNode, GEO_NODE_SAMPLE_INDEX, def_geo_sample_index, 
"SAMPLE_INDEX", SampleIndex, "Sample Index", "Retrieve values from specific 
geometry elements")

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


[Bf-blender-cvs] [f954029e97c] master: Curves Sculpt: Add report about missing surface for puff brush

2023-01-25 Thread Hans Goudey
Commit: f954029e97c866a971b62a2faadf35fdb80b73bf
Author: Hans Goudey
Date:   Wed Jan 25 11:38:12 2023 -0600
Branches: master
https://developer.blender.org/rBf954029e97c866a971b62a2faadf35fdb80b73bf

Curves Sculpt: Add report about missing surface for puff brush

This is done in the other sculpt brushes that require a surface object.

===

M   source/blender/editors/sculpt_paint/curves_sculpt_puff.cc

===

diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_puff.cc 
b/source/blender/editors/sculpt_paint/curves_sculpt_puff.cc
index e44e97bc840..dcb7a3ae797 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_puff.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_puff.cc
@@ -92,6 +92,7 @@ struct PuffOperationExecutor {
   return;
 }
 if (curves_id_->surface == nullptr || curves_id_->surface->type != 
OB_MESH) {
+  report_missing_surface(stroke_extension.reports);
   return;
 }

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


[Bf-blender-cvs] [e744673268a] master: Draw: Improve Texture assignment operator

2023-01-25 Thread Miguel Pozo
Commit: e744673268a1144034631661ce8d897277454e25
Author: Miguel Pozo
Date:   Wed Jan 25 16:40:04 2023 +0100
Branches: master
https://developer.blender.org/rBe744673268a1144034631661ce8d897277454e25

Draw: Improve Texture assignment operator

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

===

M   source/blender/draw/intern/DRW_gpu_wrapper.hh

===

diff --git a/source/blender/draw/intern/DRW_gpu_wrapper.hh 
b/source/blender/draw/intern/DRW_gpu_wrapper.hh
index 6d8c4cc8e87..22ad08b1cb9 100644
--- a/source/blender/draw/intern/DRW_gpu_wrapper.hh
+++ b/source/blender/draw/intern/DRW_gpu_wrapper.hh
@@ -560,10 +560,20 @@ class Texture : NonCopyable {
 
   Texture &operator=(Texture &&a)
   {
-if (*this != a) {
+if (this != std::addressof(a)) {
+  this->free();
+
   this->tx_ = a.tx_;
   this->name_ = a.name_;
+  this->stencil_view_ = a.stencil_view_;
+  this->mip_views_ = std::move(a.mip_views_);
+  this->layer_views_ = std::move(a.layer_views_);
+
   a.tx_ = nullptr;
+  a.name_ = nullptr;
+  a.stencil_view_ = nullptr;
+  a.mip_views_.clear();
+  a.layer_views_.clear();
 }
 return *this;
   }

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


[Bf-blender-cvs] [405b08e00da] master: Fix: Workbench Next: Ensure matcaps textures are loaded

2023-01-25 Thread Miguel Pozo
Commit: 405b08e00da6841e27739573e85240ba30c3633f
Author: Miguel Pozo
Date:   Wed Jan 25 17:12:14 2023 +0100
Branches: master
https://developer.blender.org/rB405b08e00da6841e27739573e85240ba30c3633f

Fix: Workbench Next: Ensure matcaps textures are loaded

===

M   source/blender/draw/engines/workbench/workbench_resources.cc

===

diff --git a/source/blender/draw/engines/workbench/workbench_resources.cc 
b/source/blender/draw/engines/workbench/workbench_resources.cc
index d33b57b943e..25a2b284c40 100644
--- a/source/blender/draw/engines/workbench/workbench_resources.cc
+++ b/source/blender/draw/engines/workbench/workbench_resources.cc
@@ -8,8 +8,11 @@
 
 namespace blender::workbench {
 
-static bool get_matcap_tx(Texture &matcap_tx, const StudioLight &studio_light)
+static bool get_matcap_tx(Texture &matcap_tx, StudioLight &studio_light)
 {
+  BKE_studiolight_ensure_flag(&studio_light,
+  STUDIOLIGHT_MATCAP_DIFFUSE_GPUTEXTURE |
+  STUDIOLIGHT_MATCAP_SPECULAR_GPUTEXTURE);
   ImBuf *matcap_diffuse = studio_light.matcap_diffuse.ibuf;
   ImBuf *matcap_specular = studio_light.matcap_specular.ibuf;
   if (matcap_diffuse && matcap_diffuse->rect_float) {

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


[Bf-blender-cvs] [ffe45ad87a5] master: USD import unused materials.

2023-01-25 Thread Michael Kowalski
Commit: ffe45ad87a564fd2cb7d53f222785ecb608a6e30
Author: Michael Kowalski
Date:   Wed Jan 25 10:46:07 2023 -0500
Branches: master
https://developer.blender.org/rBffe45ad87a564fd2cb7d53f222785ecb608a6e30

USD import unused materials.

Added a new Import All Materials USD import option.  When this
option is enabled, USD materials not used by any geometry will
be included in the import.  Imported materials with no users
will have a fake user assigned.

Maniphest Tasks: T97195

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

===

M   source/blender/editors/io/io_usd.c
M   source/blender/io/usd/intern/usd_capi_import.cc
M   source/blender/io/usd/intern/usd_reader_material.cc
M   source/blender/io/usd/intern/usd_reader_material.h
M   source/blender/io/usd/intern/usd_reader_mesh.cc
M   source/blender/io/usd/intern/usd_reader_stage.cc
M   source/blender/io/usd/intern/usd_reader_stage.h
M   source/blender/io/usd/usd.h

===

diff --git a/source/blender/editors/io/io_usd.c 
b/source/blender/editors/io/io_usd.c
index acd60bbd40a..99d4e84cfd4 100644
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@ -381,6 +381,8 @@ static int wm_usd_import_exec(bContext *C, wmOperator *op)
   const bool import_proxy = RNA_boolean_get(op->ptr, "import_proxy");
   const bool import_render = RNA_boolean_get(op->ptr, "import_render");
 
+  const bool import_all_materials = RNA_boolean_get(op->ptr, 
"import_all_materials");
+
   const bool import_usd_preview = RNA_boolean_get(op->ptr, 
"import_usd_preview");
   const bool set_material_blend = RNA_boolean_get(op->ptr, 
"set_material_blend");
 
@@ -427,7 +429,8 @@ static int wm_usd_import_exec(bContext *C, wmOperator *op)
.import_usd_preview = import_usd_preview,
.set_material_blend = set_material_blend,
.light_intensity_scale = 
light_intensity_scale,
-   .mtl_name_collision_mode = 
mtl_name_collision_mode};
+   .mtl_name_collision_mode = 
mtl_name_collision_mode,
+   .import_all_materials = 
import_all_materials};
 
   STRNCPY(params.prim_path_mask, prim_path_mask);
 
@@ -480,6 +483,7 @@ static void wm_usd_import_draw(bContext *UNUSED(C), 
wmOperator *op)
 
   box = uiLayoutBox(layout);
   col = uiLayoutColumnWithHeading(box, true, IFACE_("Materials"));
+  uiItemR(col, ptr, "import_all_materials", 0, NULL, ICON_NONE);
   uiItemR(col, ptr, "import_usd_preview", 0, NULL, ICON_NONE);
   uiLayoutSetEnabled(col, RNA_boolean_get(ptr, "import_materials"));
   uiLayout *row = uiLayoutRow(col, true);
@@ -579,6 +583,14 @@ void WM_OT_usd_import(struct wmOperatorType *ot)
 
   RNA_def_boolean(ot->srna, "import_render", true, "Render", "Import final 
render geometry");
 
+  RNA_def_boolean(ot->srna,
+  "import_all_materials",
+  false,
+  "Import All Materials",
+  "Also import materials that are not used by any geometry.  "
+  "Note that when this option is false, materials referenced "
+  "by geometry will still be imported");
+
   RNA_def_boolean(ot->srna,
   "import_usd_preview",
   true,
diff --git a/source/blender/io/usd/intern/usd_capi_import.cc 
b/source/blender/io/usd/intern/usd_capi_import.cc
index 600d1f0a9eb..66319a7f04e 100644
--- a/source/blender/io/usd/intern/usd_capi_import.cc
+++ b/source/blender/io/usd/intern/usd_capi_import.cc
@@ -227,6 +227,10 @@ static void import_startjob(void *customdata, bool *stop, 
bool *do_update, float
 
   archive->collect_readers(data->bmain);
 
+  if (data->params.import_materials && data->params.import_all_materials) {
+archive->import_all_materials(data->bmain);
+  }
+
   *data->do_update = true;
   *data->progress = 0.2f;
 
@@ -352,6 +356,10 @@ static void import_endjob(void *customdata)
 
 DEG_id_tag_update(&data->scene->id, ID_RECALC_BASE_FLAGS);
 DEG_relations_tag_update(data->bmain);
+
+if (data->params.import_materials && data->params.import_all_materials) {
+  data->archive->fake_users_for_unused_materials();
+}
   }
 
   WM_set_locked_interface(data->wm, false);
diff --git a/source/blender/io/usd/intern/usd_reader_material.cc 
b/source/blender/io/usd/intern/usd_reader_material.cc
index d1af4553083..351f9bc3438 100644
--- a/source/blender/io/usd/intern/usd_reader_material.cc
+++ b/source/blender/io/usd/intern/usd_reader_material.cc
@@ -757,4 +757,45 @@ void USDMaterialReader::convert_usd_primvar_reader_float2(
   link_nodes(ntree, uv_map, "UV", dest_node, dest_socket_name);
 }
 
+void build_material_map(const Main *bmain, std::map 
*r_mat_map)
+{
+  BLI_assert_msg(r_mat_map, "...");
+
+  LISTBA

[Bf-blender-cvs] [69288daa74c] master: Fix T100674: Use plural for axes option in object properties

2023-01-25 Thread Faheim Arslan M
Commit: 69288daa74c101a0126a154a4c8a741e9c373636
Author: Faheim Arslan M
Date:   Wed Jan 25 16:22:58 2023 +0100
Branches: master
https://developer.blender.org/rB69288daa74c101a0126a154a4c8a741e9c373636

Fix T100674: Use plural for axes option in object properties

This commit fixes T100674, Renamed the "axis" label under viewport display
panel to "axes" in object properties.

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

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_object.py 
b/release/scripts/startup/bl_ui/properties_object.py
index 6ab4bb3af69..836ac2dcb75 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -200,7 +200,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel):
 
 col = layout.column(heading="Show")
 col.prop(obj, "show_name", text="Name")
-col.prop(obj, "show_axis", text="Axis")
+col.prop(obj, "show_axis", text="Axes")
 
 # Makes no sense for cameras, armatures, etc.!
 # but these settings do apply to dupli instances

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


[Bf-blender-cvs] [12ca26afc27] master: Fix T104089: Removing greasepencil vertex group can leave no active

2023-01-25 Thread Philipp Oeser
Commit: 12ca26afc272b883455bb99ee2add5deedcf740d
Author: Philipp Oeser
Date:   Mon Jan 23 13:50:34 2023 +0100
Branches: master
https://developer.blender.org/rB12ca26afc272b883455bb99ee2add5deedcf740d

Fix T104089: Removing greasepencil vertex group can leave no active

We should always have an active vertexgroup (making sure this is the
case was just not happening on the greasepencil side).

Now do this (similar to what is done for other object types in
`object_defgroup_remove_common`).

Maniphest Tasks: T104089

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

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 97e3ff43cd9..b77f43276e7 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1861,6 +1861,18 @@ void BKE_gpencil_vgroup_remove(Object *ob, bDeformGroup 
*defgroup)
 
   /* Remove the group */
   BLI_freelinkN(&gpd->vertex_group_names, defgroup);
+
+  /* Update the active deform index if necessary. */
+  const int active_index = BKE_object_defgroup_active_index_get(ob);
+  if (active_index > def_nr) {
+BKE_object_defgroup_active_index_set(ob, active_index - 1);
+  }
+  /* Keep a valid active index if we still have some vertex groups. */
+  if (!BLI_listbase_is_empty(&gpd->vertex_group_names) &&
+  BKE_object_defgroup_active_index_get(ob) < 1) {
+BKE_object_defgroup_active_index_set(ob, 1);
+  }
+
   DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
 }

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


[Bf-blender-cvs] [ef3225b9daf] master: Cleanup: Workbench Next: Remove UNUSED_VARS

2023-01-25 Thread Miguel Pozo
Commit: ef3225b9dafaf842a2c4ddfe672b796708b3d12b
Author: Miguel Pozo
Date:   Wed Jan 25 13:16:53 2023 +0100
Branches: master
https://developer.blender.org/rBef3225b9dafaf842a2c4ddfe672b796708b3d12b

Cleanup: Workbench Next: Remove UNUSED_VARS

===

M   source/blender/draw/engines/workbench/workbench_shadow.cc

===

diff --git a/source/blender/draw/engines/workbench/workbench_shadow.cc 
b/source/blender/draw/engines/workbench/workbench_shadow.cc
index 15c18ffef9d..34db0a0dfe9 100644
--- a/source/blender/draw/engines/workbench/workbench_shadow.cc
+++ b/source/blender/draw/engines/workbench/workbench_shadow.cc
@@ -209,9 +209,9 @@ void ShadowPass::ShadowView::set_mode(ShadowPass::PassType 
type)
 
 void ShadowPass::ShadowView::compute_visibility(ObjectBoundsBuf &bounds,
 uint resource_len,
-bool debug_freeze)
+bool /*debug_freeze*/)
 {
-  UNUSED_VARS(debug_freeze);
+  /* TODO (Miguel Pozo): Add debug_freeze support */
 
   GPU_debug_group_begin("ShadowView.compute_visibility");

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


[Bf-blender-cvs] [e27d1d9bb66] master: Fix broken `listdir` code.

2023-01-25 Thread Bastien Montagne
Commit: e27d1d9bb6628a190eb9eab5f7029ac0e87c8db8
Author: Bastien Montagne
Date:   Wed Jan 25 12:31:00 2023 +0100
Branches: master
https://developer.blender.org/rBe27d1d9bb6628a190eb9eab5f7029ac0e87c8db8

Fix broken `listdir` code.

Error in `bli_builddir` cahnges in B4815d0706fb5 commit.

===

M   source/blender/blenlib/intern/BLI_filelist.c

===

diff --git a/source/blender/blenlib/intern/BLI_filelist.c 
b/source/blender/blenlib/intern/BLI_filelist.c
index ae7f6f79a17..7dca60128d3 100644
--- a/source/blender/blenlib/intern/BLI_filelist.c
+++ b/source/blender/blenlib/intern/BLI_filelist.c
@@ -127,7 +127,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const 
char *dirname)
   dirname_with_slash, dirname, sizeof(dirname_with_slash) - 1);
 
   if ((dirname_with_slash_len > 0) &&
-  (BLI_path_slash_is_native_compat(dirname_with_slash_len - 1) == false)) {
+  (BLI_path_slash_is_native_compat(dirname[dirname_with_slash_len - 1]) == 
false)) {
 dirname_with_slash[dirname_with_slash_len++] = SEP;
 dirname_with_slash[dirname_with_slash_len] = '\0';
   }

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


[Bf-blender-cvs] [5203af69c46] gpencil-new-data-proposal: Merge branch 'master' into gpencil-new-data-proposal

2023-01-25 Thread Antonio Vazquez
Commit: 5203af69c4695d159cf689f3b6400e912f7003d7
Author: Antonio Vazquez
Date:   Wed Jan 25 11:57:53 2023 +0100
Branches: gpencil-new-data-proposal
https://developer.blender.org/rB5203af69c4695d159cf689f3b6400e912f7003d7

Merge branch 'master' into gpencil-new-data-proposal

===



===



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


[Bf-blender-cvs] [b898e00edce] master: Cleanup: remove unused KernelGlobals in microfacet BSDF

2023-01-25 Thread Weizhen Huang
Commit: b898e00edce795d5b7414eb312503e7be5433ac3
Author: Weizhen Huang
Date:   Wed Jan 25 11:26:51 2023 +0100
Branches: master
https://developer.blender.org/rBb898e00edce795d5b7414eb312503e7be5433ac3

Cleanup: remove unused KernelGlobals in microfacet BSDF

===

M   intern/cycles/kernel/closure/bsdf.h
M   intern/cycles/kernel/closure/bsdf_microfacet.h

===

diff --git a/intern/cycles/kernel/closure/bsdf.h 
b/intern/cycles/kernel/closure/bsdf.h
index 2f53454d7dd..b0d01c427de 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -170,7 +170,7 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg,
 case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
 case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
   label = bsdf_microfacet_ggx_sample(
-  kg, sc, Ng, sd->wi, randu, randv, eval, wo, pdf, sampled_roughness, 
eta);
+  sc, Ng, sd->wi, randu, randv, eval, wo, pdf, sampled_roughness, eta);
   break;
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID:
@@ -185,7 +185,7 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg,
 case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
 case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
   label = bsdf_microfacet_beckmann_sample(
-  kg, sc, Ng, sd->wi, randu, randv, eval, wo, pdf, sampled_roughness, 
eta);
+  sc, Ng, sd->wi, randu, randv, eval, wo, pdf, sampled_roughness, eta);
   break;
 case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
   label = bsdf_ashikhmin_shirley_sample(
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h 
b/intern/cycles/kernel/closure/bsdf_microfacet.h
index 8cf4cfa244d..be21bcd720e 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet.h
@@ -42,8 +42,7 @@ static_assert(sizeof(ShaderClosure) >= 
sizeof(MicrofacetBsdf), "MicrofacetBsdf i
  * Eric Heitz and Eugene d'Eon, EGSR 2014.
  * https://hal.inria.fr/hal-00996995v2/document */
 
-ccl_device_forceinline float3 microfacet_beckmann_sample_vndf(KernelGlobals kg,
-  const float3 wi,
+ccl_device_forceinline float3 microfacet_beckmann_sample_vndf(const float3 wi,
   const float 
alpha_x,
   const float 
alpha_y,
   const float 
randu,
@@ -387,8 +386,7 @@ ccl_device Spectrum bsdf_microfacet_eval(ccl_private const 
ShaderClosure *sc,
 }
 
 template
-ccl_device int bsdf_microfacet_sample(KernelGlobals kg,
-  ccl_private const ShaderClosure *sc,
+ccl_device int bsdf_microfacet_sample(ccl_private const ShaderClosure *sc,
   float3 Ng,
   float3 wi,
   float randu,
@@ -431,7 +429,7 @@ ccl_device int bsdf_microfacet_sample(KernelGlobals kg,
   }
   else {
 /* m_type == MicrofacetType::BECKMANN */
-local_H = microfacet_beckmann_sample_vndf(kg, local_I, alpha_x, alpha_y, 
randu, randv);
+local_H = microfacet_beckmann_sample_vndf(local_I, alpha_x, alpha_y, 
randu, randv);
   }
 
   const float3 H = X * local_H.x + Y * local_H.y + N * local_H.z;
@@ -616,8 +614,7 @@ ccl_device Spectrum bsdf_microfacet_ggx_eval(ccl_private 
const ShaderClosure *sc
   return bsdf_microfacet_eval(sc, Ng, wi, wo, pdf);
 }
 
-ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals kg,
-  ccl_private const ShaderClosure *sc,
+ccl_device int bsdf_microfacet_ggx_sample(ccl_private const ShaderClosure *sc,
   float3 Ng,
   float3 wi,
   float randu,
@@ -629,7 +626,7 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals kg,
   ccl_private float *eta)
 {
   return bsdf_microfacet_sample(
-  kg, sc, Ng, wi, randu, randv, eval, wo, pdf, sampled_roughness, eta);
+  sc, Ng, wi, randu, randv, eval, wo, pdf, sampled_roughness, eta);
 }
 
 /* Beckmann microfacet with Smith shadow-masking from:
@@ -680,8 +677,7 @@ ccl_device Spectrum 
bsdf_microfacet_beckmann_eval(ccl_private const ShaderClosur
   return bsdf_microfacet_eval(sc, Ng, wi, wo, pdf);
 }
 
-ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals kg,
-   ccl_private const ShaderClosure 
*sc,
+ccl_device int bsdf_microfacet_beckmann_sample(ccl_private const ShaderClosure 
*sc,
float3 Ng,
float3 wi,