[Bf-blender-cvs] [3f9035bd5d0] usd-importer-T81257: Fixed compiler warning.

2020-12-04 Thread Michael A. Kowalski
Commit: 3f9035bd5d0cd6dd0d62c439e3c875fd14f94bb0
Author: Michael A. Kowalski
Date:   Fri Dec 4 20:20:15 2020 -0500
Branches: usd-importer-T81257
https://developer.blender.org/rB3f9035bd5d0cd6dd0d62c439e3c875fd14f94bb0

Fixed compiler warning.

===

M   source/blender/io/usd/import/usd_material_importer.cc

===

diff --git a/source/blender/io/usd/import/usd_material_importer.cc 
b/source/blender/io/usd/import/usd_material_importer.cc
index 68f3c26fd33..6d671eb77ed 100644
--- a/source/blender/io/usd/import/usd_material_importer.cc
+++ b/source/blender/io/usd/import/usd_material_importer.cc
@@ -339,28 +339,27 @@ void USDMaterialImporter::set_node_input(const 
pxr::UsdShadeInput _input,
 switch (sock->type) {
   case SOCK_FLOAT:
 if (val.IsHolding()) {
-  float fval = val.Get();
-  ((bNodeSocketValueFloat *)sock->default_value)->value = fval;
+  ((bNodeSocketValueFloat *)sock->default_value)->value = 
val.UncheckedGet();
 }
 else if (val.IsHolding()) {
-  pxr::GfVec3f v3f = val.Get();
+  pxr::GfVec3f v3f = val.UncheckedGet();
   float average = (v3f[0] + v3f[1] + v3f[2]) / 3.0f;
   ((bNodeSocketValueFloat *)sock->default_value)->value = average;
 }
 break;
   case SOCK_RGBA:
 if (val.IsHolding()) {
-  pxr::GfVec3f v3f = val.Get();
+  pxr::GfVec3f v3f = val.UncheckedGet();
   copy_v3_v3(((bNodeSocketValueRGBA *)sock->default_value)->value, 
v3f.data());
 }
 break;
   case SOCK_VECTOR:
 if (val.IsHolding()) {
-  pxr::GfVec3f v3f = val.Get();
+  pxr::GfVec3f v3f = val.UncheckedGet();
   copy_v3_v3(((bNodeSocketValueVector *)sock->default_value)->value, 
v3f.data());
 }
 else if (val.IsHolding()) {
-  pxr::GfVec2f v2f = val.Get();
+  pxr::GfVec2f v2f = val.UncheckedGet();
   copy_v2_v2(((bNodeSocketValueVector *)sock->default_value)->value, 
v2f.data());
 }
 break;

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


[Bf-blender-cvs] [48acf15f985] master: Cleanup: Outliner Data API display mode

2020-12-04 Thread Nathan Craddock
Commit: 48acf15f9856d6ffcd29cdd8b3a64dd9eb983cd0
Author: Nathan Craddock
Date:   Thu Dec 3 10:52:08 2020 -0700
Branches: master
https://developer.blender.org/rB48acf15f9856d6ffcd29cdd8b3a64dd9eb983cd0

Cleanup: Outliner Data API display mode

No functional changes. Moves the data API display building code to C++.

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

===

M   source/blender/editors/space_outliner/CMakeLists.txt
M   source/blender/editors/space_outliner/outliner_tree.c
M   source/blender/editors/space_outliner/tree/tree_display.cc
M   source/blender/editors/space_outliner/tree/tree_display.hh
A   source/blender/editors/space_outliner/tree/tree_display_data.cc

===

diff --git a/source/blender/editors/space_outliner/CMakeLists.txt 
b/source/blender/editors/space_outliner/CMakeLists.txt
index 6b941eb3e62..b21b969493a 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -51,6 +51,7 @@ set(SRC
   tree/tree_display_sequencer.cc
   tree/tree_display_orphaned.cc
   tree/tree_display_scenes.cc
+  tree/tree_display_data.cc
 
   outliner_intern.h
   tree/tree_display.h
diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index 85203d1f4dd..52f91781967 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -2061,11 +2061,6 @@ void outliner_build_tree(Main *mainvar,
  SpaceOutliner *space_outliner,
  ARegion *region)
 {
-  TreeElement *ten;
-  TreeStoreElem *tselem;
-  /* on first view, we open scenes */
-  int show_opened = !space_outliner->treestore || 
!BLI_mempool_len(space_outliner->treestore);
-
   /* Are we looking for something - we want to tag parents to filter child 
matches
* - NOT in data-blocks view - searching all data-blocks takes way too long 
to be useful
* - this variable is only set once per tree build */
@@ -2119,17 +2114,8 @@ void outliner_build_tree(Main *mainvar,
 BLI_assert(false);
   }
   else if (space_outliner->outlinevis == SO_DATA_API) {
-PointerRNA mainptr;
-
-RNA_main_pointer_create(mainvar, );
-
-ten = outliner_add_element(
-space_outliner, _outliner->tree, (void *), NULL, 
TSE_RNA_STRUCT, -1);
-
-if (show_opened) {
-  tselem = TREESTORE(ten);
-  tselem->flag &= ~TSE_CLOSED;
-}
+/* Ported to new tree-display, should be built there already. */
+BLI_assert(false);
   }
   else if (space_outliner->outlinevis == SO_ID_ORPHANS) {
 /* Ported to new tree-display, should be built there already. */
diff --git a/source/blender/editors/space_outliner/tree/tree_display.cc 
b/source/blender/editors/space_outliner/tree/tree_display.cc
index f94c643d2bb..d2070fb9b1c 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display.cc
@@ -41,6 +41,7 @@ TreeDisplay *outliner_tree_display_create(eSpaceOutliner_Mode 
mode, SpaceOutline
   tree_display = new TreeDisplaySequencer(*space_outliner);
   break;
 case SO_DATA_API:
+  tree_display = new TreeDisplayDataAPI(*space_outliner);
   break;
 case SO_ID_ORPHANS:
   tree_display = new TreeDisplayIDOrphans(*space_outliner);
diff --git a/source/blender/editors/space_outliner/tree/tree_display.hh 
b/source/blender/editors/space_outliner/tree/tree_display.hh
index 4a2559d94ab..b6183050e82 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.hh
+++ b/source/blender/editors/space_outliner/tree/tree_display.hh
@@ -163,4 +163,17 @@ class TreeDisplayScenes final : public AbstractTreeDisplay 
{
   ListBase buildTree(const TreeSourceData _data) override;
 };
 
+/*  */
+/* Data API Tree-Display */
+
+/**
+ * \brief Tree-Display for the Scenes display mode
+ */
+class TreeDisplayDataAPI final : public AbstractTreeDisplay {
+ public:
+  TreeDisplayDataAPI(SpaceOutliner _outliner);
+
+  ListBase buildTree(const TreeSourceData _data) override;
+};
+
 }  // namespace blender::ed::outliner
diff --git a/source/blender/editors/space_outliner/tree/tree_display_data.cc 
b/source/blender/editors/space_outliner/tree/tree_display_data.cc
new file mode 100644
index 000..41ca4f72903
--- /dev/null
+++ b/source/blender/editors/space_outliner/tree/tree_display_data.cc
@@ -0,0 +1,56 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,

[Bf-blender-cvs] [aaa02984d39] master: Cleanup: Outliner scenes display mode

2020-12-04 Thread Nathan Craddock
Commit: aaa02984d3978bcf94d9a98d1ac9139d5fbfca2d
Author: Nathan Craddock
Date:   Thu Dec 3 10:34:09 2020 -0700
Branches: master
https://developer.blender.org/rBaaa02984d3978bcf94d9a98d1ac9139d5fbfca2d

Cleanup: Outliner scenes display mode

No functional changes. The scene display building code has been moved
to C++.

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

===

M   source/blender/editors/space_outliner/CMakeLists.txt
M   source/blender/editors/space_outliner/outliner_tree.c
M   source/blender/editors/space_outliner/tree/tree_display.cc
M   source/blender/editors/space_outliner/tree/tree_display.hh
A   source/blender/editors/space_outliner/tree/tree_display_scenes.cc

===

diff --git a/source/blender/editors/space_outliner/CMakeLists.txt 
b/source/blender/editors/space_outliner/CMakeLists.txt
index 363e8ed8bb7..6b941eb3e62 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -50,6 +50,7 @@ set(SRC
   tree/tree_display_view_layer.cc
   tree/tree_display_sequencer.cc
   tree/tree_display_orphaned.cc
+  tree/tree_display_scenes.cc
 
   outliner_intern.h
   tree/tree_display.h
diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index f3c982d5995..85203d1f4dd 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -2061,7 +2061,7 @@ void outliner_build_tree(Main *mainvar,
  SpaceOutliner *space_outliner,
  ARegion *region)
 {
-  TreeElement *te = NULL, *ten;
+  TreeElement *ten;
   TreeStoreElem *tselem;
   /* on first view, we open scenes */
   int show_opened = !space_outliner->treestore || 
!BLI_mempool_len(space_outliner->treestore);
@@ -2111,18 +2111,8 @@ void outliner_build_tree(Main *mainvar,
 BLI_assert(false);
   }
   else if (space_outliner->outlinevis == SO_SCENES) {
-Scene *sce;
-for (sce = mainvar->scenes.first; sce; sce = sce->id.next) {
-  te = outliner_add_element(space_outliner, _outliner->tree, sce, 
NULL, 0, 0);
-  tselem = TREESTORE(te);
-
-  /* New scene elements open by default */
-  if ((sce == scene && show_opened) || !tselem->used) {
-tselem->flag &= ~TSE_CLOSED;
-  }
-
-  outliner_make_object_parent_hierarchy(>subtree);
-}
+/* Ported to new tree-display, should be built there already. */
+BLI_assert(false);
   }
   else if (space_outliner->outlinevis == SO_SEQUENCE) {
 /* Ported to new tree-display, should be built there already. */
diff --git a/source/blender/editors/space_outliner/tree/tree_display.cc 
b/source/blender/editors/space_outliner/tree/tree_display.cc
index bf976d79103..f94c643d2bb 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display.cc
@@ -32,6 +32,7 @@ TreeDisplay *outliner_tree_display_create(eSpaceOutliner_Mode 
mode, SpaceOutline
 
   switch (mode) {
 case SO_SCENES:
+  tree_display = new TreeDisplayScenes(*space_outliner);
   break;
 case SO_LIBRARIES:
   tree_display = new TreeDisplayLibraries(*space_outliner);
diff --git a/source/blender/editors/space_outliner/tree/tree_display.hh 
b/source/blender/editors/space_outliner/tree/tree_display.hh
index a933a8d7609..4a2559d94ab 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.hh
+++ b/source/blender/editors/space_outliner/tree/tree_display.hh
@@ -150,4 +150,17 @@ class TreeDisplayIDOrphans final : public 
AbstractTreeDisplay {
   bool datablock_has_orphans(ListBase &) const;
 };
 
+/*  */
+/* Scenes Tree-Display */
+
+/**
+ * \brief Tree-Display for the Scenes display mode
+ */
+class TreeDisplayScenes final : public AbstractTreeDisplay {
+ public:
+  TreeDisplayScenes(SpaceOutliner _outliner);
+
+  ListBase buildTree(const TreeSourceData _data) override;
+};
+
 }  // namespace blender::ed::outliner
diff --git a/source/blender/editors/space_outliner/tree/tree_display_scenes.cc 
b/source/blender/editors/space_outliner/tree/tree_display_scenes.cc
new file mode 100644
index 000..c4a5688504d
--- /dev/null
+++ b/source/blender/editors/space_outliner/tree/tree_display_scenes.cc
@@ -0,0 +1,63 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

[Bf-blender-cvs] [887a6024482] master: Cleanup: Finish porting outliner tree building to C++

2020-12-04 Thread Nathan Craddock
Commit: 887a602448286fe57b77046001a72d488415b1b8
Author: Nathan Craddock
Date:   Thu Dec 3 10:56:37 2020 -0700
Branches: master
https://developer.blender.org/rB887a602448286fe57b77046001a72d488415b1b8

Cleanup: Finish porting outliner tree building to C++

No functional changes. This is a few minor cleanups to the remaining C
code for building the outliner tree after parts have been moved to C++.

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

===

M   source/blender/editors/space_outliner/outliner_tree.c

===

diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index 52f91781967..37f748692f9 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -2054,7 +2054,6 @@ static void outliner_filter_tree(SpaceOutliner 
*space_outliner, ViewLayer *view_
 /* Main Tree Building API */
 
 /* Main entry point for building the tree data-structure that the outliner 
represents. */
-/* TODO: split each mode into its own function? */
 void outliner_build_tree(Main *mainvar,
  Scene *scene,
  ViewLayer *view_layer,
@@ -2091,40 +2090,13 @@ void outliner_build_tree(Main *mainvar,
 
   space_outliner->runtime->tree_display = 
outliner_tree_display_create(space_outliner->outlinevis,

space_outliner);
-  if (space_outliner->runtime->tree_display) {
-TreeSourceData source_data = {.bmain = mainvar, .scene = scene, 
.view_layer = view_layer};
-space_outliner->tree = 
outliner_tree_display_build_tree(space_outliner->runtime->tree_display,
-_data);
-  }
 
-  if (space_outliner->runtime->tree_display) {
-/* Skip if there's a tree-display that's responsible for adding all 
elements. */
-  }
-  /* options */
-  else if (space_outliner->outlinevis == SO_LIBRARIES) {
-/* Ported to new tree-display, should be built there already. */
-BLI_assert(false);
-  }
-  else if (space_outliner->outlinevis == SO_SCENES) {
-/* Ported to new tree-display, should be built there already. */
-BLI_assert(false);
-  }
-  else if (space_outliner->outlinevis == SO_SEQUENCE) {
-/* Ported to new tree-display, should be built there already. */
-BLI_assert(false);
-  }
-  else if (space_outliner->outlinevis == SO_DATA_API) {
-/* Ported to new tree-display, should be built there already. */
-BLI_assert(false);
-  }
-  else if (space_outliner->outlinevis == SO_ID_ORPHANS) {
-/* Ported to new tree-display, should be built there already. */
-BLI_assert(false);
-  }
-  else if (space_outliner->outlinevis == SO_VIEW_LAYER) {
-/* Ported to new tree-display, should be built there already. */
-BLI_assert(false);
-  }
+  /* All tree displays should be created as sub-classes of 
AbstractTreeDisplay. */
+  BLI_assert(space_outliner->runtime->tree_display != NULL);
+
+  TreeSourceData source_data = {.bmain = mainvar, .scene = scene, .view_layer 
= view_layer};
+  space_outliner->tree = 
outliner_tree_display_build_tree(space_outliner->runtime->tree_display,
+  _data);
 
   if ((space_outliner->flag & SO_SKIP_SORT_ALPHA) == 0) {
 outliner_sort(_outliner->tree);

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


[Bf-blender-cvs] [1cc0a59be66] master: Cleanup: Outliner video sequencer display mode

2020-12-04 Thread Nathan Craddock
Commit: 1cc0a59be66a1d42ec316e0c29c2e3e184b26f7d
Author: Nathan Craddock
Date:   Wed Nov 25 14:55:09 2020 -0700
Branches: master
https://developer.blender.org/rB1cc0a59be66a1d42ec316e0c29c2e3e184b26f7d

Cleanup: Outliner video sequencer display mode

No functional changes. Code is ported to C++. Variable names and logic
are also improved.

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

===

M   source/blender/editors/space_outliner/CMakeLists.txt
M   source/blender/editors/space_outliner/outliner_tree.c
M   source/blender/editors/space_outliner/tree/tree_display.cc
M   source/blender/editors/space_outliner/tree/tree_display.hh
A   source/blender/editors/space_outliner/tree/tree_display_sequencer.cc

===

diff --git a/source/blender/editors/space_outliner/CMakeLists.txt 
b/source/blender/editors/space_outliner/CMakeLists.txt
index 996570fae25..41e54ee8b86 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -48,6 +48,7 @@ set(SRC
   tree/tree_display.cc
   tree/tree_display_libraries.cc
   tree/tree_display_view_layer.cc
+  tree/tree_display_sequencer.cc
 
   outliner_intern.h
   tree/tree_display.h
diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index 94d55b13073..d3976821f8f 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -80,8 +80,6 @@
 
 #include "RNA_access.h"
 
-#include "SEQ_sequencer.h"
-
 #include "UI_interface.h"
 
 #include "outliner_intern.h"
@@ -1314,73 +1312,6 @@ TreeElement *outliner_add_element(SpaceOutliner 
*space_outliner,
 }
 
 /* === */
-/* Sequencer mode tree building */
-
-/* Helped function to put duplicate sequence in the same tree. */
-static int need_add_seq_dup(Sequence *seq)
-{
-  Sequence *p;
-
-  if ((!seq->strip) || (!seq->strip->stripdata)) {
-return 1;
-  }
-
-  /*
-   * First check backward, if we found a duplicate
-   * sequence before this, don't need it, just return.
-   */
-  p = seq->prev;
-  while (p) {
-if ((!p->strip) || (!p->strip->stripdata)) {
-  p = p->prev;
-  continue;
-}
-
-if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name)) {
-  return 2;
-}
-p = p->prev;
-  }
-
-  p = seq->next;
-  while (p) {
-if ((!p->strip) || (!p->strip->stripdata)) {
-  p = p->next;
-  continue;
-}
-
-if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name)) {
-  return 0;
-}
-p = p->next;
-  }
-  return 1;
-}
-
-static void outliner_add_seq_dup(SpaceOutliner *space_outliner,
- Sequence *seq,
- TreeElement *te,
- short index)
-{
-  /* TreeElement *ch; */ /* UNUSED */
-  Sequence *p;
-
-  p = seq;
-  while (p) {
-if ((!p->strip) || (!p->strip->stripdata) || (p->strip->stripdata->name[0] 
== '\0')) {
-  p = p->next;
-  continue;
-}
-
-if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name)) {
-  /* ch = */ /* UNUSED */ outliner_add_element(
-  space_outliner, >subtree, (void *)p, te, TSE_SEQUENCE, index);
-}
-p = p->next;
-  }
-}
-
-/* --- */
 
 static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOutliner 
*space_outliner)
 {
@@ -2246,32 +2177,8 @@ void outliner_build_tree(Main *mainvar,
 }
   }
   else if (space_outliner->outlinevis == SO_SEQUENCE) {
-Sequence *seq;
-Editing *ed = BKE_sequencer_editing_get(scene, false);
-int op;
-
-if (ed == NULL) {
-  return;
-}
-
-seq = ed->seqbasep->first;
-if (!seq) {
-  return;
-}
-
-while (seq) {
-  op = need_add_seq_dup(seq);
-  if (op == 1) {
-/* ten = */ outliner_add_element(
-space_outliner, _outliner->tree, (void *)seq, NULL, 
TSE_SEQUENCE, 0);
-  }
-  else if (op == 0) {
-ten = outliner_add_element(
-space_outliner, _outliner->tree, (void *)seq, NULL, 
TSE_SEQUENCE_DUP, 0);
-outliner_add_seq_dup(space_outliner, seq, ten, 0);
-  }
-  seq = seq->next;
-}
+/* Ported to new tree-display, should be built there already. */
+BLI_assert(false);
   }
   else if (space_outliner->outlinevis == SO_DATA_API) {
 PointerRNA mainptr;
diff --git a/source/blender/editors/space_outliner/tree/tree_display.cc 
b/source/blender/editors/space_outliner/tree/tree_display.cc
index 12599733275..1419295c81c 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display.cc
@@ -37,6 +37,8 @@ TreeDisplay 

[Bf-blender-cvs] [1db40c29e5f] master: Cleanup: Outliner orphan data display mode

2020-12-04 Thread Nathan Craddock
Commit: 1db40c29e5f30f2d8b854f67129d9d44cd844a34
Author: Nathan Craddock
Date:   Thu Dec 3 09:46:03 2020 -0700
Branches: master
https://developer.blender.org/rB1db40c29e5f30f2d8b854f67129d9d44cd844a34

Cleanup: Outliner orphan data display mode

No functional changes. Code is ported to C++ with additional cleanups to
the logic and variable names.

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

===

M   source/blender/editors/space_outliner/CMakeLists.txt
M   source/blender/editors/space_outliner/outliner_tree.c
M   source/blender/editors/space_outliner/tree/tree_display.cc
M   source/blender/editors/space_outliner/tree/tree_display.hh
A   source/blender/editors/space_outliner/tree/tree_display_orphaned.cc

===

diff --git a/source/blender/editors/space_outliner/CMakeLists.txt 
b/source/blender/editors/space_outliner/CMakeLists.txt
index 41e54ee8b86..363e8ed8bb7 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -49,6 +49,7 @@ set(SRC
   tree/tree_display_libraries.cc
   tree/tree_display_view_layer.cc
   tree/tree_display_sequencer.cc
+  tree/tree_display_orphaned.cc
 
   outliner_intern.h
   tree/tree_display.h
diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index d3976821f8f..f3c982d5995 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1313,58 +1313,6 @@ TreeElement *outliner_add_element(SpaceOutliner 
*space_outliner,
 
 /* === */
 
-static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOutliner 
*space_outliner)
-{
-  TreeElement *ten;
-  ListBase *lbarray[MAX_LIBARRAY];
-  int a, tot;
-  short filter_id_type = (space_outliner->filter & SO_FILTER_ID_TYPE) ?
- space_outliner->filter_id_type :
- 0;
-
-  if (filter_id_type) {
-lbarray[0] = which_libbase(mainvar, space_outliner->filter_id_type);
-tot = 1;
-  }
-  else {
-tot = set_listbasepointers(mainvar, lbarray);
-  }
-
-  for (a = 0; a < tot; a++) {
-if (lbarray[a] && lbarray[a]->first) {
-  ID *id = lbarray[a]->first;
-
-  /* check if there are any data-blocks of this type which are orphans */
-  for (; id; id = id->next) {
-if (ID_REAL_USERS(id) <= 0) {
-  break;
-}
-  }
-
-  if (id) {
-/* header for this type of data-block */
-if (filter_id_type) {
-  ten = NULL;
-}
-else {
-  ten = outliner_add_element(
-  space_outliner, _outliner->tree, lbarray[a], NULL, 
TSE_ID_BASE, 0);
-  ten->directdata = lbarray[a];
-  ten->name = outliner_idcode_to_plural(GS(id->name));
-}
-
-/* add the orphaned data-blocks - these will not be added with any 
subtrees attached */
-for (id = lbarray[a]->first; id; id = id->next) {
-  if (ID_REAL_USERS(id) <= 0) {
-outliner_add_element(
-space_outliner, (ten) ? >subtree : _outliner->tree, 
id, ten, 0, 0);
-  }
-}
-  }
-}
-  }
-}
-
 BLI_INLINE void outliner_add_collection_init(TreeElement *te, Collection 
*collection)
 {
   te->name = BKE_collection_ui_name_get(collection);
@@ -2194,7 +2142,8 @@ void outliner_build_tree(Main *mainvar,
 }
   }
   else if (space_outliner->outlinevis == SO_ID_ORPHANS) {
-outliner_add_orphaned_datablocks(mainvar, space_outliner);
+/* Ported to new tree-display, should be built there already. */
+BLI_assert(false);
   }
   else if (space_outliner->outlinevis == SO_VIEW_LAYER) {
 /* Ported to new tree-display, should be built there already. */
diff --git a/source/blender/editors/space_outliner/tree/tree_display.cc 
b/source/blender/editors/space_outliner/tree/tree_display.cc
index 1419295c81c..bf976d79103 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display.cc
@@ -40,7 +40,9 @@ TreeDisplay *outliner_tree_display_create(eSpaceOutliner_Mode 
mode, SpaceOutline
   tree_display = new TreeDisplaySequencer(*space_outliner);
   break;
 case SO_DATA_API:
+  break;
 case SO_ID_ORPHANS:
+  tree_display = new TreeDisplayIDOrphans(*space_outliner);
   break;
 case SO_VIEW_LAYER:
   tree_display = new TreeDisplayViewLayer(*space_outliner);
diff --git a/source/blender/editors/space_outliner/tree/tree_display.hh 
b/source/blender/editors/space_outliner/tree/tree_display.hh
index 0901451e5d3..a933a8d7609 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.hh
+++ b/source/blender/editors/space_outliner/tree/tree_display.hh
@@ -134,4 +134,20 @@ 

[Bf-blender-cvs] [c72bdc84d1f] usd-importer-T81257: Format fix.

2020-12-04 Thread Michael A. Kowalski
Commit: c72bdc84d1f5baf91770d1170a0b7256ac87bc12
Author: Michael A. Kowalski
Date:   Fri Dec 4 19:06:37 2020 -0500
Branches: usd-importer-T81257
https://developer.blender.org/rBc72bdc84d1f5baf91770d1170a0b7256ac87bc12

Format fix.

===

M   source/blender/io/usd/import/usd_data_cache.h

===

diff --git a/source/blender/io/usd/import/usd_data_cache.h 
b/source/blender/io/usd/import/usd_data_cache.h
index 6f3767387f6..656bae2790c 100644
--- a/source/blender/io/usd/import/usd_data_cache.h
+++ b/source/blender/io/usd/import/usd_data_cache.h
@@ -54,7 +54,6 @@ class USDDataCache {
   void clear_protype_mesh(const pxr::SdfPath );
 
   Mesh *get_prototype_mesh(const pxr::SdfPath ) const;
-
 };
 
 }  // namespace blender::io::usd

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


[Bf-blender-cvs] [ea37e4ea5a7] master: Fix incorrect variable name after last commit

2020-12-04 Thread Hans Goudey
Commit: ea37e4ea5a712f637e52ef5972a48920fa7e092f
Author: Hans Goudey
Date:   Fri Dec 4 14:46:51 2020 -0600
Branches: master
https://developer.blender.org/rBea37e4ea5a712f637e52ef5972a48920fa7e092f

Fix incorrect variable name after last commit

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 9d118b70e43..ac27862d507 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2249,7 +2249,7 @@ static int wm_handler_fileselect_do(bContext *C,
 
 wmWindow *temp_win = NULL;
 LISTBASE_FOREACH (wmWindow *, win, >windows) {
-  bScreen *screen = WM_window_get_active_screen(temp_win);
+  bScreen *screen = WM_window_get_active_screen(win);
   ScrArea *file_area = screen->areabase.first;
 
   if (screen->temp && (file_area->spacetype == SPACE_FILE)) {

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


[Bf-blender-cvs] [67faa85fb05] master: Cleanup: Use LISTBASE_FOREACH macro in windowmanager intern

2020-12-04 Thread Hans Goudey
Commit: 67faa85fb05defa5c596ac6549deb52a3654c3a7
Author: Hans Goudey
Date:   Fri Dec 4 13:50:53 2020 -0600
Branches: master
https://developer.blender.org/rB67faa85fb05defa5c596ac6549deb52a3654c3a7

Cleanup: Use LISTBASE_FOREACH macro in windowmanager intern

Also decrease the scope of variables related to the loops.

===

M   source/blender/windowmanager/intern/wm_event_system.c
M   source/blender/windowmanager/intern/wm_files.c
M   source/blender/windowmanager/intern/wm_init_exit.c
M   source/blender/windowmanager/intern/wm_jobs.c
M   source/blender/windowmanager/intern/wm_keymap.c
M   source/blender/windowmanager/intern/wm_operator_type.c
M   source/blender/windowmanager/intern/wm_surface.c

===

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 1bd8c675807..9d118b70e43 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -376,10 +376,9 @@ void wm_event_do_refresh_wm_and_depsgraph(bContext *C)
   /* Cached: editor refresh callbacks now, they get context. */
   LISTBASE_FOREACH (wmWindow *, win, >windows) {
 const bScreen *screen = WM_window_get_active_screen(win);
-ScrArea *area;
 
 CTX_wm_window_set(C, win);
-for (area = screen->areabase.first; area; area = area->next) {
+LISTBASE_FOREACH (ScrArea *, area, >areabase) {
   if (area->do_refresh) {
 CTX_wm_area_set(C, area);
 ED_area_do_refresh(C, area);
@@ -516,7 +515,7 @@ void wm_event_do_notifiers(bContext *C)
   bScreen *screen = WM_window_get_active_screen(win);
   WorkSpace *workspace = WM_window_get_active_workspace(win);
 
-  /* Dilter out notifiers. */
+  /* Filter out notifiers. */
   if (note->category == NC_SCREEN && note->reference && note->reference != 
screen &&
   note->reference != workspace && note->reference != 
WM_window_get_active_layout(win)) {
 /* Pass. */
@@ -525,8 +524,6 @@ void wm_event_do_notifiers(bContext *C)
 /* Pass. */
   }
   else {
-ARegion *region;
-
 /* XXX context in notifiers? */
 CTX_wm_window_set(C, win);
 
@@ -538,13 +535,13 @@ void wm_event_do_notifiers(bContext *C)
 #  endif
 ED_screen_do_listen(C, note);
 
-for (region = screen->regionbase.first; region; region = region->next) 
{
+LISTBASE_FOREACH (ARegion *, region, >regionbase) {
   ED_region_do_listen(win, NULL, region, note, scene);
 }
 
 ED_screen_areas_iter (win, screen, area) {
   ED_area_do_listen(win, area, note, scene);
-  for (region = area->regionbase.first; region; region = region->next) 
{
+  LISTBASE_FOREACH (ARegion *, region, >regionbase) {
 ED_region_do_listen(win, area, region, note, scene);
   }
 }
@@ -1708,7 +1705,8 @@ static void wm_handler_op_context(bContext *C, 
wmEventHandler_Op *handler, const
   }
 
   if (region == NULL) {
-for (region = area->regionbase.first; region; region = region->next) {
+LISTBASE_FOREACH (ARegion *, region_iter, >regionbase) {
+  region = region_iter;
   if (region == handler->context.region) {
 break;
   }
@@ -2247,23 +2245,23 @@ static int wm_handler_fileselect_do(bContext *C,
 }
   }
   else {
-wmWindow *temp_win;
 ScrArea *ctx_area = CTX_wm_area(C);
 
-for (temp_win = wm->windows.first; temp_win; temp_win = 
temp_win->next) {
+wmWindow *temp_win = NULL;
+LISTBASE_FOREACH (wmWindow *, win, >windows) {
   bScreen *screen = WM_window_get_active_screen(temp_win);
   ScrArea *file_area = screen->areabase.first;
 
   if (screen->temp && (file_area->spacetype == SPACE_FILE)) {
 int win_size[2];
 bool is_maximized;
-ED_fileselect_window_params_get(temp_win, win_size, _maximized);
+ED_fileselect_window_params_get(win, win_size, _maximized);
 ED_fileselect_params_to_userdef(file_area->spacedata.first, 
win_size, is_maximized);
 
 if (BLI_listbase_is_single(_area->spacedata)) {
-  BLI_assert(ctx_win != temp_win);
+  BLI_assert(ctx_win != win);
 
-  wm_window_close(C, wm, temp_win);
+  wm_window_close(C, wm, win);
 
   CTX_wm_window_set(C, ctx_win); /* #wm_window_close() NULLs. */
   /* Some operators expect a drawable context (for 
EVT_FILESELECT_EXEC). */
@@ -2272,7 +2270,7 @@ static int wm_handler_fileselect_do(bContext *C,
* opening (UI_BLOCK_MOVEMOUSE_QUIT). */
   wm_get_cursor_position(ctx_win, _win->eventstate->x, 
_win->eventstate->y);
   wm->winactive = ctx_win; /* Reports 

[Bf-blender-cvs] [3daf28388b7] master: Cleanup: Move Outliner runtime hash into internal runtime struct, out of DNA

2020-12-04 Thread Julian Eisel
Commit: 3daf28388b7372208cbec870f51b37be3aeac1e9
Author: Julian Eisel
Date:   Fri Dec 4 19:43:33 2020 +0100
Branches: master
https://developer.blender.org/rB3daf28388b7372208cbec870f51b37be3aeac1e9

Cleanup: Move Outliner runtime hash into internal runtime struct, out of DNA

This way Outliner internal data stays internal, non-Outliner code will not be
able to access and mess with this. Further it allows us to use the real type
(rather than `void *`), change the type to a C++ container if needed and
slightly reduces the size for every Outliner stored in files.

Slightly changed how we set the `SO_TREESTORE_REBUILD` for this, but it should
effectively behave the same way as before.

===

M   source/blender/blenkernel/intern/screen.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/editors/space_outliner/outliner_intern.h
M   source/blender/editors/space_outliner/outliner_tree.c
M   source/blender/editors/space_outliner/outliner_utils.c
M   source/blender/editors/space_outliner/space_outliner.c
M   source/blender/makesdna/DNA_space_types.h

===

diff --git a/source/blender/blenkernel/intern/screen.c 
b/source/blender/blenkernel/intern/screen.c
index 97bef99944a..355db8f0d60 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -1561,7 +1561,6 @@ static void direct_link_area(BlendDataReader *reader, 
ScrArea *area)
 /* we only saved what was used */
 space_outliner->storeflag |= SO_TREESTORE_CLEANUP; /* at first draw */
   }
-  space_outliner->treehash = NULL;
   space_outliner->tree.first = space_outliner->tree.last = NULL;
   space_outliner->runtime = NULL;
 }
@@ -1825,10 +1824,8 @@ void BKE_screen_area_blend_read_lib(BlendLibReader 
*reader, ID *parent_id, ScrAr
   while ((tselem = BLI_mempool_iterstep())) {
 BLO_read_id_address(reader, NULL, >id);
   }
-  if (space_outliner->treehash) {
-/* rebuild hash table, because it depends on ids too */
-space_outliner->storeflag |= SO_TREESTORE_REBUILD;
-  }
+  /* rebuild hash table, because it depends on ids too */
+  space_outliner->storeflag |= SO_TREESTORE_REBUILD;
 }
 break;
   }
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 2c10dd446f1..9ce767b7ce1 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2834,10 +2834,8 @@ static void lib_link_workspace_layout_restore(struct 
IDNameLib_Map *id_map,
 tselem->id = NULL;
   }
 }
-if (space_outliner->treehash) {
-  /* rebuild hash table, because it depends on ids too */
-  space_outliner->storeflag |= SO_TREESTORE_REBUILD;
-}
+/* rebuild hash table, because it depends on ids too */
+space_outliner->storeflag |= SO_TREESTORE_REBUILD;
   }
 }
 else if (sl->spacetype == SPACE_NODE) {
diff --git a/source/blender/editors/space_outliner/outliner_intern.h 
b/source/blender/editors/space_outliner/outliner_intern.h
index aefba929c5e..0b432d932ca 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -47,10 +47,13 @@ struct wmKeyConfig;
 struct wmOperatorType;
 
 typedef struct SpaceOutliner_Runtime {
-  /**
-   * Internal C++ object to create and manage the tree for a specific display 
type (View Layers,
-   * Scenes, Blender File, etc.). */
+  /** Internal C++ object to create and manage the tree for a specific display 
type (View Layers,
+   *  Scenes, Blender File, etc.). */
   struct TreeDisplay *tree_display;
+
+  /** Pointers to treestore elements, grouped by (id, type, nr)
+   *  in hashtable for faster searching */
+  struct GHash *treehash;
 } SpaceOutliner_Runtime;
 
 typedef enum TreeElementInsertType {
diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index 159511546be..94d55b13073 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -132,9 +132,9 @@ static void outliner_storage_cleanup(SpaceOutliner 
*space_outliner)
 if (BLI_mempool_len(ts) == unused) {
   BLI_mempool_destroy(ts);
   space_outliner->treestore = NULL;
-  if (space_outliner->treehash) {
-BKE_outliner_treehash_free(space_outliner->treehash);
-space_outliner->treehash = NULL;
+  if (space_outliner->runtime->treehash) {
+BKE_outliner_treehash_free(space_outliner->runtime->treehash);
+space_outliner->runtime->treehash = NULL;
 

[Bf-blender-cvs] [fc71aaa487c] soc-2020-io-performance: Exporter: Fix scaling: change scale before applying locrot transform.

2020-12-04 Thread Ankit Meel
Commit: fc71aaa487cb1d6f0cbf16655333ee07dd0f78cc
Author: Ankit Meel
Date:   Thu Dec 3 23:13:48 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rBfc71aaa487cb1d6f0cbf16655333ee07dd0f78cc

Exporter: Fix scaling: change scale before applying locrot transform.

===

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

===

diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc 
b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index 0751184b233..4095bbf2de6 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@ -280,8 +280,8 @@ float3 OBJMesh::calc_vertex_coords(const int vert_index, 
const float scaling_fac
 {
   float3 r_coords;
   copy_v3_v3(r_coords, export_mesh_eval_->mvert[vert_index].co);
-  mul_m4_v3(world_and_axes_transform_, r_coords);
   mul_v3_fl(r_coords, scaling_factor);
+  mul_m4_v3(world_and_axes_transform_, r_coords);
   return r_coords;
 }

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


[Bf-blender-cvs] [b54aa8a77c7] soc-2020-io-performance: Importer: make a class OBJStorer, and smaller functions.

2020-12-04 Thread Ankit Meel
Commit: b54aa8a77c733d33f30695513a7b77fa2efc2c33
Author: Ankit Meel
Date:   Tue Dec 1 16:49:36 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rBb54aa8a77c733d33f30695513a7b77fa2efc2c33

Importer: make a class OBJStorer, and smaller functions.

===

M   source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
M   source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh
M   source/blender/io/wavefront_obj/importer/obj_import_objects.hh
M   source/blender/io/wavefront_obj/importer/obj_importer.cc

===

diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc 
b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
index 5cbd06bad67..2af5c1a612b 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
@@ -87,6 +87,199 @@ static Geometry *create_geometry(Geometry *const 
prev_geometry,
   return new_geometry();
 }
 
+void OBJStorer::add_vertex(const StringRef rest_line, GlobalVertices 
_global_vertices)
+{
+  float3 curr_vert;
+  Vector str_vert_split;
+  split_by_char(rest_line, ' ', str_vert_split);
+  copy_string_to_float(str_vert_split, FLT_MAX, {curr_vert, 3});
+  r_global_vertices.vertices.append(curr_vert);
+  r_geom_.vertex_indices_.append(r_global_vertices.vertices.size() - 1);
+}
+
+void OBJStorer::add_vertex_normal(const StringRef rest_line, GlobalVertices 
_global_vertices)
+{
+  float3 curr_vert_normal;
+  Vector str_vert_normal_split;
+  split_by_char(rest_line, ' ', str_vert_normal_split);
+  copy_string_to_float(str_vert_normal_split, FLT_MAX, {curr_vert_normal, 2});
+  r_global_vertices.vertex_normals.append(curr_vert_normal);
+  
r_geom_.vertex_normal_indices_.append(r_global_vertices.vertex_normals.size() - 
1);
+}
+
+void OBJStorer::add_uv_vertex(const StringRef rest_line, GlobalVertices 
_global_vertices)
+{
+  float2 curr_uv_vert;
+  Vector str_uv_vert_split;
+  split_by_char(rest_line, ' ', str_uv_vert_split);
+  copy_string_to_float(str_uv_vert_split, FLT_MAX, {curr_uv_vert, 2});
+  r_global_vertices.uv_vertices.append(curr_uv_vert);
+}
+
+void OBJStorer::add_edge(const StringRef rest_line,
+ const VertexIndexOffset ,
+ GlobalVertices _global_vertices)
+{
+  int edge_v1 = -1, edge_v2 = -1;
+  Vector str_edge_split;
+  split_by_char(rest_line, ' ', str_edge_split);
+  copy_string_to_int(str_edge_split[0], -1, edge_v1);
+  copy_string_to_int(str_edge_split[1], -1, edge_v2);
+  /* Always keep stored indices non-negative and zero-based. */
+  edge_v1 += edge_v1 < 0 ? r_global_vertices.vertices.size() : 
-offsets.get_index_offset() - 1;
+  edge_v2 += edge_v2 < 0 ? r_global_vertices.vertices.size() : 
-offsets.get_index_offset() - 1;
+  BLI_assert(edge_v1 >= 0 && edge_v2 >= 0);
+  r_geom_.edges_.append({static_cast(edge_v1), 
static_cast(edge_v2)});
+}
+
+void OBJStorer::add_polygon(const StringRef rest_line,
+const VertexIndexOffset ,
+const GlobalVertices _vertices,
+const StringRef state_material_name,
+const StringRef state_object_group,
+const bool state_shaded_smooth)
+{
+  PolyElem curr_face;
+  curr_face.shaded_smooth = state_shaded_smooth;
+  if (!state_material_name.is_empty()) {
+curr_face.material_name = state_material_name;
+  }
+  if (!state_object_group.is_empty()) {
+curr_face.vertex_group = state_object_group;
+/* Yes it repeats several times, but another if-check will not reduce 
steps either. */
+r_geom_.use_vertex_groups_ = true;
+  }
+
+  Vector str_corners_split;
+  split_by_char(rest_line, ' ', str_corners_split);
+  for (StringRef str_corner : str_corners_split) {
+PolyCorner corner;
+const size_t n_slash = std::count(str_corner.begin(), str_corner.end(), 
'/');
+if (n_slash == 0) {
+  /* Case: "f v1 v2 v3". */
+  copy_string_to_int(str_corner, INT32_MAX, corner.vert_index);
+}
+else if (n_slash == 1) {
+  /* Case: "f v1/vt1 v2/vt2 v3/vt3". */
+  Vector vert_uv_split;
+  split_by_char(str_corner, '/', vert_uv_split);
+  copy_string_to_int(vert_uv_split[0], INT32_MAX, corner.vert_index);
+  if (vert_uv_split.size() == 2) {
+copy_string_to_int(vert_uv_split[1], INT32_MAX, corner.uv_vert_index);
+  }
+}
+else if (n_slash == 2) {
+  /* Case: "f v1//vn1 v2//vn2 v3//vn3". */
+  /* Case: "f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3". */
+  Vector vert_uv_normal_split;
+  split_by_char(str_corner, '/', vert_uv_normal_split);
+  copy_string_to_int(vert_uv_normal_split[0], INT32_MAX, 
corner.vert_index);
+  copy_string_to_int(vert_uv_normal_split[1], INT32_MAX, 

[Bf-blender-cvs] [01fa2a239c9] soc-2020-io-performance: Importer: remove useless `{}`s. renames.

2020-12-04 Thread Ankit Meel
Commit: 01fa2a239c9cc2c370ddbf0e5f3224cf3c82d1e6
Author: Ankit Meel
Date:   Mon Nov 30 19:37:12 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rB01fa2a239c9cc2c370ddbf0e5f3224cf3c82d1e6

Importer: remove useless `{}`s. renames.

===

M   source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
M   source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh
M   source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
M   source/blender/io/wavefront_obj/importer/obj_import_objects.cc
M   source/blender/io/wavefront_obj/importer/obj_import_objects.hh

===

diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc 
b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
index 76786e6f3c9..57f6a07e858 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
@@ -63,8 +63,8 @@ static Geometry *create_geometry(Geometry *const 
prev_geometry,
   if (prev_geometry && prev_geometry->get_geom_type() == GEOM_MESH) {
 /* After the creation of a Geometry instance, at least one element has 
been found in the OBJ
  * file that indicates that it is a mesh. */
-if (prev_geometry->tot_verts() || prev_geometry->tot_face_elems() ||
-prev_geometry->tot_normals() || prev_geometry->tot_edges()) {
+if (prev_geometry->total_verts() || prev_geometry->total_face_elems() ||
+prev_geometry->total_normals() || prev_geometry->total_edges()) {
   return new_geometry();
 }
 if (new_type == GEOM_MESH) {
@@ -120,9 +120,9 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
 
   /* State-setting variables: if set, they remain the same for the remaining
* elements in the object. */
-  bool shaded_smooth = false;
-  string object_group{};
-  string material_name;
+  bool state_shaded_smooth = false;
+  string state_object_group;
+  string state_material_name;
 
   while (std::getline(obj_file_, line)) {
 /* Keep reading new lines if the last character is `\`. */
@@ -139,15 +139,15 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
   mtl_libraries_.append(string(rest_line));
 }
 else if (line_key == "o") {
-  shaded_smooth = false;
-  object_group = {};
-  material_name = "";
+  state_shaded_smooth = false;
+  state_object_group = "";
+  state_material_name = "";
   current_geometry = create_geometry(
   current_geometry, GEOM_MESH, rest_line, r_global_vertices, 
r_all_geometries, offset);
 }
 else if (line_key == "v") {
   BLI_assert(current_geometry);
-  float3 curr_vert{};
+  float3 curr_vert;
   Vector str_vert_split;
   split_by_char(rest_line, ' ', str_vert_split);
   copy_string_to_float(str_vert_split, FLT_MAX, {curr_vert, 3});
@@ -155,7 +155,7 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
   
current_geometry->vertex_indices_.append(r_global_vertices.vertices.size() - 1);
 }
 else if (line_key == "vn") {
-  float3 curr_vert_normal{};
+  float3 curr_vert_normal;
   Vector str_vert_normal_split;
   split_by_char(rest_line, ' ', str_vert_normal_split);
   copy_string_to_float(str_vert_normal_split, FLT_MAX, {curr_vert_normal, 
2});
@@ -163,7 +163,7 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
   
current_geometry->vertex_normal_indices_.append(r_global_vertices.vertex_normals.size()
 - 1);
 }
 else if (line_key == "vt") {
-  float2 curr_uv_vert{};
+  float2 curr_uv_vert;
   Vector str_uv_vert_split;
   split_by_char(rest_line, ' ', str_uv_vert_split);
   copy_string_to_float(str_uv_vert_split, FLT_MAX, {curr_uv_vert, 2});
@@ -183,11 +183,11 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
   current_geometry->edges_.append({static_cast(edge_v1), 
static_cast(edge_v2)});
 }
 else if (line_key == "g") {
-  object_group = rest_line;
-  if (object_group.find("off") != string::npos || 
object_group.find("null") != string::npos ||
-  object_group.find("default") != string::npos) {
+  state_object_group = rest_line;
+  if (state_object_group.find("off") != string::npos || 
state_object_group.find("null") != string::npos ||
+  state_object_group.find("default") != string::npos) {
 /* Set group for future elements like faces or curves to empty. */
-object_group = {};
+state_object_group = "";
   }
 }
 else if (line_key == "s") {
@@ -196,22 +196,22 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
   rest_line.find("null") == StringRef::not_found) {
 int smooth = 0;
 copy_string_to_int(rest_line, 0, smooth);
-shaded_smooth = smooth != 0;
+state_shaded_smooth = smooth != 

[Bf-blender-cvs] [7206226ee0c] soc-2020-io-performance: Importer: Use switch-case instead of else-if chain in main code.

2020-12-04 Thread Ankit Meel
Commit: 7206226ee0cc328ba3a0d3443e23f4d4e4e754c7
Author: Ankit Meel
Date:   Tue Dec 1 22:46:56 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rB7206226ee0cc328ba3a0d3443e23f4d4e4e754c7

Importer: Use switch-case instead of else-if chain in main code.

===

M   source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
M   source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh

===

diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc 
b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
index 2af5c1a612b..9a909504b50 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
@@ -328,69 +328,89 @@ void OBJParser::parse(Vector> 
_all_geometries,
   continue;
 }
 
-if (line_key == "v") {
-  OBJStorer storer(*current_geometry);
-  storer.add_vertex(rest_line, r_global_vertices);
-}
-else if (line_key == "vn") {
-  OBJStorer storer(*current_geometry);
-  storer.add_vertex_normal(rest_line, r_global_vertices);
-}
-else if (line_key == "vt") {
-  OBJStorer storer(*current_geometry);
-  storer.add_uv_vertex(rest_line, r_global_vertices);
-}
-else if (line_key == "f") {
-  OBJStorer storer(*current_geometry);
-  storer.add_polygon(rest_line,
- offsets,
- r_global_vertices,
- state_material_name,
- state_material_name,
- state_shaded_smooth);
-}
-else if (line_key == "l") {
-  OBJStorer storer(*current_geometry);
-  storer.add_edge(rest_line, offsets, r_global_vertices);
-}
-else if (line_key == "mtllib") {
-  mtl_libraries_.append(string(rest_line));
-}
-else if (line_key == "o") {
-  state_shaded_smooth = false;
-  state_object_group = "";
-  state_material_name = "";
-  current_geometry = create_geometry(
-  current_geometry, GEOM_MESH, rest_line, r_global_vertices, 
r_all_geometries, offsets);
-}
-else if (line_key == "cstype") {
-  OBJStorer storer(*current_geometry);
-  storer.set_curve_type(
-  rest_line, r_global_vertices, state_object_group, offsets, 
r_all_geometries);
-}
-else if (line_key == "deg") {
-  OBJStorer storer(*current_geometry);
-  storer.set_curve_degree(rest_line);
-}
-else if (line_key == "curv") {
-  OBJStorer storer(*current_geometry);
-  storer.add_curve_vertex_indices(rest_line, r_global_vertices);
-}
-else if (line_key == "parm") {
-  OBJStorer storer(*current_geometry);
-  storer.add_curve_parameters(rest_line);
-}
-else if (line_key == "g") {
-  OBJStorer storer(*current_geometry);
-  storer.update_object_group(rest_line, state_object_group);
-}
-else if (line_key == "s") {
-  OBJStorer storer(*current_geometry);
-  storer.update_smooth_group(rest_line, state_shaded_smooth);
-}
-else if (line_key == "usemtl") {
-  OBJStorer storer(*current_geometry);
-  storer.update_polygon_material(rest_line, state_material_name);
+switch (line_key_str_to_enum(line_key)) {
+  case eOBJLineKey::V: {
+OBJStorer storer(*current_geometry);
+storer.add_vertex(rest_line, r_global_vertices);
+break;
+  }
+  case eOBJLineKey::VN: {
+OBJStorer storer(*current_geometry);
+storer.add_vertex_normal(rest_line, r_global_vertices);
+break;
+  }
+  case eOBJLineKey::VT: {
+OBJStorer storer(*current_geometry);
+storer.add_uv_vertex(rest_line, r_global_vertices);
+break;
+  }
+  case eOBJLineKey::F: {
+OBJStorer storer(*current_geometry);
+storer.add_polygon(rest_line,
+   offsets,
+   r_global_vertices,
+   state_material_name,
+   state_material_name,
+   state_shaded_smooth);
+break;
+  }
+  case eOBJLineKey::L: {
+OBJStorer storer(*current_geometry);
+storer.add_edge(rest_line, offsets, r_global_vertices);
+break;
+  }
+  case eOBJLineKey::CSTYPE: {
+OBJStorer storer(*current_geometry);
+storer.set_curve_type(
+rest_line, r_global_vertices, state_object_group, offsets, 
r_all_geometries);
+break;
+  }
+  case eOBJLineKey::DEG: {
+OBJStorer storer(*current_geometry);
+storer.set_curve_degree(rest_line);
+break;
+  }
+  case eOBJLineKey::CURV: {
+OBJStorer storer(*current_geometry);
+storer.add_curve_vertex_indices(rest_line, r_global_vertices);
+break;
+   

[Bf-blender-cvs] [7faaaf7fd76] soc-2020-io-performance: Importer Cleanup: renames, const.

2020-12-04 Thread Ankit Meel
Commit: 7faaaf7fd766db868a498be3f6a2464ca6e7196e
Author: Ankit Meel
Date:   Tue Dec 1 00:58:44 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rB7faaaf7fd766db868a498be3f6a2464ca6e7196e

Importer Cleanup: renames, const.

===

M   source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
M   source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
M   source/blender/io/wavefront_obj/importer/obj_import_mesh.hh
M   source/blender/io/wavefront_obj/importer/obj_import_objects.cc
M   source/blender/io/wavefront_obj/importer/obj_import_objects.hh

===

diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc 
b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
index 57f6a07e858..5cbd06bad67 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
@@ -113,10 +113,10 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
 
   string line;
   /* Store vertex coordinates that belong to other Geometry instances.  */
-  VertexIndexOffset offset;
+  VertexIndexOffset offsets;
   /* Non owning raw pointer to a Geometry. To be updated while creating a new 
Geometry. */
   Geometry *current_geometry = create_geometry(
-  nullptr, GEOM_MESH, "", r_global_vertices, r_all_geometries, offset);
+  nullptr, GEOM_MESH, "", r_global_vertices, r_all_geometries, offsets);
 
   /* State-setting variables: if set, they remain the same for the remaining
* elements in the object. */
@@ -143,7 +143,7 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
   state_object_group = "";
   state_material_name = "";
   current_geometry = create_geometry(
-  current_geometry, GEOM_MESH, rest_line, r_global_vertices, 
r_all_geometries, offset);
+  current_geometry, GEOM_MESH, rest_line, r_global_vertices, 
r_all_geometries, offsets);
 }
 else if (line_key == "v") {
   BLI_assert(current_geometry);
@@ -177,14 +177,15 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
   copy_string_to_int(str_edge_split[0], -1, edge_v1);
   copy_string_to_int(str_edge_split[1], -1, edge_v2);
   /* Always keep stored indices non-negative and zero-based. */
-  edge_v1 += edge_v1 < 0 ? r_global_vertices.vertices.size() : 
-offset.get_index_offset() - 1;
-  edge_v2 += edge_v2 < 0 ? r_global_vertices.vertices.size() : 
-offset.get_index_offset() - 1;
+  edge_v1 += edge_v1 < 0 ? r_global_vertices.vertices.size() : 
-offsets.get_index_offset() - 1;
+  edge_v2 += edge_v2 < 0 ? r_global_vertices.vertices.size() : 
-offsets.get_index_offset() - 1;
   BLI_assert(edge_v1 >= 0 && edge_v2 >= 0);
   current_geometry->edges_.append({static_cast(edge_v1), 
static_cast(edge_v2)});
 }
 else if (line_key == "g") {
   state_object_group = rest_line;
-  if (state_object_group.find("off") != string::npos || 
state_object_group.find("null") != string::npos ||
+  if (state_object_group.find("off") != string::npos ||
+  state_object_group.find("null") != string::npos ||
   state_object_group.find("default") != string::npos) {
 /* Set group for future elements like faces or curves to empty. */
 state_object_group = "";
@@ -205,7 +206,7 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
 }
 else if (line_key == "f") {
   BLI_assert(current_geometry);
-  FaceElement curr_face;
+  PolyElem curr_face;
   curr_face.shaded_smooth = state_shaded_smooth;
   if (!state_material_name.empty()) {
 curr_face.material_name = state_material_name;
@@ -219,14 +220,14 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
   Vector str_corners_split;
   split_by_char(rest_line, ' ', str_corners_split);
   for (StringRef str_corner : str_corners_split) {
-FaceCorner corner;
-size_t n_slash = std::count(str_corner.begin(), str_corner.end(), '/');
+PolyCorner corner;
+const size_t n_slash = std::count(str_corner.begin(), 
str_corner.end(), '/');
 if (n_slash == 0) {
-  /* Case: f v1 v2 v3 . */
+  /* Case: "f v1 v2 v3". */
   copy_string_to_int(str_corner, INT32_MAX, corner.vert_index);
 }
 else if (n_slash == 1) {
-  /* Case: f v1/vt1 v2/vt2 v3/vt3 . */
+  /* Case: "f v1/vt1 v2/vt2 v3/vt3". */
   Vector vert_uv_split;
   split_by_char(str_corner, '/', vert_uv_split);
   copy_string_to_int(vert_uv_split[0], INT32_MAX, corner.vert_index);
@@ -235,8 +236,8 @@ void 
OBJParser::parse_and_store(Vector> _all_geometr
   }
 }
 else if (n_slash == 2) {
-  /* Case: f v1//vn1 v2//vn2 v3//vn3 . */
-  /* Case: f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 

[Bf-blender-cvs] [32dad88e8f4] soc-2020-io-performance: Importer: Cleanup: single storer; reorder parameters.

2020-12-04 Thread Ankit Meel
Commit: 32dad88e8f4b8862cb4ae4adc02354d6296d849b
Author: Ankit Meel
Date:   Wed Dec 2 09:56:08 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rB32dad88e8f4b8862cb4ae4adc02354d6296d849b

Importer: Cleanup: single storer; reorder parameters.

===

M   source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
M   source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh

===

diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc 
b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
index 9a909504b50..f5417718ab9 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
@@ -133,8 +133,8 @@ void OBJStorer::add_edge(const StringRef rest_line,
 }
 
 void OBJStorer::add_polygon(const StringRef rest_line,
-const VertexIndexOffset ,
 const GlobalVertices _vertices,
+const VertexIndexOffset ,
 const StringRef state_material_name,
 const StringRef state_object_group,
 const bool state_shaded_smooth)
@@ -327,56 +327,47 @@ void OBJParser::parse(Vector> 
_all_geometries,
 if (line.empty() || rest_line.is_empty()) {
   continue;
 }
-
+OBJStorer storer(*current_geometry);
 switch (line_key_str_to_enum(line_key)) {
   case eOBJLineKey::V: {
-OBJStorer storer(*current_geometry);
 storer.add_vertex(rest_line, r_global_vertices);
 break;
   }
   case eOBJLineKey::VN: {
-OBJStorer storer(*current_geometry);
 storer.add_vertex_normal(rest_line, r_global_vertices);
 break;
   }
   case eOBJLineKey::VT: {
-OBJStorer storer(*current_geometry);
 storer.add_uv_vertex(rest_line, r_global_vertices);
 break;
   }
   case eOBJLineKey::F: {
-OBJStorer storer(*current_geometry);
 storer.add_polygon(rest_line,
-   offsets,
r_global_vertices,
+   offsets,
state_material_name,
state_material_name,
state_shaded_smooth);
 break;
   }
   case eOBJLineKey::L: {
-OBJStorer storer(*current_geometry);
 storer.add_edge(rest_line, offsets, r_global_vertices);
 break;
   }
   case eOBJLineKey::CSTYPE: {
-OBJStorer storer(*current_geometry);
 storer.set_curve_type(
 rest_line, r_global_vertices, state_object_group, offsets, 
r_all_geometries);
 break;
   }
   case eOBJLineKey::DEG: {
-OBJStorer storer(*current_geometry);
 storer.set_curve_degree(rest_line);
 break;
   }
   case eOBJLineKey::CURV: {
-OBJStorer storer(*current_geometry);
 storer.add_curve_vertex_indices(rest_line, r_global_vertices);
 break;
   }
   case eOBJLineKey::PARM: {
-OBJStorer storer(*current_geometry);
 storer.add_curve_parameters(rest_line);
 break;
   }
@@ -389,17 +380,14 @@ void OBJParser::parse(Vector> 
_all_geometries,
 break;
   }
   case eOBJLineKey::G: {
-OBJStorer storer(*current_geometry);
 storer.update_object_group(rest_line, state_object_group);
 break;
   }
   case eOBJLineKey::S: {
-OBJStorer storer(*current_geometry);
 storer.update_smooth_group(rest_line, state_shaded_smooth);
 break;
   }
   case eOBJLineKey::USEMTL: {
-OBJStorer storer(*current_geometry);
 storer.update_polygon_material(rest_line, state_material_name);
 break;
   }
@@ -408,8 +396,9 @@ void OBJParser::parse(Vector> 
_all_geometries,
 break;
   }
   case eOBJLineKey::COMMENT:
-ATTR_FALLTHROUGH;
+break;
   default:
+std::cout << "Element not recognised: '" << line_key << "'" << 
std::endl;
 break;
 }
   }
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh 
b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh
index 359aa93f06f..49e46d3494a 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh
+++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.hh
@@ -60,8 +60,8 @@ class OBJStorer {
 const VertexIndexOffset ,
 GlobalVertices _global_vertices);
   void add_polygon(const StringRef rest_line,
-   const VertexIndexOffset ,
const GlobalVertices _vertices,
+   const VertexIndexOffset ,
const StringRef 

[Bf-blender-cvs] [5c48127877a] soc-2020-io-performance: Importer: Cleanup: const, remove unneeded assignment.

2020-12-04 Thread Ankit Meel
Commit: 5c48127877aa17f57e0a144741646a5f434900e1
Author: Ankit Meel
Date:   Wed Dec 2 10:03:19 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rB5c48127877aa17f57e0a144741646a5f434900e1

Importer: Cleanup: const, remove unneeded assignment.

===

M   source/blender/io/wavefront_obj/importer/parser_string_utils.cc

===

diff --git a/source/blender/io/wavefront_obj/importer/parser_string_utils.cc 
b/source/blender/io/wavefront_obj/importer/parser_string_utils.cc
index 361752238ff..3d48d6310b7 100644
--- a/source/blender/io/wavefront_obj/importer/parser_string_utils.cc
+++ b/source/blender/io/wavefront_obj/importer/parser_string_utils.cc
@@ -55,7 +55,7 @@ void read_next_line(std::ifstream , string _line)
  * Also remove leading & trailing spaces as well as `\r` carriage return
  * character if present.
  */
-void split_line_key_rest(StringRef line, StringRef _line_key, StringRef 
_rest_line)
+void split_line_key_rest(const StringRef line, StringRef _line_key, 
StringRef _rest_line)
 {
   if (line.is_empty()) {
 return;
@@ -71,7 +71,8 @@ void split_line_key_rest(StringRef line, StringRef 
_line_key, StringRef _res
 r_line_key = line.substr(0, pos_split);
   }
 
-  r_rest_line = line = line.drop_prefix(r_line_key.size());
+  /* Eat the delimiter also using "+ 1". */
+  r_rest_line = line.drop_prefix(r_line_key.size() + 1);
   if (r_rest_line.is_empty()) {
 return;
   }

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


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

2020-12-04 Thread Ankit Meel
Commit: c59a5002e227207c75720a057da1198f27bd2590
Author: Ankit Meel
Date:   Sat Dec 5 00:27:15 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rBc59a5002e227207c75720a057da1198f27bd2590

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

===



===



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


[Bf-blender-cvs] [6cc5e59b492] soc-2020-io-performance: Exporter: remove useless `{}`s.

2020-12-04 Thread Ankit Meel
Commit: 6cc5e59b4926c8d8be08858f9359ebb6b9b19e7e
Author: Ankit Meel
Date:   Mon Nov 30 19:31:33 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rB6cc5e59b4926c8d8be08858f9359ebb6b9b19e7e

Exporter: remove useless `{}`s.

===

M   source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh

===

diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh 
b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh
index 89de626fb4b..ea5dd58089b 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh
@@ -40,12 +40,12 @@ struct tex_map_XX {
   tex_map_XX(StringRef to_socket_id) : dest_socket_id(to_socket_id){};
 
   /** Target socket which this texture node connects to. */
-  const std::string dest_socket_id{};
+  const std::string dest_socket_id;
   float3 translation{0.0f};
   float3 scale{1.0f};
   /* Only Flat and Smooth projections are supported. */
   int projection_type = SHD_PROJ_FLAT;
-  std::string image_path{};
+  std::string image_path;
   std::string mtl_dir_path;
 };
 
@@ -76,7 +76,7 @@ struct MTLMaterial {
 }
   }
 
-  std::string name{};
+  std::string name;
   /* Always check for negative values while importing or exporting. Use 
defaults if
* any value is negative. */
   float Ns{-1.0f};

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


[Bf-blender-cvs] [f5eaf67e34d] master: Atomics: Add 16 bit fetch + AND and fetch + OR signed integer operations

2020-12-04 Thread Julian Eisel
Commit: f5eaf67e34df088a2f0a19c744be7f8a51e7d9be
Author: Julian Eisel
Date:   Fri Dec 4 16:25:49 2020 +0100
Branches: master
https://developer.blender.org/rBf5eaf67e34df088a2f0a19c744be7f8a51e7d9be

Atomics: Add 16 bit fetch + AND and fetch + OR signed integer operations

I could use a 16 bit atomic fetch + AND for D9719. The alternative would be to
turn a `short` into a `int` in DNA, which isn't a nice workaround.

Also adds tests for the new functions.

===

M   intern/atomic/atomic_ops.h
M   intern/atomic/intern/atomic_ops_msvc.h
M   intern/atomic/intern/atomic_ops_unix.h
M   intern/atomic/tests/atomic_test.cc

===

diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h
index e6ca7a105ba..ad404c756ce 100644
--- a/intern/atomic/atomic_ops.h
+++ b/intern/atomic/atomic_ops.h
@@ -87,6 +87,9 @@ ATOMIC_INLINE int32_t atomic_fetch_and_add_int32(int32_t *p, 
int32_t x);
 ATOMIC_INLINE int32_t atomic_fetch_and_or_int32(int32_t *p, int32_t x);
 ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t *p, int32_t x);
 
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t b);
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b);
+
 ATOMIC_INLINE uint8_t atomic_fetch_and_or_uint8(uint8_t *p, uint8_t b);
 ATOMIC_INLINE uint8_t atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b);
 
diff --git a/intern/atomic/intern/atomic_ops_msvc.h 
b/intern/atomic/intern/atomic_ops_msvc.h
index 356140541ba..c9ad1a46ab9 100644
--- a/intern/atomic/intern/atomic_ops_msvc.h
+++ b/intern/atomic/intern/atomic_ops_msvc.h
@@ -162,6 +162,20 @@ ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t 
*p, int32_t x)
   return InterlockedAnd((long *)p, x);
 }
 
+/**/
+/* 16-bit operations. */
+
+/* Signed */
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t x)
+{
+  return InterlockedOr16((short *)p, x);
+}
+
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t x)
+{
+  return InterlockedAnd16((short *)p, x);
+}
+
 
/**/
 /* 8-bit operations. */
 
diff --git a/intern/atomic/intern/atomic_ops_unix.h 
b/intern/atomic/intern/atomic_ops_unix.h
index 0de9daaaf5f..dc1e71cda76 100644
--- a/intern/atomic/intern/atomic_ops_unix.h
+++ b/intern/atomic/intern/atomic_ops_unix.h
@@ -55,6 +55,7 @@
  * its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
  */
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
+#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_2
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_4
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_8
 #endif
@@ -325,6 +326,24 @@ ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t 
*p, int32_t x)
 #  error "Missing implementation for 32-bit atomic operations"
 #endif
 
+/**/
+/* 16-bit operations. */
+#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) || 
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_2))
+
+/* Signed */
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b)
+{
+  return __sync_fetch_and_and(p, b);
+}
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t b)
+{
+  return __sync_fetch_and_or(p, b);
+}
+
+#else
+#  error "Missing implementation for 16-bit atomic operations"
+#endif
+
 
/**/
 /* 8-bit operations. */
 #if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || 
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_1))
diff --git a/intern/atomic/tests/atomic_test.cc 
b/intern/atomic/tests/atomic_test.cc
index 6178b5074a7..661c130c65d 100644
--- a/intern/atomic/tests/atomic_test.cc
+++ b/intern/atomic/tests/atomic_test.cc
@@ -559,6 +559,39 @@ TEST(atomic, atomic_fetch_and_and_int32)
 
 /** \} */
 
+/** \name 16 bit signed int atomics
+ * \{ */
+
+TEST(atomic, atomic_fetch_and_or_int16)
+{
+  {
+int16_t value = 12;
+EXPECT_EQ(atomic_fetch_and_or_int16(, 5), 12);
+EXPECT_EQ(value, 13);
+  }
+
+  {
+int16_t value = 0x1234;
+EXPECT_EQ(atomic_fetch_and_or_int16(, -0x5678), 0x1234);
+EXPECT_EQ(value, -0x);
+  }
+}
+
+TEST(atomic, atomic_fetch_and_and_int16)
+{
+  {
+int16_t value = 12;
+EXPECT_EQ(atomic_fetch_and_and_int16(, 5), 12);
+EXPECT_EQ(value, 4);
+  }
+
+  {
+int16_t value = 0x1234;
+EXPECT_EQ(atomic_fetch_and_and_int16(, -0x789A), 0x1234);
+EXPECT_EQ(value, 0x224);
+  }
+}
+
 /** \name 8 bit unsigned int atomics
  * \{ */

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


[Bf-blender-cvs] [0f0ea8b8179] geometry-nodes-distribute-points: Silence debug prints and make max density be in m^2 units (was factor)

2020-12-04 Thread Sebastian Parborg
Commit: 0f0ea8b81790d6b9d279e66c7a0c08f42626841d
Author: Sebastian Parborg
Date:   Fri Dec 4 18:25:18 2020 +0100
Branches: geometry-nodes-distribute-points
https://developer.blender.org/rB0f0ea8b81790d6b9d279e66c7a0c08f42626841d

Silence debug prints and make max density be in m^2 units (was factor)

===

M   source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc 
b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
index cec6616d738..22b3c90d5b2 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
@@ -178,7 +178,7 @@ static Vector 
poisson_scatter_points_from_mesh(const Mesh *mesh,
 
   cy::WeightedSampleElimination wse;
   {
-SCOPED_TIMER("poisson random dist points");
+// SCOPED_TIMER("poisson random dist points");
 const int rnd_seed = BLI_hash_int(seed);
 RandomNumberGenerator point_rng(rnd_seed);
 
@@ -196,7 +196,7 @@ static Vector 
poisson_scatter_points_from_mesh(const Mesh *mesh,
   // Eliminate the scattered points until we get a possion distribution.
   Vector output_points(output_points_target);
   {
-SCOPED_TIMER("Total poisson sample elim");
+// SCOPED_TIMER("Total poisson sample elim");
 
 bool is_progressive = true;
 
@@ -215,7 +215,7 @@ static Vector 
poisson_scatter_points_from_mesh(const Mesh *mesh,
   final_points.reserve(output_points_target);
   // Check if we have any points we should remove from the final possion 
distribition.
   {
-SCOPED_TIMER("poisson projection mapping");
+// SCOPED_TIMER("poisson projection mapping");
 BVHTreeFromMesh treedata;
 BKE_bvhtree_from_mesh_get(, const_cast(mesh), 
BVHTREE_FROM_LOOPTRI, 2);
 
@@ -228,7 +228,9 @@ static Vector 
poisson_scatter_points_from_mesh(const Mesh *mesh,
 data.mesh = mesh;
 data.projected_points = _points;
 data.density_factors = const_cast(_factors);
-data.base_weight = density;
+data.base_weight = std::min(
+1.0f,
+density / (output_points.size() / (point_scale_multiplier * 
point_scale_multiplier)));
 
 const float max_dist = bb_max[2] - bb_min[2] + 2.0f;
 const float3 dir = float3(0, 0, -1);

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


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

2020-12-04 Thread Antonio Vazquez
Commit: 29785dd513da001823aec13a83a38be0fd7addf4
Author: Antonio Vazquez
Date:   Fri Dec 4 17:35:03 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rB29785dd513da001823aec13a83a38be0fd7addf4

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] [67b48290853] temp-atomics-int16: Atomics: Add 16 bit fetch + AND and fetch + OR signed integer operations

2020-12-04 Thread Julian Eisel
Commit: 67b48290853a9d7e8f92764a6a3938c3a804c294
Author: Julian Eisel
Date:   Fri Dec 4 16:25:49 2020 +0100
Branches: temp-atomics-int16
https://developer.blender.org/rB67b48290853a9d7e8f92764a6a3938c3a804c294

Atomics: Add 16 bit fetch + AND and fetch + OR signed integer operations

I could use a 16 bit atomic fetch + AND for D9719. The alternative would be to
turn a `short` into a `int` in DNA, which isn't a nice workaround.

Also adds tests for the new functions.

===

M   intern/atomic/atomic_ops.h
M   intern/atomic/intern/atomic_ops_msvc.h
M   intern/atomic/intern/atomic_ops_unix.h
M   intern/atomic/tests/atomic_test.cc

===

diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h
index e6ca7a105ba..ad404c756ce 100644
--- a/intern/atomic/atomic_ops.h
+++ b/intern/atomic/atomic_ops.h
@@ -87,6 +87,9 @@ ATOMIC_INLINE int32_t atomic_fetch_and_add_int32(int32_t *p, 
int32_t x);
 ATOMIC_INLINE int32_t atomic_fetch_and_or_int32(int32_t *p, int32_t x);
 ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t *p, int32_t x);
 
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t b);
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b);
+
 ATOMIC_INLINE uint8_t atomic_fetch_and_or_uint8(uint8_t *p, uint8_t b);
 ATOMIC_INLINE uint8_t atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b);
 
diff --git a/intern/atomic/intern/atomic_ops_msvc.h 
b/intern/atomic/intern/atomic_ops_msvc.h
index 356140541ba..c9ad1a46ab9 100644
--- a/intern/atomic/intern/atomic_ops_msvc.h
+++ b/intern/atomic/intern/atomic_ops_msvc.h
@@ -162,6 +162,20 @@ ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t 
*p, int32_t x)
   return InterlockedAnd((long *)p, x);
 }
 
+/**/
+/* 16-bit operations. */
+
+/* Signed */
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t x)
+{
+  return InterlockedOr16((short *)p, x);
+}
+
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t x)
+{
+  return InterlockedAnd16((short *)p, x);
+}
+
 
/**/
 /* 8-bit operations. */
 
diff --git a/intern/atomic/intern/atomic_ops_unix.h 
b/intern/atomic/intern/atomic_ops_unix.h
index 0de9daaaf5f..dc1e71cda76 100644
--- a/intern/atomic/intern/atomic_ops_unix.h
+++ b/intern/atomic/intern/atomic_ops_unix.h
@@ -55,6 +55,7 @@
  * its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
  */
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
+#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_2
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_4
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_8
 #endif
@@ -325,6 +326,24 @@ ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t 
*p, int32_t x)
 #  error "Missing implementation for 32-bit atomic operations"
 #endif
 
+/**/
+/* 16-bit operations. */
+#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) || 
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_2))
+
+/* Signed */
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b)
+{
+  return __sync_fetch_and_and(p, b);
+}
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t b)
+{
+  return __sync_fetch_and_or(p, b);
+}
+
+#else
+#  error "Missing implementation for 16-bit atomic operations"
+#endif
+
 
/**/
 /* 8-bit operations. */
 #if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || 
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_1))
diff --git a/intern/atomic/tests/atomic_test.cc 
b/intern/atomic/tests/atomic_test.cc
index 6178b5074a7..661c130c65d 100644
--- a/intern/atomic/tests/atomic_test.cc
+++ b/intern/atomic/tests/atomic_test.cc
@@ -559,6 +559,39 @@ TEST(atomic, atomic_fetch_and_and_int32)
 
 /** \} */
 
+/** \name 16 bit signed int atomics
+ * \{ */
+
+TEST(atomic, atomic_fetch_and_or_int16)
+{
+  {
+int16_t value = 12;
+EXPECT_EQ(atomic_fetch_and_or_int16(, 5), 12);
+EXPECT_EQ(value, 13);
+  }
+
+  {
+int16_t value = 0x1234;
+EXPECT_EQ(atomic_fetch_and_or_int16(, -0x5678), 0x1234);
+EXPECT_EQ(value, -0x);
+  }
+}
+
+TEST(atomic, atomic_fetch_and_and_int16)
+{
+  {
+int16_t value = 12;
+EXPECT_EQ(atomic_fetch_and_and_int16(, 5), 12);
+EXPECT_EQ(value, 4);
+  }
+
+  {
+int16_t value = 0x1234;
+EXPECT_EQ(atomic_fetch_and_and_int16(, -0x789A), 0x1234);
+EXPECT_EQ(value, 0x224);
+  }
+}
+
 /** \name 8 bit unsigned int atomics
  * \{ */

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


[Bf-blender-cvs] [cc2f90d1189] temp-atomics-int16: Atomics: Add 16 bit fetch + AND and fetch + OR signed integer operations

2020-12-04 Thread Julian Eisel
Commit: cc2f90d1189adc49e2652ce4587894493ca2d41d
Author: Julian Eisel
Date:   Fri Dec 4 16:25:49 2020 +0100
Branches: temp-atomics-int16
https://developer.blender.org/rBcc2f90d1189adc49e2652ce4587894493ca2d41d

Atomics: Add 16 bit fetch + AND and fetch + OR signed integer operations

I could use a 16 bit atomic fetch + AND for D9719. The alternative would be to
turn a `short` into a `int` in DNA, which isn't a nice workaround.

Also adds tests for the new functions.

===

M   intern/atomic/atomic_ops.h
M   intern/atomic/intern/atomic_ops_msvc.h
M   intern/atomic/intern/atomic_ops_unix.h
M   intern/atomic/tests/atomic_test.cc

===

diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h
index e6ca7a105ba..ad404c756ce 100644
--- a/intern/atomic/atomic_ops.h
+++ b/intern/atomic/atomic_ops.h
@@ -87,6 +87,9 @@ ATOMIC_INLINE int32_t atomic_fetch_and_add_int32(int32_t *p, 
int32_t x);
 ATOMIC_INLINE int32_t atomic_fetch_and_or_int32(int32_t *p, int32_t x);
 ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t *p, int32_t x);
 
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t b);
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b);
+
 ATOMIC_INLINE uint8_t atomic_fetch_and_or_uint8(uint8_t *p, uint8_t b);
 ATOMIC_INLINE uint8_t atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b);
 
diff --git a/intern/atomic/intern/atomic_ops_msvc.h 
b/intern/atomic/intern/atomic_ops_msvc.h
index 356140541ba..c9ad1a46ab9 100644
--- a/intern/atomic/intern/atomic_ops_msvc.h
+++ b/intern/atomic/intern/atomic_ops_msvc.h
@@ -162,6 +162,20 @@ ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t 
*p, int32_t x)
   return InterlockedAnd((long *)p, x);
 }
 
+/**/
+/* 16-bit operations. */
+
+/* Signed */
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t x)
+{
+  return InterlockedOr16((short *)p, x);
+}
+
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t x)
+{
+  return InterlockedAnd16((short *)p, x);
+}
+
 
/**/
 /* 8-bit operations. */
 
diff --git a/intern/atomic/intern/atomic_ops_unix.h 
b/intern/atomic/intern/atomic_ops_unix.h
index 0de9daaaf5f..dc1e71cda76 100644
--- a/intern/atomic/intern/atomic_ops_unix.h
+++ b/intern/atomic/intern/atomic_ops_unix.h
@@ -55,6 +55,7 @@
  * its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
  */
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
+#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_2
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_4
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_8
 #endif
@@ -325,6 +326,24 @@ ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t 
*p, int32_t x)
 #  error "Missing implementation for 32-bit atomic operations"
 #endif
 
+/**/
+/* 16-bit operations. */
+#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) || 
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_2))
+
+/* Signed */
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b)
+{
+  return __sync_fetch_and_and(p, b);
+}
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t b)
+{
+  return __sync_fetch_and_or(p, b);
+}
+
+#else
+#  error "Missing implementation for 16-bit atomic operations"
+#endif
+
 
/**/
 /* 8-bit operations. */
 #if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || 
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_1))
diff --git a/intern/atomic/tests/atomic_test.cc 
b/intern/atomic/tests/atomic_test.cc
index 6178b5074a7..51ab9828ba4 100644
--- a/intern/atomic/tests/atomic_test.cc
+++ b/intern/atomic/tests/atomic_test.cc
@@ -559,6 +559,39 @@ TEST(atomic, atomic_fetch_and_and_int32)
 
 /** \} */
 
+/** \name 16 bit signed int atomics
+ * \{ */
+
+TEST(atomic, atomic_fetch_and_or_int16)
+{
+  {
+int16_t value = 12;
+EXPECT_EQ(atomic_fetch_and_or_int16(, 5), 12);
+EXPECT_EQ(value, 13);
+  }
+
+  {
+int32_t value = 0x1234;
+EXPECT_EQ(atomic_fetch_and_or_int32(, -0x5678), 0x1234);
+EXPECT_EQ(value, -0x);
+  }
+}
+
+TEST(atomic, atomic_fetch_and_and_int16)
+{
+  {
+int16_t value = 12;
+EXPECT_EQ(atomic_fetch_and_and_int16(, 5), 12);
+EXPECT_EQ(value, 4);
+  }
+
+  {
+int32_t value = 0x1234;
+EXPECT_EQ(atomic_fetch_and_and_int32(, -0xABCD), 0x1234);
+EXPECT_EQ(value, 0x1030);
+  }
+}
+
 /** \name 8 bit unsigned int atomics
  * \{ */

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


[Bf-blender-cvs] [1d2c70d7615] master: Fix API doc generation.

2020-12-04 Thread Bastien Montagne
Commit: 1d2c70d7615c14b380e00ae993e58cc14376dcf7
Author: Bastien Montagne
Date:   Fri Dec 4 16:44:22 2020 +0100
Branches: master
https://developer.blender.org/rB1d2c70d7615c14b380e00ae993e58cc14376dcf7

Fix API doc generation.

BMesh auto-extracting API info does not support comments inside BMesh
operators parameters definition.

===

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

===

diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c 
b/source/blender/bmesh/intern/bmesh_opdefines.c
index cf58dfc684e..4ce70e7bd5a 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -1787,8 +1787,8 @@ static BMOpDefine bmo_bevel_def = {
{"spread", BMO_OP_SLOT_FLT},   /* amount to offset beveled edge */
{"smoothresh", BMO_OP_SLOT_FLT},   /* for passing mesh's smoothresh, 
used in hardening */
{"custom_profile", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_STRUCT}}, 
/* CurveProfile */
-   {"vmesh_method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, /* 
the method to use to create meshes at intersections */
-bmo_enum_bevel_vmesh_method},
+   {"vmesh_method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
+bmo_enum_bevel_vmesh_method}, /* The method to use to create 
meshes at intersections. */
{{'\0'}},
   },
   /* slots_out */

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


[Bf-blender-cvs] [719dfd40889] master: macOS deps: Support building clang tidy

2020-12-04 Thread Ankit Meel
Commit: 719dfd40889aa50d39d27b3264388768f42b2984
Author: Ankit Meel
Date:   Fri Dec 4 21:11:19 2020 +0530
Branches: master
https://developer.blender.org/rB719dfd40889aa50d39d27b3264388768f42b2984

macOS deps: Support building clang tidy

This patch builds clang-extra-tools on macOS for the
clang-tidy binary. The script "run-clang-tidy.py" is
also harvested because using the `CMAKE_C[XX]_CLANG_TIDY`
option can miss out some files (like makesrna), and using the
script is faster as it does not compile the files.
Thanks to `@LazyDodo` for the base patch D8502.

Reviewed By: LazyDodo, sebbas, #platform_macos
Differential Revision: https://developer.blender.org/D9450

===

M   build_files/build_environment/cmake/clang.cmake
M   build_files/build_environment/cmake/harvest.cmake
M   build_files/build_environment/cmake/versions.cmake

===

diff --git a/build_files/build_environment/cmake/clang.cmake 
b/build_files/build_environment/cmake/clang.cmake
index 9de0ec1b182..d8d83619e1a 100644
--- a/build_files/build_environment/cmake/clang.cmake
+++ b/build_files/build_environment/cmake/clang.cmake
@@ -17,13 +17,14 @@
 # * END GPL LICENSE BLOCK *
 
 set(CLANG_EXTRA_ARGS
-  -DCLANG_PATH_TO_LLVM_SOURCE=${BUILD_DIR}/ll/src/ll
-  -DCLANG_PATH_TO_LLVM_BUILD=${LIBDIR}/llvm
+  -DLLVM_DIR="${LIBDIR}/llvm/lib/cmake/llvm/"
   -DLLVM_USE_CRT_RELEASE=MD
   -DLLVM_USE_CRT_DEBUG=MDd
   -DLLVM_CONFIG=${LIBDIR}/llvm/bin/llvm-config
 )
 
+set(BUILD_CLANG_TOOLS OFF)
+
 if(WIN32)
   set(CLANG_GENERATOR "Ninja")
 else()
@@ -31,11 +32,32 @@ else()
 endif()
 
 if(APPLE)
+  set(BUILD_CLANG_TOOLS ON)
   set(CLANG_EXTRA_ARGS ${CLANG_EXTRA_ARGS}
 -DLIBXML2_LIBRARY=${LIBDIR}/xml2/lib/libxml2.a
   )
 endif()
 
+if(BUILD_CLANG_TOOLS)
+  # ExternalProject_Add does not allow multiple tarballs to be
+  # downloaded. Work around this by having an empty build action
+  # for the extra tools, and referring the clang build to the location
+  # of the clang-tools-extra source.
+  ExternalProject_Add(external_clang_tools
+URL ${CLANG_TOOLS_URI}
+DOWNLOAD_DIR ${DOWNLOAD_DIR}
+URL_HASH MD5=${CLANG_TOOLS_HASH}
+INSTALL_DIR ${LIBDIR}/clang_tools
+PREFIX ${BUILD_DIR}/clang_tools
+CONFIGURE_COMMAND echo "."
+BUILD_COMMAND echo "."
+INSTALL_COMMAND echo "."
+  )
+  list(APPEND CLANG_EXTRA_ARGS
+
-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=${BUILD_DIR}/clang_tools/src/external_clang_tools/
+  )
+endif()
+
 ExternalProject_Add(external_clang
   URL ${CLANG_URI}
   DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -65,6 +87,14 @@ add_dependencies(
   ll
 )
 
+if(BUILD_CLANG_TOOLS)
+  # `external_clang_tools` is for downloading the source, not compiling it.
+  add_dependencies(
+external_clang
+external_clang_tools
+  )
+endif()
+
 # We currently do not build libxml2 on Windows.
 if(NOT WIN32)
   add_dependencies(
diff --git a/build_files/build_environment/cmake/harvest.cmake 
b/build_files/build_environment/cmake/harvest.cmake
index 0f9b67a3d44..536907f563d 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -98,6 +98,10 @@ harvest(jpg/include jpeg/include "*.h")
 harvest(jpg/lib jpeg/lib "libjpeg.a")
 harvest(lame/lib ffmpeg/lib "*.a")
 harvest(clang/bin llvm/bin "clang-format")
+if(BUILD_CLANG_TOOLS)
+  harvest(clang/bin llvm/bin "clang-tidy")
+  harvest(clang/share/clang llvm/share "run-clang-tidy.py")
+endif()
 harvest(clang/include llvm/include "*")
 harvest(llvm/include llvm/include "*")
 harvest(llvm/bin llvm/bin "llvm-config")
diff --git a/build_files/build_environment/cmake/versions.cmake 
b/build_files/build_environment/cmake/versions.cmake
index 653db9f740c..d4a2c715ecc 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -120,6 +120,9 @@ set(LLVM_HASH 31eb9ce73dd2a0f8dcab8319fb03f8fc)
 set(CLANG_URI 
https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang-${LLVM_VERSION}.src.tar.xz)
 set(CLANG_HASH 13468e4a44940efef1b75e8641752f90)
 
+set(CLANG_TOOLS_URI 
https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang-tools-extra-${LLVM_VERSION}.src.tar.xz)
+set(CLANG_TOOLS_HASH c76293870b564c6a7968622b475b7646)
+
 set(OPENMP_URI 
https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
 set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)

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


[Bf-blender-cvs] [cc2f90d1189] temp-atomics-int16: Atomics: Add 16 bit fetch + AND and fetch + OR signed integer operations

2020-12-04 Thread Julian Eisel
Commit: cc2f90d1189adc49e2652ce4587894493ca2d41d
Author: Julian Eisel
Date:   Fri Dec 4 16:25:49 2020 +0100
Branches: temp-atomics-int16
https://developer.blender.org/rBcc2f90d1189adc49e2652ce4587894493ca2d41d

Atomics: Add 16 bit fetch + AND and fetch + OR signed integer operations

I could use a 16 bit atomic fetch + AND for D9719. The alternative would be to
turn a `short` into a `int` in DNA, which isn't a nice workaround.

Also adds tests for the new functions.

===

M   intern/atomic/atomic_ops.h
M   intern/atomic/intern/atomic_ops_msvc.h
M   intern/atomic/intern/atomic_ops_unix.h
M   intern/atomic/tests/atomic_test.cc

===

diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h
index e6ca7a105ba..ad404c756ce 100644
--- a/intern/atomic/atomic_ops.h
+++ b/intern/atomic/atomic_ops.h
@@ -87,6 +87,9 @@ ATOMIC_INLINE int32_t atomic_fetch_and_add_int32(int32_t *p, 
int32_t x);
 ATOMIC_INLINE int32_t atomic_fetch_and_or_int32(int32_t *p, int32_t x);
 ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t *p, int32_t x);
 
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t b);
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b);
+
 ATOMIC_INLINE uint8_t atomic_fetch_and_or_uint8(uint8_t *p, uint8_t b);
 ATOMIC_INLINE uint8_t atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b);
 
diff --git a/intern/atomic/intern/atomic_ops_msvc.h 
b/intern/atomic/intern/atomic_ops_msvc.h
index 356140541ba..c9ad1a46ab9 100644
--- a/intern/atomic/intern/atomic_ops_msvc.h
+++ b/intern/atomic/intern/atomic_ops_msvc.h
@@ -162,6 +162,20 @@ ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t 
*p, int32_t x)
   return InterlockedAnd((long *)p, x);
 }
 
+/**/
+/* 16-bit operations. */
+
+/* Signed */
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t x)
+{
+  return InterlockedOr16((short *)p, x);
+}
+
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t x)
+{
+  return InterlockedAnd16((short *)p, x);
+}
+
 
/**/
 /* 8-bit operations. */
 
diff --git a/intern/atomic/intern/atomic_ops_unix.h 
b/intern/atomic/intern/atomic_ops_unix.h
index 0de9daaaf5f..dc1e71cda76 100644
--- a/intern/atomic/intern/atomic_ops_unix.h
+++ b/intern/atomic/intern/atomic_ops_unix.h
@@ -55,6 +55,7 @@
  * its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
  */
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
+#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_2
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_4
 #  define JE_FORCE_SYNC_COMPARE_AND_SWAP_8
 #endif
@@ -325,6 +326,24 @@ ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t 
*p, int32_t x)
 #  error "Missing implementation for 32-bit atomic operations"
 #endif
 
+/**/
+/* 16-bit operations. */
+#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) || 
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_2))
+
+/* Signed */
+ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b)
+{
+  return __sync_fetch_and_and(p, b);
+}
+ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t b)
+{
+  return __sync_fetch_and_or(p, b);
+}
+
+#else
+#  error "Missing implementation for 16-bit atomic operations"
+#endif
+
 
/**/
 /* 8-bit operations. */
 #if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || 
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_1))
diff --git a/intern/atomic/tests/atomic_test.cc 
b/intern/atomic/tests/atomic_test.cc
index 6178b5074a7..51ab9828ba4 100644
--- a/intern/atomic/tests/atomic_test.cc
+++ b/intern/atomic/tests/atomic_test.cc
@@ -559,6 +559,39 @@ TEST(atomic, atomic_fetch_and_and_int32)
 
 /** \} */
 
+/** \name 16 bit signed int atomics
+ * \{ */
+
+TEST(atomic, atomic_fetch_and_or_int16)
+{
+  {
+int16_t value = 12;
+EXPECT_EQ(atomic_fetch_and_or_int16(, 5), 12);
+EXPECT_EQ(value, 13);
+  }
+
+  {
+int32_t value = 0x1234;
+EXPECT_EQ(atomic_fetch_and_or_int32(, -0x5678), 0x1234);
+EXPECT_EQ(value, -0x);
+  }
+}
+
+TEST(atomic, atomic_fetch_and_and_int16)
+{
+  {
+int16_t value = 12;
+EXPECT_EQ(atomic_fetch_and_and_int16(, 5), 12);
+EXPECT_EQ(value, 4);
+  }
+
+  {
+int32_t value = 0x1234;
+EXPECT_EQ(atomic_fetch_and_and_int32(, -0xABCD), 0x1234);
+EXPECT_EQ(value, 0x1030);
+  }
+}
+
 /** \name 8 bit unsigned int atomics
  * \{ */

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


[Bf-blender-cvs] [b9195116075] master: Cleanup: Deduplicate constraint event code

2020-12-04 Thread Germano Cavalcante
Commit: b9195116075420b09969eacd4ba91c4cce7b7b5c
Author: Germano Cavalcante
Date:   Fri Dec 4 12:22:50 2020 -0300
Branches: master
https://developer.blender.org/rBb9195116075420b09969eacd4ba91c4cce7b7b5c

Cleanup: Deduplicate constraint event code

===

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

===

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 3b8f7f90edc..2004e3b052d 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -713,55 +713,67 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf)
   return keymap;
 }
 
-static void transform_event_xyz_constraint(TransInfo *t, short key_type, bool 
is_plane)
+static bool transform_event_modal_constraint(TransInfo *t, short modal_type)
 {
   if (!(t->flag & T_NO_CONSTRAINT)) {
-char cmode = constraintModeToChar(t);
-int constraint_axis, constraint_plane;
-const bool edit_2d = (t->flag & T_2D_EDIT) != 0;
-const char *msg1 = "", *msg2 = "", *msg3 = "";
-char axis;
+if (t->flag & T_2D_EDIT && ELEM(modal_type, TFM_MODAL_AXIS_Z, 
TFM_MODAL_PLANE_Z)) {
+  return false;
+}
+int constraint_curr = (t->con.mode & CON_APPLY) ?
+  t->con.mode & (CON_AXIS0 | CON_AXIS1 | 
CON_AXIS2) :
+  -1;
+int constraint_new;
+const char *msg_2d = "", *msg_3d = "";
 
 /* Initialize */
-switch (key_type) {
-  case EVT_XKEY:
-msg1 = TIP_("along X");
-msg2 = TIP_("along %s X");
-msg3 = TIP_("locking %s X");
-axis = 'X';
-constraint_axis = CON_AXIS0;
+switch (modal_type) {
+  case TFM_MODAL_AXIS_X:
+msg_2d = TIP_("along X");
+msg_3d = TIP_("along %s X");
+constraint_new = CON_AXIS0;
+break;
+  case TFM_MODAL_AXIS_Y:
+msg_2d = TIP_("along Y");
+msg_3d = TIP_("along %s Y");
+constraint_new = CON_AXIS1;
 break;
-  case EVT_YKEY:
-msg1 = TIP_("along Y");
-msg2 = TIP_("along %s Y");
-msg3 = TIP_("locking %s Y");
-axis = 'Y';
-constraint_axis = CON_AXIS1;
+  case TFM_MODAL_AXIS_Z:
+msg_2d = TIP_("along Z");
+msg_3d = TIP_("along %s Z");
+constraint_new = CON_AXIS2;
 break;
-  case EVT_ZKEY:
-msg1 = TIP_("along Z");
-msg2 = TIP_("along %s Z");
-msg3 = TIP_("locking %s Z");
-axis = 'Z';
-constraint_axis = CON_AXIS2;
+  case TFM_MODAL_PLANE_X:
+msg_3d = TIP_("locking %s X");
+constraint_new = CON_AXIS1 | CON_AXIS2;
+break;
+  case TFM_MODAL_PLANE_Y:
+msg_3d = TIP_("locking %s Y");
+constraint_new = CON_AXIS0 | CON_AXIS2;
+break;
+  case TFM_MODAL_PLANE_Z:
+msg_3d = TIP_("locking %s Z");
+constraint_new = CON_AXIS0 | CON_AXIS1;
 break;
   default:
 /* Invalid key */
-return;
+return false;
 }
-constraint_plane = ((CON_AXIS0 | CON_AXIS1 | CON_AXIS2) & 
(~constraint_axis));
 
-if (edit_2d && (key_type != EVT_ZKEY)) {
-  if (cmode == axis) {
+if (t->flag & T_2D_EDIT) {
+  BLI_assert(modal_type < TFM_MODAL_PLANE_X);
+  if (constraint_new == CON_AXIS2) {
+return false;
+  }
+  if (constraint_curr == constraint_new) {
 stopConstraint(t);
   }
   else {
-setUserConstraint(t, constraint_axis, msg1);
+setUserConstraint(t, constraint_new, msg_2d);
   }
 }
-else if (!edit_2d) {
+else {
   short orient_index = 1;
-  if (t->orient_curr == 0 || ELEM(cmode, '\0', axis)) {
+  if (t->orient_curr == 0 || ELEM(constraint_curr, -1, constraint_new)) {
 /* Successive presses on existing axis, cycle orientation modes. */
 orient_index = (short)((t->orient_curr + 1) % 
(int)ARRAY_SIZE(t->orient));
   }
@@ -771,16 +783,13 @@ static void transform_event_xyz_constraint(TransInfo *t, 
short key_type, bool is
 stopConstraint(t);
   }
   else {
-if (is_plane == false) {
-  setUserConstraint(t, constraint_axis, msg2);
-}
-else {
-  setUserConstraint(t, constraint_plane, msg3);
-}
+setUserConstraint(t, constraint_new, msg_3d);
   }
 }
 t->redraw |= TREDRAW_HARD;
+return true;
   }
+  return false;
 }
 
 int transformEvent(TransInfo *t, const wmEvent *event)
@@ -949,44 +958,12 @@ int transformEvent(TransInfo *t, const wmEvent *event)
 handled = true;
 break;
   case TFM_MODAL_AXIS_X:
-if (!(t->flag & T_NO_CONSTRAINT)) {
-  transform_event_xyz_constraint(t, EVT_XKEY, false);
-  t->redraw |= TREDRAW_HARD;

[Bf-blender-cvs] [d07009498ac] master: Transform: Don't use Automatic Constraint Plane in 2D editors

2020-12-04 Thread Germano Cavalcante
Commit: d07009498ac36d067fbccd61cfbcd51d4e2ba310
Author: Germano Cavalcante
Date:   Fri Dec 4 12:30:52 2020 -0300
Branches: master
https://developer.blender.org/rBd07009498ac36d067fbccd61cfbcd51d4e2ba310

Transform: Don't use Automatic Constraint Plane in 2D editors

Technically it shouldn't have any effect on these editors.

The key tips in the header can be misleading.

The effect it previously had was not intended.

===

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

===

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 2004e3b052d..5969de5b5da 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -599,7 +599,8 @@ static bool transform_modal_item_poll(const wmOperator *op, 
int value)
 case TFM_MODAL_AXIS_Z:
 case TFM_MODAL_PLANE_X:
 case TFM_MODAL_PLANE_Y:
-case TFM_MODAL_PLANE_Z: {
+case TFM_MODAL_PLANE_Z:
+case TFM_MODAL_AUTOCONSTRAINTPLANE: {
   if (t->flag & T_NO_CONSTRAINT) {
 return false;
   }

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


[Bf-blender-cvs] [fe1f05de1b7] master: i18n utils CLI: add missing RTL process command.

2020-12-04 Thread Bastien Montagne
Commit: fe1f05de1b77798650b91c4e5f8c2b02c3276b18
Author: Bastien Montagne
Date:   Fri Dec 4 15:54:50 2020 +0100
Branches: master
https://developer.blender.org/rBfe1f05de1b77798650b91c4e5f8c2b02c3276b18

i18n utils CLI: add missing RTL process command.

===

M   release/scripts/modules/bl_i18n_utils/utils_cli.py

===

diff --git a/release/scripts/modules/bl_i18n_utils/utils_cli.py 
b/release/scripts/modules/bl_i18n_utils/utils_cli.py
index 4390544ec17..d38911c122d 100644
--- a/release/scripts/modules/bl_i18n_utils/utils_cli.py
+++ b/release/scripts/modules/bl_i18n_utils/utils_cli.py
@@ -62,6 +62,15 @@ def strip_po(args, settings):
 po.write(kind="PO_COMPACT", dest=args.dst)
 
 
+def rtl_process_po(args, settings):
+uid = os.path.splitext(os.path.basename(args.src))[0]
+if not args.dst:
+args.dst = args.src
+po = utils_i18n.I18nMessages(uid=uid, kind='PO', src=args.src, 
settings=settings)
+po.rtl_process()
+po.write(kind="PO", dest=args.dst)
+
+
 def language_menu(args, settings):
 # 'DEFAULT' and en_US are always valid, fully-translated "languages"!
 stats = {"DEFAULT": 1.0, "en_US": 1.0}
@@ -111,6 +120,12 @@ def main():
 sub_parser.add_argument('--dst', metavar='dst.po', help="The destination 
po to write to.")
 sub_parser.set_defaults(func=strip_po) 
 
+sub_parser = sub_parsers.add_parser('rtl_process_po',
+help="Pre-process PO files for RTL 
languages.")
+sub_parser.add_argument('--src', metavar='src.po', required=True, 
help="The source po file to process.")
+sub_parser.add_argument('--dst', metavar='dst.po', help="The destination 
po to write to.")
+sub_parser.set_defaults(func=rtl_process_po)
+
 sub_parser = sub_parsers.add_parser('language_menu',
 help="Generate the text file used by 
Blender to create its language menu.")
 sub_parser.set_defaults(func=language_menu)

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


[Bf-blender-cvs] [5b66a0769b0] geometry-nodes-distribute-points: Fixed vertex weights not reading correctly when sharing input sockets

2020-12-04 Thread Sebastian Parborg
Commit: 5b66a0769b01e597b6ac74fc3d8b66834d975665
Author: Sebastian Parborg
Date:   Fri Dec 4 15:53:12 2020 +0100
Branches: geometry-nodes-distribute-points
https://developer.blender.org/rB5b66a0769b01e597b6ac74fc3d8b66834d975665

Fixed vertex weights not reading correctly when sharing input sockets

===

M   source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc 
b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
index a182a6f5375..cec6616d738 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
@@ -154,7 +154,7 @@ static void project_2d_bvh_callback(void *userdata,
   }
 }
 
-static Vector poisson_scatter_points_from_mesh(Mesh *mesh,
+static Vector poisson_scatter_points_from_mesh(const Mesh *mesh,
const float density,
const float min_dist,
const 
FloatReadAttribute _factors,
@@ -217,7 +217,7 @@ static Vector poisson_scatter_points_from_mesh(Mesh 
*mesh,
   {
 SCOPED_TIMER("poisson projection mapping");
 BVHTreeFromMesh treedata;
-BKE_bvhtree_from_mesh_get(, mesh, BVHTREE_FROM_LOOPTRI, 2);
+BKE_bvhtree_from_mesh_get(, const_cast(mesh), 
BVHTREE_FROM_LOOPTRI, 2);
 
 float3 bb_min, bb_max;
 BLI_bvhtree_get_bounding_box(treedata.tree, bb_min, bb_max);
@@ -283,10 +283,8 @@ static void 
geo_node_point_distribute_exec(GeoNodeExecParams params)
 return;
   }
 
-  // Non const because of mesh BVH generaton when projection mapping is used.
-  // TODO should we just const cast for BVH gen instead?
-  MeshComponent _component = 
geometry_set.get_component_for_write();
-  Mesh *mesh_in = mesh_component.get_for_write();
+  const MeshComponent _component = 
*geometry_set.get_component_for_read();
+  const Mesh *mesh_in = mesh_component.get_for_read();
 
   const FloatReadAttribute density_factors = 
mesh_component.attribute_get_for_read(
   density_attribute, ATTR_DOMAIN_POINT, 1.0f);

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


[Bf-blender-cvs] [3bd111a140e] geometry-nodes-distribute-points: Merge branch 'geometry-nodes' into geometry-nodes-distribute-points

2020-12-04 Thread Sebastian Parborg
Commit: 3bd111a140e01e65f213d217034763cbe69f2f12
Author: Sebastian Parborg
Date:   Fri Dec 4 15:32:04 2020 +0100
Branches: geometry-nodes-distribute-points
https://developer.blender.org/rB3bd111a140e01e65f213d217034763cbe69f2f12

Merge branch 'geometry-nodes' into geometry-nodes-distribute-points

===



===

diff --cc source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
index 2da256209f4,2f5f7e264bc..a182a6f5375
--- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
@@@ -322,9 -132,9 +322,10 @@@ void register_node_type_geo_point_distr
  {
static bNodeType ntype;
  
-   geo_node_type_base(, GEO_NODE_POINT_DISTRIBUTE, "Point Distribute", 
0, 0);
+   geo_node_type_base(
+   , GEO_NODE_POINT_DISTRIBUTE, "Point Distribute", 
NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(, geo_node_point_distribute_in, 
geo_node_point_distribute_out);
 +  node_type_update(, node_point_distribute_update);
ntype.geometry_node_execute = 
blender::nodes::geo_node_point_distribute_exec;
nodeRegisterType();
  }

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


[Bf-blender-cvs] [ca4b809e63c] master: i18n utils: Add first version of the CLI wrapper around i18n tools.

2020-12-04 Thread Bastien Montagne
Commit: ca4b809e63cf1f6d809b82ea6d0d41cae8eab82a
Author: Bastien Montagne
Date:   Fri Dec 4 15:13:07 2020 +0100
Branches: master
https://developer.blender.org/rBca4b809e63cf1f6d809b82ea6d0d41cae8eab82a

i18n utils: Add first version of the CLI wrapper around i18n tools.

Plan is to use that in new 'buildbot' pipeline to automate generation of
i18n files for Blender.

===

A   release/scripts/modules/bl_i18n_utils/utils_cli.py

===

diff --git a/release/scripts/modules/bl_i18n_utils/utils_cli.py 
b/release/scripts/modules/bl_i18n_utils/utils_cli.py
new file mode 100644
index 000..4390544ec17
--- /dev/null
+++ b/release/scripts/modules/bl_i18n_utils/utils_cli.py
@@ -0,0 +1,130 @@
+# * BEGIN GPL LICENSE BLOCK *
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# * END GPL LICENSE BLOCK *
+
+# 
+
+# Some useful operations from utils' I18nMessages class exposed as a CLI.
+
+import os
+
+if __package__ is None:
+import settings as settings_i18n
+import utils as utils_i18n
+import utils_languages_menu
+else:
+from . import settings as settings_i18n
+from . import utils as utils_i18n
+from . import utils_languages_menu
+
+
+def update_po(args, settings):
+pot = utils_i18n.I18nMessages(uid=None, kind='PO', src=args.template, 
settings=settings)
+if os.path.isfile(args.dst):
+uid = os.path.splitext(os.path.basename(args.dst))[0]
+po = utils_i18n.I18nMessages(uid=uid, kind='PO', src=args.dst, 
settings=settings)
+po.update(pot)
+else:
+po = pot
+po.write(kind="PO", dest=args.dst)
+
+
+def cleanup_po(args, settings):
+uid = os.path.splitext(os.path.basename(args.src))[0]
+if not args.dst:
+args.dst = args.src
+po = utils_i18n.I18nMessages(uid=uid, kind='PO', src=args.src, 
settings=settings)
+po.check(fix=True)
+po.clean_commented()
+po.write(kind="PO", dest=args.dst)
+
+
+def strip_po(args, settings):
+uid = os.path.splitext(os.path.basename(args.src))[0]
+if not args.dst:
+args.dst = args.src
+po = utils_i18n.I18nMessages(uid=uid, kind='PO', src=args.src, 
settings=settings)
+po.clean_commented()
+po.write(kind="PO_COMPACT", dest=args.dst)
+
+
+def language_menu(args, settings):
+# 'DEFAULT' and en_US are always valid, fully-translated "languages"!
+stats = {"DEFAULT": 1.0, "en_US": 1.0}
+
+po_to_uid = {os.path.basename(po_path_branch): uid
+ for can_use, uid, _num_id, _name, _isocode, po_path_branch
+ in utils_i18n.list_po_dir(settings.BRANCHES_DIR, settings)
+ if can_use}
+for po_dir in os.listdir(settings.BRANCHES_DIR):
+po_dir = os.path.join(settings.BRANCHES_DIR, po_dir)
+if not os.path.isdir(po_dir):
+continue
+for po_path in os.listdir(po_dir):
+uid = po_to_uid.get(po_path, None)
+#print("Checking %s, found uid %s" % (po_path, uid))
+po_path = os.path.join(settings.TRUNK_PO_DIR, po_path)
+if uid is not None:
+po = utils_i18n.I18nMessages(uid=uid, kind='PO', src=po_path, 
settings=settings)
+stats[uid] = po.nbr_trans_msgs / po.nbr_msgs if po.nbr_msgs > 
0 else 0
+utils_languages_menu.gen_menu_file(stats, settings)
+
+
+def main():
+import sys
+import argparse
+
+parser = argparse.ArgumentParser(description="Tool to perform common 
actions over PO/MO files.")
+parser.add_argument('-s', '--settings', default=None,
+help="Override (some) default settings. Either a JSon 
file name, or a JSon string.")
+sub_parsers = parser.add_subparsers()
+
+sub_parser = sub_parsers.add_parser('update_po', help="Update a PO file 
from a given POT template file")
+sub_parser.add_argument('--template', metavar='template.pot', 
required=True, 
+help="The source pot file to use as template for 
the update.")
+sub_parser.add_argument('--dst', metavar='dst.po', required=True, 
help="The destination po to update.")
+sub_parser.set_defaults(func=update_po) 
+
+sub_parser = sub_parsers.add_parser('cleanup_po',
+

[Bf-blender-cvs] [06ae2e3a609] master: i18n utils : Reduce dependency to Blender bpy API, step 2.

2020-12-04 Thread Bastien Montagne
Commit: 06ae2e3a609fdc2081108e4163b7c62540618310
Author: Bastien Montagne
Date:   Fri Dec 4 15:08:11 2020 +0100
Branches: master
https://developer.blender.org/rB06ae2e3a609fdc2081108e4163b7c62540618310

i18n utils : Reduce dependency to Blender bpy API, step 2.

Remove some top imports of bpy, only import it in a few specific
functions that only make sense when used whithin Blender anyway.

===

M   release/scripts/modules/bl_i18n_utils/settings.py
M   release/scripts/modules/bl_i18n_utils/utils.py

===

diff --git a/release/scripts/modules/bl_i18n_utils/settings.py 
b/release/scripts/modules/bl_i18n_utils/settings.py
index e304ef5ea17..cfa4fcac17f 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -30,7 +30,11 @@ import os
 import sys
 import types
 
-import bpy
+try:
+import bpy
+except ModuleNotFoundError:
+print("Could not import bpy, some features are not available when not run 
from Blender.")
+bpy = None
 
 ###
 # MISC
@@ -98,8 +102,10 @@ LANGUAGES = (
 (47, "Slovak (SlovenĨina)", "sk_SK"),
 )
 
-# Default context, in py!
-DEFAULT_CONTEXT = bpy.app.translations.contexts.default
+# Default context, in py (keep in sync with `BLT_translation.h`)!
+if bpy is not None:
+assert(bpy.app.translations.contexts.default == "*")
+DEFAULT_CONTEXT = "*"
 
 # Name of language file used by Blender to generate translations' menu.
 LANGUAGES_FILE = "languages"
diff --git a/release/scripts/modules/bl_i18n_utils/utils.py 
b/release/scripts/modules/bl_i18n_utils/utils.py
index 14587100aea..2224c39e48c 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -35,8 +35,6 @@ from bl_i18n_utils import (
 utils_rtl,
 )
 
-import bpy
-
 
 # Misc Utils #
 _valid_po_path_re = re.compile(r"^\S+:[0-9]+$")
@@ -191,6 +189,12 @@ def enable_addons(addons=None, support=None, 
disable=False, check_only=False):
 """
 import addon_utils
 
+try:
+import bpy
+except ModuleNotFoundError:
+print("Could not import bpy, enable_addons must be run from whithin 
Blender.")
+return
+
 if addons is None:
 addons = {}
 if support is None:
@@ -744,6 +748,13 @@ class I18nMessages:
 rna_ctxt: the labels' i18n context.
 rna_struct_name, rna_prop_name, rna_enum_name: should be 
self-explanatory!
 """
+try:
+import bpy
+except ModuleNotFoundError:
+print("Could not import bpy, find_best_messages_matches must be 
run from whithin Blender.")
+return
+
+
 # Build helper mappings.
 # Note it's user responsibility to know when to invalidate (and hence 
force rebuild) this cache!
 if self._reverse_cache is None:
@@ -1294,7 +1305,7 @@ class I18n:
 msgs.print_stats(prefix=msgs_prefix)
 print(prefix)
 
-nbr_contexts = len(self.contexts - 
{bpy.app.translations.contexts.default})
+nbr_contexts = len(self.contexts - {self.settings.DEFAULT_CONTEXT})
 if nbr_contexts != 1:
 if nbr_contexts == 0:
 nbr_contexts = "No"
@@ -1312,7 +1323,7 @@ class I18n:
 "The org msgids are currently made of {} 
signs.\n".format(self.nbr_signs),
 "All processed translations are currently made of {} 
signs.\n".format(self.nbr_trans_signs),
 "{} specific context{} present:\n".format(self.nbr_contexts, 
_ctx_txt)) +
-tuple("" + c + "\n" for c in self.contexts - 
{bpy.app.translations.contexts.default}) +
+tuple("" + c + "\n" for c in self.contexts - 
{self.settings.DEFAULT_CONTEXT}) +
 ("\n",)
 )
 print(prefix.join(lines))

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


[Bf-blender-cvs] [b3306cf669f] master: i18n utils: Add a helper to list and match po files with languages codes.

2020-12-04 Thread Bastien Montagne
Commit: b3306cf669fb1035c6ec2ac3569a4f3dca4aa1c2
Author: Bastien Montagne
Date:   Fri Dec 4 15:10:43 2020 +0100
Branches: master
https://developer.blender.org/rBb3306cf669fb1035c6ec2ac3569a4f3dca4aa1c2

i18n utils: Add a helper to list and match po files with languages codes.

This code was previously done in the add-on, but we'll need it for the
CLI tool as well, so now it is a utils generator instead.

===

M   release/scripts/modules/bl_i18n_utils/utils.py

===

diff --git a/release/scripts/modules/bl_i18n_utils/utils.py 
b/release/scripts/modules/bl_i18n_utils/utils.py
index 2224c39e48c..40b76b617b3 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -181,6 +181,36 @@ def get_po_files_from_dir(root_dir, langs=set()):
 yield uid, po_file
 
 
+def list_po_dir(root_path, settings):
+"""
+Generator. List given directory (expecting one sub-directory per languages)
+and return all files matching languages listed in settings.
+
+Yield tuples (can_use, uid, num_id, name, isocode, po_path)
+
+Note that po_path may not actually exists.
+"""
+isocodes = ((e, os.path.join(root_path, e, e + ".po")) for e in 
os.listdir(root_path))
+isocodes = dict(e for e in isocodes if os.path.isfile(e[1]))
+for num_id, name, uid in settings.LANGUAGES[2:]:  # Skip "default" and 
"en" languages!
+best_po = find_best_isocode_matches(uid, isocodes)
+#print(uid, "->", best_po)
+if best_po:
+isocode = best_po[0]
+yield (True, uid, num_id, name, isocode, isocodes[isocode])
+else:
+yielded = False
+language, _1, _2, language_country, language_variant = 
locale_explode(uid)
+for isocode in (language, language_variant, language_country, uid):
+p = os.path.join(root_path, isocode, isocode + ".po")
+if not os.path.exists(p):
+yield (True, uid, num_id, name, isocode, p)
+yielded = True
+break
+if not yielded:
+yield (False, uid, num_id, name, None, None)
+
+
 def enable_addons(addons=None, support=None, disable=False, check_only=False):
 """
 Enable (or disable) addons based either on a set of names, or a set of 
'support' types.

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


[Bf-blender-cvs] [7bd8b8cdacd] master: i18n utils: reduce dependency to Blender bpy API, step 1.

2020-12-04 Thread Bastien Montagne
Commit: 7bd8b8cdacd2cd7036851a77b41c4c7767f09e5e
Author: Bastien Montagne
Date:   Fri Dec 4 15:04:28 2020 +0100
Branches: master
https://developer.blender.org/rB7bd8b8cdacd2cd7036851a77b41c4c7767f09e5e

i18n utils: reduce dependency to Blender bpy API, step 1.

This involves re-implementing some of Blender-defined helpers in utils,
we keep debug code to ensure those are still matching on
behavior/results sides.

This will allow to get more i18n tools independent from blender
executable.

===

M   release/scripts/modules/bl_i18n_utils/utils.py

===

diff --git a/release/scripts/modules/bl_i18n_utils/utils.py 
b/release/scripts/modules/bl_i18n_utils/utils.py
index 4cb25816a34..14587100aea 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -39,9 +39,6 @@ import bpy
 
 
 # Misc Utils #
-from bpy.app.translations import locale_explode
-
-
 _valid_po_path_re = re.compile(r"^\S+:[0-9]+$")
 
 
@@ -79,6 +76,28 @@ def get_best_similar(data):
 return key, tmp
 
 
+_locale_explode_re = 
re.compile(r"^([a-z]{2,})(?:_([A-Z]{2,}))?(?:@([a-z]{2,}))?$")
+
+
+def locale_explode(locale):
+"""Copies behavior of `BLT_lang_locale_explode`, keep them in sync."""
+ret = (None, None, None, None, None)
+m = _locale_explode_re.match(locale)
+if m:
+lang, country, variant = m.groups()
+return (lang, country, variant,
+"%s_%s" % (lang, country) if country else None,
+"%s@%s" % (lang, variant) if variant else None)
+
+try:
+import bpy.app.translations as bpy_translations
+assert(ret == bpy_translations.locale_explode(locale))
+except ModuleNotFoundError:
+pass
+
+return ret
+
+
 def locale_match(loc1, loc2):
 """
 Return:

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


[Bf-blender-cvs] [69dd7e42c8b] master: i18n utils: Cleanup.

2020-12-04 Thread Bastien Montagne
Commit: 69dd7e42c8bbe0e6feb0aee0eeb424f21f5da0af
Author: Bastien Montagne
Date:   Fri Dec 4 14:55:23 2020 +0100
Branches: master
https://developer.blender.org/rB69dd7e42c8bbe0e6feb0aee0eeb424f21f5da0af

i18n utils: Cleanup.

===

M   release/scripts/modules/bl_i18n_utils/utils_languages_menu.py

===

diff --git a/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py 
b/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py
index 7c98faebe9d..63981310839 100755
--- a/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py
+++ b/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py
@@ -40,7 +40,7 @@ def gen_menu_file(stats, settings):
 # Generate languages file used by Blender's i18n system.
 # First, match all entries in LANGUAGES to a lang in stats, if possible!
 tmp = []
-for uid_num, label, uid, in settings.LANGUAGES:
+for uid_num, label, uid in settings.LANGUAGES:
 if uid in stats:
 if uid in settings.IMPORT_LANGUAGES_SKIP:
 tmp.append((stats[uid], uid_num, label, uid, FORBIDDEN))

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


[Bf-blender-cvs] [04d3b54000b] master: Cleanup: Declare variables where initialized

2020-12-04 Thread Hans Goudey
Commit: 04d3b54000bedd06bc767fa908772c0b20cb792f
Author: Hans Goudey
Date:   Fri Dec 4 08:03:14 2020 -0600
Branches: master
https://developer.blender.org/rB04d3b54000bedd06bc767fa908772c0b20cb792f

Cleanup: Declare variables where initialized

===

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

===

diff --git a/source/blender/editors/interface/interface_context_menu.c 
b/source/blender/editors/interface/interface_context_menu.c
index 02a9c3742d7..39b405a02b8 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -90,9 +90,8 @@ static IDProperty *shortcut_property_from_rna(bContext *C, 
uiBut *but)
   }
 
   /* Create ID property of data path, to pass to the operator. */
-  IDProperty *prop;
   const IDPropertyTemplate val = {0};
-  prop = IDP_New(IDP_GROUP, , __func__);
+  IDProperty *prop = IDP_New(IDP_GROUP, , __func__);
   IDP_AddToGroup(prop, IDP_NewString(final_data_path, "data_path", 
strlen(final_data_path) + 1));
 
   MEM_freeN((void *)final_data_path);
@@ -167,43 +166,40 @@ static void but_shortcut_name_func(bContext *C, void 
*arg1, int UNUSED(event))
 static uiBlock *menu_change_shortcut(bContext *C, ARegion *region, void *arg)
 {
   wmWindowManager *wm = CTX_wm_manager(C);
-  uiBlock *block;
   uiBut *but = (uiBut *)arg;
-  wmKeyMap *km;
-  wmKeyMapItem *kmi;
   PointerRNA ptr;
-  uiLayout *layout;
   const uiStyle *style = UI_style_get_dpi();
   IDProperty *prop;
   const char *idname = shortcut_get_operator_property(C, but, );
 
-  kmi = WM_key_event_operator(C,
-  idname,
-  but->opcontext,
-  prop,
-  EVT_TYPE_MASK_HOTKEY_INCLUDE,
-  EVT_TYPE_MASK_HOTKEY_EXCLUDE,
-  );
+  wmKeyMap *km;
+  wmKeyMapItem *kmi = WM_key_event_operator(C,
+idname,
+but->opcontext,
+prop,
+EVT_TYPE_MASK_HOTKEY_INCLUDE,
+EVT_TYPE_MASK_HOTKEY_EXCLUDE,
+);
   U.runtime.is_dirty = true;
 
   BLI_assert(kmi != NULL);
 
   RNA_pointer_create(>id, _KeyMapItem, kmi, );
 
-  block = UI_block_begin(C, region, "_popup", UI_EMBOSS);
+  uiBlock *block = UI_block_begin(C, region, "_popup", UI_EMBOSS);
   UI_block_func_handle_set(block, but_shortcut_name_func, but);
   UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
   UI_block_direction_set(block, UI_DIR_CENTER_Y);
 
-  layout = UI_block_layout(block,
-   UI_LAYOUT_VERTICAL,
-   UI_LAYOUT_PANEL,
-   0,
-   0,
-   U.widget_unit * 10,
-   U.widget_unit * 2,
-   0,
-   style);
+  uiLayout *layout = UI_block_layout(block,
+ UI_LAYOUT_VERTICAL,
+ UI_LAYOUT_PANEL,
+ 0,
+ 0,
+ U.widget_unit * 10,
+ U.widget_unit * 2,
+ 0,
+ style);
 
   uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Change 
Shortcut"), ICON_HAND);
   uiItemR(layout, , "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, 
"", ICON_NONE);
@@ -223,22 +219,17 @@ static int g_kmi_id_hack;
 static uiBlock *menu_add_shortcut(bContext *C, ARegion *region, void *arg)
 {
   wmWindowManager *wm = CTX_wm_manager(C);
-  uiBlock *block;
   uiBut *but = (uiBut *)arg;
-  wmKeyMap *km;
-  wmKeyMapItem *kmi;
   PointerRNA ptr;
-  uiLayout *layout;
   const uiStyle *style = UI_style_get_dpi();
-  int kmi_id;
   IDProperty *prop;
   const char *idname = shortcut_get_operator_property(C, but, );
 
   /* XXX this guess_opname can potentially return a different keymap
* than being found on adding later... */
-  km = WM_keymap_guess_opname(C, idname);
-  kmi = WM_keymap_add_item(km, idname, EVT_AKEY, KM_PRESS, 0, 0);
-  kmi_id = kmi->id;
+  wmKeyMap *km = WM_keymap_guess_opname(C, idname);
+  wmKeyMapItem *kmi = WM_keymap_add_item(km, idname, EVT_AKEY, KM_PRESS, 0, 0);
+  int kmi_id = kmi->id;
 
   /* This takes ownership of prop, or prop can be NULL for reset. */
   WM_keymap_item_properties_reset(kmi, prop);
@@ -252,19 +243,19 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion 
*region, void *arg)
 
   RNA_pointer_create(>id, _KeyMapItem, kmi, );
 
-  block = UI_block_begin(C, region, 

[Bf-blender-cvs] [4bb53147549] master: Cleanup: Use typedef for button string info type

2020-12-04 Thread Hans Goudey
Commit: 4bb531475490c36c57065fb3db3d41974fb14897
Author: Hans Goudey
Date:   Fri Dec 4 08:01:54 2020 -0600
Branches: master
https://developer.blender.org/rB4bb531475490c36c57065fb3db3d41974fb14897

Cleanup: Use typedef for button string info type

Before, it wasn't clear what the int in `uiStringInfo` was supposed to
store. Using a typedef can make this someone more explicit.

===

M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/interface/interface.c

===

diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index f9dc23502c7..a190194d89d 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1351,7 +1351,7 @@ struct PointerRNA *UI_but_operator_ptr_get(uiBut *but);
 void UI_but_unit_type_set(uiBut *but, const int unit_type);
 int UI_but_unit_type_get(const uiBut *but);
 
-enum {
+typedef enum uiStringInfoType {
   BUT_GET_RNAPROP_IDENTIFIER = 1,
   BUT_GET_RNASTRUCT_IDENTIFIER,
   BUT_GET_RNAENUM_IDENTIFIER,
@@ -1364,10 +1364,10 @@ enum {
   BUT_GET_RNAENUM_TIP,
   BUT_GET_OP_KEYMAP,
   BUT_GET_PROP_KEYMAP,
-};
+} uiStringInfoType;
 
 typedef struct uiStringInfo {
-  int type;
+  uiStringInfoType type;
   char *strinfo;
 } uiStringInfo;
 
diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index 685b34b7185..4a02c6b6e88 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -6795,7 +6795,7 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
 
   va_start(args, but);
   while ((si = (uiStringInfo *)va_arg(args, void *))) {
-int type = si->type;
+uiStringInfoType type = si->type;
 char *tmp = NULL;
 
 if (type == BUT_GET_LABEL) {

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


[Bf-blender-cvs] [2de49d1ff7e] master: Revert "Fix T83177: Industry Compatible keymap: MMB-dragging to transform engages axis-constraining on release"

2020-12-04 Thread Germano Cavalcante
Commit: 2de49d1ff7e2ea5e632bb3664d6cf6210153
Author: Germano Cavalcante
Date:   Fri Dec 4 10:35:26 2020 -0300
Branches: master
https://developer.blender.org/rB2de49d1ff7e2ea5e632bb3664d6cf6210153

Revert "Fix T83177: Industry Compatible keymap: MMB-dragging to transform 
engages axis-constraining on release"

This reverts commit c0677b662f4b13429c0738b99ace85403385ff38.

===

M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_generics.c
M   source/blender/editors/transform/transform_ops.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_event_system.c

===

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 356ad8643f8..bba0b750d0c 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -818,15 +818,9 @@ int transformEvent(TransInfo *t, const wmEvent *event)
 t->redraw |= handleSnapping(t, event);
 handled = true;
   }
-  else if (event->val == t->release_confirm_event_val &&
-   event->type == t->release_confirm_event_type) {
-/* Confirm transform if launch key is released after mouse move. */
-BLI_assert(t->flag & T_RELEASE_CONFIRM);
-t->state = TRANS_CONFIRM;
-  }
+  /* handle modal keymap first */
+  /* enforce redraw of transform when modifiers are used */
   else if (event->type == EVT_MODAL_MAP) {
-/* Handle modal keymap first. */
-/* Enforce redraw of transform when modifiers are used */
 switch (event->val) {
   case TFM_MODAL_CANCEL:
 t->state = TRANS_CANCEL;
@@ -1128,8 +1122,8 @@ int transformEvent(TransInfo *t, const wmEvent *event)
 break;
 }
   }
+  /* Else do non-mapped events. */
   else if (event->val == KM_PRESS) {
-/* Do non-mapped events. */
 switch (event->type) {
   case EVT_CKEY:
 if (event->is_repeat) {
@@ -1217,6 +1211,11 @@ int transformEvent(TransInfo *t, const wmEvent *event)
 }
 break;
 }
+
+/* confirm transform if launch key is released after mouse move */
+if ((t->flag & T_RELEASE_CONFIRM) && event->type == t->launch_event) {
+  t->state = TRANS_CONFIRM;
+}
   }
 
   /* if we change snap options, get the unsnapped values back */
@@ -1688,6 +1687,17 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator 
*op, const wmEvent *eve
 
   t->mode = mode;
 
+  /* Needed to translate tweak events to mouse buttons. */
+  t->launch_event = event ? 
WM_userdef_event_type_from_keymap_type(event->type) : -1;
+  t->is_launch_event_tweak = event ? ISTWEAK(event->type) : false;
+
+  /* XXX Remove this when wm_operator_call_internal doesn't use 
window->eventstate
+   * (which can have type = 0) */
+  /* For gizmo only, so assume LEFTMOUSE. */
+  if (t->launch_event == 0) {
+t->launch_event = LEFTMOUSE;
+  }
+
   unit_m3(t->spacemtx);
 
   initTransInfo(C, t, op, event);
@@ -1761,6 +1771,37 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator 
*op, const wmEvent *eve
 }
   }
 
+  if (event) {
+/* keymap for shortcut header prints */
+t->keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
+
+/* Stupid code to have Ctrl-Click on gizmo work ok.
+ *
+ * Do this only for translation/rotation/resize because only these
+ * modes are available from gizmo and doing such check could
+ * lead to keymap conflicts for other modes (see T31584)
+ */
+if (ELEM(mode, TFM_TRANSLATION, TFM_ROTATION, TFM_RESIZE)) {
+  wmKeyMapItem *kmi;
+
+  for (kmi = t->keymap->items.first; kmi; kmi = kmi->next) {
+if (kmi->flag & KMI_INACTIVE) {
+  continue;
+}
+
+if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) {
+  if ((ELEM(kmi->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY) && 
event->ctrl) ||
+  (ELEM(kmi->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY) && 
event->shift) ||
+  (ELEM(kmi->type, EVT_LEFTALTKEY, EVT_RIGHTALTKEY) && event->alt) 
||
+  ((kmi->type == EVT_OSKEY) && event->oskey)) {
+t->modifiers |= MOD_SNAP_INVERT;
+  }
+  break;
+}
+  }
+}
+  }
+
   initSnapping(t, op); /* Initialize snapping data AFTER mode flags */
 
   initSnapSpatial(t, t->snap_spatial);
diff --git a/source/blender/editors/transform/transform.h 
b/source/blender/editors/transform/transform.h
index 485d5282a62..227330e8524 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -351,8 +351,7 @@ typedef struct TransInfo {
 
   /*** NEW STUFF */
   /** event type used to launch transform. */
-  short release_confirm_event_type;
-  

[Bf-blender-cvs] [6fda30cc54d] master: Fix T83177: Industry Compatible keymap: MMB-dragging to transform engages axis-constraining on release

2020-12-04 Thread Germano Cavalcante
Commit: 6fda30cc54d24730d81b96b2e3b542bf94f52137
Author: Germano Cavalcante
Date:   Fri Dec 4 10:49:45 2020 -0300
Branches: master
https://developer.blender.org/rB6fda30cc54d24730d81b96b2e3b542bf94f52137

Fix T83177: Industry Compatible keymap: MMB-dragging to transform engages 
axis-constraining on release

With rBc0677b662f4b, we try to track all modal events in order to detect the
one corresponding to the release.

But modifier keys can mask the modal event and thus confirm realease ends up
being skipped.

This resulted in the T83387.

With this commit we now read the actual key drop value in the modal event.

This fixes T83387

===

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

===

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index bba0b750d0c..3b8f7f90edc 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1082,7 +1082,12 @@ int transformEvent(TransInfo *t, const wmEvent *event)
 break;
   case TFM_MODAL_AUTOCONSTRAINT:
   case TFM_MODAL_AUTOCONSTRAINTPLANE:
-if ((t->flag & T_NO_CONSTRAINT) == 0) {
+if ((t->flag & T_RELEASE_CONFIRM) && (event->prevval == KM_RELEASE) &&
+event->prevtype == t->launch_event) {
+  /* Confirm transform if launch key is released after mouse move. */
+  t->state = TRANS_CONFIRM;
+}
+else if ((t->flag & T_NO_CONSTRAINT) == 0) {
   if (t->modifiers & (MOD_CONSTRAINT_SELECT | MOD_CONSTRAINT_PLANE)) {
 /* Confirm. */
 postSelectConstraint(t);

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


[Bf-blender-cvs] [39b922509b6] geometry-nodes-distribute-points: Added stable weight based point removal for poisson dist

2020-12-04 Thread Sebastian Parborg
Commit: 39b922509b254f1455f5b3ae55895ee002d6
Author: Sebastian Parborg
Date:   Fri Dec 4 13:46:21 2020 +0100
Branches: geometry-nodes-distribute-points
https://developer.blender.org/rB39b922509b254f1455f5b3ae55895ee002d6

Added stable weight based point removal for poisson dist

===

M   source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc 
b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
index 54877bb2abb..2da256209f4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
@@ -108,7 +108,11 @@ struct RayCastAll_Data {
 
   BVHTree_RayCastCallback raycast_callback;
 
+  const Mesh *mesh;
+  float base_weight;
+  FloatReadAttribute *density_factors;
   Vector *projected_points;
+  float cur_point_weight;
 };
 
 static void project_2d_bvh_callback(void *userdata,
@@ -119,7 +123,34 @@ static void project_2d_bvh_callback(void *userdata,
   struct RayCastAll_Data *data = (RayCastAll_Data *)userdata;
   data->raycast_callback(data->bvhdata, index, ray, hit);
   if (hit->index != -1) {
-data->projected_points->append(hit->co);
+/* This only updates a cache and can be considered to be logically const. 
*/
+const MLoopTri *looptris = BKE_mesh_runtime_looptri_ensure(const_cast(data->mesh));
+const MVert *mvert = data->mesh->mvert;
+
+const MLoopTri  = looptris[index];
+const FloatReadAttribute _factors = data->density_factors[0];
+
+const int v0_index = data->mesh->mloop[looptri.tri[0]].v;
+const int v1_index = data->mesh->mloop[looptri.tri[1]].v;
+const int v2_index = data->mesh->mloop[looptri.tri[2]].v;
+
+const float v0_density_factor = std::max(0.0f, density_factors[v0_index]);
+const float v1_density_factor = std::max(0.0f, density_factors[v1_index]);
+const float v2_density_factor = std::max(0.0f, density_factors[v2_index]);
+
+// Calculate barycentric weights for hit point.
+float3 weights;
+interp_weights_tri_v3(
+weights, mvert[v0_index].co, mvert[v1_index].co, mvert[v2_index].co, 
hit->co);
+
+float point_weight = weights[0] * v0_density_factor + weights[1] * 
v1_density_factor +
+ weights[2] * v2_density_factor;
+
+point_weight *= data->base_weight;
+
+if (point_weight >= FLT_EPSILON && data->cur_point_weight <= point_weight) 
{
+  data->projected_points->append(hit->co);
+}
   }
 }
 
@@ -167,7 +198,7 @@ static Vector poisson_scatter_points_from_mesh(Mesh 
*mesh,
   {
 SCOPED_TIMER("Total poisson sample elim");
 
-bool is_progressive = false;
+bool is_progressive = true;
 
 float d_max = 2 * min_dist;
 wse.Eliminate(points.data(),
@@ -194,7 +225,10 @@ static Vector 
poisson_scatter_points_from_mesh(Mesh *mesh,
 struct RayCastAll_Data data;
 data.bvhdata = 
 data.raycast_callback = treedata.raycast_callback;
+data.mesh = mesh;
 data.projected_points = _points;
+data.density_factors = const_cast(_factors);
+data.base_weight = density;
 
 const float max_dist = bb_max[2] - bb_min[2] + 2.0f;
 const float3 dir = float3(0, 0, -1);
@@ -212,9 +246,12 @@ static Vector 
poisson_scatter_points_from_mesh(Mesh *mesh,
   float tile_curr_x_coord = x * point_scale_multiplier + 
tile_start_x_coord;
   for (int y = 0; y < tile_repeat_y; y++) {
 float tile_curr_y_coord = y * point_scale_multiplier + 
tile_start_y_coord;
-for (auto  : output_points) {
-  raystart.x = point.x + tile_curr_x_coord;
-  raystart.y = point.y + tile_curr_y_coord;
+for (int idx = 0; idx < output_points.size(); idx++) {
+  raystart.x = output_points[idx].x + tile_curr_x_coord;
+  raystart.y = output_points[idx].y + tile_curr_y_coord;
+
+  data.cur_point_weight = (float)idx / (float)output_points.size();
+
   BLI_bvhtree_ray_cast_all(
   treedata.tree, raystart, dir, 0.0f, max_dist, 
project_2d_bvh_callback, );
 }
@@ -247,6 +284,7 @@ static void 
geo_node_point_distribute_exec(GeoNodeExecParams params)
   }
 
   // Non const because of mesh BVH generaton when projection mapping is used.
+  // TODO should we just const cast for BVH gen instead?
   MeshComponent _component = 
geometry_set.get_component_for_write();
   Mesh *mesh_in = mesh_component.get_for_write();

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


[Bf-blender-cvs] [c10546f5e9f] master: Cycles: Add support for shader raytracing in OptiX

2020-12-04 Thread Patrick Mours
Commit: c10546f5e9fe2a300b6a21e1e16b22c93060d0e9
Author: Patrick Mours
Date:   Thu Dec 3 12:19:36 2020 +0100
Branches: master
https://developer.blender.org/rBc10546f5e9fe2a300b6a21e1e16b22c93060d0e9

Cycles: Add support for shader raytracing in OptiX

Support for the AO and bevel shader nodes requires calling "optixTrace" from 
within the shading
VM, which is only allowed from inlined functions to the raygen program or 
callables. This patch
therefore converts the shading VM to use direct callables to make it work. To 
prevent performance
regressions a separate kernel module is compiled and used for this purpose.

Reviewed By: brecht

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

===

M   intern/cycles/device/device_optix.cpp
M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/kernel_subsurface.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/kernel_volume.h
M   intern/cycles/kernel/svm/svm.h

===

diff --git a/intern/cycles/device/device_optix.cpp 
b/intern/cycles/device/device_optix.cpp
index 95234845f98..682540a51fd 100644
--- a/intern/cycles/device/device_optix.cpp
+++ b/intern/cycles/device/device_optix.cpp
@@ -141,7 +141,8 @@ class OptiXDevice : public CUDADevice {
 PG_BAKE,  // kernel_bake_evaluate
 PG_DISP,  // kernel_displace_evaluate
 PG_BACK,  // kernel_background_evaluate
-NUM_PROGRAM_GROUPS
+PG_CALL,
+NUM_PROGRAM_GROUPS = PG_CALL + 3
   };
 
   // List of OptiX pipelines
@@ -334,11 +335,6 @@ class OptiXDevice : public CUDADevice {
   set_error("OptiX backend does not support baking yet");
   return false;
 }
-// Disable shader raytracing support for now, since continuation callables 
are slow
-if (requested_features.use_shader_raytrace) {
-  set_error("OptiX backend does not support 'Ambient Occlusion' and 
'Bevel' shader nodes yet");
-  return false;
-}
 
 const CUDAContextScope scope(cuContext);
 
@@ -410,7 +406,9 @@ class OptiXDevice : public CUDADevice {
 }
 
 {  // Load and compile PTX module with OptiX kernels
-  string ptx_data, ptx_filename = path_get("lib/kernel_optix.ptx");
+  string ptx_data, ptx_filename = 
path_get(requested_features.use_shader_raytrace ?
+   
"lib/kernel_optix_shader_raytrace.ptx" :
+   "lib/kernel_optix.ptx");
   if (use_adaptive_compilation() || path_file_size(ptx_filename) == -1) {
 if (!getenv("OPTIX_ROOT_DIR")) {
   set_error(
@@ -525,6 +523,21 @@ class OptiXDevice : public CUDADevice {
   group_descs[PG_BACK].raygen.entryFunctionName = 
"__raygen__kernel_optix_background";
 }
 
+// Shader raytracing replaces some functions with direct callables
+if (requested_features.use_shader_raytrace) {
+  group_descs[PG_CALL + 0].kind = OPTIX_PROGRAM_GROUP_KIND_CALLABLES;
+  group_descs[PG_CALL + 0].callables.moduleDC = optix_module;
+  group_descs[PG_CALL + 0].callables.entryFunctionNameDC = 
"__direct_callable__svm_eval_nodes";
+  group_descs[PG_CALL + 1].kind = OPTIX_PROGRAM_GROUP_KIND_CALLABLES;
+  group_descs[PG_CALL + 1].callables.moduleDC = optix_module;
+  group_descs[PG_CALL + 1].callables.entryFunctionNameDC =
+  "__direct_callable__kernel_volume_shadow";
+  group_descs[PG_CALL + 2].kind = OPTIX_PROGRAM_GROUP_KIND_CALLABLES;
+  group_descs[PG_CALL + 2].callables.moduleDC = optix_module;
+  group_descs[PG_CALL + 2].callables.entryFunctionNameDC =
+  "__direct_callable__subsurface_scatter_multi_setup";
+}
+
 check_result_optix_ret(optixProgramGroupCreate(
 context, group_descs, NUM_PROGRAM_GROUPS, _options, nullptr, 0, 
groups));
 
@@ -564,33 +577,51 @@ class OptiXDevice : public CUDADevice {
 #  endif
 
 {  // Create path tracing pipeline
-  OptixProgramGroup pipeline_groups[] = {
-groups[PG_RGEN],
-groups[PG_MISS],
-groups[PG_HITD],
-groups[PG_HITS],
-groups[PG_HITL],
+  vector pipeline_groups;
+  pipeline_groups.reserve(NUM_PROGRAM_GROUPS);
+  pipeline_groups.push_back(groups[PG_RGEN]);
+  pipeline_groups.push_back(groups[PG_MISS]);
+  pipeline_groups.push_back(groups[PG_HITD]);
+  pipeline_groups.push_back(groups[PG_HITS]);
+  pipeline_groups.push_back(groups[PG_HITL]);
 #  if OPTIX_ABI_VERSION >= 36
-groups[PG_HITD_MOTION],
-groups[PG_HITS_MOTION],
+  if (motion_blur) {
+pipeline_groups.push_back(groups[PG_HITD_MOTION]);
+pipeline_groups.push_back(groups[PG_HITS_MOTION]);
+  }
 #  endif
-  };
-  check_result_optix_ret(
-  optixPipelineCreate(context,
-  _options,
-  _options,
-  

[Bf-blender-cvs] [17b88d7348d] asset-browser: Merge branch 'master' into asset-browser

2020-12-04 Thread Julian Eisel
Commit: 17b88d7348d2458b994daf5c91ac7bbaad34671f
Author: Julian Eisel
Date:   Fri Dec 4 11:41:59 2020 +0100
Branches: asset-browser
https://developer.blender.org/rB17b88d7348d2458b994daf5c91ac7bbaad34671f

Merge branch 'master' into asset-browser

===



===



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


[Bf-blender-cvs] [55c4917339a] asset-browser: Fix leftover "focused_id", causing "Make Asset" on material slots to fail

2020-12-04 Thread Julian Eisel
Commit: 55c4917339a131018867a205567258262c410a12
Author: Julian Eisel
Date:   Fri Dec 4 11:38:18 2020 +0100
Branches: asset-browser
https://developer.blender.org/rB55c4917339a131018867a205567258262c410a12

Fix leftover "focused_id", causing "Make Asset" on material slots to fail

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_material.py 
b/release/scripts/startup/bl_ui/properties_material.py
index cd6bebfea94..47ab98386f4 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -43,7 +43,7 @@ class MATERIAL_UL_matslots(UIList):
 slot = item
 ma = slot.material
 
-layout.context_pointer_set("focused_id", ma)
+layout.context_pointer_set("id", ma)
 
 if self.layout_type in {'DEFAULT', 'COMPACT'}:
 if ma:

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


[Bf-blender-cvs] [0048a18b13a] asset-browser: Fix "Make Asset" failing for collections in the Outliner

2020-12-04 Thread Julian Eisel
Commit: 0048a18b13a0cf8dc6793bf3025289795be16cd7
Author: Julian Eisel
Date:   Fri Dec 4 11:25:07 2020 +0100
Branches: asset-browser
https://developer.blender.org/rB0048a18b13a0cf8dc6793bf3025289795be16cd7

Fix "Make Asset" failing for collections in the Outliner

All ID types but collections have a `TreeStoreElem.type` of 0, but 
collections...
AFAIK to avoid compatilibity breaking changes back in 2.8.

===

M   source/blender/editors/space_outliner/outliner_context.c

===

diff --git a/source/blender/editors/space_outliner/outliner_context.c 
b/source/blender/editors/space_outliner/outliner_context.c
index d6b467f0c86..760fa8e4604 100644
--- a/source/blender/editors/space_outliner/outliner_context.c
+++ b/source/blender/editors/space_outliner/outliner_context.c
@@ -36,7 +36,7 @@ static void outliner_context_selected_ids_recursive(const 
ListBase *subtree,
 {
   LISTBASE_FOREACH (const TreeElement *, te, subtree) {
 const TreeStoreElem *tse = TREESTORE(te);
-if ((tse->flag & TSE_SELECTED) && (tse->type == 0)) {
+if ((tse->flag & TSE_SELECTED) && (ELEM(tse->type, 0, 
TSE_LAYER_COLLECTION))) {
   CTX_data_id_list_add(result, tse->id);
 }
 outliner_context_selected_ids_recursive(>subtree, result);

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


[Bf-blender-cvs] [005b3ef9a88] asset-browser: Fix variable shadowing warning

2020-12-04 Thread Julian Eisel
Commit: 005b3ef9a884842843878045a474be3c47925c7b
Author: Julian Eisel
Date:   Thu Dec 3 23:43:38 2020 +0100
Branches: asset-browser
https://developer.blender.org/rB005b3ef9a884842843878045a474be3c47925c7b

Fix variable shadowing warning

===

M   source/blender/editors/space_file/file_draw.c

===

diff --git a/source/blender/editors/space_file/file_draw.c 
b/source/blender/editors/space_file/file_draw.c
index 172a2a0d129..3b58d74b5a6 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -946,7 +946,6 @@ void file_draw_list(const bContext *C, ARegion *region)
 }
 
 if (file_selflag & FILE_SEL_EDITING) {
-  FileSelectParams *params = ED_fileselect_get_active_params(sfile);
   const short width = (params->display == FILE_IMGDISPLAY) ?
   textwidth :
   layout->attribute_columns[COLUMN_NAME].width -

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