[Bf-blender-cvs] [ac7dfab0cb8] greasepencil-refactor: GPencil: Refactor: Fix display bug of strokes endpoints

2020-02-07 Thread Clément Foucault
Commit: ac7dfab0cb88009d9a4dcdc75c5290d61cda
Author: Clément Foucault
Date:   Sat Feb 8 03:00:40 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBac7dfab0cb88009d9a4dcdc75c5290d61cda

GPencil: Refactor: Fix display bug of strokes endpoints

===

M   source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
index 83fa9d5d0f6..17986db54f7 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
@@ -409,12 +409,15 @@ void stroke_vertex()
 strokeThickness = (is_squares) ? 1e18 : (thickness / gl_Position.w);
   }
   else {
+bool is_stroke_start = (ma.x == -1.0 && x == -1.0);
+bool is_stroke_end = (ma3.x == -1.0 && x == 1.0);
+
 /* Mitter tangent vector. */
 vec2 miter_tan = safe_normalize(line_adj + line);
 float miter_dot = dot(miter_tan, line_adj);
 /* Break corners after a certain angle to avoid really thick corners. */
 const float miter_limit = 0.5; /* cos(60°) */
-bool miter_break = (miter_dot < miter_limit);
+bool miter_break = (miter_dot < miter_limit) || is_stroke_start || 
is_stroke_end;
 miter_tan = (miter_break) ? line : (miter_tan / miter_dot);
 
 vec2 miter = rotate_90deg(miter_tan);
@@ -423,13 +426,11 @@ void stroke_vertex()
 strokePt2.xy = ss2;
 strokeThickness = thickness / gl_Position.w;
 
-/* Reminder: we packed the cap flag into the sign of stength and thickness 
sign. */
-bool is_stroke_start = (ma.x == -1.0 && x == -1.0 && strength1 > 0.0) || 
miter_break;
-bool is_stroke_end = (ma3.x == -1.0 && x == 1.0 && thickness1 > 0.0) || 
miter_break;
-
 vec2 screen_ofs = miter * y;
 
-if (is_stroke_start || is_stroke_end) {
+/* Reminder: we packed the cap flag into the sign of stength and thickness 
sign. */
+if ((is_stroke_start && strength1 > 0.0) || (is_stroke_end && thickness1 > 
0.0) ||
+miter_break) {
   screen_ofs += line * x;
 }

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


[Bf-blender-cvs] [a010d972045] master: Cleanup: remove old VSE prefetching code.

2020-02-07 Thread Richard Antalik
Commit: a010d97204558e795e323a014fccca1f5a7c59c7
Author: Richard Antalik
Date:   Fri Feb 7 23:49:37 2020 +0100
Branches: master
https://developer.blender.org/rBa010d97204558e795e323a014fccca1f5a7c59c7

Cleanup: remove old VSE prefetching code.

Reviewed By: brecht

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

===

M   source/blender/blenkernel/BKE_sequencer.h
M   source/blender/blenkernel/intern/sequencer.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/makesdna/DNA_userdef_types.h
M   source/blender/makesrna/intern/rna_userdef.c

===

diff --git a/source/blender/blenkernel/BKE_sequencer.h 
b/source/blender/blenkernel/BKE_sequencer.h
index bc312c7bb2b..2618bea74e6 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -211,9 +211,6 @@ struct SeqEffectHandle {
 double BKE_sequencer_rendersize_to_scale_factor(int size);
 
 struct ImBuf *BKE_sequencer_give_ibuf(const SeqRenderData *context, float 
cfra, int chanshown);
-struct ImBuf *BKE_sequencer_give_ibuf_threaded(const SeqRenderData *context,
-   float cfra,
-   int chanshown);
 struct ImBuf *BKE_sequencer_give_ibuf_direct(const SeqRenderData *context,
  float cfra,
  struct Sequence *seq);
@@ -221,9 +218,6 @@ struct ImBuf *BKE_sequencer_give_ibuf_seqbase(const 
SeqRenderData *context,
   float cfra,
   int chan_shown,
   struct ListBase *seqbasep);
-void BKE_sequencer_give_ibuf_prefetch_request(const SeqRenderData *context,
-  float cfra,
-  int chan_shown);
 
 /* **
  * sequencer.c
diff --git a/source/blender/blenkernel/intern/sequencer.c 
b/source/blender/blenkernel/intern/sequencer.c
index 747ce18cada..4dc2177ec75 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -4147,146 +4147,6 @@ ImBuf *BKE_sequencer_give_ibuf_direct(const 
SeqRenderData *context, float cfra,
   return ibuf;
 }
 
-/* *** threading api *** */
-
-static ListBase running_threads;
-static ListBase prefetch_wait;
-static ListBase prefetch_done;
-
-static pthread_mutex_t queue_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t wakeup_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t wakeup_cond = PTHREAD_COND_INITIALIZER;
-
-// static pthread_mutex_t prefetch_ready_lock = PTHREAD_MUTEX_INITIALIZER;
-// static pthread_cond_t  prefetch_ready_cond = PTHREAD_COND_INITIALIZER;
-
-static pthread_mutex_t frame_done_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t frame_done_cond = PTHREAD_COND_INITIALIZER;
-
-static volatile bool seq_thread_shutdown = true;
-static volatile int seq_last_given_monoton_cfra = 0;
-static int monoton_cfra = 0;
-
-typedef struct PrefetchThread {
-  struct PrefetchThread *next, *prev;
-
-  Scene *scene;
-  struct PrefetchQueueElem *current;
-  pthread_t pthread;
-  int running;
-
-} PrefetchThread;
-
-typedef struct PrefetchQueueElem {
-  struct PrefetchQueueElem *next, *prev;
-
-  int rectx;
-  int recty;
-  float cfra;
-  int chanshown;
-  int preview_render_size;
-
-  int monoton_cfra;
-
-  ImBuf *ibuf;
-} PrefetchQueueElem;
-
-void BKE_sequencer_give_ibuf_prefetch_request(const SeqRenderData *context,
-  float cfra,
-  int chanshown)
-{
-  PrefetchQueueElem *e;
-  if (seq_thread_shutdown) {
-return;
-  }
-
-  e = MEM_callocN(sizeof(PrefetchQueueElem), "prefetch_queue_elem");
-  e->rectx = context->rectx;
-  e->recty = context->recty;
-  e->cfra = cfra;
-  e->chanshown = chanshown;
-  e->preview_render_size = context->preview_render_size;
-  e->monoton_cfra = monoton_cfra++;
-
-  pthread_mutex_lock(_lock);
-  BLI_addtail(_wait, e);
-  pthread_mutex_unlock(_lock);
-
-  pthread_mutex_lock(_lock);
-  pthread_cond_signal(_cond);
-  pthread_mutex_unlock(_lock);
-}
-
-ImBuf *BKE_sequencer_give_ibuf_threaded(const SeqRenderData *context, float 
cfra, int chanshown)
-{
-  PrefetchQueueElem *e = NULL;
-  bool found_something = false;
-
-  if (seq_thread_shutdown) {
-return BKE_sequencer_give_ibuf(context, cfra, chanshown);
-  }
-
-  while (!e) {
-bool success = false;
-pthread_mutex_lock(_lock);
-
-for (e = prefetch_done.first; e; e = e->next) {
-  if (cfra == e->cfra && chanshown == e->chanshown && context->rectx == 
e->rectx &&
-  

[Bf-blender-cvs] [10f2e39f480] greasepencil-refactor: GPencil: Refactor: New linked mask system

2020-02-07 Thread Clément Foucault
Commit: 10f2e39f4803ca4f1110f3866e7aae1ac29acc95
Author: Clément Foucault
Date:   Fri Feb 7 23:43:36 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB10f2e39f4803ca4f1110f3866e7aae1ac29acc95

GPencil: Refactor: New linked mask system

The new system is more flexible and a bit simpler from the code side.

Each layer has a mask layer slot. If filled with a correct layer name,
the mask layer will be rendered again in a separate buffer. This buffer
will then be used in the blend pass to modulate the opacity of the layer.

This approach is not 100% equivalent to the standard layering in most 2D
applications if using varying alpha on a mask applied to multiple layers.
However this technique does support any ordering arrangement of the masks.

The layers used as mask can now still render normaly.

===

M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/draw/CMakeLists.txt
M   source/blender/draw/engines/gpencil/gpencil_cache_utils.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/gpencil_shader.c
M   
source/blender/draw/engines/gpencil/shaders/gpencil_layer_blend_frag.glsl
D   source/blender/draw/engines/gpencil/shaders/gpencil_layer_mask_frag.glsl

===

diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index 495fe4eb7f6..f19af3cb1b7 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -179,6 +179,7 @@ struct bGPDframe *BKE_gpencil_layer_frame_get(struct 
bGPDlayer *gpl,
 struct bGPDframe *BKE_gpencil_layer_frame_find(struct bGPDlayer *gpl, int 
cframe);
 bool BKE_gpencil_layer_frame_delete(struct bGPDlayer *gpl, struct bGPDframe 
*gpf);
 
+struct bGPDlayer *BKE_gpencil_layer_named_get(struct bGPdata *gpd, const char 
*name);
 struct bGPDlayer *BKE_gpencil_layer_active_get(struct bGPdata *gpd);
 void BKE_gpencil_layer_active_set(struct bGPdata *gpd, struct bGPDlayer 
*active);
 void BKE_gpencil_layer_delete(struct bGPdata *gpd, struct bGPDlayer *gpl);
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 2b58525396b..02cbbcc4060 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1002,6 +1002,14 @@ bool BKE_gpencil_layer_frame_delete(bGPDlayer *gpl, 
bGPDframe *gpf)
   return changed;
 }
 
+bGPDlayer *BKE_gpencil_layer_named_get(bGPdata *gpd, const char *name)
+{
+  if (name[0] == '\0') {
+return NULL;
+  }
+  return BLI_findstring(>layers, name, offsetof(bGPDlayer, info));
+}
+
 /* get the active gp-layer for editing */
 bGPDlayer *BKE_gpencil_layer_active_get(bGPdata *gpd)
 {
diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index 5d11578fe19..46fce6341f0 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -283,7 +283,6 @@ 
data_to_c_simple(engines/gpencil/shaders/gpencil_antialiasing_vert.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_common_lib.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_composite_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_layer_blend_frag.glsl SRC)
-data_to_c_simple(engines/gpencil/shaders/gpencil_layer_mask_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_depth_merge_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_depth_merge_vert.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_vfx_frag.glsl SRC)
diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
index ae8ac611570..6b4e017c96b 100644
--- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
@@ -115,6 +115,7 @@ GPENCIL_tLayer *gpencil_layer_cache_add(GPENCIL_PrivateData 
*pd, Object *ob, bGP
   const bool is_obact = ((pd->obact) && (pd->obact == ob));
   const bool is_fade = ((pd->fade_layer_opacity > -1.0f) && (is_obact) &&
 ((gpl->flag & GP_LAYER_ACTIVE) == 0));
+  bool mask_invert = true; /* True because we invert the dummy texture red 
channel. */
 
   /* Defines layer opacity. For active object depends of layer opacity factor, 
and
* for no active object, depends if the fade grease pencil objects option is 
enabled. */
@@ -127,28 +128,21 @@ GPENCIL_tLayer 
*gpencil_layer_cache_add(GPENCIL_PrivateData *pd, Object *ob, bGP
   fade_layer_opacity = pd->fade_gp_object_opacity;
 }
   }
+
   bGPdata *gpd = (bGPdata *)ob->data;
   GPENCIL_tLayer *tgp_layer = BLI_memblock_alloc(pd->gp_layer_pool);
+  tgp_layer->layer_id = 

[Bf-blender-cvs] [4e2e28b8c33] master: Merge branch 'blender-v2.82-release'

2020-02-07 Thread Sebastián Barschkis
Commit: 4e2e28b8c33e70ccd1b79d13b2042700a92e0697
Author: Sebastián Barschkis
Date:   Fri Feb 7 19:38:33 2020 +0100
Branches: master
https://developer.blender.org/rB4e2e28b8c33e70ccd1b79d13b2042700a92e0697

Merge branch 'blender-v2.82-release'

===



===



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


[Bf-blender-cvs] [68221b7ebaf] blender-v2.82-release: Fluid: Fixed cache reading issue with larger resolution noise grids

2020-02-07 Thread Sebastián Barschkis
Commit: 68221b7ebafe58a2bbf612ad8c59e24569489be5
Author: Sebastián Barschkis
Date:   Fri Feb 7 19:37:44 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rB68221b7ebafe58a2bbf612ad8c59e24569489be5

Fluid: Fixed cache reading issue with larger resolution noise grids

Important fix that needs to go into the release. The upscaled noise cache was 
not read into upscaled grids.

===

M   intern/mantaflow/intern/MANTA_main.cpp
M   intern/mantaflow/intern/MANTA_main.h
M   source/blender/blenkernel/intern/fluid.c

===

diff --git a/intern/mantaflow/intern/MANTA_main.cpp 
b/intern/mantaflow/intern/MANTA_main.cpp
index 2cbf058d8de..cd496ac0c01 100644
--- a/intern/mantaflow/intern/MANTA_main.cpp
+++ b/intern/mantaflow/intern/MANTA_main.cpp
@@ -1204,7 +1204,7 @@ int MANTA::updateSmokeStructures(FluidModifierData *mmd, 
int framenr)
   if (!BLI_exists(targetFile)) {
 return 0;
   }
-  result += updateGridFromFile(targetFile, mDensity);
+  result += updateGridFromFile(targetFile, mDensity, false);
 
   expected += 1;
   ss.str("");
@@ -1214,7 +1214,7 @@ int MANTA::updateSmokeStructures(FluidModifierData *mmd, 
int framenr)
   if (!BLI_exists(targetFile)) {
 return 0;
   }
-  result += updateGridFromFile(targetFile, mShadow);
+  result += updateGridFromFile(targetFile, mShadow, false);
 
   if (mUsingHeat) {
 expected += 1;
@@ -1225,7 +1225,7 @@ int MANTA::updateSmokeStructures(FluidModifierData *mmd, 
int framenr)
 if (!BLI_exists(targetFile)) {
   return 0;
 }
-result += updateGridFromFile(targetFile, mHeat);
+result += updateGridFromFile(targetFile, mHeat, false);
   }
 
   if (mUsingColors) {
@@ -1237,7 +1237,7 @@ int MANTA::updateSmokeStructures(FluidModifierData *mmd, 
int framenr)
 if (!BLI_exists(targetFile)) {
   return 0;
 }
-result += updateGridFromFile(targetFile, mColorR);
+result += updateGridFromFile(targetFile, mColorR, false);
 
 ss.str("");
 ss << "color_g_" << dformat;
@@ -1246,7 +1246,7 @@ int MANTA::updateSmokeStructures(FluidModifierData *mmd, 
int framenr)
 if (!BLI_exists(targetFile)) {
   return 0;
 }
-result += updateGridFromFile(targetFile, mColorG);
+result += updateGridFromFile(targetFile, mColorG, false);
 
 ss.str("");
 ss << "color_b_" << dformat;
@@ -1255,7 +1255,7 @@ int MANTA::updateSmokeStructures(FluidModifierData *mmd, 
int framenr)
 if (!BLI_exists(targetFile)) {
   return 0;
 }
-result += updateGridFromFile(targetFile, mColorB);
+result += updateGridFromFile(targetFile, mColorB, false);
   }
 
   if (mUsingFire) {
@@ -1267,7 +1267,7 @@ int MANTA::updateSmokeStructures(FluidModifierData *mmd, 
int framenr)
 if (!BLI_exists(targetFile)) {
   return 0;
 }
-result += updateGridFromFile(targetFile, mFlame);
+result += updateGridFromFile(targetFile, mFlame, false);
 
 ss.str("");
 ss << "fuel_" << dformat;
@@ -1276,7 +1276,7 @@ int MANTA::updateSmokeStructures(FluidModifierData *mmd, 
int framenr)
 if (!BLI_exists(targetFile)) {
   return 0;
 }
-result += updateGridFromFile(targetFile, mFuel);
+result += updateGridFromFile(targetFile, mFuel, false);
 
 ss.str("");
 ss << "react_" << dformat;
@@ -1285,7 +1285,7 @@ int MANTA::updateSmokeStructures(FluidModifierData *mmd, 
int framenr)
 if (!BLI_exists(targetFile)) {
   return 0;
 }
-result += updateGridFromFile(targetFile, mReact);
+result += updateGridFromFile(targetFile, mReact, false);
   }
 
   mSmokeFromFile = true;
@@ -1334,7 +1334,7 @@ int MANTA::updateNoiseStructures(FluidModifierData *mmd, 
int framenr)
   if (!BLI_exists(targetFile)) {
 return 0;
   }
-  result += updateGridFromFile(targetFile, mDensityHigh);
+  result += updateGridFromFile(targetFile, mDensityHigh, true);
 
   expected += 1;
   ss.str("");
@@ -1344,7 +1344,7 @@ int MANTA::updateNoiseStructures(FluidModifierData *mmd, 
int framenr)
   if (!BLI_exists(targetFile)) {
 return 0;
   }
-  result += updateGridFromFile(targetFile, mShadow);
+  result += updateGridFromFile(targetFile, mShadow, false);
 
   if (mUsingColors) {
 expected += 3;
@@ -1355,7 +1355,7 @@ int MANTA::updateNoiseStructures(FluidModifierData *mmd, 
int framenr)
 if (!BLI_exists(targetFile)) {
   return 0;
 }
-result += updateGridFromFile(targetFile, mColorRHigh);
+result += updateGridFromFile(targetFile, mColorRHigh, true);
 
 ss.str("");
 ss << "color_g_noise_" << nformat;
@@ -1364,7 +1364,7 @@ int MANTA::updateNoiseStructures(FluidModifierData *mmd, 
int framenr)
 if (!BLI_exists(targetFile)) {
   return 0;
 }
-result += updateGridFromFile(targetFile, mColorGHigh);
+result += updateGridFromFile(targetFile, mColorGHigh, true);
 
 ss.str("");
 ss << "color_b_noise_" 

[Bf-blender-cvs] [b05651199b8] master: Code Quality Day: Comment formatting in bmesh_bevel.c

2020-02-07 Thread Hans Goudey
Commit: b05651199b87f74bc3ce7bb9ee761c8ecfe3aab8
Author: Hans Goudey
Date:   Fri Feb 7 13:32:02 2020 -0500
Branches: master
https://developer.blender.org/rBb05651199b87f74bc3ce7bb9ee761c8ecfe3aab8

Code Quality Day: Comment formatting in bmesh_bevel.c

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index d3b3541a539..d8c2057bb56 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -66,7 +66,7 @@
 /* for testing */
 // #pragma GCC diagnostic error "-Wpadded"
 
-/* Constructed vertex, sometimes later instantiated as BMVert */
+/* Constructed vertex, sometimes later instantiated as BMVert. */
 typedef struct NewVert {
   BMVert *v;
   float co[3];
@@ -75,31 +75,31 @@ typedef struct NewVert {
 
 struct BoundVert;
 
-/* Data for one end of an edge involved in a bevel */
+/* Data for one end of an edge involved in a bevel. */
 typedef struct EdgeHalf {
   /** Other EdgeHalves connected to the same BevVert, in CCW order. */
   struct EdgeHalf *next, *prev;
-  /** Original mesh edge */
+  /** Original mesh edge. */
   BMEdge *e;
-  /** Face between this edge and previous, if any */
+  /** Face between this edge and previous, if any. */
   BMFace *fprev;
-  /** Face between this edge and next, if any */
+  /** Face between this edge and next, if any. */
   BMFace *fnext;
-  /** Left boundary vert (looking along edge to end) */
+  /** Left boundary vert (looking along edge to end). */
   struct BoundVert *leftv;
-  /** Right boundary vert, if beveled */
+  /** Right boundary vert, if beveled. */
   struct BoundVert *rightv;
-  /** Offset into profile to attach non-beveled edge */
+  /** Offset into profile to attach non-beveled edge. */
   int profile_index;
-  /** How many segments for the bevel */
+  /** How many segments for the bevel. */
   int seg;
-  /** Offset for this edge, on left side */
+  /** Offset for this edge, on left side. */
   float offset_l;
-  /** Offset for this edge, on right side */
+  /** Offset for this edge, on right side. */
   float offset_r;
-  /** User specification for offset_l */
+  /** User specification for offset_l. */
   float offset_l_spec;
-  /** User specification for offset_r */
+  /** User specification for offset_r. */
   float offset_r_spec;
   /** Is this edge beveled? */
   bool is_bev;
@@ -107,44 +107,45 @@ typedef struct EdgeHalf {
   bool is_rev;
   /** Is e a seam for custom loopdata (e.g., UVs)? */
   bool is_seam;
-  /** Used during the custom profile orientation pass */
+  /** Used during the custom profile orientation pass. */
   bool visited_rpo;
   char _pad[4];
 } EdgeHalf;
 
-/* Profile specification:
+/**
+ * Profile specification:
+ * The profile is a path defined with start, middle, and end control points 
projected onto a
+ * plane (plane_no is normal, plane_co is a point on it) via lines in a given 
direction (proj_dir).
+ *
  * Many interesting profiles are in family of superellipses:
  * (abs(x/a))^r + abs(y/b))^r = 1
  * r==2 => ellipse; r==1 => line; r < 1 => concave; r > 1 => bulging out.
  * Special cases: let r==0 mean straight-inward, and r==4 mean straight 
outward.
- * The profile is a path defined with start, middle, and end control points
- * projected onto a plane (plane_no is normal, plane_co is a point on it)
- * via lines in a given direction (proj_dir).
- * After the parameters are all set, the actual profile points are calculated
- * and pointed to by prof_co. We also may need profile points for a higher 
resolution
- * number of segments for the subdivision while making the ADJ vertex mesh 
pattern,
- * and that goes in prof_co_2.
+ *
+ * After the parameters are all set, the actual profile points are calculated 
and pointed to
+ * by prof_co. We also may need profile points for a higher resolution number 
of segments
+ * for the subdivision while making the ADJ vertex mesh pattern, and that goes 
in prof_co_2.
  */
 typedef struct Profile {
-  /** Superellipse r parameter */
+  /** Superellipse r parameter. */
   float super_r;
-  /** Height for profile cutoff face sides */
+  /** Height for profile cutoff face sides. */
   float height;
-  /** Start control point for profile */
+  /** Start control point for profile. */
   float start[3];
-  /** Mid control point for profile */
+  /** Mid control point for profile. */
   float middle[3];
-  /** End control point for profile */
+  /** End control point for profile. */
   float end[3];
-  /** Normal of plane to project to */
+  /** Normal of plane to project to. */
   float plane_no[3];
-  /** Coordinate on plane to project to */
+  /** Coordinate on plane to project to. */
   float plane_co[3];
-  /** Direction of projection line */
+  /** Direction of projection line. */
   float proj_dir[3];
- 

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

2020-02-07 Thread Antonio Vazquez
Commit: 323808ca5a8da06030dedce9760eefeb7426646b
Author: Antonio Vazquez
Date:   Fri Feb 7 19:09:33 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rB323808ca5a8da06030dedce9760eefeb7426646b

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] [4e2cb23bbd1] greasepencil-refactor: Merge branch 'greasepencil-object' into greasepencil-refactor

2020-02-07 Thread Antonio Vazquez
Commit: 4e2cb23bbd1081a025d4325852b4d5aac6fe930a
Author: Antonio Vazquez
Date:   Fri Feb 7 19:10:15 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB4e2cb23bbd1081a025d4325852b4d5aac6fe930a

Merge branch 'greasepencil-object' into greasepencil-refactor

===



===



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


[Bf-blender-cvs] [47d13fecfbb] master: Fix T73660: Hide envelop option for Grease Pencil weights generation

2020-02-07 Thread Antonio Vazquez
Commit: 47d13fecfbb7f2111ccd71b5376c8c3094ca1558
Author: Antonio Vazquez
Date:   Fri Feb 7 17:46:29 2020 +0100
Branches: master
https://developer.blender.org/rB47d13fecfbb7f2111ccd71b5376c8c3094ca1558

Fix T73660: Hide envelop option for Grease Pencil weights generation

As this feature is not supported yet, it's better to hide for grease pencil.
Differential Revision: https://developer.blender.org/D6777

===

M   source/blender/editors/object/object_relations.c

===

diff --git a/source/blender/editors/object/object_relations.c 
b/source/blender/editors/object/object_relations.c
index 080c6400d31..9057922906c 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1054,7 +1054,9 @@ static int parent_set_invoke_menu(bContext *C, 
wmOperatorType *ot)
   if (parent->type == OB_ARMATURE) {
 uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE);
 uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_NAME);
-uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_ENVELOPE);
+if (!has_children_of_type.gpencil) {
+  uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_ENVELOPE);
+}
 if (has_children_of_type.mesh || has_children_of_type.gpencil) {
   uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_AUTO);
 }

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


[Bf-blender-cvs] [2f0189964ad] temp-sybren-anim-cleanup: Cleanup: Animation, simplified fcurve_eval_between_keyframes() code

2020-02-07 Thread Sybren A. Stüvel
Commit: 2f0189964ad5a4ae7cb819233c753df51a4b1508
Author: Sybren A. Stüvel
Date:   Fri Feb 7 17:29:30 2020 +0100
Branches: temp-sybren-anim-cleanup
https://developer.blender.org/rB2f0189964ad5a4ae7cb819233c753df51a4b1508

Cleanup: Animation, simplified fcurve_eval_between_keyframes() code

The function now immediately returns the evaluated value, rather than
setting a variable's value and returning that at the end of the
function. As a result, `else`-clauses and `break` statements could be
removed, simplifying and unindenting the code.

Declarations of some variables that are only used in a specific part of
the function have been moved there to clarify and limit their scope.

No functional changes.

===

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

===

diff --git a/source/blender/blenkernel/intern/fcurve.c 
b/source/blender/blenkernel/intern/fcurve.c
index 41edba040c6..4c5644c130b 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2786,13 +2786,9 @@ static float fcurve_eval_between_keyframes(const FCurve 
*fcu,
BezTriple *bezts,
const float evaltime)
 {
-  float cvalue = 0.0f;
-
-  const float eps = 1.e-8f;
-  float v1[2], v2[2], v3[2], v4[2], opl[32];
-  unsigned int a;
-  int b;
-  bool exact = false;
+  unsigned int bezt_index;
+  BezTriple *prevbezt;
+  BezTriple *bezt;
 
   /* Use binary search to find appropriate keyframes...
*
@@ -2804,304 +2800,227 @@ static float fcurve_eval_between_keyframes(const 
FCurve *fcu,
*   Weird errors, like selecting the wrong keyframe range (see T39207), 
occur.
*   This lower bound was established in 
b888a32eee8147b028464336ad2404d8155c64dd.
*/
-  a = binarysearch_bezt_index_ex(bezts, evaltime, fcu->totvert, 0.0001, 
);
-
-  BezTriple *prevbezt;
-  BezTriple *bezt;
-
+  bool exact = false;
+  bezt_index = binarysearch_bezt_index_ex(bezts, evaltime, fcu->totvert, 
0.0001, );
   if (exact) {
-/* index returned must be interpreted differently when it sits on top of 
an existing keyframe
- * - that keyframe is the start of the segment we need (see 
action_bug_2.blend in T39207)
- */
-prevbezt = bezts + a;
-bezt = (a < fcu->totvert - 1) ? (prevbezt + 1) : prevbezt;
-  }
-  else {
-/* index returned refers to the keyframe that the eval-time occurs *before*
- * - hence, that keyframe marks the start of the segment we're dealing with
- */
-bezt = bezts + a;
-prevbezt = (a > 0) ? (bezt - 1) : bezt;
+bezt = bezts + bezt_index;
+return bezt->vec[1][1];
   }
 
-  /* use if the key is directly on the frame,
-   * rare cases this is needed else we get 0.0 instead. */
-  /* XXX: consult T39207 for examples of files where failure of these checks 
can cause issues */
-  if (exact) {
-cvalue = prevbezt->vec[1][1];
-  }
-  else if (fabsf(bezt->vec[1][0] - evaltime) < eps) {
-cvalue = bezt->vec[1][1];
+  /* index returned refers to the keyframe that the eval-time occurs *before*
+   * - hence, that keyframe marks the start of the segment we're dealing with
+   */
+  bezt = bezts + bezt_index;
+  prevbezt = (bezt_index > 0) ? (bezt - 1) : bezt;
+
+  /* TODO(Sybren): remove the below code, as in this case the binary search has
+   * already marked the result as an exact match. */
+  const float eps = 1.e-8f;
+  if (fabsf(bezt->vec[1][0] - evaltime) < eps) {
+return bezt->vec[1][1];
   }
-  /* evaltime occurs within the interval defined by these two keyframes */
-  else if ((prevbezt->vec[1][0] <= evaltime) && (bezt->vec[1][0] >= evaltime)) 
{
-const float begin = prevbezt->vec[1][1];
-const float change = bezt->vec[1][1] - prevbezt->vec[1][1];
-const float duration = bezt->vec[1][0] - prevbezt->vec[1][0];
-const float time = evaltime - prevbezt->vec[1][0];
-const float amplitude = prevbezt->amplitude;
-const float period = prevbezt->period;
 
-/* value depends on interpolation mode */
-if ((prevbezt->ipo == BEZT_IPO_CONST) || (fcu->flag & 
FCURVE_DISCRETE_VALUES) ||
-(duration == 0)) {
-  /* constant (evaltime not relevant, so no interpolation needed) */
-  cvalue = prevbezt->vec[1][1];
+  /* evaltime should occur within the interval defined by these two keyframes. 
*/
+  if (evaltime < prevbezt->vec[1][0] || bezt->vec[1][0] < evaltime) {
+if (G.debug & G_DEBUG) {
+  printf("   ERROR: failed eval - p=%f b=%f, t=%f (%f)\n",
+ prevbezt->vec[1][0],
+ bezt->vec[1][0],
+ evaltime,
+ fabsf(bezt->vec[1][0] - evaltime));
 }
-else {
-  switch (prevbezt->ipo) {
-/* interpolation .. */
-case BEZT_IPO_BEZ:
-  /* bezier interpolation */
-  /* (v1, v2) are the first 

[Bf-blender-cvs] [d690c76e56c] temp-sybren-anim-cleanup: Cleanup: Animation, removed impossible-to-reach code

2020-02-07 Thread Sybren A. Stüvel
Commit: d690c76e56cfc8858a7a31333716a87704c51508
Author: Sybren A. Stüvel
Date:   Fri Feb 7 17:47:00 2020 +0100
Branches: temp-sybren-anim-cleanup
https://developer.blender.org/rBd690c76e56cfc8858a7a31333716a87704c51508

Cleanup: Animation, removed impossible-to-reach code

While fixing T39207 @aligorith added a threshold to the binary search
function that's used to find the closest keyframe. Since that threshold
is larger than the threshold used in the now-removed code, the condition
in that code will evaluate to true anyway, and thus it can be removed.

===

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

===

diff --git a/source/blender/blenkernel/intern/fcurve.c 
b/source/blender/blenkernel/intern/fcurve.c
index 4c5644c130b..6ced863f0de 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2813,13 +2813,6 @@ static float fcurve_eval_between_keyframes(const FCurve 
*fcu,
   bezt = bezts + bezt_index;
   prevbezt = (bezt_index > 0) ? (bezt - 1) : bezt;
 
-  /* TODO(Sybren): remove the below code, as in this case the binary search has
-   * already marked the result as an exact match. */
-  const float eps = 1.e-8f;
-  if (fabsf(bezt->vec[1][0] - evaltime) < eps) {
-return bezt->vec[1][1];
-  }
-
   /* evaltime should occur within the interval defined by these two keyframes. 
*/
   if (evaltime < prevbezt->vec[1][0] || bezt->vec[1][0] < evaltime) {
 if (G.debug & G_DEBUG) {

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


[Bf-blender-cvs] [7766ba2189c] temp-sybren-anim-cleanup: Cleanup: Animation, split fcurve_eval_keyframes() into separate functions

2020-02-07 Thread Sybren A. Stüvel
Commit: 7766ba2189c160686355a3eac2961f0f5253781f
Author: Sybren A. Stüvel
Date:   Fri Feb 7 14:53:05 2020 +0100
Branches: temp-sybren-anim-cleanup
https://developer.blender.org/rB7766ba2189c160686355a3eac2961f0f5253781f

Cleanup: Animation, split fcurve_eval_keyframes() into separate functions

There are three main parts of the `fcurve_eval_keyframes()` function:

- before or on the first keyframe
- after or on the last keyframe
- between those points

These are now separated into separate functions. Apart from moving the
code, there are minimal code/cleanup changes. More cleanups to follow.

No functional changes.

===

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

===

diff --git a/source/blender/blenkernel/intern/fcurve.c 
b/source/blender/blenkernel/intern/fcurve.c
index 251c6421d66..41edba040c6 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2665,60 +2665,31 @@ static void berekeny(float f1, float f2, float f3, 
float f4, float *o, int b)
 
 /* -- */
 
-/* Calculate F-Curve value for 'evaltime' using BezTriple keyframes */
-static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float 
evaltime)
+static float fcurve_eval_before_or_on_first_keyframe(const FCurve *fcu,
+ const BezTriple *prevbezt,
+ const float evaltime)
 {
-  const float eps = 1.e-8f;
-  BezTriple *bezt, *prevbezt, *lastbezt;
-  float v1[2], v2[2], v3[2], v4[2], opl[32], dx, fac;
-  unsigned int a;
-  int b;
   float cvalue = 0.0f;
 
-  /* get pointers */
-  a = fcu->totvert - 1;
-  prevbezt = bezts;
-  bezt = prevbezt + 1;
-  lastbezt = prevbezt + a;
-
-  /* evaluation time at or past endpoints? */
-  if (prevbezt->vec[1][0] >= evaltime) {
-/* before or on first keyframe */
-if ((fcu->extend == FCURVE_EXTRAPOLATE_LINEAR) && (prevbezt->ipo != 
BEZT_IPO_CONST) &&
-!(fcu->flag & FCURVE_DISCRETE_VALUES)) {
-  /* linear or bezier interpolation */
-  if (prevbezt->ipo == BEZT_IPO_LIN) {
-/* Use the next center point instead of our own handle for
- * linear interpolated extrapolate
- */
-if (fcu->totvert == 1) {
-  cvalue = prevbezt->vec[1][1];
-}
-else {
-  bezt = prevbezt + 1;
-  dx = prevbezt->vec[1][0] - evaltime;
-  fac = bezt->vec[1][0] - prevbezt->vec[1][0];
-
-  /* prevent division by zero */
-  if (fac) {
-fac = (bezt->vec[1][1] - prevbezt->vec[1][1]) / fac;
-cvalue = prevbezt->vec[1][1] - (fac * dx);
-  }
-  else {
-cvalue = prevbezt->vec[1][1];
-  }
-}
+  /* before or on first keyframe */
+  if ((fcu->extend == FCURVE_EXTRAPOLATE_LINEAR) && (prevbezt->ipo != 
BEZT_IPO_CONST) &&
+  !(fcu->flag & FCURVE_DISCRETE_VALUES)) {
+/* linear or bezier interpolation */
+if (prevbezt->ipo == BEZT_IPO_LIN) {
+  /* Use the next center point instead of our own handle for
+   * linear interpolated extrapolate
+   */
+  if (fcu->totvert == 1) {
+cvalue = prevbezt->vec[1][1];
   }
   else {
-/* Use the first handle (earlier) of first BezTriple to calculate the
- * gradient and thus the value of the curve at evaltime
- */
-dx = prevbezt->vec[1][0] - evaltime;
-fac = prevbezt->vec[1][0] - prevbezt->vec[0][0];
+const BezTriple *bezt = prevbezt + 1;
+float dx = prevbezt->vec[1][0] - evaltime;
+float fac = bezt->vec[1][0] - prevbezt->vec[1][0];
 
 /* prevent division by zero */
 if (fac) {
-  fac = (prevbezt->vec[1][1] - prevbezt->vec[0][1]) / fac;
+  fac = (bezt->vec[1][1] - prevbezt->vec[1][1]) / fac;
   cvalue = prevbezt->vec[1][1] - (fac * dx);
 }
 else {
@@ -2727,49 +2698,57 @@ static float fcurve_eval_keyframes(FCurve *fcu, 
BezTriple *bezts, float evaltime
   }
 }
 else {
-  /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation,
-   * so just extend first keyframe's value
+  /* Use the first handle (earlier) of first BezTriple to calculate the
+   * gradient and thus the value of the curve at evaltime
*/
-  cvalue = prevbezt->vec[1][1];
+  float dx = prevbezt->vec[1][0] - evaltime;
+  float fac = prevbezt->vec[1][0] - prevbezt->vec[0][0];
+
+  /* prevent division by zero */
+  if (fac) {
+fac = (prevbezt->vec[1][1] - prevbezt->vec[0][1]) / fac;
+cvalue = prevbezt->vec[1][1] - (fac * dx);
+  }
+  else {
+cvalue = prevbezt->vec[1][1];
+  }
 }
   }
-  else if (lastbezt->vec[1][0] <= evaltime) {
-/* after or on last keyframe */
-if ((fcu->extend == 

[Bf-blender-cvs] [559816a8cb4] temp-sybren-anim-cleanup: Animation: added unittests for FCurve evaluation

2020-02-07 Thread Sybren A. Stüvel
Commit: 559816a8cb41243eb5a11d122a201d19f636a880
Author: Sybren A. Stüvel
Date:   Fri Feb 7 16:32:14 2020 +0100
Branches: temp-sybren-anim-cleanup
https://developer.blender.org/rB559816a8cb41243eb5a11d122a201d19f636a880

Animation: added unittests for FCurve evaluation

I want to clean up some of the FCurve evaluation functions by breaking
them up into smaller parts and simplifying some code paths. Before I do
that, however, I want to add some tests to ensure I don't mess up too
much.

===

M   tests/gtests/CMakeLists.txt
A   tests/gtests/blenkernel/BKE_fcurve_test.cc
A   tests/gtests/blenkernel/CMakeLists.txt

===

diff --git a/tests/gtests/CMakeLists.txt b/tests/gtests/CMakeLists.txt
index bcf77fb6de7..bab436bd5e7 100644
--- a/tests/gtests/CMakeLists.txt
+++ b/tests/gtests/CMakeLists.txt
@@ -14,6 +14,7 @@ if(WITH_GTESTS)
   add_subdirectory(testing)
   add_subdirectory(blenlib)
   add_subdirectory(blenloader)
+  add_subdirectory(blenkernel)
   add_subdirectory(guardedalloc)
   add_subdirectory(bmesh)
   if(WITH_CODEC_FFMPEG)
diff --git a/tests/gtests/blenkernel/BKE_fcurve_test.cc 
b/tests/gtests/blenkernel/BKE_fcurve_test.cc
new file mode 100644
index 000..ac9ba5191dd
--- /dev/null
+++ b/tests/gtests/blenkernel/BKE_fcurve_test.cc
@@ -0,0 +1,207 @@
+/*
+ * 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.
+ *
+ * The Original Code is Copyright (C) 2020 by Blender Foundation.
+ */
+#include "testing/testing.h"
+#include "MEM_guardedalloc.h"
+
+extern "C" {
+#include "BKE_fcurve.h"
+
+#include "ED_keyframing.h"
+
+#include "DNA_anim_types.h"
+}
+
+TEST(evaluate_fcurve, EmptyFCurve)
+{
+  FCurve *fcu = static_cast(MEM_callocN(sizeof(FCurve), "FCurve"));
+  EXPECT_EQ(evaluate_fcurve(fcu, 47.0f), 0.0f);
+  free_fcurve(fcu);
+}
+
+TEST(evaluate_fcurve, OnKeys)
+{
+  FCurve *fcu = static_cast(MEM_callocN(sizeof(FCurve), "FCurve"));
+
+  insert_vert_fcurve(fcu, 1.0f, 7.0f, BEZT_KEYTYPE_KEYFRAME, 
INSERTKEY_NO_USERPREF);
+  insert_vert_fcurve(fcu, 2.0f, 13.0f, BEZT_KEYTYPE_KEYFRAME, 
INSERTKEY_NO_USERPREF);
+  insert_vert_fcurve(fcu, 3.0f, 19.0f, BEZT_KEYTYPE_KEYFRAME, 
INSERTKEY_NO_USERPREF);
+
+  EXPECT_FLOAT_EQ(evaluate_fcurve(fcu, 1.0f), 7.0f);   // hits 'on or before 
first' function
+  EXPECT_FLOAT_EQ(evaluate_fcurve(fcu, 2.0f), 13.0f);  // hits 'between' 
function
+  EXPECT_FLOAT_EQ(evaluate_fcurve(fcu, 3.0f), 19.0f);  // hits 'on or after 
last' function
+
+  /* Also test within an epsilon of the keys, as this was an issue in T39207.
+   * This epsilon is just slightly smaller than the epsilon given to 
binarysearch_bezt_index_ex()
+   * in fcurve_eval_between_keyframes(), so it should hit the "exact" code 
path. */
+  float epsilon = 0.8f;
+  EXPECT_FLOAT_EQ(evaluate_fcurve(fcu, 2.0f - epsilon), 13.0f);
+  EXPECT_FLOAT_EQ(evaluate_fcurve(fcu, 2.0f + epsilon), 13.0f);
+
+  free_fcurve(fcu);
+}
+
+TEST(evaluate_fcurve, InterpolationConstant)
+{
+  FCurve *fcu = static_cast(MEM_callocN(sizeof(FCurve), "FCurve"));
+
+  EXPECT_EQ(insert_vert_fcurve(fcu, 1.0f, 7.0f, BEZT_KEYTYPE_KEYFRAME, 
INSERTKEY_NO_USERPREF), 0);
+  EXPECT_EQ(insert_vert_fcurve(fcu, 2.0f, 13.0f, BEZT_KEYTYPE_KEYFRAME, 
INSERTKEY_NO_USERPREF), 1);
+
+  fcu->bezt[0].ipo = BEZT_IPO_CONST;
+  fcu->bezt[1].ipo = BEZT_IPO_CONST;
+
+  EXPECT_FLOAT_EQ(evaluate_fcurve(fcu, 1.25f), 7.0f);
+  EXPECT_FLOAT_EQ(evaluate_fcurve(fcu, 1.50f), 7.0f);
+
+  free_fcurve(fcu);
+}
+
+TEST(evaluate_fcurve, InterpolationLinear)
+{
+  FCurve *fcu = static_cast(MEM_callocN(sizeof(FCurve), "FCurve"));
+
+  EXPECT_EQ(insert_vert_fcurve(fcu, 1.0f, 7.0f, BEZT_KEYTYPE_KEYFRAME, 
INSERTKEY_NO_USERPREF), 0);
+  EXPECT_EQ(insert_vert_fcurve(fcu, 2.0f, 13.0f, BEZT_KEYTYPE_KEYFRAME, 
INSERTKEY_NO_USERPREF), 1);
+
+  fcu->bezt[0].ipo = BEZT_IPO_LIN;
+  fcu->bezt[1].ipo = BEZT_IPO_LIN;
+
+  EXPECT_FLOAT_EQ(evaluate_fcurve(fcu, 1.25f), 8.5f);
+  EXPECT_FLOAT_EQ(evaluate_fcurve(fcu, 1.50f), 10.0f);
+  EXPECT_FLOAT_EQ(evaluate_fcurve(fcu, 1.75f), 11.5f);
+
+  free_fcurve(fcu);
+}
+
+TEST(evaluate_fcurve, InterpolationBezier)
+{
+  FCurve *fcu = static_cast(MEM_callocN(sizeof(FCurve), "FCurve"));
+
+  EXPECT_EQ(insert_vert_fcurve(fcu, 1.0f, 7.0f, BEZT_KEYTYPE_KEYFRAME, 

[Bf-blender-cvs] [03000549fbe] master: remove poll for OBJECT_OT_parent_clear

2020-02-07 Thread Philipp Oeser
Commit: 03000549fbed522cce231a3a41346af2c8c291c2
Author: Philipp Oeser
Date:   Fri Feb 7 12:09:09 2020 +0100
Branches: master
https://developer.blender.org/rB03000549fbed522cce231a3a41346af2c8c291c2

remove poll for OBJECT_OT_parent_clear

This works on selected_editable_objects, so no active object mandatory.

After deletion of the active object and using slection tools such as
e.g. box select, the lack of an active object would prevent this
operator from being called without good reason.

Also cannot think of any other existing poll that would really make
sense (Editor type, ...).

ref T68975

Maniphest Tasks: T68975

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

===

M   source/blender/editors/object/object_relations.c

===

diff --git a/source/blender/editors/object/object_relations.c 
b/source/blender/editors/object/object_relations.c
index e00b7fd2dc5..080c6400d31 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -616,8 +616,6 @@ void OBJECT_OT_parent_clear(wmOperatorType *ot)
   ot->invoke = WM_menu_invoke;
   ot->exec = parent_clear_exec;
 
-  ot->poll = ED_operator_object_active_editable;
-
   /* flags */
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

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


[Bf-blender-cvs] [c2e80cfaa30] master: BLI: add index_range method to some data structures

2020-02-07 Thread Jacques Lucke
Commit: c2e80cfaa302e666421a8adee8d2b25a69d0700e
Author: Jacques Lucke
Date:   Fri Feb 7 17:23:25 2020 +0100
Branches: master
https://developer.blender.org/rBc2e80cfaa302e666421a8adee8d2b25a69d0700e

BLI: add index_range method to some data structures

This can be used to iterate over all indices with less code.

===

M   source/blender/blenlib/BLI_allocator.h
M   source/blender/blenlib/BLI_array_cxx.h
M   source/blender/blenlib/BLI_array_ref.h
M   source/blender/blenlib/BLI_vector.h

===

diff --git a/source/blender/blenlib/BLI_allocator.h 
b/source/blender/blenlib/BLI_allocator.h
index 52fa8d2b705..82cf76e425c 100644
--- a/source/blender/blenlib/BLI_allocator.h
+++ b/source/blender/blenlib/BLI_allocator.h
@@ -30,6 +30,7 @@
  */
 
 #include 
+#include 
 
 #include "MEM_guardedalloc.h"
 
diff --git a/source/blender/blenlib/BLI_array_cxx.h 
b/source/blender/blenlib/BLI_array_cxx.h
index c7704e20fb1..e987121d68c 100644
--- a/source/blender/blenlib/BLI_array_cxx.h
+++ b/source/blender/blenlib/BLI_array_cxx.h
@@ -27,6 +27,7 @@
 #include "BLI_allocator.h"
 #include "BLI_array_ref.h"
 #include "BLI_memory_utils_cxx.h"
+#include "BLI_index_range.h"
 
 namespace BLI {
 
@@ -182,6 +183,11 @@ template class Array {
 return m_data + m_size;
   }
 
+  IndexRange index_range() const
+  {
+return IndexRange(m_size);
+  }
+
  private:
   T *allocate(uint size)
   {
diff --git a/source/blender/blenlib/BLI_array_ref.h 
b/source/blender/blenlib/BLI_array_ref.h
index e34647676d8..bef7b862bf9 100644
--- a/source/blender/blenlib/BLI_array_ref.h
+++ b/source/blender/blenlib/BLI_array_ref.h
@@ -246,6 +246,11 @@ template class ArrayRef {
 return fallback;
   }
 
+  IndexRange index_range() const
+  {
+return IndexRange(m_size);
+  }
+
   /**
* Get a new array ref to the same underlying memory buffer. No conversions 
are done.
* Asserts when the sizes of the types don't match.
@@ -411,6 +416,11 @@ template class MutableArrayRef {
   {
 return ArrayRef(m_start, m_size);
   }
+
+  IndexRange index_range() const
+  {
+return IndexRange(m_size);
+  }
 };
 
 /**
diff --git a/source/blender/blenlib/BLI_vector.h 
b/source/blender/blenlib/BLI_vector.h
index 46c46a1440f..5c03a896692 100644
--- a/source/blender/blenlib/BLI_vector.h
+++ b/source/blender/blenlib/BLI_vector.h
@@ -37,6 +37,7 @@
 #include "BLI_listbase_wrapper.h"
 #include "BLI_math_base.h"
 #include "BLI_allocator.h"
+#include "BLI_index_range.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -520,6 +521,11 @@ template class Ve
 return (uint)(m_capacity_end - m_begin);
   }
 
+  IndexRange index_range() const
+  {
+return IndexRange(this->size());
+  }
+
   void print_stats() const
   {
 std::cout << "Small Vector at " << (void *)this << ":" << std::endl;

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


[Bf-blender-cvs] [11df80fc6d3] master: Cleanup: add extern "C"

2020-02-07 Thread Jacques Lucke
Commit: 11df80fc6d3e9193acd278923952a8210a01282c
Author: Jacques Lucke
Date:   Fri Feb 7 17:23:50 2020 +0100
Branches: master
https://developer.blender.org/rB11df80fc6d3e9193acd278923952a8210a01282c

Cleanup: add extern "C"

===

M   source/blender/modifiers/MOD_modifiertypes.h

===

diff --git a/source/blender/modifiers/MOD_modifiertypes.h 
b/source/blender/modifiers/MOD_modifiertypes.h
index 7dd1ce830aa..5dc4adf4393 100644
--- a/source/blender/modifiers/MOD_modifiertypes.h
+++ b/source/blender/modifiers/MOD_modifiertypes.h
@@ -23,6 +23,10 @@
 
 #include "BKE_modifier.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* ** Type structures for all modifiers ** */
 
 extern ModifierTypeInfo modifierType_None;
@@ -86,4 +90,8 @@ extern ModifierTypeInfo modifierType_WeightedNormal;
 /* MOD_util.c */
 void modifier_type_init(ModifierTypeInfo *types[]);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __MOD_MODIFIERTYPES_H__ */

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


[Bf-blender-cvs] [f3db5a09659] master: Cleanup: Improve usage of extern "C"

2020-02-07 Thread Jacques Lucke
Commit: f3db5a0965902db622ea291850a1b815eda9d288
Author: Jacques Lucke
Date:   Fri Feb 7 17:22:11 2020 +0100
Branches: master
https://developer.blender.org/rBf3db5a0965902db622ea291850a1b815eda9d288

Cleanup: Improve usage of extern "C"

===

M   source/blender/blenkernel/BKE_deform.h
M   source/blender/blenkernel/BKE_modifier.h
M   source/blender/makesdna/DNA_modifier_types.h

===

diff --git a/source/blender/blenkernel/BKE_deform.h 
b/source/blender/blenkernel/BKE_deform.h
index fd7fa632999..ca06716599c 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -20,6 +20,10 @@
 #ifndef __BKE_DEFORM_H__
 #define __BKE_DEFORM_H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** \file
  * \ingroup bke
  * \brief support for deformation groups and hooks.
@@ -142,4 +146,8 @@ void BKE_defvert_extract_vgroup_to_polyweights(struct 
MDeformVert *dvert,
 
 void BKE_defvert_weight_to_rgb(float r_rgb[3], const float weight);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __BKE_DEFORM_H__ */
diff --git a/source/blender/blenkernel/BKE_modifier.h 
b/source/blender/blenkernel/BKE_modifier.h
index 1e549849989..0872550d7ae 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -20,14 +20,14 @@
  * \ingroup bke
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include "DNA_modifier_types.h" /* needed for all enum typdefs */
 #include "BLI_compiler_attrs.h"
 #include "BKE_customdata.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct BMEditMesh;
 struct CustomData_MeshMasks;
 struct DepsNodeHandle;
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index fcf41481ade..2c0d34fdccf 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -24,6 +24,10 @@
 #include "DNA_defs.h"
 #include "DNA_listBase.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* WARNING ALERT! TYPEDEF VALUES ARE WRITTEN IN FILES! SO DO NOT CHANGE!
  * (ONLY ADD NEW ITEMS AT THE END)
  */
@@ -2042,4 +2046,8 @@ enum {
 #define MOD_MESHSEQ_READ_ALL \
   (MOD_MESHSEQ_READ_VERT | MOD_MESHSEQ_READ_POLY | MOD_MESHSEQ_READ_UV | 
MOD_MESHSEQ_READ_COLOR)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __DNA_MODIFIER_TYPES_H__ */

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


[Bf-blender-cvs] [6fda1c80730] greasepencil-refactor: GPencil: Rename collision to boundbox

2020-02-07 Thread Antonio Vazquez
Commit: 6fda1c807303a67545f723dc64b54f2f54a9b2e9
Author: Antonio Vazquez
Date:   Fri Feb 7 17:12:56 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB6fda1c807303a67545f723dc64b54f2f54a9b2e9

GPencil: Rename collision to boundbox

The initial use of the variables was collision, but now are used for more 
things, so it's better put a more general name.

===

M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
M   source/blender/makesdna/DNA_gpencil_types.h

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 610c8b4280c..2b58525396b 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1340,8 +1340,8 @@ void BKE_gpencil_centroid_3d(bGPdata *gpd, float 
r_centroid[3])
 /* Compute stroke collision detection center and radius. */
 void BKE_gpencil_stroke_collision_get(bGPDstroke *gps)
 {
-  INIT_MINMAX(gps->collision_min, gps->collision_max);
-  BKE_gpencil_stroke_minmax(gps, false, gps->collision_min, 
gps->collision_max);
+  INIT_MINMAX(gps->boundbox_min, gps->boundbox_max);
+  BKE_gpencil_stroke_minmax(gps, false, gps->boundbox_min, gps->boundbox_max);
 }
 
 /* create bounding box values */
diff --git a/source/blender/editors/gpencil/gpencil_utils.c 
b/source/blender/editors/gpencil/gpencil_utils.c
index 6995f7074e8..3ac01bb45ff 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -2564,26 +2564,25 @@ bool 
ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc,
 {
   const int offset = (int)ceil(sqrt((radius * radius) * 2));
   bGPDspoint pt_dummy, pt_dummy_ps;
-  float gps_collision_min[2] = {0.0f};
-  float gps_collision_max[2] = {0.0f};
+  float boundbox_min[2] = {0.0f};
+  float boundbox_max[2] = {0.0f};
   float zerov3[3];
 
   /* Check we have something to use (only for old files). */
-  if (equals_v3v3(zerov3, gps->collision_min)) {
+  if (equals_v3v3(zerov3, gps->boundbox_min)) {
 BKE_gpencil_stroke_collision_get(gps);
   }
 
   /* Convert bound box to 2d */
-  copy_v3_v3(_dummy.x, gps->collision_min);
+  copy_v3_v3(_dummy.x, gps->boundbox_min);
   gp_point_to_parent_space(_dummy, diff_mat, _dummy_ps);
-  gp_point_to_xy_fl(gsc, gps, _dummy_ps, _collision_min[0], 
_collision_min[1]);
+  gp_point_to_xy_fl(gsc, gps, _dummy_ps, _min[0], 
_min[1]);
 
-  copy_v3_v3(_dummy.x, gps->collision_max);
+  copy_v3_v3(_dummy.x, gps->boundbox_max);
   gp_point_to_parent_space(_dummy, diff_mat, _dummy_ps);
-  gp_point_to_xy_fl(gsc, gps, _dummy_ps, _collision_max[0], 
_collision_max[1]);
+  gp_point_to_xy_fl(gsc, gps, _dummy_ps, _max[0], 
_max[1]);
 
-  rcti rect_stroke = {
-  gps_collision_min[0], gps_collision_max[0], gps_collision_min[1], 
gps_collision_max[1]};
+  rcti rect_stroke = {boundbox_min[0], boundbox_max[0], boundbox_min[1], 
boundbox_max[1]};
 
   /* For mouse, add a small offet to avoid false negative in corners. */
   rcti rect_mouse = {mouse[0] - offset, mouse[0] + offset, mouse[1] - offset, 
mouse[1] + offset};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index ab621a966a7..712959adefe 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -231,7 +231,7 @@ static void generate_geometry(GpencilModifierData *md,
 /* Calculate original stroke center (only first loop). */
 float center[3];
 if (x == 1) {
-  add_v3_v3v3(center, gps->collision_min, gps->collision_max);
+  add_v3_v3v3(center, gps->boundbox_min, gps->boundbox_max);
   mul_v3_fl(center, 0.5f);
   sub_v3_v3v3(center, center, ob->obmat[3]);
 }
diff --git a/source/blender/makesdna/DNA_gpencil_types.h 
b/source/blender/makesdna/DNA_gpencil_types.h
index 409b758d570..1b5d893764f 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -229,10 +229,10 @@ typedef struct bGPDstroke {
   /** Factor of opacity for Fill color (used by opacity modifier). */
   float fill_opacity_fac;
 
-  /** Min of the collision bound box used to speedup painting. */
-  float collision_min[3];
-  /** Max of the collision bound box used to speedup painting. */
-  float collision_max[3];
+  /** Min of the bound box used to speedup painting operators. */
+  float boundbox_min[3];
+  /** Max of the bound box used to speedup painting operators. */
+  float boundbox_max[3];
 
   /** UV rotation */
   float uv_rotation;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org

[Bf-blender-cvs] [4c492acba6c] greasepencil-refactor: GPencil: Fix merge errors

2020-02-07 Thread Antonio Vazquez
Commit: 4c492acba6c0d950c54bc9992c70d0c809f653bc
Author: Antonio Vazquez
Date:   Fri Feb 7 16:46:12 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB4c492acba6c0d950c54bc9992c70d0c809f653bc

GPencil: Fix merge errors

Also, the modiifer reuse precalculated bounding box data.

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index 2014c965e6c..ab621a966a7 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -229,17 +229,15 @@ static void generate_geometry(GpencilModifierData *md,
   /* check if stroke can be duplicated */
   if (valid_strokes[idx]) {
 /* Calculate original stroke center (only first loop). */
-float r_min[3], r_max[3], center[3];
+float center[3];
 if (x == 1) {
-  INIT_MINMAX(r_min, r_max);
-  BKE_gpencil_stroke_minmax(gps, false, r_min, r_max);
-  add_v3_v3v3(center, r_min, r_max);
+  add_v3_v3v3(center, gps->collision_min, gps->collision_max);
   mul_v3_fl(center, 0.5f);
   sub_v3_v3v3(center, center, ob->obmat[3]);
 }
 
 /* Duplicate stroke */
-bGPDstroke *gps_dst = BKE_gpencil_stroke_duplicate(gps);
+bGPDstroke *gps_dst = BKE_gpencil_stroke_duplicate(gps, true);
 
 /* Move points */
 for (int i = 0; i < gps->totpoints; i++) {

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


[Bf-blender-cvs] [974eca79d3c] master: Cleanup: Animation, split driver evaluation into separate functions

2020-02-07 Thread Sybren A. Stüvel
Commit: 974eca79d3cc568a327de8298634661550abbffa
Author: Sybren A. Stüvel
Date:   Fri Feb 7 14:26:26 2020 +0100
Branches: master
https://developer.blender.org/rB974eca79d3cc568a327de8298634661550abbffa

Cleanup: Animation, split driver evaluation into separate functions

No functional changes.

===

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

===

diff --git a/source/blender/blenkernel/intern/fcurve.c 
b/source/blender/blenkernel/intern/fcurve.c
index 254142fabab..251c6421d66 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2354,6 +2354,98 @@ float driver_get_variable_value(ChannelDriver *driver, 
DriverVar *dvar)
   return dvar->curval;
 }
 
+static void evaluate_driver_sum(ChannelDriver *driver)
+{
+  DriverVar *dvar;
+
+  /* check how many variables there are first (i.e. just one?) */
+  if (BLI_listbase_is_single(>variables)) {
+/* just one target, so just use that */
+dvar = driver->variables.first;
+driver->curval = driver_get_variable_value(driver, dvar);
+return;
+  }
+
+  /* more than one target, so average the values of the targets */
+  float value = 0.0f;
+  int tot = 0;
+
+  /* loop through targets, adding (hopefully we don't get any overflow!) */
+  for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
+value += driver_get_variable_value(driver, dvar);
+tot++;
+  }
+
+  /* perform operations on the total if appropriate */
+  if (driver->type == DRIVER_TYPE_AVERAGE) {
+driver->curval = tot ? (value / (float)tot) : 0.0f;
+  }
+  else {
+driver->curval = value;
+  }
+}
+
+static void evaluate_driver_min_max(ChannelDriver *driver)
+{
+  DriverVar *dvar;
+  float value = 0.0f;
+
+  /* loop through the variables, getting the values and comparing them to 
existing ones */
+  for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
+/* get value */
+float tmp_val = driver_get_variable_value(driver, dvar);
+
+/* store this value if appropriate */
+if (dvar->prev) {
+  /* check if greater/smaller than the baseline */
+  if (driver->type == DRIVER_TYPE_MAX) {
+/* max? */
+if (tmp_val > value) {
+  value = tmp_val;
+}
+  }
+  else {
+/* min? */
+if (tmp_val < value) {
+  value = tmp_val;
+}
+  }
+}
+else {
+  /* first item - make this the baseline for comparisons */
+  value = tmp_val;
+}
+  }
+
+  /* store value in driver */
+  driver->curval = value;
+}
+
+static void evaluate_driver_python(PathResolvedRNA *anim_rna,
+   ChannelDriver *driver,
+   ChannelDriver *driver_orig,
+   const float evaltime)
+{
+  /* check for empty or invalid expression */
+  if ((driver_orig->expression[0] == '\0') || (driver_orig->flag & 
DRIVER_FLAG_INVALID)) {
+driver->curval = 0.0f;
+  }
+  else if (!driver_try_evaluate_simple_expr(driver, driver_orig, 
>curval, evaltime)) {
+#ifdef WITH_PYTHON
+/* this evaluates the expression using Python, and returns its result:
+ * - on errors it reports, then returns 0.0f
+ */
+BLI_mutex_lock(_driver_lock);
+
+driver->curval = BPY_driver_exec(anim_rna, driver, driver_orig, evaltime);
+
+BLI_mutex_unlock(_driver_lock);
+#else  /* WITH_PYTHON*/
+UNUSED_VARS(anim_rna, evaltime);
+#endif /* WITH_PYTHON*/
+  }
+}
+
 /* Evaluate an Channel-Driver to get a 'time' value to use instead of 
"evaltime"
  * - "evaltime" is the frame at which F-Curve is being evaluated
  * - has to return a float value
@@ -2364,8 +2456,6 @@ float evaluate_driver(PathResolvedRNA *anim_rna,
   ChannelDriver *driver_orig,
   const float evaltime)
 {
-  DriverVar *dvar;
-
   /* check if driver can be evaluated */
   if (driver_orig->flag & DRIVER_FLAG_INVALID) {
 return 0.0f;
@@ -2374,99 +2464,21 @@ float evaluate_driver(PathResolvedRNA *anim_rna,
   switch (driver->type) {
 case DRIVER_TYPE_AVERAGE: /* average values of driver targets */
 case DRIVER_TYPE_SUM: /* sum values of driver targets */
-{
-  /* check how many variables there are first (i.e. just one?) */
-  if (BLI_listbase_is_single(>variables)) {
-/* just one target, so just use that */
-dvar = driver->variables.first;
-driver->curval = driver_get_variable_value(driver, dvar);
-  }
-  else {
-/* more than one target, so average the values of the targets */
-float value = 0.0f;
-int tot = 0;
-
-/* loop through targets, adding (hopefully we don't get any overflow!) 
*/
-for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
-  value += driver_get_variable_value(driver, dvar);
-  tot++;
-}
-
-/* 

[Bf-blender-cvs] [41ada0381c3] master: Cleanup: Animation, reduce indentation by reordering conditions

2020-02-07 Thread Sybren A. Stüvel
Commit: 41ada0381c3b32eaa6c5508a65ed98f2bb391f61
Author: Sybren A. Stüvel
Date:   Fri Feb 7 14:02:11 2020 +0100
Branches: master
https://developer.blender.org/rB41ada0381c3b32eaa6c5508a65ed98f2bb391f61

Cleanup: Animation, reduce indentation by reordering conditions

This turns error condition checks into precondition checks, grouping the
non-error functionality together towards the bottom of the function and
error-handling functionality towards the top.

No functional changes.

===

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

===

diff --git a/source/blender/blenkernel/intern/fcurve.c 
b/source/blender/blenkernel/intern/fcurve.c
index 5708cb0379b..254142fabab 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1320,60 +1320,7 @@ static float dtar_get_prop_val(ChannelDriver *driver, 
DriverTarget *dtar)
   RNA_id_pointer_create(id, _ptr);
 
   /* get property to read from, and get value as appropriate */
-  if (RNA_path_resolve_property_full(_ptr, dtar->rna_path, , , 
)) {
-if (RNA_property_array_check(prop)) {
-  /* array */
-  if ((index >= 0) && (index < RNA_property_array_length(, prop))) {
-switch (RNA_property_type(prop)) {
-  case PROP_BOOLEAN:
-value = (float)RNA_property_boolean_get_index(, prop, index);
-break;
-  case PROP_INT:
-value = (float)RNA_property_int_get_index(, prop, index);
-break;
-  case PROP_FLOAT:
-value = RNA_property_float_get_index(, prop, index);
-break;
-  default:
-break;
-}
-  }
-  else {
-/* out of bounds */
-if (G.debug & G_DEBUG) {
-  CLOG_ERROR(,
- "Driver Evaluation Error: array index is out of bounds 
for %s -> %s (%d)",
- id->name,
- dtar->rna_path,
- index);
-}
-
-driver->flag |= DRIVER_FLAG_INVALID;
-dtar->flag |= DTAR_FLAG_INVALID;
-return 0.0f;
-  }
-}
-else {
-  /* not an array */
-  switch (RNA_property_type(prop)) {
-case PROP_BOOLEAN:
-  value = (float)RNA_property_boolean_get(, prop);
-  break;
-case PROP_INT:
-  value = (float)RNA_property_int_get(, prop);
-  break;
-case PROP_FLOAT:
-  value = RNA_property_float_get(, prop);
-  break;
-case PROP_ENUM:
-  value = (float)RNA_property_enum_get(, prop);
-  break;
-default:
-  break;
-  }
-}
-  }
-  else {
+  if (!RNA_path_resolve_property_full(_ptr, dtar->rna_path, , , 
)) {
 /* path couldn't be resolved */
 if (G.debug & G_DEBUG) {
   CLOG_ERROR(,
@@ -1387,6 +1334,57 @@ static float dtar_get_prop_val(ChannelDriver *driver, 
DriverTarget *dtar)
 return 0.0f;
   }
 
+  if (RNA_property_array_check(prop)) {
+/* array */
+if (index < 0 || index >= RNA_property_array_length(, prop)) {
+  /* out of bounds */
+  if (G.debug & G_DEBUG) {
+CLOG_ERROR(,
+   "Driver Evaluation Error: array index is out of bounds for 
%s -> %s (%d)",
+   id->name,
+   dtar->rna_path,
+   index);
+  }
+
+  driver->flag |= DRIVER_FLAG_INVALID;
+  dtar->flag |= DTAR_FLAG_INVALID;
+  return 0.0f;
+}
+
+switch (RNA_property_type(prop)) {
+  case PROP_BOOLEAN:
+value = (float)RNA_property_boolean_get_index(, prop, index);
+break;
+  case PROP_INT:
+value = (float)RNA_property_int_get_index(, prop, index);
+break;
+  case PROP_FLOAT:
+value = RNA_property_float_get_index(, prop, index);
+break;
+  default:
+break;
+}
+  }
+  else {
+/* not an array */
+switch (RNA_property_type(prop)) {
+  case PROP_BOOLEAN:
+value = (float)RNA_property_boolean_get(, prop);
+break;
+  case PROP_INT:
+value = (float)RNA_property_int_get(, prop);
+break;
+  case PROP_FLOAT:
+value = RNA_property_float_get(, prop);
+break;
+  case PROP_ENUM:
+value = (float)RNA_property_enum_get(, prop);
+break;
+  default:
+break;
+}
+  }
+
   /* if we're still here, we should be ok... */
   dtar->flag &= ~DTAR_FLAG_INVALID;
   return value;

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


[Bf-blender-cvs] [c9ebd5fc16a] greasepencil-refactor: Merge branch 'greasepencil-object' into greasepencil-refactor

2020-02-07 Thread Antonio Vazquez
Commit: c9ebd5fc16a33669dd8b8cc74b52298616ec42f1
Author: Antonio Vazquez
Date:   Fri Feb 7 16:38:21 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBc9ebd5fc16a33669dd8b8cc74b52298616ec42f1

Merge branch 'greasepencil-object' into greasepencil-refactor

 Conflicts:
source/blender/blenloader/intern/readfile.c

===



===

diff --cc source/blender/blenloader/intern/readfile.c
index da2ef97570d,9c7e4a35e1f..37fcf10e553
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -6941,7 -6928,7 +6928,7 @@@ static void lib_link_gpencil(FileData *
  {
/* Relink all data-lock linked by GP data-lock */
/* Layers */
- LISTBASE_FOREACH(bGPDlayer*, gpl, >layers) {
 -  for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
++  LISTBASE_FOREACH (bGPDlayer *, gpl, >layers) {
  /* Layer -> Parent References */
  gpl->parent = newlibadr(fd, gpd->id.lib, gpl->parent);
}
@@@ -10963,11 -10879,7 +10868,7 @@@ static void expand_linestyle(FileData *
  
  static void expand_gpencil(FileData *fd, Main *mainvar, bGPdata *gpd)
  {
-   if (gpd->adt) {
- expand_animdata(fd, mainvar, gpd->adt);
-   }
- 
 -  for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 +  LISTBASE_FOREACH (bGPDlayer *, gpl, >layers) {
  expand_doit(fd, mainvar, gpl->parent);
}

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


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

2020-02-07 Thread Antonio Vazquez
Commit: c0146170af9175120b06416364e021ddbb5f4771
Author: Antonio Vazquez
Date:   Fri Feb 7 16:36:48 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc0146170af9175120b06416364e021ddbb5f4771

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] [677e027f206] master: Fix T73625: GPencil array offset wrong whe use Scale or Rotation

2020-02-07 Thread Antonio Vazquez
Commit: 677e027f2069dac18891db931c860542cbcb4bbe
Author: Antonio Vazquez
Date:   Fri Feb 7 16:35:26 2020 +0100
Branches: master
https://developer.blender.org/rB677e027f2069dac18891db931c860542cbcb4bbe

Fix T73625: GPencil array offset wrong whe use Scale or Rotation

This is not 100% a bug but a design change. The old method used the object 
origin as pivot point for Scale a nd Rotation, so when you moved the stroke in 
edit mode, the whole array ittems where offset because the pivot point distance 
changed.

Now, before applying scale and rotation, the stroke is moved to object origin 
to keep the offset when scale or rotate, so these transformations are done in 
stroke local space.

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index bb70b548675..e258fbdccd1 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -228,24 +228,34 @@ static void generate_geometry(GpencilModifierData *md,
 for (gps = gpf->strokes.first, idx = 0; gps; gps = gps->next, idx++) {
   /* check if stroke can be duplicated */
   if (valid_strokes[idx]) {
-/* Duplicate stroke */
-bGPDstroke *gps_dst = MEM_dupallocN(gps);
-gps_dst->points = MEM_dupallocN(gps->points);
-if (gps->dvert) {
-  gps_dst->dvert = MEM_dupallocN(gps->dvert);
-  BKE_gpencil_stroke_weights_duplicate(gps, gps_dst);
+/* Calculate original stroke center (only first loop). */
+float r_min[3], r_max[3], center[3];
+if (x == 1) {
+  INIT_MINMAX(r_min, r_max);
+  BKE_gpencil_stroke_minmax(gps, false, r_min, r_max);
+  add_v3_v3v3(center, r_min, r_max);
+  mul_v3_fl(center, 0.5f);
+  sub_v3_v3v3(center, center, ob->obmat[3]);
 }
-gps_dst->triangles = MEM_dupallocN(gps->triangles);
+
+/* Duplicate stroke */
+bGPDstroke *gps_dst = BKE_gpencil_stroke_duplicate(gps);
 
 /* Move points */
 for (int i = 0; i < gps->totpoints; i++) {
   bGPDspoint *pt = _dst->points[i];
+  /* Apply object local transform (Rot/Scale). */
   if (mmd->object) {
-/* apply local changes (rot/scale) */
 mul_m4_v3(mat, >x);
   }
-  /* global changes */
-  mul_m4_v3(current_offset, >x);
+  /* Translate to object origin. */
+  float fpt[3];
+  sub_v3_v3v3(fpt, >x, center);
+  /* Global Rotate and scale. */
+  mul_mat3_m4_v3(current_offset, fpt);
+  /* Global translate. */
+  add_v3_v3(fpt, center);
+  add_v3_v3v3(>x, fpt, current_offset[3]);
 }
 
 /* if replace material, use new one */

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


[Bf-blender-cvs] [faf08954d57] master: Cleanup: Rename `BKE_library_idmap` file to `BKE_main_idmap`

2020-02-07 Thread Bastien Montagne
Commit: faf08954d572c84d42de074effbca02fee3b27df
Author: Bastien Montagne
Date:   Fri Feb 7 16:29:02 2020 +0100
Branches: master
https://developer.blender.org/rBfaf08954d572c84d42de074effbca02fee3b27df

Cleanup: Rename `BKE_library_idmap` file to `BKE_main_idmap`

Part of T72604:
> Proposal: BKE_library and BKE_main API naming: prefixes conventions

===

R094source/blender/blenkernel/BKE_library_idmap.h   
source/blender/blenkernel/BKE_main_idmap.h
M   source/blender/blenkernel/CMakeLists.txt
R099source/blender/blenkernel/intern/library_idmap.c
source/blender/blenkernel/intern/main_idmap.c
M   source/blender/blenloader/intern/readfile.c

===

diff --git a/source/blender/blenkernel/BKE_library_idmap.h 
b/source/blender/blenkernel/BKE_main_idmap.h
similarity index 94%
rename from source/blender/blenkernel/BKE_library_idmap.h
rename to source/blender/blenkernel/BKE_main_idmap.h
index 0285699dea3..d95f32b162a 100644
--- a/source/blender/blenkernel/BKE_library_idmap.h
+++ b/source/blender/blenkernel/BKE_main_idmap.h
@@ -13,8 +13,8 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
-#ifndef __BKE_LIBRARY_IDMAP_H__
-#define __BKE_LIBRARY_IDMAP_H__
+#ifndef __BKE_MAIN_IDMAP_H__
+#define __BKE_MAIN_IDMAP_H__
 
 /** \file
  * \ingroup bke
@@ -42,4 +42,4 @@ struct ID *BKE_main_idmap_lookup_id(struct IDNameLib_Map 
*id_typemap,
 const struct ID *id) 
ATTR_WARN_UNUSED_RESULT
 ATTR_NONNULL(1, 2);
 
-#endif /* __BKE_LIBRARY_IDMAP_H__ */
+#endif /* __BKE_MAIN_IDMAP_H__ */
diff --git a/source/blender/blenkernel/CMakeLists.txt 
b/source/blender/blenkernel/CMakeLists.txt
index 0aa4f0fe677..2f839aafa2c 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -136,7 +136,6 @@ set(SRC
   intern/layer.c
   intern/layer_utils.c
   intern/library.c
-  intern/library_idmap.c
   intern/library_override.c
   intern/library_query.c
   intern/library_remap.c
@@ -144,6 +143,7 @@ set(SRC
   intern/lightprobe.c
   intern/linestyle.c
   intern/main.c
+  intern/main_idmap.c
   intern/mask.c
   intern/mask_evaluate.c
   intern/mask_rasterize.c
@@ -299,7 +299,6 @@ set(SRC
   BKE_lattice.h
   BKE_layer.h
   BKE_library.h
-  BKE_library_idmap.h
   BKE_library_override.h
   BKE_library_query.h
   BKE_library_remap.h
@@ -307,6 +306,7 @@ set(SRC
   BKE_lightprobe.h
   BKE_linestyle.h
   BKE_main.h
+  BKE_main_idmap.h
   BKE_mask.h
   BKE_material.h
   BKE_mball.h
diff --git a/source/blender/blenkernel/intern/library_idmap.c 
b/source/blender/blenkernel/intern/main_idmap.c
similarity index 99%
rename from source/blender/blenkernel/intern/library_idmap.c
rename to source/blender/blenkernel/intern/main_idmap.c
index ab0ff5b0096..a210961b212 100644
--- a/source/blender/blenkernel/intern/library_idmap.c
+++ b/source/blender/blenkernel/intern/main_idmap.c
@@ -26,8 +26,8 @@
 #include "DNA_ID.h"
 
 #include "BKE_idcode.h"
-#include "BKE_library_idmap.h" /* own include */
 #include "BKE_main.h"
+#include "BKE_main_idmap.h" /* own include */
 
 /** \file
  * \ingroup bke
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 9547e4cd05a..2ad79b4e252 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -121,7 +121,7 @@
 #include "BKE_idprop.h"
 #include "BKE_layer.h"
 #include "BKE_library.h"
-#include "BKE_library_idmap.h"
+#include "BKE_main_idmap.h"
 #include "BKE_library_override.h"
 #include "BKE_library_query.h"
 #include "BKE_main.h"  // for Main

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


[Bf-blender-cvs] [f4e17b25bd9] libquery-handle-ui-pointers: libquery: add optional handling of 'UI' ID pointers.

2020-02-07 Thread Bastien Montagne
Commit: f4e17b25bd982cec5f693c48143e3dc36aeee649
Author: Bastien Montagne
Date:   Fri Feb 7 16:10:01 2020 +0100
Branches: libquery-handle-ui-pointers
https://developer.blender.org/rBf4e17b25bd982cec5f693c48143e3dc36aeee649

libquery: add optional handling of 'UI' ID pointers.

Handling those through different ways /might/ be needed sometimes, but
in most case this is just a nest of issues, since you can easily forget
to take them into account.

Note that this should be a 'non-functional' change, as this new behavior
is not used anywhere yet.

===

M   source/blender/blenkernel/BKE_library_query.h
M   source/blender/blenkernel/BKE_main.h
M   source/blender/blenkernel/intern/library.c
M   source/blender/blenkernel/intern/library_query.c
M   source/blender/blenkernel/intern/main.c

===

diff --git a/source/blender/blenkernel/BKE_library_query.h 
b/source/blender/blenkernel/BKE_library_query.h
index b959b55b1d6..ab77510b65c 100644
--- a/source/blender/blenkernel/BKE_library_query.h
+++ b/source/blender/blenkernel/BKE_library_query.h
@@ -85,7 +85,8 @@ typedef int (*LibraryIDLinkCallback)(void *user_data,
 enum {
   IDWALK_NOP = 0,
   IDWALK_READONLY = (1 << 0),
-  IDWALK_RECURSE = (1 << 1), /* Also implies IDWALK_READONLY. */
+  IDWALK_RECURSE = (1 << 1),/* Also implies IDWALK_READONLY. */
+  IDWALK_INCLUDE_UI = (1 << 2), /* Include UI pointers (from WM and screens 
editors). */
 
   IDWALK_NO_INDIRECT_PROXY_DATA_USAGE = (1 << 8), /* Ugly special case : */
 };
diff --git a/source/blender/blenkernel/BKE_main.h 
b/source/blender/blenkernel/BKE_main.h
index c48a9cad443..030367fa837 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -66,10 +66,17 @@ typedef struct MainIDRelations {
   struct GHash *id_user_to_used;
   struct GHash *id_used_to_user;
 
+  short flag;
+
   /* Private... */
   struct BLI_mempool *entry_pool;
 } MainIDRelations;
 
+enum {
+  /* Those bmain relations include pointers/usages from editors. */
+  MAINIDRELATIONS_INCLUDE_UI = 1 << 0,
+};
+
 typedef struct Main {
   struct Main *next, *prev;
   char name[1024];   /* 1024 = FILE_MAX */
@@ -142,7 +149,7 @@ void BKE_main_free(struct Main *mainvar);
 void BKE_main_lock(struct Main *bmain);
 void BKE_main_unlock(struct Main *bmain);
 
-void BKE_main_relations_create(struct Main *bmain);
+void BKE_main_relations_create(struct Main *bmain, const short flag);
 void BKE_main_relations_free(struct Main *bmain);
 
 struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset);
diff --git a/source/blender/blenkernel/intern/library.c 
b/source/blender/blenkernel/intern/library.c
index e051dc946cb..405beb1cbd9 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -2041,7 +2041,7 @@ void BKE_main_id_refcount_recompute(struct Main *bmain, 
const bool do_linked_onl
 id,
 id_refcount_recompute_callback,
 POINTER_FROM_INT((int)do_linked_only),
-IDWALK_READONLY);
+IDWALK_READONLY | IDWALK_INCLUDE_UI);
   }
   FOREACH_MAIN_ID_END;
 }
@@ -2147,7 +2147,7 @@ void BKE_library_make_local(Main *bmain,
   TIMEIT_START(make_local);
 #endif
 
-  BKE_main_relations_create(bmain);
+  BKE_main_relations_create(bmain, 0);
 
 #ifdef DEBUG_TIME
   printf("Pre-compute current ID relations: Done.\n");
diff --git a/source/blender/blenkernel/intern/library_query.c 
b/source/blender/blenkernel/intern/library_query.c
index 5fd852ff089..320e3cf9b87 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -44,11 +44,13 @@
 #include "DNA_mask_types.h"
 #include "DNA_node_types.h"
 #include "DNA_object_force_types.h"
+#include "DNA_outliner_types.h"
 #include "DNA_lightprobe_types.h"
 #include "DNA_rigidbody_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_sequence_types.h"
 #include "DNA_screen_types.h"
+#include "DNA_space_types.h"
 #include "DNA_speaker_types.h"
 #include "DNA_sound_types.h"
 #include "DNA_text_types.h"
@@ -357,6 +359,148 @@ static void 
library_foreach_collection(LibraryForeachIDData *data, Collection *c
   FOREACH_FINALIZE_VOID;
 }
 
+static void library_foreach_dopesheet(LibraryForeachIDData *data, bDopeSheet 
*ads)
+{
+  if (ads != NULL) {
+FOREACH_CALLBACK_INVOKE_ID(data, ads->source, IDWALK_CB_NOP);
+FOREACH_CALLBACK_INVOKE(data, ads->filter_grp, IDWALK_CB_NOP);
+  }
+
+  FOREACH_FINALIZE_VOID;
+}
+
+static void library_foreach_screen_area(LibraryForeachIDData *data, ScrArea 
*area)
+{
+  FOREACH_CALLBACK_INVOKE(data, area->full, IDWALK_CB_NOP);
+
+  for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
+switch (sl->spacetype) {
+  

[Bf-blender-cvs] [891fadc071c] undo-experiments: Merge branch 'libquery-handle-ui-pointers' into undo-experiments

2020-02-07 Thread Bastien Montagne
Commit: 891fadc071c5ae24590b1b08d13ebe44b09685dc
Author: Bastien Montagne
Date:   Fri Feb 7 16:14:03 2020 +0100
Branches: undo-experiments
https://developer.blender.org/rB891fadc071c5ae24590b1b08d13ebe44b09685dc

Merge branch 'libquery-handle-ui-pointers' into undo-experiments

===



===



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


[Bf-blender-cvs] [f2df4e0076a] master: Build optimization: Compile glew for size rather than speed with msvc.

2020-02-07 Thread Ray Molenkamp
Commit: f2df4e0076a29a32813f870741b0f89fcbf00eed
Author: Ray Molenkamp
Date:   Fri Feb 7 07:35:17 2020 -0700
Branches: master
https://developer.blender.org/rBf2df4e0076a29a32813f870741b0f89fcbf00eed

Build optimization: Compile glew for size rather than speed with msvc.

Glew.obj is one of the more expensive targets we have to build clocking in
at 34.907 seconds.

The root cause [1] is the msvc inliner is not super thrilled with the
glewIsSupported supported function, this patch changes the buildflags
of extern_glew to optimize for size rather than speed.

Given glew is only in play at initalization time there will be no
performance impact.

Time to build glew.obj

Before: 34.907s
After :  1.961s

[1] 
https://developercommunity.visualstudio.com/content/problem/732941/slow-compilation-of-glewc-for-visual-studio-2019-x.html

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

Reviewers: brecht, sergey, fclem

===

M   extern/glew/CMakeLists.txt

===

diff --git a/extern/glew/CMakeLists.txt b/extern/glew/CMakeLists.txt
index 18ca88e6fec..59f13eb73c7 100644
--- a/extern/glew/CMakeLists.txt
+++ b/extern/glew/CMakeLists.txt
@@ -25,6 +25,16 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES 
"Clang")
   )
 endif()
 
+# MSVC's inliner is not having a happy time with glewIsSupported
+# causing this to be one of the most expensive things to build
+# in blender. Optimize for size rather than speed sidesteps this
+# problem, more details at
+# 
https://developercommunity.visualstudio.com/content/problem/732941/slow-compilation-of-glewc-for-visual-studio-2019-x.html
+
+if(MSVC)
+  add_c_flag("/Os")
+endif()
+
 set(INC
   include
 )

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


[Bf-blender-cvs] [08a4cb0727d] master: Cleanup: `make format`

2020-02-07 Thread Dalai Felinto
Commit: 08a4cb0727d2a176fd541676bf0cabcb6d9541d9
Author: Dalai Felinto
Date:   Fri Feb 7 15:26:35 2020 +0100
Branches: master
https://developer.blender.org/rB08a4cb0727d2a176fd541676bf0cabcb6d9541d9

Cleanup: `make format`

Remember to run `make format` after cleanups/renames/...

===

M   intern/cycles/blender/blender_light.cpp
M   intern/cycles/render/scene.cpp
M   source/blender/blenlib/BLI_math_color_blend.h

===

diff --git a/intern/cycles/blender/blender_light.cpp 
b/intern/cycles/blender/blender_light.cpp
index 5351de2e84b..6f95821e31e 100644
--- a/intern/cycles/blender/blender_light.cpp
+++ b/intern/cycles/blender/blender_light.cpp
@@ -210,4 +210,3 @@ void BlenderSync::sync_background_light(BL::SpaceView3D 
_v3d, bool use_portal)
 }
 
 CCL_NAMESPACE_END
-
diff --git a/intern/cycles/render/scene.cpp b/intern/cycles/render/scene.cpp
index 4f7d886cb10..24469620840 100644
--- a/intern/cycles/render/scene.cpp
+++ b/intern/cycles/render/scene.cpp
@@ -356,8 +356,8 @@ bool Scene::need_update()
 bool Scene::need_data_update()
 {
   return (background->need_update || image_manager->need_update || 
object_manager->need_update ||
-  geometry_manager->need_update || light_manager->need_update || 
lookup_tables->need_update ||
-  integrator->need_update || shader_manager->need_update ||
+  geometry_manager->need_update || light_manager->need_update ||
+  lookup_tables->need_update || integrator->need_update || 
shader_manager->need_update ||
   particle_system_manager->need_update || 
curve_system_manager->need_update ||
   bake_manager->need_update || film->need_update);
 }
diff --git a/source/blender/blenlib/BLI_math_color_blend.h 
b/source/blender/blenlib/BLI_math_color_blend.h
index a3efb5d72e9..47bafff3a49 100644
--- a/source/blender/blenlib/BLI_math_color_blend.h
+++ b/source/blender/blenlib/BLI_math_color_blend.h
@@ -69,9 +69,7 @@ MINLINE void blend_color_overlay_byte(unsigned char dst[4],
 MINLINE void blend_color_hardlight_byte(unsigned char dst[4],
 const uchar src1[4],
 const uchar src2[4]);
-MINLINE void blend_color_burn_byte(unsigned char dst[4],
-   const uchar src1[4],
-   const uchar src2[4]);
+MINLINE void blend_color_burn_byte(unsigned char dst[4], const uchar src1[4], 
const uchar src2[4]);
 MINLINE void blend_color_linearburn_byte(unsigned char dst[4],
  const uchar src1[4],
  const uchar src2[4]);
@@ -102,9 +100,7 @@ MINLINE void blend_color_exclusion_byte(unsigned char 
dst[4],
 MINLINE void blend_color_color_byte(unsigned char dst[4],
 const uchar src1[4],
 const uchar src2[4]);
-MINLINE void blend_color_hue_byte(unsigned char dst[4],
-  const uchar src1[4],
-  const uchar src2[4]);
+MINLINE void blend_color_hue_byte(unsigned char dst[4], const uchar src1[4], 
const uchar src2[4]);
 MINLINE void blend_color_saturation_byte(unsigned char dst[4],
  const uchar src1[4],
  const uchar src2[4]);

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


[Bf-blender-cvs] [6477fcf40f5] master: BuildSystem/Cleanup: Fix warning behaviour regarding library dependencies

2020-02-07 Thread Ray Molenkamp
Commit: 6477fcf40f541bcb8de24aa8023df53775cc7827
Author: Ray Molenkamp
Date:   Fri Feb 7 07:27:40 2020 -0700
Branches: master
https://developer.blender.org/rB6477fcf40f541bcb8de24aa8023df53775cc7827

BuildSystem/Cleanup: Fix warning behaviour regarding library dependencies

Adding USD to a lite build fails to build due to boost errors, when you turn
boost on and rebuild still boost errors, boost was silently turned off since
it was not deemed needed. Once boost was forced on, it still fails due to TBB
being off.

This patch fixes:

- The Silent disabling of boost
- Add a check that USD is is not on before doing that
- move the TBB checks to a central location rather than the individual platform 
files
- Add USD to the TBB checks.

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

Reviewers: brecht, sybren

===

M   CMakeLists.txt
M   build_files/cmake/macros.cmake
M   build_files/cmake/platform/platform_apple.cmake
M   build_files/cmake/platform/platform_unix.cmake
M   build_files/cmake/platform/platform_win32.cmake

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 509de9943e2..60656a9e4fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -613,29 +613,25 @@ endif()
 
 # enable boost for cycles, audaspace or i18n
 # otherwise if the user disabled
-if(NOT WITH_BOOST)
-  # Explicitly disabled. so disable all deps.
-  macro(set_and_warn
-_setting _val)
-if(${${_setting}})
-  message(STATUS "'WITH_BOOST' is disabled: forcing 'set(${_setting} 
${_val})'")
-endif()
-set(${_setting} ${_val})
-  endmacro()
-
-  set_and_warn(WITH_CYCLES OFF)
-  set_and_warn(WITH_INTERNATIONAL  OFF)
-  set_and_warn(WITH_OPENVDBOFF)
-  set_and_warn(WITH_OPENCOLORIOOFF)
-  set_and_warn(WITH_QUADRIFLOW OFF)
-elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
-   WITH_OPENVDB OR WITH_OPENCOLORIO)
-  # Keep enabled
-else()
-  # Disable boost if not needed.
+
+set_and_warn_dependency(WITH_BOOST WITH_CYCLES OFF)
+set_and_warn_dependency(WITH_BOOST WITH_INTERNATIONAL  OFF)
+set_and_warn_dependency(WITH_BOOST WITH_OPENVDBOFF)
+set_and_warn_dependency(WITH_BOOST WITH_OPENCOLORIOOFF)
+set_and_warn_dependency(WITH_BOOST WITH_QUADRIFLOW OFF)
+set_and_warn_dependency(WITH_BOOST WITH_USDOFF)
+
+if(NOT (WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
+   WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_USD))
+  message(STATUS "No dependencies need 'WITH_BOOST' forcing WITH_BOOST=OFF")
   set(WITH_BOOST OFF)
 endif()
 
+set_and_warn_dependency(WITH_TBB WITH_USD   OFF)
+set_and_warn_dependency(WITH_TBB WITH_OPENIMAGEDENOISE  OFF)
+set_and_warn_dependency(WITH_TBB WITH_OPENVDB   OFF)
+set_and_warn_dependency(WITH_TBB WITH_MOD_FLUID OFF)
+
 # auto enable openimageio for cycles
 if(WITH_CYCLES)
   set(WITH_OPENIMAGEIO ON)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 2d13476f09a..daf156bc3f2 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1157,3 +1157,13 @@ macro(blender_precompile_headers target cpp header)
 set_source_files_properties(${cpp} PROPERTIES COMPILE_FLAGS "/Yc${header} 
/Fp${pchfinal}")
   endif()
 endmacro()
+
+macro(set_and_warn_dependency
+_dependency _setting _val)
+# when $_dependency is disabled, forces $_setting = $_val
+if(NOT ${${_dependency}} AND ${${_setting}})
+  message(STATUS "'${_dependency}' is disabled: forcing 'set(${_setting} 
${_val})'")
+  set(${_setting} ${_val})
+endif()
+endmacro()
+
diff --git a/build_files/cmake/platform/platform_apple.cmake 
b/build_files/cmake/platform/platform_apple.cmake
index a4de3876243..b231a2b6fa4 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -398,21 +398,6 @@ if(WITH_TBB)
   find_package(TBB)
 endif()
 
-if(NOT WITH_TBB OR NOT TBB_FOUND)
-  if(WITH_OPENIMAGEDENOISE)
-message(STATUS "TBB not found, disabling OpenImageDenoise")
-set(WITH_OPENIMAGEDENOISE OFF)
-  endif()
-  if(WITH_OPENVDB)
-message(STATUS "TBB not found, disabling OpenVDB")
-set(WITH_OPENVDB OFF)
-  endif()
-  if(WITH_MOD_FLUID)
-message(STATUS "TBB not found, disabling Fluid modifier")
-set(WITH_MOD_FLUID OFF)
-  endif()
-endif()
-
 # CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide 
custom flags.
 if(WITH_OPENMP)
   if(CMAKE_C_COMPILER_ID MATCHES "AppleClang" AND CMAKE_C_COMPILER_VERSION 
VERSION_GREATER_EQUAL "7.0")
diff --git a/build_files/cmake/platform/platform_unix.cmake 
b/build_files/cmake/platform/platform_unix.cmake
index 2f9f39b46d9..91f836d5265 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -448,17 +448,6 @@ if(WITH_TBB)
   

[Bf-blender-cvs] [1a93bc2db87] master: Merge branch 'blender-v2.82-release'

2020-02-07 Thread Sebastián Barschkis
Commit: 1a93bc2db874b10054ad2814dff5705ce751963a
Author: Sebastián Barschkis
Date:   Fri Feb 7 15:21:26 2020 +0100
Branches: master
https://developer.blender.org/rB1a93bc2db874b10054ad2814dff5705ce751963a

Merge branch 'blender-v2.82-release'

===



===



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


[Bf-blender-cvs] [ffcccf654c8] blender-v2.82-release: OpenVDB: Added missing macros in fluid wrapper file

2020-02-07 Thread Sebastián Barschkis
Commit: ffcccf654c8e05f464c59fad82404833160f5b85
Author: Sebastián Barschkis
Date:   Fri Feb 7 15:19:17 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rBffcccf654c8e05f464c59fad82404833160f5b85

OpenVDB: Added missing macros in fluid wrapper file

These were needed to compile when WITH_FLUID=1 and WITH_OPENVDB=0.

===

M   intern/mantaflow/intern/MANTA_main.cpp

===

diff --git a/intern/mantaflow/intern/MANTA_main.cpp 
b/intern/mantaflow/intern/MANTA_main.cpp
index c0c7ef5dbf2..2cbf058d8de 100644
--- a/intern/mantaflow/intern/MANTA_main.cpp
+++ b/intern/mantaflow/intern/MANTA_main.cpp
@@ -2798,8 +2798,10 @@ int MANTA::updateGridFromFile(const char *filename, 
float *grid)
 
 if (extension.compare("uni") == 0)
   return updateGridFromUni(filename, grid);
+#ifdef WITH_OPENVDB
 else if (extension.compare("vdb") == 0)
   return updateGridFromVDB(filename, grid);
+#endif
 else if (extension.compare("raw") == 0)
   return updateGridFromRaw(filename, grid);
 else
@@ -2884,6 +2886,7 @@ int MANTA::updateGridFromUni(const char *filename, float 
*grid)
   return 1;
 }
 
+#ifdef WITH_OPENVDB
 int MANTA::updateGridFromVDB(const char *filename, float *grid)
 {
   if (with_debug)
@@ -2922,6 +2925,7 @@ int MANTA::updateGridFromVDB(const char *filename, float 
*grid)
   }
   return 1;
 }
+#endif
 
 int MANTA::updateGridFromRaw(const char *filename, float *grid)
 {

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


[Bf-blender-cvs] [6f3e498e7d5] master: Cleanup: use of 'unsigned'

2020-02-07 Thread Campbell Barton
Commit: 6f3e498e7d5e0c772ef795e7301dd332bccada22
Author: Campbell Barton
Date:   Sat Feb 8 01:02:18 2020 +1100
Branches: master
https://developer.blender.org/rB6f3e498e7d5e0c772ef795e7301dd332bccada22

Cleanup: use of 'unsigned'

- Replace 'unsigned' used on it's own with 'uint'.
- Replace 'unsigned const char' with 'const uchar'.

===

M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/BKE_paint.h
M   source/blender/blenkernel/intern/mask_evaluate.c
M   source/blender/blenkernel/intern/mesh.c
M   source/blender/blenkernel/intern/paint.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenlib/BLI_math_color_blend.h
M   source/blender/blenlib/intern/BLI_ghash.c
M   source/blender/blenlib/intern/math_base_inline.c
M   source/blender/blenlib/intern/math_color_blend_inline.c
M   source/blender/blenlib/intern/math_vector.c
M   source/blender/blenlib/intern/string_utf8.c
M   source/blender/bmesh/intern/bmesh_log.c
M   source/blender/bmesh/intern/bmesh_polygon_edgenet.c
M   source/blender/bmesh/intern/bmesh_private.h
M   source/blender/bmesh/operators/bmo_connect.c
M   source/blender/bmesh/operators/bmo_fill_grid.c
M   source/blender/bmesh/operators/bmo_join_triangles.c
M   source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
M   source/blender/collada/MeshImporter.cpp
M   source/blender/editors/include/ED_node.h
M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/interface/view2d.c
M   source/blender/editors/object/object_vgroup.c
M   source/blender/editors/screen/area.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/space_graph/graph_draw.c
M   source/blender/editors/space_image/image_draw.c
M   source/blender/editors/space_node/drawnode.c
M   source/blender/editors/space_node/node_draw.c
M   source/blender/editors/space_outliner/outliner_draw.c
M   source/blender/editors/space_view3d/drawobject.c
M   source/blender/modifiers/intern/MOD_screw.c
M   source/blender/windowmanager/intern/wm_cursors.c

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index 570541eb990..d6934e8a7da 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -91,9 +91,7 @@ struct Mesh *BKE_mesh_from_editmesh_with_coords_thin_wrap(
 float (*vertexCos)[3],
 const struct Mesh *me_settings);
 
-int poly_find_loop_from_vert(const struct MPoly *poly,
- const struct MLoop *loopstart,
- unsigned vert);
+int poly_find_loop_from_vert(const struct MPoly *poly, const struct MLoop 
*loopstart, uint vert);
 int poly_get_adj_loops_from_vert(const struct MPoly *poly,
  const struct MLoop *mloop,
  unsigned int vert,
diff --git a/source/blender/blenkernel/BKE_paint.h 
b/source/blender/blenkernel/BKE_paint.h
index db35fbde2c8..28e564f0fe2 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -194,10 +194,7 @@ bool paint_is_grid_face_hidden(const unsigned int 
*grid_hidden, int gridsize, in
 bool paint_is_bmesh_face_hidden(struct BMFace *f);
 
 /* paint masks */
-float paint_grid_paint_mask(const struct GridPaintMask *gpm,
-unsigned level,
-unsigned x,
-unsigned y);
+float paint_grid_paint_mask(const struct GridPaintMask *gpm, uint level, uint 
x, uint y);
 
 /* stroke related */
 bool paint_calculate_rake_rotation(struct UnifiedPaintSettings *ups,
diff --git a/source/blender/blenkernel/intern/mask_evaluate.c 
b/source/blender/blenkernel/intern/mask_evaluate.c
index f4f93fcb698..cb8b3b5ecc9 100644
--- a/source/blender/blenkernel/intern/mask_evaluate.c
+++ b/source/blender/blenkernel/intern/mask_evaluate.c
@@ -198,7 +198,7 @@ float 
(*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline,
 float (*BKE_mask_spline_differentiate(
 MaskSpline *spline, int width, int height, unsigned int 
*tot_diff_point))[2]
 {
-  int unsigned resol = BKE_mask_spline_resolution(spline, width, height);
+  uint resol = BKE_mask_spline_resolution(spline, width, height);
 
   return BKE_mask_spline_differentiate_with_resolution(spline, tot_diff_point, 
resol);
 }
diff --git a/source/blender/blenkernel/intern/mesh.c 
b/source/blender/blenkernel/intern/mesh.c
index 3835e405630..098da997d8f 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -1200,7 +1200,7 @@ void BKE_mesh_smooth_flag_set(Mesh *me, const bool 
use_smooth)
  * Find the index of the loop in 'poly' which references vertex,
  * returns -1 if not found
  */
-int 

[Bf-blender-cvs] [80415ee2031] master: Cleanup: remove legacy OpenGL viewport clipping code

2020-02-07 Thread Campbell Barton
Commit: 80415ee2031f1b1b9ef38774fa9a297f7a5018aa
Author: Campbell Barton
Date:   Sat Feb 8 00:38:40 2020 +1100
Branches: master
https://developer.blender.org/rB80415ee2031f1b1b9ef38774fa9a297f7a5018aa

Cleanup: remove legacy OpenGL viewport clipping code

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_draw.c 
b/source/blender/editors/space_view3d/view3d_draw.c
index 6704fc9908f..d092de4fcce 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1947,45 +1947,23 @@ bool ED_view3d_clipping_test(const RegionView3D *rv3d, 
const float co[3], const
   return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip);
 }
 
-/* Legacy 2.7x, now use shaders that use clip distance instead.
- * Remove once clipping is working properly. */
-#define USE_CLIP_PLANES
-
-void ED_view3d_clipping_set(RegionView3D *rv3d)
+void ED_view3d_clipping_set(RegionView3D *UNUSED(rv3d))
 {
-#ifdef USE_CLIP_PLANES
-  double plane[4];
-  const uint tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6;
-
-  for (unsigned a = 0; a < tot; a++) {
-copy_v4db_v4fl(plane, rv3d->clip[a]);
-glClipPlane(GL_CLIP_PLANE0 + a, plane);
-glEnable(GL_CLIP_PLANE0 + a);
-glEnable(GL_CLIP_DISTANCE0 + a);
-  }
-#else
-  for (unsigned a = 0; a < 6; a++) {
+  for (uint a = 0; a < 6; a++) {
 glEnable(GL_CLIP_DISTANCE0 + a);
   }
-#endif
 }
 
 /* Use these to temp disable/enable clipping when 'rv3d->rflag & 
RV3D_CLIPPING' is set. */
 void ED_view3d_clipping_disable(void)
 {
-  for (unsigned a = 0; a < 6; a++) {
-#ifdef USE_CLIP_PLANES
-glDisable(GL_CLIP_PLANE0 + a);
-#endif
+  for (uint a = 0; a < 6; a++) {
 glDisable(GL_CLIP_DISTANCE0 + a);
   }
 }
 void ED_view3d_clipping_enable(void)
 {
-  for (unsigned a = 0; a < 6; a++) {
-#ifdef USE_CLIP_PLANES
-glEnable(GL_CLIP_PLANE0 + a);
-#endif
+  for (uint a = 0; a < 6; a++) {
 glEnable(GL_CLIP_DISTANCE0 + a);
   }
 }

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


[Bf-blender-cvs] [91c64b5ca33] master: CodeCleanup: Remove unused studiolight algorithm

2020-02-07 Thread Jeroen Bakker
Commit: 91c64b5ca330e1e940a9b60507b30e7aff54c7be
Author: Jeroen Bakker
Date:   Fri Feb 7 14:19:08 2020 +0100
Branches: master
https://developer.blender.org/rB91c64b5ca330e1e940a9b60507b30e7aff54c7be

CodeCleanup: Remove unused studiolight algorithm

Code was originally added to test a different approach to calculate the
irradiance buffer. The approach was just to slow so we never used it.

This change will remove it from the code base

===

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

===

diff --git a/source/blender/blenkernel/intern/studiolight.c 
b/source/blender/blenkernel/intern/studiolight.c
index 9008348ed3b..4a69fcfa9d0 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -56,17 +56,6 @@ static int last_studiolight_id = 0;
 #define STUDIOLIGHT_IRRADIANCE_EQUIRECT_WIDTH 
(STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT * 2)
 #define STUDIOLIGHT_PASSNAME_DIFFUSE "diffuse"
 #define STUDIOLIGHT_PASSNAME_SPECULAR "specular"
-/*
- * The method to calculate the irradiance buffers
- * The irradiance buffer is only shown in the background when in LookDev.
- *
- * STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE is very slow, but very accurate
- * STUDIOLIGHT_IRRADIANCE_METHOD_SPHERICAL_HARMONICS is faster but has 
artifacts
- * Cannot have both enabled at the same time!!!
- */
-// #define STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
-#define STUDIOLIGHT_IRRADIANCE_METHOD_SPHERICAL_HARMONICS
-
 /* Temporarily disabled due to the creation of textures with -nan(ind)s */
 #define STUDIOLIGHT_SH_WINDOWING 0.0f /* 0.0 is disabled */
 
@@ -1024,40 +1013,6 @@ BLI_INLINE void 
studiolight_evaluate_specular_radiance_buffer(ImBuf *radiance_bu
   madd_v3_v3fl(color, accum, 1.0f / accum_weight);
 }
 
-#ifdef STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
-static void studiolight_irradiance_eval(StudioLight *sl, float color[3], const 
float normal[3])
-{
-  copy_v3_fl(color, 0.0f);
-
-  /* XXX: This is madness, iterating over all cubemap pixels for each 
destination pixels
-   * even if their weight is 0.0f.
-   * It should use hemisphere, cosine sampling at least. */
-
-  /* back */
-  studiolight_evaluate_specular_radiance_buffer(
-  sl->radiance_cubemap_buffers[STUDIOLIGHT_Y_POS], normal, color, 0, 2, 1, 
1);
-  /* front */
-  studiolight_evaluate_specular_radiance_buffer(
-  sl->radiance_cubemap_buffers[STUDIOLIGHT_Y_NEG], normal, color, 0, 2, 1, 
-1);
-
-  /* left */
-  studiolight_evaluate_specular_radiance_buffer(
-  sl->radiance_cubemap_buffers[STUDIOLIGHT_X_POS], normal, color, 1, 2, 0, 
1);
-  /* right */
-  studiolight_evaluate_specular_radiance_buffer(
-  sl->radiance_cubemap_buffers[STUDIOLIGHT_X_NEG], normal, color, 1, 2, 0, 
-1);
-
-  /* top */
-  studiolight_evaluate_specular_radiance_buffer(
-  sl->radiance_cubemap_buffers[STUDIOLIGHT_Z_POS], normal, color, 0, 1, 2, 
1);
-  /* bottom */
-  studiolight_evaluate_specular_radiance_buffer(
-  sl->radiance_cubemap_buffers[STUDIOLIGHT_Z_NEG], normal, color, 0, 1, 2, 
-1);
-
-  mul_v3_fl(color, 1.0 / M_PI);
-}
-#endif
-
 static float brdf_approx(float spec_color, float roughness, float NV)
 {
   /* Very rough own approx. We don't need it to be correct, just fast.
@@ -1185,11 +1140,7 @@ static bool 
studiolight_load_spherical_harmonics_coefficients(StudioLight *sl)
 static void studiolight_calculate_irradiance_equirect_image(StudioLight *sl)
 {
   if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) {
-#ifdef STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
-BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_RADIANCE_BUFFERS_CALCULATED);
-#else
 BKE_studiolight_ensure_flag(sl, 
STUDIOLIGHT_SPHERICAL_HARMONICS_COEFFICIENTS_CALCULATED);
-#endif
 
 float *colbuf = MEM_mallocN(STUDIOLIGHT_IRRADIANCE_EQUIRECT_WIDTH *
 STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT * 
sizeof(float[4]),
@@ -1202,11 +1153,7 @@ static void 
studiolight_calculate_irradiance_equirect_image(StudioLight *sl)
  STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT) {
   float dir[3];
   equirect_to_direction(dir, x, y);
-#ifdef STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
-  studiolight_irradiance_eval(sl, pixel, dir);
-#else
   studiolight_spherical_harmonics_eval(sl, pixel, dir);
-#endif
   pixel[3] = 1.0f;
 }
 ITER_PIXELS_END;
@@ -1217,15 +1164,6 @@ static void 
studiolight_calculate_irradiance_equirect_image(StudioLight *sl)
  
STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT,
  4);
 MEM_freeN(colbuf);
-
-#ifdef STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
-/*
- * Only store cached files when using 
STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
- */
-if (sl->flag & STUDIOLIGHT_USER_DEFINED) {
-  IMB_saveiff(sl->equirect_irradiance_buffer, 

[Bf-blender-cvs] [636fe3df0e9] master: CodeCleanup: Workbench

2020-02-07 Thread Jeroen Bakker
Commit: 636fe3df0e95999d5a2029c913a8812fd95fe25a
Author: Jeroen Bakker
Date:   Fri Feb 7 14:14:50 2020 +0100
Branches: master
https://developer.blender.org/rB636fe3df0e95999d5a2029c913a8812fd95fe25a

CodeCleanup: Workbench

Code was already hidden by a compile directive.

===

M   source/blender/draw/engines/workbench/workbench_forward.c
M   source/blender/draw/engines/workbench/workbench_studiolight.c

===

diff --git a/source/blender/draw/engines/workbench/workbench_forward.c 
b/source/blender/draw/engines/workbench/workbench_forward.c
index fcdf24d2d2f..05494b79af0 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -665,7 +665,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data 
*vedata, Object *ob)
 return;
   }
 
-  WORKBENCH_MaterialData *material;
+  WORKBENCH_MaterialData *material = NULL;
   if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) {
 const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, 
draw_ctx->v3d) &&
  !DRW_state_is_image_render();
diff --git a/source/blender/draw/engines/workbench/workbench_studiolight.c 
b/source/blender/draw/engines/workbench/workbench_studiolight.c
index 941a6741998..1fb0b394cb1 100644
--- a/source/blender/draw/engines/workbench/workbench_studiolight.c
+++ b/source/blender/draw/engines/workbench/workbench_studiolight.c
@@ -69,63 +69,6 @@ void studiolight_update_world(WORKBENCH_PrivateData *wpd,
   }
 
   copy_v3_v3(wd->ambient_color, studiolight->light_ambient);
-
-#if 0
-  BKE_studiolight_ensure_flag(sl, 
STUDIOLIGHT_SPHERICAL_HARMONICS_COEFFICIENTS_CALCULATED);
-
-#  if STUDIOLIGHT_SH_BANDS == 2
-  /* Use Geomerics non-linear SH. */
-  mul_v3_v3fl(wd->spherical_harmonics_coefs[0], 
sl->spherical_harmonics_coefs[0], M_1_PI);
-  /* Swizzle to make shader code simpler. */
-  for (int i = 0; i < 3; i++) {
-copy_v3_fl3(wd->spherical_harmonics_coefs[i + 1],
--sl->spherical_harmonics_coefs[3][i],
-sl->spherical_harmonics_coefs[2][i],
--sl->spherical_harmonics_coefs[1][i]);
-
-/* 1.5f is to improve the contrast a bit. */
-mul_v3_fl(wd->spherical_harmonics_coefs[i + 1], M_1_PI * 1.5f);
-  }
-
-  /* Precompute as much as we can. See shader code for derivation. */
-  float len_r1[3], lr1_r0[3], p[3], a[3];
-  for (int i = 0; i < 3; i++) {
-mul_v3_fl(wd->spherical_harmonics_coefs[i + 1], 0.5f);
-len_r1[i] = len_v3(wd->spherical_harmonics_coefs[i + 1]);
-mul_v3_fl(wd->spherical_harmonics_coefs[i + 1], 1.0f / len_r1[i]);
-  }
-  /* lr1_r0 = lenR1 / R0; */
-  copy_v3_v3(lr1_r0, wd->spherical_harmonics_coefs[0]);
-  invert_v3(lr1_r0);
-  mul_v3_v3(lr1_r0, len_r1);
-  /* p = 1.0 + 2.0 * lr1_r0; */
-  copy_v3_v3(p, lr1_r0);
-  mul_v3_fl(p, 2.0f);
-  add_v3_fl(p, 1.0f);
-  /* a = (1.0 - lr1_r0) / (1.0 + lr1_r0); */
-  copy_v3_v3(a, lr1_r0);
-  add_v3_fl(a, 1.0f);
-  invert_v3(a);
-  negate_v3(lr1_r0);
-  add_v3_fl(lr1_r0, 1.0f);
-  mul_v3_v3(a, lr1_r0);
-  /* sh_coefs[4] = p; */
-  copy_v3_v3(wd->spherical_harmonics_coefs[4], p);
-  /* sh_coefs[5] = R0 * a; */
-  mul_v3_v3v3(wd->spherical_harmonics_coefs[5], 
wd->spherical_harmonics_coefs[0], a);
-  /* sh_coefs[0] = R0 * (1.0 - a) * (p + 1.0); */
-  negate_v3(a);
-  add_v3_fl(a, 1.0f);
-  add_v3_fl(p, 1.0f);
-  mul_v3_v3(a, p);
-  mul_v3_v3(wd->spherical_harmonics_coefs[0], a);
-#  else
-  for (int i = 0; i < STUDIOLIGHT_SH_EFFECTIVE_COEFS_LEN; i++) {
-/* Can't memcpy because of alignment */
-copy_v3_v3(wd->spherical_harmonics_coefs[i], 
sl->spherical_harmonics_coefs[i]);
-  }
-#  endif
-#endif
 }
 
 static void compute_parallel_lines_nor_and_dist(const float v1[2],

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


[Bf-blender-cvs] [b40ac820524] master: Cleanup: transform_convert comment and spacing

2020-02-07 Thread mano-wii
Commit: b40ac820524b1fa7124c38ebd2ac02beb23c048a
Author: mano-wii
Date:   Fri Feb 7 10:02:11 2020 -0300
Branches: master
https://developer.blender.org/rBb40ac820524b1fa7124c38ebd2ac02beb23c048a

Cleanup: transform_convert comment and spacing

===

M   source/blender/editors/transform/transform_convert.h

===

diff --git a/source/blender/editors/transform/transform_convert.h 
b/source/blender/editors/transform/transform_convert.h
index 53ff9952d05..e81a896e062 100644
--- a/source/blender/editors/transform/transform_convert.h
+++ b/source/blender/editors/transform/transform_convert.h
@@ -19,6 +19,7 @@
 
 /** \file
  * \ingroup edtransform
+ * \brief conversion and adaptation of different datablocks to a common struct.
  */
 
 #ifndef __TRANSFORM_CONVERT_H__
@@ -60,28 +61,38 @@ void clipUVData(TransInfo *t);
 
 /* transform_convert_action.c */
 void flushTransIntFrameActionData(TransInfo *t);
+
 /* transform_convert_armature.c */
 void restoreMirrorPoseBones(TransDataContainer *tc);
 void restoreBones(TransDataContainer *tc);
+
 /* transform_convert_graph.c */
 void flushTransGraphData(TransInfo *t);
+
 /* transform_convert_mask.c */
 void flushTransMasking(TransInfo *t);
+
 /* transform_convert_mesh.c */
 void flushTransUVs(TransInfo *t);
 void trans_mesh_customdata_correction_init(TransInfo *t);
 void trans_mesh_customdata_correction_apply(struct TransDataContainer *tc, 
bool is_final);
+
 /* transform_convert_node.c */
 void flushTransNodes(TransInfo *t);
+
 /* transform_convert_object.c */
 void trans_obdata_in_obmode_update_all(struct TransInfo *t);
 void trans_obchild_in_obmode_update_all(struct TransInfo *t);
+
 /* transform_convert_paintcurve.c */
 void flushTransPaintCurve(TransInfo *t);
+
 /* transform_convert_particle.c */
 void flushTransParticles(TransInfo *t);
+
 /* transform_convert_sequencer.c */
 void flushTransSeq(TransInfo *t);
+
 /* transform_convert_tracking.c */
 void flushTransTracking(TransInfo *t);
 
@@ -96,45 +107,62 @@ bool FrameOnMouseSide(char side, float frame, float 
cframe);
 
 /* transform_convert_action.c */
 void createTransActionData(bContext *C, TransInfo *t);
+
 /* transform_convert_armature.c */
 struct bKinematicConstraint *has_targetless_ik(struct bPoseChannel *pchan);
 void createTransPose(TransInfo *t);
 void createTransArmatureVerts(TransInfo *t);
+
 /* transform_convert_cursor.c */
 void createTransCursor_image(TransInfo *t);
 void createTransCursor_view3d(TransInfo *t);
+
 /* transform_convert_curve.c */
 void createTransCurveVerts(TransInfo *t);
+
 /* transform_convert_graph.c */
 void createTransGraphEditData(bContext *C, TransInfo *t);
+
 /* transform_convert_gpencil.c */
 void createTransGPencil(bContext *C, TransInfo *t);
+
 /* transform_convert_lattice.c */
 void createTransLatticeVerts(TransInfo *t);
+
 /* transform_convert_mask.c */
 void createTransMaskingData(bContext *C, TransInfo *t);
+
 /* transform_convert_mball.c */
 void createTransMBallVerts(TransInfo *t);
+
 /* transform_convert_mesh.c */
 void createTransEditVerts(TransInfo *t);
 void createTransEdge(TransInfo *t);
 void createTransUVs(bContext *C, TransInfo *t);
+
 /* transform_convert_nla.c */
 void createTransNlaData(bContext *C, TransInfo *t);
+
 /* transform_convert_node.c */
 void createTransNodeData(bContext *UNUSED(C), TransInfo *t);
+
 /* transform_convert_object.c */
 void clear_trans_object_base_flags(TransInfo *t);
 void createTransObject(bContext *C, TransInfo *t);
 void createTransTexspace(TransInfo *t);
+
 /* transform_convert_paintcurve.c */
 void createTransPaintCurveVerts(bContext *C, TransInfo *t);
+
 /* transform_convert_particle.c */
 void createTransParticleVerts(bContext *C, TransInfo *t);
+
 /* transform_convert_sculpt.c */
 void createTransSculpt(TransInfo *t);
+
 /* transform_convert_sequence.c */
 void createTransSeqData(bContext *C, TransInfo *t);
+
 /* transform_convert_tracking.c */
 void createTransTrackingData(bContext *C, TransInfo *t);
 void cancelTransTracking(TransInfo *t);

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


[Bf-blender-cvs] [ccda7ef9961] master: Cleanup: Animation, match parameter names in declaration with implementation

2020-02-07 Thread Sybren A. Stüvel
Commit: ccda7ef9961314a7e60a3f81bd63171dbde0019c
Author: Sybren A. Stüvel
Date:   Fri Feb 7 13:56:04 2020 +0100
Branches: master
https://developer.blender.org/rBccda7ef9961314a7e60a3f81bd63171dbde0019c

Cleanup: Animation, match parameter names in declaration with implementation

The implementation had more descriptive parameter names, so I copied those
to the declarations.

No functional changes.

===

M   source/blender/blenkernel/BKE_fcurve.h

===

diff --git a/source/blender/blenkernel/BKE_fcurve.h 
b/source/blender/blenkernel/BKE_fcurve.h
index 405b052f477..d389b557503 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -87,7 +87,7 @@ void bezt_add_to_cfra_elem(ListBase *lb, struct BezTriple 
*bezt);
 void fcurve_free_driver(struct FCurve *fcu);
 struct ChannelDriver *fcurve_copy_driver(const struct ChannelDriver *driver);
 
-void driver_variables_copy(struct ListBase *dst_list, const struct ListBase 
*src_list);
+void driver_variables_copy(struct ListBase *dst_vars, const struct ListBase 
*src_vars);
 
 void BKE_driver_target_matrix_to_rot_channels(
 float mat[4][4], int auto_order, int rotation_mode, int channel, bool 
angles, float r_buf[4]);
@@ -280,7 +280,7 @@ struct FCurve *rna_get_fcurve_context_ui(struct bContext *C,
  struct PointerRNA *ptr,
  struct PropertyRNA *prop,
  int rnaindex,
- struct AnimData **r_adt,
+ struct AnimData **r_animdata,
  struct bAction **r_action,
  bool *r_driven,
  bool *r_special);

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


[Bf-blender-cvs] [6dc9f89c6a0] master: Constraint: Fix forced request of evaluated camera

2020-02-07 Thread Sergey Sharybin
Commit: 6dc9f89c6a06f3e7870177c5067f58520c6d275c
Author: Sergey Sharybin
Date:   Fri Feb 7 13:52:01 2020 +0100
Branches: master
https://developer.blender.org/rB6dc9f89c6a06f3e7870177c5067f58520c6d275c

Constraint: Fix forced request of evaluated camera

Constraint stack similarly to modifier stack is fully operate on what
have been given to it, without requesting original or evaluated IDs.
Validness of datablocks passed to constraint stack are to be handled
on dependency graph/evaluation stream levels.

===

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

===

diff --git a/source/blender/blenkernel/intern/constraint.c 
b/source/blender/blenkernel/intern/constraint.c
index a17a09297c5..708d0600e91 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4557,9 +4557,7 @@ static void followtrack_evaluate(bConstraint *con, 
bConstraintOb *cob, ListBase
   MovieTracking *tracking;
   MovieTrackingTrack *track;
   MovieTrackingObject *tracking_object;
-
-  Object *camob_eval = DEG_get_evaluated_object(depsgraph,
-data->camera ? data->camera : 
scene->camera);
+  Object *camob = data->camera ? data->camera : scene->camera;
 
   float ctime = DEG_get_ctime(depsgraph);
   float framenr;
@@ -4568,7 +4566,7 @@ static void followtrack_evaluate(bConstraint *con, 
bConstraintOb *cob, ListBase
 clip = scene->clip;
   }
 
-  if (!clip || !data->track[0] || !camob_eval) {
+  if (!clip || !data->track[0] || !camob) {
 return;
   }
 
@@ -4602,7 +4600,7 @@ static void followtrack_evaluate(bConstraint *con, 
bConstraintOb *cob, ListBase
   if ((tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0) {
 float imat[4][4];
 
-copy_m4_m4(mat, camob_eval->obmat);
+copy_m4_m4(mat, camob->obmat);
 
 BKE_tracking_camera_get_reconstructed_interpolate(
 tracking, tracking_object, framenr, imat);
@@ -4613,7 +4611,7 @@ static void followtrack_evaluate(bConstraint *con, 
bConstraintOb *cob, ListBase
 cob->matrix, track->bundle_pos[0], track->bundle_pos[1], 
track->bundle_pos[2]);
   }
   else {
-BKE_tracking_get_camera_object_matrix(cob->scene, camob_eval, mat);
+BKE_tracking_get_camera_object_matrix(cob->scene, camob, mat);
 
 mul_m4_m4m4(cob->matrix, obmat, mat);
 translate_m4(
@@ -4626,7 +4624,7 @@ static void followtrack_evaluate(bConstraint *con, 
bConstraintOb *cob, ListBase
 float aspect = (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * 
scene->r.yasp);
 float len, d;
 
-BKE_object_where_is_calc_mat4(camob_eval, mat);
+BKE_object_where_is_calc_mat4(camob, mat);
 
 /* camera axis */
 vec[0] = 0.0f;
@@ -4694,7 +4692,7 @@ static void followtrack_evaluate(bConstraint *con, 
bConstraintOb *cob, ListBase
   }
 
   BKE_camera_params_init();
-  BKE_camera_params_from_object(, camob_eval);
+  BKE_camera_params_from_object(, camob);
 
   if (params.is_ortho) {
 vec[0] = params.ortho_scale * (pos[0] - 0.5f + params.shiftx);
@@ -4708,9 +4706,9 @@ static void followtrack_evaluate(bConstraint *con, 
bConstraintOb *cob, ListBase
   vec[0] *= aspect;
 }
 
-mul_v3_m4v3(disp, camob_eval->obmat, vec);
+mul_v3_m4v3(disp, camob->obmat, vec);
 
-copy_m4_m4(rmat, camob_eval->obmat);
+copy_m4_m4(rmat, camob->obmat);
 zero_v3(rmat[3]);
 mul_m4_m4m4(cob->matrix, cob->matrix, rmat);
 
@@ -4730,10 +4728,10 @@ static void followtrack_evaluate(bConstraint *con, 
bConstraintOb *cob, ListBase
   vec[0] *= aspect;
 }
 
-mul_v3_m4v3(disp, camob_eval->obmat, vec);
+mul_v3_m4v3(disp, camob->obmat, vec);
 
 /* apply camera rotation so Z-axis would be co-linear */
-copy_m4_m4(rmat, camob_eval->obmat);
+copy_m4_m4(rmat, camob->obmat);
 zero_v3(rmat[3]);
 mul_m4_m4m4(cob->matrix, cob->matrix, rmat);
 
@@ -4751,7 +4749,7 @@ static void followtrack_evaluate(bConstraint *con, 
bConstraintOb *cob, ListBase
 
   invert_m4_m4(imat, depth_ob->obmat);
 
-  mul_v3_m4v3(ray_start, imat, camob_eval->obmat[3]);
+  mul_v3_m4v3(ray_start, imat, camob->obmat[3]);
   mul_v3_m4v3(ray_end, imat, cob->matrix[3]);
 
   sub_v3_v3v3(ray_nor, ray_end, ray_start);

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


[Bf-blender-cvs] [f81fe8a3a07] master: Cleanup: Tracking, use LISTBASE_FOREACH

2020-02-07 Thread Sergey Sharybin
Commit: f81fe8a3a0711a416091081b5e25256031d94e77
Author: Sergey Sharybin
Date:   Fri Feb 7 12:51:18 2020 +0100
Branches: master
https://developer.blender.org/rBf81fe8a3a0711a416091081b5e25256031d94e77

Cleanup: Tracking, use LISTBASE_FOREACH

Makes loops declaration shorter and cleaner.

===

M   source/blender/blenkernel/intern/tracking.c
M   source/blender/blenkernel/intern/tracking_auto.c
M   source/blender/blenkernel/intern/tracking_solver.c
M   source/blender/blenkernel/intern/tracking_stabilize.c

===

diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index 9caecb73e89..86fb2ab58bc 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -80,7 +80,7 @@ static struct {
 /* Free the whole list of tracks, list's head and tail are set to NULL. */
 static void tracking_tracks_free(ListBase *tracks)
 {
-  for (MovieTrackingTrack *track = tracks->first; track; track = track->next) {
+  LISTBASE_FOREACH (MovieTrackingTrack *, track, tracks) {
 BKE_tracking_track_free(track);
   }
 
@@ -90,8 +90,7 @@ static void tracking_tracks_free(ListBase *tracks)
 /* Free the whole list of plane tracks, list's head and tail are set to NULL. 
*/
 static void tracking_plane_tracks_free(ListBase *plane_tracks)
 {
-  for (MovieTrackingPlaneTrack *plane_track = plane_tracks->first; plane_track;
-   plane_track = plane_track->next) {
+  LISTBASE_FOREACH (MovieTrackingPlaneTrack *, plane_track, plane_tracks) {
 BKE_tracking_plane_track_free(plane_track);
   }
 
@@ -126,7 +125,7 @@ static void tracking_object_free(MovieTrackingObject 
*object)
 static void tracking_objects_free(ListBase *objects)
 {
   /* Free objects contents. */
-  for (MovieTrackingObject *object = objects->first; object; object = 
object->next) {
+  LISTBASE_FOREACH (MovieTrackingObject *, object, objects) {
 tracking_object_free(object);
   }
 
@@ -189,8 +188,7 @@ static void tracking_tracks_copy(ListBase *tracks_dst,
   BLI_listbase_clear(tracks_dst);
   BLI_ghash_clear(tracks_mapping, NULL, NULL);
 
-  for (MovieTrackingTrack *track_src = tracks_src->first; track_src != NULL;
-   track_src = track_src->next) {
+  LISTBASE_FOREACH (MovieTrackingTrack *, track_src, tracks_src) {
 MovieTrackingTrack *track_dst = MEM_dupallocN(track_src);
 if (track_src->markers) {
   track_dst->markers = MEM_dupallocN(track_src->markers);
@@ -213,9 +211,7 @@ static void tracking_plane_tracks_copy(ListBase 
*plane_tracks_list_dst,
 {
   BLI_listbase_clear(plane_tracks_list_dst);
 
-  for (MovieTrackingPlaneTrack *plane_track_src = plane_tracks_list_src->first;
-   plane_track_src != NULL;
-   plane_track_src = plane_track_src->next) {
+  LISTBASE_FOREACH (MovieTrackingPlaneTrack *, plane_track_src, 
plane_tracks_list_src) {
 MovieTrackingPlaneTrack *plane_track_dst = MEM_dupallocN(plane_track_src);
 if (plane_track_src->markers) {
   plane_track_dst->markers = MEM_dupallocN(plane_track_src->markers);
@@ -273,8 +269,7 @@ static void tracking_objects_copy(ListBase *objects_dst,
 {
   BLI_listbase_clear(objects_dst);
 
-  for (MovieTrackingObject *object_src = objects_src->first; object_src != 
NULL;
-   object_src = object_src->next) {
+  LISTBASE_FOREACH (MovieTrackingObject *, object_src, objects_src) {
 MovieTrackingObject *object_dst = MEM_mallocN(sizeof(*object_dst), 
__func__);
 tracking_object_copy(object_dst, object_src, tracks_mapping, flag);
 BLI_addtail(objects_dst, object_dst);
@@ -1172,7 +1167,7 @@ void BKE_tracking_track_deselect(MovieTrackingTrack 
*track, int area)
 
 void BKE_tracking_tracks_deselect_all(ListBase *tracksbase)
 {
-  for (MovieTrackingTrack *track = tracksbase->first; track; track = 
track->next) {
+  LISTBASE_FOREACH (MovieTrackingTrack *, track, tracksbase) {
 if ((track->flag & TRACK_HIDDEN) == 0) {
   BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT);
 }
@@ -1445,15 +1440,14 @@ MovieTrackingPlaneTrack 
*BKE_tracking_plane_track_add(MovieTracking *tracking,
 {
   MovieTrackingPlaneTrack *plane_track;
   MovieTrackingPlaneMarker plane_marker;
-  MovieTrackingTrack *track;
   float tracks_min[2], tracks_max[2];
-  int track_index, num_selected_tracks = 0;
+  int num_selected_tracks = 0;
 
   (void)tracking; /* Ignored. */
 
   /* Use bounding box of selected markers as an initial size of plane. */
   INIT_MINMAX2(tracks_min, tracks_max);
-  for (track = tracks->first; track; track = track->next) {
+  LISTBASE_FOREACH (MovieTrackingTrack *, track, tracks) {
 if (TRACK_SELECTED(track)) {
   MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
   float pattern_min[2], pattern_max[2];
@@ -1481,7 +1475,8 @@ MovieTrackingPlaneTrack 
*BKE_tracking_plane_track_add(MovieTracking *tracking,

[Bf-blender-cvs] [3e738a60d06] master: Cleanup: Tracking, reduce scope of variables

2020-02-07 Thread Sergey Sharybin
Commit: 3e738a60d06acc3ebecc8f4e23bf0262d7b57f3c
Author: Sergey Sharybin
Date:   Fri Feb 7 12:20:05 2020 +0100
Branches: master
https://developer.blender.org/rB3e738a60d06acc3ebecc8f4e23bf0262d7b57f3c

Cleanup: Tracking, reduce scope of variables

===

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

===

diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index 37ca6b1885d..9caecb73e89 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -836,7 +836,7 @@ void BKE_tracking_tracks_join(MovieTracking *tracking,
 
   MovieTrackingMarker *marker_a, *marker_b;
   int start_a = a, start_b = b, len = 0, frame = 
src_track->markers[a].framenr;
-  int j, inverse = 0;
+  int inverse = 0;
 
   inverse = (b == 0) || (dst_track->markers[b - 1].flag & 
MARKER_DISABLED) ||
 (dst_track->markers[b - 1].framenr != frame - 1);
@@ -864,7 +864,7 @@ void BKE_tracking_tracks_join(MovieTracking *tracking,
   b = start_b;
 
   /* linear interpolation for intersecting frames */
-  for (j = 0; j < len; j++) {
+  for (int j = 0; j < len; j++) {
 float fac = 0.5f;
 
 if (len > 1) {
@@ -2897,8 +2897,6 @@ static void 
tracking_dopesheet_channels_calc(MovieTracking *tracking)
   bool show_hidden = (dopesheet->flag & TRACKING_DOPE_SHOW_HIDDEN) != 0;
 
   for (MovieTrackingTrack *track = tracksbase->first; track; track = 
track->next) {
-MovieTrackingDopesheetChannel *channel;
-
 if (!show_hidden && (track->flag & TRACK_HIDDEN) != 0) {
   continue;
 }
@@ -2907,7 +2905,8 @@ static void 
tracking_dopesheet_channels_calc(MovieTracking *tracking)
   continue;
 }
 
-channel = MEM_callocN(sizeof(MovieTrackingDopesheetChannel), "tracking 
dopesheet channel");
+MovieTrackingDopesheetChannel *channel = 
MEM_callocN(sizeof(MovieTrackingDopesheetChannel),
+ "tracking dopesheet 
channel");
 channel->track = track;
 
 if (reconstruction->flag & TRACKING_RECONSTRUCTED) {

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


[Bf-blender-cvs] [dfa7e1cd9f6] master: Cleanup: reduced indentations by returning/continuing early

2020-02-07 Thread Sybren A. Stüvel
Commit: dfa7e1cd9f6d495c6bdf01a140fdc59b0cced38f
Author: Sybren A. Stüvel
Date:   Fri Feb 7 12:58:01 2020 +0100
Branches: master
https://developer.blender.org/rBdfa7e1cd9f6d495c6bdf01a140fdc59b0cced38f

Cleanup: reduced indentations by returning/continuing early

No functional changes.

===

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

===

diff --git a/source/blender/blenkernel/intern/fcurve.c 
b/source/blender/blenkernel/intern/fcurve.c
index 833b8409f7d..5708cb0379b 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -204,29 +204,31 @@ FCurve *id_data_find_fcurve(
 
   RNA_pointer_create(id, type, data, );
   prop = RNA_struct_find_property(, prop_name);
+  if (prop == NULL) {
+return NULL;
+  }
 
-  if (prop) {
-path = RNA_path_from_ID_to_property(, prop);
-
-if (path) {
-  /* animation takes priority over drivers */
-  if ((adt->action) && (adt->action->curves.first)) {
-fcu = list_find_fcurve(>action->curves, path, index);
-  }
+  path = RNA_path_from_ID_to_property(, prop);
+  if (path == NULL) {
+return NULL;
+  }
 
-  /* if not animated, check if driven */
-  if ((fcu == NULL) && (adt->drivers.first)) {
-fcu = list_find_fcurve(>drivers, path, index);
-if (fcu && r_driven) {
-  *r_driven = true;
-}
-fcu = NULL;
-  }
+  /* animation takes priority over drivers */
+  if (adt->action && adt->action->curves.first) {
+fcu = list_find_fcurve(>action->curves, path, index);
+  }
 
-  MEM_freeN(path);
+  /* if not animated, check if driven */
+  if (fcu == NULL && adt->drivers.first) {
+fcu = list_find_fcurve(>drivers, path, index);
+if (fcu && r_driven) {
+  *r_driven = true;
 }
+fcu = NULL;
   }
 
+  MEM_freeN(path);
+
   return fcu;
 }
 
@@ -309,26 +311,28 @@ int list_find_data_fcurves(ListBase *dst,
   /* search each F-Curve one by one */
   for (fcu = src->first; fcu; fcu = fcu->next) {
 /* check if quoted string matches the path */
-if ((fcu->rna_path) && strstr(fcu->rna_path, dataPrefix)) {
-  char *quotedName = BLI_str_quoted_substrN(fcu->rna_path, dataPrefix);
+if (fcu->rna_path == NULL || !strstr(fcu->rna_path, dataPrefix)) {
+  continue;
+}
 
-  if (quotedName) {
-/* check if the quoted name matches the required name */
-if (STREQ(quotedName, dataName)) {
-  LinkData *ld = MEM_callocN(sizeof(LinkData), __func__);
+char *quotedName = BLI_str_quoted_substrN(fcu->rna_path, dataPrefix);
+if (quotedName == NULL) {
+  continue;
+}
 
-  ld->data = fcu;
-  BLI_addtail(dst, ld);
+/* check if the quoted name matches the required name */
+if (STREQ(quotedName, dataName)) {
+  LinkData *ld = MEM_callocN(sizeof(LinkData), __func__);
 
-  matches++;
-}
+  ld->data = fcu;
+  BLI_addtail(dst, ld);
 
-/* always free the quoted string, since it needs freeing */
-MEM_freeN(quotedName);
-  }
+  matches++;
 }
-  }
 
+/* always free the quoted string, since it needs freeing */
+MEM_freeN(quotedName);
+  }
   /* return the number of matches */
   return matches;
 }
@@ -397,53 +401,58 @@ FCurve *rna_get_fcurve_context_ui(bContext *C,
 
 /* Standard F-Curve - Animation (Action) or Drivers */
 while (adt && step--) {
-  if ((adt->action && adt->action->curves.first) || (adt->drivers.first)) {
-/* XXX this function call can become a performance bottleneck */
-if (step) {
-  path = RNA_path_from_ID_to_property(, prop);
-}
+  if ((adt->action == NULL || adt->action->curves.first == NULL) &&
+  (adt->drivers.first == NULL)) {
+continue;
+  }
 
-// XXX: the logic here is duplicated with a function up above
-if (path) {
-  /* animation takes priority over drivers */
-  if (adt->action && adt->action->curves.first) {
-fcu = list_find_fcurve(>action->curves, path, rnaindex);
+  /* XXX this function call can become a performance bottleneck */
+  if (step) {
+path = RNA_path_from_ID_to_property(, prop);
+  }
+  if (path == NULL) {
+continue;
+  }
 
-if (fcu && r_action) {
-  *r_action = adt->action;
-}
-  }
+  // XXX: the logic here is duplicated with a function up above
+  /* animation takes priority over drivers */
+  if (adt->action && adt->action->curves.first) {
+fcu = list_find_fcurve(>action->curves, path, rnaindex);
 
-  /* if not animated, check if driven */
-  if (!fcu && (adt->drivers.first)) {
-fcu = list_find_fcurve(>drivers, path, rnaindex);
+if (fcu && r_action) {
+  *r_action = adt->action;
+}
+  }
 

[Bf-blender-cvs] [04b5b4a914d] new-object-types: Merge branch 'master' into new-object-types

2020-02-07 Thread Brecht Van Lommel
Commit: 04b5b4a914da5c6f213b1005a9281ffde74e7f4f
Author: Brecht Van Lommel
Date:   Fri Feb 7 12:26:24 2020 +0100
Branches: new-object-types
https://developer.blender.org/rB04b5b4a914da5c6f213b1005a9281ffde74e7f4f

Merge branch 'master' into new-object-types

===



===

diff --cc intern/cycles/blender/blender_curves.cpp
index 4da5c8f7101,affd5685337..641f267e2f4
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@@ -594,7 -595,41 +595,7 @@@ static void ExportCurveTriangleGeometry
/* texture coords still needed */
  }
  
- static void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData 
*CData)
 -static void export_hair_motion_validate_attribute(Hair *hair,
 -  int motion_step,
 -  int num_motion_keys,
 -  bool have_motion)
 -{
 -  Attribute *attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
 -  const int num_keys = hair->curve_keys.size();
 -
 -  if (num_motion_keys != num_keys || !have_motion) {
 -/* No motion or hair "topology" changed, remove attributes again. */
 -if (num_motion_keys != num_keys) {
 -  VLOG(1) << "Hair topology changed, removing attribute.";
 -}
 -else {
 -  VLOG(1) << "No motion, removing attribute.";
 -}
 -hair->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
 -  }
 -  else if (motion_step > 0) {
 -VLOG(1) << "Filling in new motion vertex position for motion_step " << 
motion_step;
 -
 -/* Motion, fill up previous steps that we might have skipped because
 - * they had no motion, but we need them anyway now. */
 -for (int step = 0; step < motion_step; step++) {
 -  float4 *mP = attr_mP->data_float4() + step * num_keys;
 -
 -  for (int key = 0; key < num_keys; key++) {
 -mP[key] = float3_to_float4(hair->curve_keys[key]);
 -mP[key].w = hair->curve_radius[key];
 -  }
 -}
 -  }
 -}
 -
+ static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData 
*CData)
  {
int num_keys = 0;
int num_curves = 0;
@@@ -713,43 -748,9 +714,43 @@@ static float4 LerpCurveSegmentMotionCV(
return lerp(mP, mP2, remainder);
  }
  
- static void export_hair_motion_validate_attribute(Mesh *mesh,
++static void export_hair_motion_validate_attribute(Hair *hair,
 +  int motion_step,
 +  int num_motion_keys,
 +  bool have_motion)
 +{
-   Attribute *attr_mP = 
mesh->curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
-   const int num_keys = mesh->curve_keys.size();
++  Attribute *attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
++  const int num_keys = hair->curve_keys.size();
 +
 +  if (num_motion_keys != num_keys || !have_motion) {
 +/* No motion or hair "topology" changed, remove attributes again. */
 +if (num_motion_keys != num_keys) {
 +  VLOG(1) << "Hair topology changed, removing attribute.";
 +}
 +else {
 +  VLOG(1) << "No motion, removing attribute.";
 +}
- mesh->curve_attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
++hair->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
 +  }
 +  else if (motion_step > 0) {
 +VLOG(1) << "Filling in new motion vertex position for motion_step " << 
motion_step;
 +
 +/* Motion, fill up previous steps that we might have skipped because
 + * they had no motion, but we need them anyway now. */
 +for (int step = 0; step < motion_step; step++) {
 +  float4 *mP = attr_mP->data_float4() + step * num_keys;
 +
 +  for (int key = 0; key < num_keys; key++) {
- mP[key] = float3_to_float4(mesh->curve_keys[key]);
- mP[key].w = mesh->curve_radius[key];
++mP[key] = float3_to_float4(hair->curve_keys[key]);
++mP[key].w = hair->curve_radius[key];
 +  }
 +}
 +  }
 +}
 +
- static void ExportCurveSegmentsMotion(Mesh *mesh, ParticleCurveData *CData, 
int motion_step)
+ static void ExportCurveSegmentsMotion(Hair *hair, ParticleCurveData *CData, 
int motion_step)
  {
-   VLOG(1) << "Exporting curve motion segments for mesh " << mesh->name << ", 
motion step "
+   VLOG(1) << "Exporting curve motion segments for hair " << hair->name << ", 
motion step "
<< motion_step;
  
/* find attribute */
@@@ -816,9 -817,9 +817,9 @@@
  }
}
  
 -  /* in case of new attribute, we verify if there really was any motion */
 +  /* In case of new attribute, we verify if there really was any motion. */
if (new_attribute) {
- export_hair_motion_validate_attribute(mesh, motion_step, i, have_motion);
+ export_hair_motion_validate_attribute(hair, motion_step, i, have_motion);
  

[Bf-blender-cvs] [dfaf024449e] new-object-types: Merge branch 'master' into new-object-types

2020-02-07 Thread Brecht Van Lommel
Commit: dfaf024449ed341b3a21b9b86cdc0b20ef083317
Author: Brecht Van Lommel
Date:   Fri Feb 7 12:24:19 2020 +0100
Branches: new-object-types
https://developer.blender.org/rBdfaf024449ed341b3a21b9b86cdc0b20ef083317

Merge branch 'master' into new-object-types

===



===



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


[Bf-blender-cvs] [d809853513c] master: Cleanup: simplify Cycles primitive attribute map storage

2020-02-07 Thread Brecht Van Lommel
Commit: d809853513c1333c9d9a22ab6ba35617b5ed2b8c
Author: Brecht Van Lommel
Date:   Mon Feb 3 21:40:58 2020 +0100
Branches: master
https://developer.blender.org/rBd809853513c1333c9d9a22ab6ba35617b5ed2b8c

Cleanup: simplify Cycles primitive attribute map storage

===

M   intern/cycles/kernel/geom/geom_attribute.h
M   intern/cycles/kernel/geom/geom_motion_curve.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/osl/osl_shader.cpp
M   intern/cycles/render/attribute.cpp
M   intern/cycles/render/attribute.h
M   intern/cycles/render/geometry.cpp
M   intern/cycles/render/hair.cpp
M   intern/cycles/render/mesh.cpp

===

diff --git a/intern/cycles/kernel/geom/geom_attribute.h 
b/intern/cycles/kernel/geom/geom_attribute.h
index 456608bfa22..e1b0e6fb81c 100644
--- a/intern/cycles/kernel/geom/geom_attribute.h
+++ b/intern/cycles/kernel/geom/geom_attribute.h
@@ -29,17 +29,11 @@ ccl_device_inline uint subd_triangle_patch(KernelGlobals 
*kg, const ShaderData *
 
 ccl_device_inline uint attribute_primitive_type(KernelGlobals *kg, const 
ShaderData *sd)
 {
-#ifdef __HAIR__
-  if (sd->type & PRIMITIVE_ALL_CURVE) {
-return ATTR_PRIM_CURVE;
-  }
-  else
-#endif
-  if (subd_triangle_patch(kg, sd) != ~0) {
+  if ((sd->type & PRIMITIVE_ALL_TRIANGLE) && subd_triangle_patch(kg, sd) != 
~0) {
 return ATTR_PRIM_SUBD;
   }
   else {
-return ATTR_PRIM_TRIANGLE;
+return ATTR_PRIM_GEOMETRY;
   }
 }
 
diff --git a/intern/cycles/kernel/geom/geom_motion_curve.h 
b/intern/cycles/kernel/geom/geom_motion_curve.h
index 7380c506bf4..0e2a00e9d2e 100644
--- a/intern/cycles/kernel/geom/geom_motion_curve.h
+++ b/intern/cycles/kernel/geom/geom_motion_curve.h
@@ -36,7 +36,7 @@ ccl_device_inline int 
find_attribute_curve_motion(KernelGlobals *kg,
* zero iterations and rendering is really slow with motion curves. For 
until other
* areas are speed up it's probably not so crucial to optimize this out.
*/
-  uint attr_offset = object_attribute_map_offset(kg, object) + ATTR_PRIM_CURVE;
+  uint attr_offset = object_attribute_map_offset(kg, object) + 
ATTR_PRIM_GEOMETRY;
   uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
 
   while (attr_map.x != id) {
diff --git a/intern/cycles/kernel/kernel_types.h 
b/intern/cycles/kernel/kernel_types.h
index 1e1d161ff9b..bf34450df4b 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -725,9 +725,8 @@ typedef enum PrimitiveType {
 /* Attributes */
 
 typedef enum AttributePrimitive {
-  ATTR_PRIM_TRIANGLE = 0,
+  ATTR_PRIM_GEOMETRY = 0,
   ATTR_PRIM_SUBD,
-  ATTR_PRIM_CURVE,
 
   ATTR_PRIM_TYPES
 } AttributePrimitive;
diff --git a/intern/cycles/kernel/osl/osl_shader.cpp 
b/intern/cycles/kernel/osl/osl_shader.cpp
index db5ad06d3fc..0994bfaf950 100644
--- a/intern/cycles/kernel/osl/osl_shader.cpp
+++ b/intern/cycles/kernel/osl/osl_shader.cpp
@@ -382,10 +382,6 @@ int OSLShader::find_attribute(KernelGlobals *kg,
 {
   /* for OSL, a hash map is used to lookup the attribute by name. */
   int object = sd->object * ATTR_PRIM_TYPES;
-#ifdef __HAIR__
-  if (sd->type & PRIMITIVE_ALL_CURVE)
-object += ATTR_PRIM_CURVE;
-#endif
 
   OSLGlobals::AttributeMap _map = kg->osl->attribute_map[object];
   ustring stdname(std::string("geom:") +
diff --git a/intern/cycles/render/attribute.cpp 
b/intern/cycles/render/attribute.cpp
index fcba901ae6c..05c0b5693bc 100644
--- a/intern/cycles/render/attribute.cpp
+++ b/intern/cycles/render/attribute.cpp
@@ -193,7 +193,7 @@ size_t Attribute::element_size(Geometry *geom, 
AttributePrimitive prim) const
 case ATTR_ELEMENT_FACE:
   if (geom->type == Geometry::MESH) {
 Mesh *mesh = static_cast(geom);
-if (prim == ATTR_PRIM_TRIANGLE) {
+if (prim == ATTR_PRIM_GEOMETRY) {
   size = mesh->num_triangles();
 }
 else {
@@ -205,7 +205,7 @@ size_t Attribute::element_size(Geometry *geom, 
AttributePrimitive prim) const
 case ATTR_ELEMENT_CORNER_BYTE:
   if (geom->type == Geometry::MESH) {
 Mesh *mesh = static_cast(geom);
-if (prim == ATTR_PRIM_TRIANGLE) {
+if (prim == ATTR_PRIM_GEOMETRY) {
   size = mesh->num_triangles() * 3;
 }
 else {
@@ -390,11 +390,9 @@ void Attribute::get_uv_tiles(Geometry *geom,
 
 /* Attribute Set */
 
-AttributeSet::AttributeSet()
+AttributeSet::AttributeSet(Geometry *geometry, AttributePrimitive prim)
+: geometry(geometry), prim(prim)
 {
-  triangle_mesh = NULL;
-  subd_mesh = NULL;
-  hair = NULL;
 }
 
 AttributeSet::~AttributeSet()
@@ -428,12 +426,7 @@ Attribute *AttributeSet::add(ustring name, TypeDesc type, 
AttributeElement eleme
 #endif
 
   /* this is weak .. */
-  if (triangle_mesh)
-attr->resize(triangle_mesh, ATTR_PRIM_TRIANGLE, false);
-  if (subd_mesh)
-attr->resize(subd_mesh, 

[Bf-blender-cvs] [d9c5f0d25fc] master: Cleanup: split Cycles Hair and Mesh classes, with Geometry base class

2020-02-07 Thread Brecht Van Lommel
Commit: d9c5f0d25fc91b069158ae1ab4fddc21bfd85846
Author: Brecht Van Lommel
Date:   Sun Feb 2 12:04:19 2020 +0100
Branches: master
https://developer.blender.org/rBd9c5f0d25fc91b069158ae1ab4fddc21bfd85846

Cleanup: split Cycles Hair and Mesh classes, with Geometry base class

===

M   intern/cycles/app/cycles_xml.cpp
M   intern/cycles/blender/blender_curves.cpp
M   intern/cycles/blender/blender_geometry.cpp
M   intern/cycles/blender/blender_id_map.h
M   intern/cycles/blender/blender_light.cpp
M   intern/cycles/blender/blender_mesh.cpp
M   intern/cycles/blender/blender_object.cpp
M   intern/cycles/blender/blender_particles.cpp
M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/blender/blender_shader.cpp
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_sync.h
M   intern/cycles/bvh/bvh.cpp
M   intern/cycles/bvh/bvh.h
M   intern/cycles/bvh/bvh2.cpp
M   intern/cycles/bvh/bvh2.h
M   intern/cycles/bvh/bvh4.cpp
M   intern/cycles/bvh/bvh4.h
M   intern/cycles/bvh/bvh8.cpp
M   intern/cycles/bvh/bvh8.h
M   intern/cycles/bvh/bvh_build.cpp
M   intern/cycles/bvh/bvh_build.h
M   intern/cycles/bvh/bvh_embree.cpp
M   intern/cycles/bvh/bvh_embree.h
M   intern/cycles/bvh/bvh_optix.cpp
M   intern/cycles/bvh/bvh_optix.h
M   intern/cycles/bvh/bvh_params.h
M   intern/cycles/bvh/bvh_split.cpp
M   intern/cycles/bvh/bvh_split.h
M   intern/cycles/bvh/bvh_unaligned.cpp
M   intern/cycles/device/device_optix.cpp
M   intern/cycles/graph/node_type.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/render/CMakeLists.txt
M   intern/cycles/render/attribute.cpp
M   intern/cycles/render/attribute.h
M   intern/cycles/render/bake.cpp
M   intern/cycles/render/camera.cpp
M   intern/cycles/render/film.cpp
A   intern/cycles/render/geometry.cpp
A   intern/cycles/render/geometry.h
A   intern/cycles/render/hair.cpp
A   intern/cycles/render/hair.h
M   intern/cycles/render/light.cpp
M   intern/cycles/render/mesh.cpp
M   intern/cycles/render/mesh.h
M   intern/cycles/render/mesh_displace.cpp
M   intern/cycles/render/mesh_volume.cpp
M   intern/cycles/render/nodes.cpp
M   intern/cycles/render/object.cpp
M   intern/cycles/render/object.h
M   intern/cycles/render/scene.cpp
M   intern/cycles/render/scene.h
M   intern/cycles/render/session.cpp
M   intern/cycles/render/shader.cpp
M   intern/cycles/render/shader.h

===

diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index bdb014d31ef..2540786a014 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -380,11 +380,11 @@ static Mesh *xml_add_mesh(Scene *scene, const Transform 
)
 {
   /* create mesh */
   Mesh *mesh = new Mesh();
-  scene->meshes.push_back(mesh);
+  scene->geometry.push_back(mesh);
 
   /* create object*/
   Object *object = new Object();
-  object->mesh = mesh;
+  object->geometry = mesh;
   object->tfm = tfm;
   scene->objects.push_back(object);
 
diff --git a/intern/cycles/blender/blender_curves.cpp 
b/intern/cycles/blender/blender_curves.cpp
index e42151d8f48..affd5685337 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -17,6 +17,7 @@
 #include "render/attribute.h"
 #include "render/camera.h"
 #include "render/curves.h"
+#include "render/hair.h"
 #include "render/mesh.h"
 #include "render/object.h"
 #include "render/scene.h"
@@ -107,12 +108,12 @@ static void InterpolateKeySegments(
 }
 
 static bool ObtainCacheParticleData(
-Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, 
bool background)
+Geometry *geom, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData 
*CData, bool background)
 {
   int curvenum = 0;
   int keyno = 0;
 
-  if (!(mesh && b_mesh && b_ob && CData))
+  if (!(geom && b_mesh && b_ob && CData))
 return false;
 
   Transform tfm = get_transform(b_ob->matrix_world());
@@ -128,7 +129,7 @@ static bool ObtainCacheParticleData(
 
   if ((b_part.render_type() == BL::ParticleSettings::render_type_PATH) &&
   (b_part.type() == BL::ParticleSettings::type_HAIR)) {
-int shader = clamp(b_part.material() - 1, 0, mesh->used_shaders.size() 
- 1);
+int shader = clamp(b_part.material() - 1, 0, geom->used_shaders.size() 
- 1);
 int display_step = background ? b_part.render_step() : 
b_part.display_step();
 int totparts = b_psys.particles.length();
 int totchild = background ? b_psys.child_particles.length() :
@@ -202,14 +203,14 @@ static bool ObtainCacheParticleData(
   return true;
 }
 
-static bool ObtainCacheParticleUV(Mesh *mesh,
+static bool ObtainCacheParticleUV(Geometry *geom,

[Bf-blender-cvs] [46c9872afaa] master: Cleanup: remove unnecessary operations in Cycles curves export

2020-02-07 Thread Brecht Van Lommel
Commit: 46c9872afaa8053f8b2894c038402b1beb3ac66c
Author: Brecht Van Lommel
Date:   Mon Feb 3 21:21:11 2020 +0100
Branches: master
https://developer.blender.org/rB46c9872afaa8053f8b2894c038402b1beb3ac66c

Cleanup: remove unnecessary operations in Cycles curves export

Clearing and computing bounds is already done elsewhere.

===

M   intern/cycles/blender/blender_curves.cpp

===

diff --git a/intern/cycles/blender/blender_curves.cpp 
b/intern/cycles/blender/blender_curves.cpp
index 64efaab70e0..e42151d8f48 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -989,24 +989,11 @@ bool BlenderSync::object_has_particle_hair(BL::Object 
b_ob)
 void BlenderSync::sync_particle_hair(
 Mesh *mesh, BL::Mesh _mesh, BL::Object _ob, bool motion, int 
motion_step)
 {
-  if (!motion) {
-/* Clear stored curve data */
-mesh->curve_keys.clear();
-mesh->curve_radius.clear();
-mesh->curve_first_key.clear();
-mesh->curve_shader.clear();
-mesh->curve_attributes.clear();
-  }
-
-  /* obtain general settings */
-  const bool use_curves = scene->curve_system_manager->use_curves;
-
-  if (!(use_curves && b_ob.mode() != b_ob.mode_PARTICLE_EDIT && b_ob.mode() != 
b_ob.mode_EDIT)) {
-if (!motion)
-  mesh->compute_bounds();
+  if (b_ob.mode() == b_ob.mode_PARTICLE_EDIT || b_ob.mode() == b_ob.mode_EDIT) 
{
 return;
   }
 
+  /* obtain general settings */
   const int primitive = scene->curve_system_manager->primitive;
   const int triangle_method = scene->curve_system_manager->triangle_method;
   const int resolution = scene->curve_system_manager->resolution;
@@ -1159,7 +1146,6 @@ void BlenderSync::sync_particle_hair(
 }
   }
 
-  mesh->compute_bounds();
   mesh->geometry_flags |= Mesh::GEOMETRY_CURVES;
 }
 
@@ -1172,7 +1158,7 @@ void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, 
BL::Object b_ob, Mesh *me
   oldcurve_keys.steal_data(mesh->curve_keys);
   oldcurve_radius.steal_data(mesh->curve_radius);
 
-  if (view_layer.use_hair) {
+  if (view_layer.use_hair && scene->curve_system_manager->use_curves) {
 /* Particle hair. */
 bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED);
 BL::Mesh b_mesh = object_to_mesh(

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


[Bf-blender-cvs] [47402dcb916] master: Cleanup: split Cycles export into smaller files

2020-02-07 Thread Brecht Van Lommel
Commit: 47402dcb9160793fcfd87ea3c6e6685ea6954b3f
Author: Brecht Van Lommel
Date:   Sun Feb 2 13:09:18 2020 +0100
Branches: master
https://developer.blender.org/rB47402dcb9160793fcfd87ea3c6e6685ea6954b3f

Cleanup: split Cycles export into smaller files

===

M   intern/cycles/blender/CMakeLists.txt
M   intern/cycles/blender/blender_curves.cpp
A   intern/cycles/blender/blender_geometry.cpp
A   intern/cycles/blender/blender_id_map.h
A   intern/cycles/blender/blender_image.cpp
A   intern/cycles/blender/blender_light.cpp
M   intern/cycles/blender/blender_mesh.cpp
M   intern/cycles/blender/blender_object.cpp
M   intern/cycles/blender/blender_object_cull.cpp
M   intern/cycles/blender/blender_python.cpp
M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/blender/blender_sync.h
M   intern/cycles/blender/blender_util.h
A   intern/cycles/blender/blender_volume.cpp

===

diff --git a/intern/cycles/blender/CMakeLists.txt 
b/intern/cycles/blender/CMakeLists.txt
index 0888eeb78bb..d9a2ebf8571 100644
--- a/intern/cycles/blender/CMakeLists.txt
+++ b/intern/cycles/blender/CMakeLists.txt
@@ -18,6 +18,9 @@ set(INC_SYS
 set(SRC
   blender_camera.cpp
   blender_device.cpp
+  blender_image.cpp
+  blender_geometry.cpp
+  blender_light.cpp
   blender_mesh.cpp
   blender_object.cpp
   blender_object_cull.cpp
@@ -30,9 +33,11 @@ set(SRC
   blender_sync.cpp
   blender_texture.cpp
   blender_viewport.cpp
+  blender_volume.cpp
 
   CCL_api.h
   blender_device.h
+  blender_id_map.h
   blender_object_cull.h
   blender_sync.h
   blender_session.h
diff --git a/intern/cycles/blender/blender_curves.cpp 
b/intern/cycles/blender/blender_curves.cpp
index 755214f422c..64efaab70e0 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -1160,6 +1160,63 @@ void BlenderSync::sync_particle_hair(
   }
 
   mesh->compute_bounds();
+  mesh->geometry_flags |= Mesh::GEOMETRY_CURVES;
+}
+
+void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh 
*mesh)
+{
+  /* compares curve_keys rather than strands in order to handle quick hair
+   * adjustments in dynamic BVH - other methods could probably do this better*/
+  array oldcurve_keys;
+  array oldcurve_radius;
+  oldcurve_keys.steal_data(mesh->curve_keys);
+  oldcurve_radius.steal_data(mesh->curve_radius);
+
+  if (view_layer.use_hair) {
+/* Particle hair. */
+bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED);
+BL::Mesh b_mesh = object_to_mesh(
+b_data, b_ob, b_depsgraph, need_undeformed, Mesh::SUBDIVISION_NONE);
+
+if (b_mesh) {
+  sync_particle_hair(mesh, b_mesh, b_ob, false);
+  free_object_to_mesh(b_data, b_ob, b_mesh);
+}
+  }
+
+  /* tag update */
+  bool rebuild = (oldcurve_keys != mesh->curve_keys) || (oldcurve_radius != 
mesh->curve_radius);
+  mesh->tag_update(scene, rebuild);
+}
+
+void BlenderSync::sync_hair_motion(BL::Depsgraph b_depsgraph,
+   BL::Object b_ob,
+   Mesh *mesh,
+   int motion_step)
+{
+  /* Skip if no curves were exported. */
+  size_t numkeys = mesh->curve_keys.size();
+  if (numkeys == 0) {
+return;
+  }
+
+  /* Export deformed coordinates. */
+  if (ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) {
+/* Particle hair. */
+BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_depsgraph, false, 
Mesh::SUBDIVISION_NONE);
+if (b_mesh) {
+  sync_particle_hair(mesh, b_mesh, b_ob, true, motion_step);
+  free_object_to_mesh(b_data, b_ob, b_mesh);
+  return;
+}
+  }
+
+  /* No deformation on this frame, copy coordinates if other frames did have 
it. */
+  Attribute *attr_mP = 
mesh->curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
+  if (attr_mP) {
+float3 *keys = >curve_keys[0];
+memcpy(attr_mP->data_float3() + motion_step * numkeys, keys, 
sizeof(float3) * numkeys);
+  }
 }
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/blender/blender_geometry.cpp 
b/intern/cycles/blender/blender_geometry.cpp
new file mode 100644
index 000..151b741b003
--- /dev/null
+++ b/intern/cycles/blender/blender_geometry.cpp
@@ -0,0 +1,146 @@
+
+/*
+ * Copyright 2011-2013 Blender Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the 

[Bf-blender-cvs] [ad489b71646] master: Cleanup: add type inheritance for Cycles nodes

2020-02-07 Thread Brecht Van Lommel
Commit: ad489b71646a2e03e2ce9b0d193d541e3987b4cd
Author: Brecht Van Lommel
Date:   Mon Feb 3 09:02:00 2020 +0100
Branches: master
https://developer.blender.org/rBad489b71646a2e03e2ce9b0d193d541e3987b4cd

Cleanup: add type inheritance for Cycles nodes

===

M   intern/cycles/app/cycles_xml.cpp
M   intern/cycles/graph/node.cpp
M   intern/cycles/graph/node.h
M   intern/cycles/graph/node_type.cpp
M   intern/cycles/graph/node_type.h
M   intern/cycles/graph/node_xml.cpp

===

diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 1dbe8a30ff2..bdb014d31ef 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -326,6 +326,10 @@ static void xml_read_shader_graph(XMLReadState , 
Shader *shader, xml_node
 fprintf(stderr, "Node type \"%s\" is not a shader node.\n", 
node_type->name.c_str());
 continue;
   }
+  else if (node_type->create == NULL) {
+fprintf(stderr, "Can't create abstract node type \"%s\".\n", 
node_type->name.c_str());
+continue;
+  }
 
   snode = (ShaderNode *)node_type->create(node_type);
 }
diff --git a/intern/cycles/graph/node.cpp b/intern/cycles/graph/node.cpp
index 4f79a7518dc..1439fb5a407 100644
--- a/intern/cycles/graph/node.cpp
+++ b/intern/cycles/graph/node.cpp
@@ -669,4 +669,14 @@ size_t Node::get_total_size_in_bytes() const
   return total_size;
 }
 
+bool Node::is_a(const NodeType *type_)
+{
+  for (const NodeType *base = type; base; base = base->base) {
+if (base == type_) {
+  return true;
+}
+  }
+  return false;
+}
+
 CCL_NAMESPACE_END
diff --git a/intern/cycles/graph/node.h b/intern/cycles/graph/node.h
index d35a1bb489c..4473b8aca28 100644
--- a/intern/cycles/graph/node.h
+++ b/intern/cycles/graph/node.h
@@ -94,6 +94,9 @@ struct Node {
   /* Get total size of this node. */
   size_t get_total_size_in_bytes() const;
 
+  /* Type testing, taking into account base classes. */
+  bool is_a(const NodeType *type);
+
   ustring name;
   const NodeType *type;
 };
diff --git a/intern/cycles/graph/node_type.cpp 
b/intern/cycles/graph/node_type.cpp
index f46d4e48026..0283ed7c817 100644
--- a/intern/cycles/graph/node_type.cpp
+++ b/intern/cycles/graph/node_type.cpp
@@ -135,8 +135,13 @@ bool SocketType::is_float3(Type type)
 
 /* Node Type */
 
-NodeType::NodeType(Type type_) : type(type_)
+NodeType::NodeType(Type type, const NodeType *base) : type(type), base(base)
 {
+  if (base) {
+/* Inherit sockets. */
+inputs = base->inputs;
+outputs = base->outputs;
+  }
 }
 
 NodeType::~NodeType()
@@ -209,7 +214,7 @@ unordered_map 
::types()
   return _types;
 }
 
-NodeType *NodeType::add(const char *name_, CreateFunc create_, Type type_)
+NodeType *NodeType::add(const char *name_, CreateFunc create_, Type type_, 
const NodeType *base_)
 {
   ustring name(name_);
 
@@ -219,7 +224,7 @@ NodeType *NodeType::add(const char *name_, CreateFunc 
create_, Type type_)
 return NULL;
   }
 
-  types()[name] = NodeType(type_);
+  types()[name] = NodeType(type_, base_);
 
   NodeType *type = ()[name];
   type->name = name;
diff --git a/intern/cycles/graph/node_type.h b/intern/cycles/graph/node_type.h
index e9496a42658..a4461ec7abb 100644
--- a/intern/cycles/graph/node_type.h
+++ b/intern/cycles/graph/node_type.h
@@ -103,7 +103,7 @@ struct SocketType {
 struct NodeType {
   enum Type { NONE, SHADER };
 
-  explicit NodeType(Type type = NONE);
+  explicit NodeType(Type type = NONE, const NodeType *base = NULL);
   ~NodeType();
 
   void register_input(ustring name,
@@ -124,11 +124,15 @@ struct NodeType {
 
   ustring name;
   Type type;
+  const NodeType *base;
   vector> inputs;
   vector> outputs;
   CreateFunc create;
 
-  static NodeType *add(const char *name, CreateFunc create, Type type = NONE);
+  static NodeType *add(const char *name,
+   CreateFunc create,
+   Type type = NONE,
+   const NodeType *base = NULL);
   static const NodeType *find(ustring name);
   static unordered_map ();
 };
@@ -148,6 +152,14 @@ struct NodeType {
   } \
   template const NodeType *structname::register_type()
 
+#define NODE_ABSTRACT_DECLARE \
+  template static const NodeType *register_type(); \
+  static const NodeType *node_type;
+
+#define NODE_ABSTRACT_DEFINE(structname) \
+  const NodeType *structname::node_type = 
structname::register_type(); \
+  template const NodeType *structname::register_type()
+
 /* Sock Definition Macros */
 
 #define SOCKET_OFFSETOF(T, name) (((char *)&(((T *)1)->name)) - (char *)1)
diff --git a/intern/cycles/graph/node_xml.cpp b/intern/cycles/graph/node_xml.cpp
index a96970cc904..d333400cc4a 100644
--- a/intern/cycles/graph/node_xml.cpp
+++ b/intern/cycles/graph/node_xml.cpp
@@ -200,7 +200,7 @@ void xml_read_node(XMLReader , Node *node, xml_node 

[Bf-blender-cvs] [7b66f73558d] master: Cleanup: export particle hair as a separate Cycles object

2020-02-07 Thread Brecht Van Lommel
Commit: 7b66f73558d1e4dda308366bc8ad2b5dfa8009d3
Author: Brecht Van Lommel
Date:   Sun Feb 2 13:09:18 2020 +0100
Branches: master
https://developer.blender.org/rB7b66f73558d1e4dda308366bc8ad2b5dfa8009d3

Cleanup: export particle hair as a separate Cycles object

===

M   intern/cycles/blender/blender_curves.cpp
M   intern/cycles/blender/blender_mesh.cpp
M   intern/cycles/blender/blender_object.cpp
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_sync.h
M   intern/cycles/blender/blender_util.h

===

diff --git a/intern/cycles/blender/blender_curves.cpp 
b/intern/cycles/blender/blender_curves.cpp
index 78db1d5c832..755214f422c 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -964,7 +964,29 @@ void BlenderSync::sync_curve_settings()
 curve_system_manager->tag_update(scene);
 }
 
-void BlenderSync::sync_curves(
+bool BlenderSync::object_has_particle_hair(BL::Object b_ob)
+{
+  /* Test if the object has a particle modifier with hair. */
+  BL::Object::modifiers_iterator b_mod;
+  for (b_ob.modifiers.begin(b_mod); b_mod != b_ob.modifiers.end(); ++b_mod) {
+if ((b_mod->type() == b_mod->type_PARTICLE_SYSTEM) &&
+(preview ? b_mod->show_viewport() : b_mod->show_render())) {
+  BL::ParticleSystemModifier psmd((const PointerRNA)b_mod->ptr);
+  BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
+  BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
+
+  if ((b_part.render_type() == BL::ParticleSettings::render_type_PATH) &&
+  (b_part.type() == BL::ParticleSettings::type_HAIR)) {
+return true;
+  }
+}
+  }
+
+  return false;
+}
+
+/* Old particle hair. */
+void BlenderSync::sync_particle_hair(
 Mesh *mesh, BL::Mesh _mesh, BL::Object _ob, bool motion, int 
motion_step)
 {
   if (!motion) {
diff --git a/intern/cycles/blender/blender_mesh.cpp 
b/intern/cycles/blender/blender_mesh.cpp
index b18f9a37948..d3dac3c6151 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -967,12 +967,12 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph _depsgraph,
  BL::Object _ob,
  BL::Object _ob_instance,
  bool object_updated,
- bool show_self,
- bool show_particles)
+ bool use_particle_hair)
 {
   /* test if we can instance or if the object is modified */
   BL::ID b_ob_data = b_ob.data();
-  BL::ID key = (BKE_object_is_modified(b_ob)) ? b_ob_instance : b_ob_data;
+  BL::ID b_key_id = (BKE_object_is_modified(b_ob)) ? b_ob_instance : b_ob_data;
+  MeshKey key(b_key_id.ptr.data, use_particle_hair);
   BL::Material material_override = view_layer.material_override;
 
   /* find shader indices */
@@ -1006,7 +1006,7 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph _depsgraph,
   }
   Mesh *mesh;
 
-  if (!mesh_map.sync(, key)) {
+  if (!mesh_map.sync(, b_key_id, key)) {
 /* if transform was applied to mesh, need full update */
 if (object_updated && mesh->transform_applied)
   ;
@@ -1078,7 +1078,7 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph _depsgraph,
 
 if (b_mesh) {
   /* Sync mesh itself. */
-  if (view_layer.use_surfaces && show_self) {
+  if (view_layer.use_surfaces && !use_particle_hair) {
 if (mesh->subdivision_type != Mesh::SUBDIVISION_NONE)
   create_subd_mesh(scene, mesh, b_ob, b_mesh, used_shaders, 
dicing_rate, max_subdivisions);
 else
@@ -1088,9 +1088,9 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph _depsgraph,
   }
 
   /* Sync hair curves. */
-  if (view_layer.use_hair && show_particles &&
+  if (view_layer.use_hair && use_particle_hair &&
   mesh->subdivision_type == Mesh::SUBDIVISION_NONE) {
-sync_curves(mesh, b_mesh, b_ob, false);
+sync_particle_hair(mesh, b_mesh, b_ob, false);
   }
 
   free_object_to_mesh(b_data, b_ob, b_mesh);
@@ -1099,7 +1099,9 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph _depsgraph,
   mesh->geometry_flags = requested_geometry_flags;
 
   /* mesh fluid motion mantaflow */
-  sync_mesh_fluid_motion(b_ob, scene, mesh);
+  if (!use_particle_hair) {
+sync_mesh_fluid_motion(b_ob, scene, mesh);
+  }
 
   /* tag update */
   bool rebuild = (oldtriangles != mesh->triangles) || (oldsubd_faces != 
mesh->subd_faces) ||
@@ -1258,7 +1260,7 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph 
_depsgraph,
 
   /* hair motion */
   if (numkeys)
-sync_curves(mesh, b_mesh, b_ob, true, motion_step);
+sync_particle_hair(mesh, b_mesh, b_ob, true, motion_step);
 
   /* free derived mesh */
   free_object_to_mesh(b_data, b_ob, b_mesh);
diff --git 

[Bf-blender-cvs] [b1f1a1ca603] master: Cleanup: Tracking, reduce scope of more variables

2020-02-07 Thread Sergey Sharybin
Commit: b1f1a1ca6035e23d66656c97c16fe081caafcae8
Author: Sergey Sharybin
Date:   Fri Feb 7 12:16:23 2020 +0100
Branches: master
https://developer.blender.org/rBb1f1a1ca6035e23d66656c97c16fe081caafcae8

Cleanup: Tracking, reduce scope of more variables

===

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

===

diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index 0b732677dcb..37ca6b1885d 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1276,15 +1276,14 @@ void BKE_tracking_marker_clamp(MovieTrackingMarker 
*marker, int event)
 sub_v2_v2v2(dim, pat_max, pat_min);
 
 for (int a = 0; a < 2; a++) {
-  int b;
   /* pattern shouldn't be moved outside of search */
   if (pat_min[a] < marker->search_min[a]) {
-for (b = 0; b < 4; b++) {
+for (int b = 0; b < 4; b++) {
   marker->pattern_corners[b][a] += marker->search_min[a] - pat_min[a];
 }
   }
   if (pat_max[a] > marker->search_max[a]) {
-for (b = 0; b < 4; b++) {
+for (int b = 0; b < 4; b++) {
   marker->pattern_corners[b][a] -= pat_max[a] - marker->search_max[a];
 }
   }

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


[Bf-blender-cvs] [28cd16ec448] master: Cleanup: Tracking, reduce scope of variables

2020-02-07 Thread Sergey Sharybin
Commit: 28cd16ec448f57b863f8be0a8f5d303d94bc1f1f
Author: Sergey Sharybin
Date:   Fri Feb 7 12:00:57 2020 +0100
Branches: master
https://developer.blender.org/rB28cd16ec448f57b863f8be0a8f5d303d94bc1f1f

Cleanup: Tracking, reduce scope of variables

Mainly affects for() loops.

The reason why loop parameter was declared outside of the loop roots
back to the times when not all compilers supported C99.

===

M   source/blender/blenkernel/intern/tracking.c
M   source/blender/blenkernel/intern/tracking_auto.c
M   source/blender/blenkernel/intern/tracking_detect.c
M   source/blender/blenkernel/intern/tracking_plane_tracker.c
M   source/blender/blenkernel/intern/tracking_region_tracker.c
M   source/blender/blenkernel/intern/tracking_solver.c
M   source/blender/blenkernel/intern/tracking_stabilize.c
M   source/blender/blenkernel/intern/tracking_util.c

===

diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index 1e7b3af53d5..0b732677dcb 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -80,9 +80,7 @@ static struct {
 /* Free the whole list of tracks, list's head and tail are set to NULL. */
 static void tracking_tracks_free(ListBase *tracks)
 {
-  MovieTrackingTrack *track;
-
-  for (track = tracks->first; track; track = track->next) {
+  for (MovieTrackingTrack *track = tracks->first; track; track = track->next) {
 BKE_tracking_track_free(track);
   }
 
@@ -92,9 +90,8 @@ static void tracking_tracks_free(ListBase *tracks)
 /* Free the whole list of plane tracks, list's head and tail are set to NULL. 
*/
 static void tracking_plane_tracks_free(ListBase *plane_tracks)
 {
-  MovieTrackingPlaneTrack *plane_track;
-
-  for (plane_track = plane_tracks->first; plane_track; plane_track = 
plane_track->next) {
+  for (MovieTrackingPlaneTrack *plane_track = plane_tracks->first; plane_track;
+   plane_track = plane_track->next) {
 BKE_tracking_plane_track_free(plane_track);
   }
 
@@ -128,10 +125,8 @@ static void tracking_object_free(MovieTrackingObject 
*object)
 /* Free list of tracking objects, list's head and tail is set to NULL. */
 static void tracking_objects_free(ListBase *objects)
 {
-  MovieTrackingObject *object;
-
   /* Free objects contents. */
-  for (object = objects->first; object; object = object->next) {
+  for (MovieTrackingObject *object = objects->first; object; object = 
object->next) {
 tracking_object_free(object);
   }
 
@@ -191,13 +186,12 @@ static void tracking_tracks_copy(ListBase *tracks_dst,
  GHash *tracks_mapping,
  const int flag)
 {
-  MovieTrackingTrack *track_dst, *track_src;
-
   BLI_listbase_clear(tracks_dst);
   BLI_ghash_clear(tracks_mapping, NULL, NULL);
 
-  for (track_src = tracks_src->first; track_src != NULL; track_src = 
track_src->next) {
-track_dst = MEM_dupallocN(track_src);
+  for (MovieTrackingTrack *track_src = tracks_src->first; track_src != NULL;
+   track_src = track_src->next) {
+MovieTrackingTrack *track_dst = MEM_dupallocN(track_src);
 if (track_src->markers) {
   track_dst->markers = MEM_dupallocN(track_src->markers);
 }
@@ -217,13 +211,12 @@ static void tracking_plane_tracks_copy(ListBase 
*plane_tracks_list_dst,
GHash *tracks_mapping,
const int flag)
 {
-  MovieTrackingPlaneTrack *plane_track_dst, *plane_track_src;
-
   BLI_listbase_clear(plane_tracks_list_dst);
 
-  for (plane_track_src = plane_tracks_list_src->first; plane_track_src != NULL;
+  for (MovieTrackingPlaneTrack *plane_track_src = plane_tracks_list_src->first;
+   plane_track_src != NULL;
plane_track_src = plane_track_src->next) {
-plane_track_dst = MEM_dupallocN(plane_track_src);
+MovieTrackingPlaneTrack *plane_track_dst = MEM_dupallocN(plane_track_src);
 if (plane_track_src->markers) {
   plane_track_dst->markers = MEM_dupallocN(plane_track_src->markers);
 }
@@ -278,12 +271,11 @@ static void tracking_objects_copy(ListBase *objects_dst,
   GHash *tracks_mapping,
   const int flag)
 {
-  MovieTrackingObject *object_dst, *object_src;
-
   BLI_listbase_clear(objects_dst);
 
-  for (object_src = objects_src->first; object_src != NULL; object_src = 
object_src->next) {
-object_dst = MEM_mallocN(sizeof(*object_dst), __func__);
+  for (MovieTrackingObject *object_src = objects_src->first; object_src != 
NULL;
+   object_src = object_src->next) {
+MovieTrackingObject *object_dst = MEM_mallocN(sizeof(*object_dst), 
__func__);
 tracking_object_copy(object_dst, object_src, tracks_mapping, flag);
 BLI_addtail(objects_dst, object_dst);
   }
@@ -1180,9 

[Bf-blender-cvs] [0f7a90d4ad2] master: Cleanup: `make format`

2020-02-07 Thread Dalai Felinto
Commit: 0f7a90d4ad2c144b82679c24020e1338a3fc7cef
Author: Dalai Felinto
Date:   Fri Feb 7 11:58:51 2020 +0100
Branches: master
https://developer.blender.org/rB0f7a90d4ad2c144b82679c24020e1338a3fc7cef

Cleanup: `make format`

Dear developers remember to set your coding environment to use clang-format.

===

M   source/blender/blenkernel/intern/lattice.c
M   source/blender/collada/ErrorHandler.cpp
M   source/blender/editors/mesh/editmesh_tools.c
M   source/blender/editors/render/render_preview.c
M   source/blender/makesrna/intern/rna_brush.c
M   source/blender/modifiers/intern/MOD_curve.c
M   source/blender/modifiers/intern/MOD_lattice.c
M   source/blender/modifiers/intern/MOD_smooth.c

===

diff --git a/source/blender/blenkernel/intern/lattice.c 
b/source/blender/blenkernel/intern/lattice.c
index 243c63a8f03..a09e97d4fed 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -783,7 +783,7 @@ void curve_deform_verts(Object *cuOb,
 
 if (cu->flag & CU_DEFORM_BOUNDS_OFF) {
   for (a = 0, dvert_iter = dvert; a < numVerts; a++, dvert_iter++) {
-const float weight = invert_vgroup? 1.0f - 
defvert_find_weight(dvert_iter, defgrp_index) :
+const float weight = invert_vgroup ? 1.0f - 
defvert_find_weight(dvert_iter, defgrp_index) :
  defvert_find_weight(dvert_iter, 
defgrp_index);
 
 if (weight > 0.0f) {
@@ -800,7 +800,7 @@ void curve_deform_verts(Object *cuOb,
   INIT_MINMAX(cd.dmin, cd.dmax);
 
   for (a = 0, dvert_iter = dvert; a < numVerts; a++, dvert_iter++) {
-const float weight = invert_vgroup? 1.0f - 
defvert_find_weight(dvert_iter, defgrp_index) :
+const float weight = invert_vgroup ? 1.0f - 
defvert_find_weight(dvert_iter, defgrp_index) :
  defvert_find_weight(dvert_iter, 
defgrp_index);
 if (weight > 0.0f) {
   mul_m4_v3(cd.curvespace, vert_coords[a]);
@@ -809,7 +809,7 @@ void curve_deform_verts(Object *cuOb,
   }
 
   for (a = 0, dvert_iter = dvert; a < numVerts; a++, dvert_iter++) {
-const float weight = invert_vgroup? 1.0f - 
defvert_find_weight(dvert_iter, defgrp_index) :
+const float weight = invert_vgroup ? 1.0f - 
defvert_find_weight(dvert_iter, defgrp_index) :
  defvert_find_weight(dvert_iter, 
defgrp_index);
 
 if (weight > 0.0f) {
@@ -899,8 +899,9 @@ static void lattice_deform_vert_task(void *__restrict 
userdata,
   const LatticeDeformUserdata *data = userdata;
 
   if (data->dvert != NULL) {
-const float weight = data->invert_vgroup? 1.0f - 
defvert_find_weight(data->dvert + index, data->defgrp_index) :
-
defvert_find_weight(data->dvert + index, data->defgrp_index);
+const float weight = data->invert_vgroup ?
+ 1.0f - defvert_find_weight(data->dvert + index, 
data->defgrp_index) :
+ defvert_find_weight(data->dvert + index, 
data->defgrp_index);
 if (weight > 0.0f) {
   calc_latt_deform(data->lattice_deform_data, data->vert_coords[index], 
weight * data->fac);
 }
diff --git a/source/blender/collada/ErrorHandler.cpp 
b/source/blender/collada/ErrorHandler.cpp
index 4f70281fb45..286bcbfb759 100644
--- a/source/blender/collada/ErrorHandler.cpp
+++ b/source/blender/collada/ErrorHandler.cpp
@@ -79,7 +79,8 @@ bool ErrorHandler::handleError(const COLLADASaxFWL::IError 
*error)
   error_context = "File access";
 }
 
-else if (parserError.getErrorType() == 
GeneratedSaxParser::ParserError::ERROR_REQUIRED_ATTRIBUTE_MISSING) {
+else if (parserError.getErrorType() ==
+ 
GeneratedSaxParser::ParserError::ERROR_REQUIRED_ATTRIBUTE_MISSING) {
   isError = true;
 }
 
diff --git a/source/blender/editors/mesh/editmesh_tools.c 
b/source/blender/editors/mesh/editmesh_tools.c
index 0c564bb7593..bd8017acd28 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3935,7 +3935,10 @@ static Base *mesh_separate_tagged(
   /* DAG_relations_tag_update(bmain); */
 
   /* new in 2.5 */
-  BKE_object_material_array_assign(bmain, base_new->object, 
BKE_object_material_array(obedit), *BKE_object_material_num(obedit));
+  BKE_object_material_array_assign(bmain,
+   base_new->object,
+   BKE_object_material_array(obedit),
+   *BKE_object_material_num(obedit));
 
   ED_object_base_select(base_new, BA_SELECT);
 
@@ -4002,7 +4005,10 @@ static Base *mesh_separate_arrays(Main *bmain,
   /* DAG_relations_tag_update(bmain); */
 
   /* new in 2.5 */
-  BKE_object_material_array_assign(bmain, 

[Bf-blender-cvs] [f2695c9c1d8] master: Cleanup: Remove view3d_draw_legacy.c

2020-02-07 Thread Dalai Felinto
Commit: f2695c9c1d8da179ce155817ba620b56b5ff5e62
Author: Dalai Felinto
Date:   Fri Feb 7 10:58:07 2020 +0100
Branches: master
https://developer.blender.org/rBf2695c9c1d8da179ce155817ba620b56b5ff5e62

Cleanup: Remove view3d_draw_legacy.c

This file was originally a placeholder for all the old functions that
have not yet been ported to the new draw system. Over time all the
functions that needed refactor were gone, and the functions here are
still needed.

While moving the functions around I removed dead code and made sure the
existent comments start with a capital letter and end with a full stop.

===

M   source/blender/editors/space_view3d/CMakeLists.txt
M   source/blender/editors/space_view3d/view3d_draw.c
D   source/blender/editors/space_view3d/view3d_draw_legacy.c

===

diff --git a/source/blender/editors/space_view3d/CMakeLists.txt 
b/source/blender/editors/space_view3d/CMakeLists.txt
index 95d7f79f666..9e3c9d6725d 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -48,7 +48,6 @@ set(SRC
   view3d_buttons.c
   view3d_camera_control.c
   view3d_draw.c
-  view3d_draw_legacy.c
   view3d_edit.c
   view3d_fly.c
   view3d_gizmo_armature.c
diff --git a/source/blender/editors/space_view3d/view3d_draw.c 
b/source/blender/editors/space_view3d/view3d_draw.c
index 0e5592abfd2..6704fc9908f 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -33,7 +33,9 @@
 #include "BKE_camera.h"
 #include "BKE_collection.h"
 #include "BKE_context.h"
+#include "BKE_customdata.h"
 #include "BKE_global.h"
+#include "BKE_layer.h"
 #include "BKE_key.h"
 #include "BKE_main.h"
 #include "BKE_scene.h"
@@ -56,11 +58,13 @@
 #include "DNA_windowmanager_types.h"
 
 #include "DRW_engine.h"
+#include "DRW_select_buffer.h"
 
 #include "ED_armature.h"
 #include "ED_keyframing.h"
 #include "ED_gpencil.h"
 #include "ED_screen.h"
+#include "ED_screen_types.h"
 #include "ED_transform.h"
 
 #include "DEG_depsgraph_query.h"
@@ -1936,11 +1940,476 @@ static bool view3d_clipping_test(const float co[3], 
const float clip[6][4])
   return true;
 }
 
-/* for 'local' ED_view3d_clipping_local must run first
- * then all comparisons can be done in localspace */
+/* For 'local' ED_view3d_clipping_local must run first
+ * then all comparisons can be done in localspace. */
 bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], 
const bool is_local)
 {
   return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip);
 }
 
+/* Legacy 2.7x, now use shaders that use clip distance instead.
+ * Remove once clipping is working properly. */
+#define USE_CLIP_PLANES
+
+void ED_view3d_clipping_set(RegionView3D *rv3d)
+{
+#ifdef USE_CLIP_PLANES
+  double plane[4];
+  const uint tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6;
+
+  for (unsigned a = 0; a < tot; a++) {
+copy_v4db_v4fl(plane, rv3d->clip[a]);
+glClipPlane(GL_CLIP_PLANE0 + a, plane);
+glEnable(GL_CLIP_PLANE0 + a);
+glEnable(GL_CLIP_DISTANCE0 + a);
+  }
+#else
+  for (unsigned a = 0; a < 6; a++) {
+glEnable(GL_CLIP_DISTANCE0 + a);
+  }
+#endif
+}
+
+/* Use these to temp disable/enable clipping when 'rv3d->rflag & 
RV3D_CLIPPING' is set. */
+void ED_view3d_clipping_disable(void)
+{
+  for (unsigned a = 0; a < 6; a++) {
+#ifdef USE_CLIP_PLANES
+glDisable(GL_CLIP_PLANE0 + a);
+#endif
+glDisable(GL_CLIP_DISTANCE0 + a);
+  }
+}
+void ED_view3d_clipping_enable(void)
+{
+  for (unsigned a = 0; a < 6; a++) {
+#ifdef USE_CLIP_PLANES
+glEnable(GL_CLIP_PLANE0 + a);
+#endif
+glEnable(GL_CLIP_DISTANCE0 + a);
+  }
+}
+
+/* *** backdraw for selection *** */
+
+/**
+ * \note Only use in object mode.
+ */
+static void validate_object_select_id(
+struct Depsgraph *depsgraph, ViewLayer *view_layer, ARegion *ar, View3D 
*v3d, Object *obact)
+{
+  Object *obact_eval = DEG_get_evaluated_object(depsgraph, obact);
+
+  BLI_assert(ar->regiontype == RGN_TYPE_WINDOW);
+  UNUSED_VARS_NDEBUG(ar);
+
+  if (obact_eval && (obact_eval->mode & (OB_MODE_VERTEX_PAINT | 
OB_MODE_WEIGHT_PAINT) ||
+ BKE_paint_select_face_test(obact_eval))) {
+/* do nothing */
+  }
+  /* texture paint mode sampling */
+  else if (obact_eval && (obact_eval->mode & OB_MODE_TEXTURE_PAINT) &&
+   (v3d->shading.type > OB_WIRE)) {
+/* do nothing */
+  }
+  else if ((obact_eval && (obact_eval->mode & OB_MODE_PARTICLE_EDIT)) && 
!XRAY_ENABLED(v3d)) {
+/* do nothing */
+  }
+  else {
+v3d->flag &= ~V3D_INVALID_BACKBUF;
+return;
+  }
+
+  if (!(v3d->flag & V3D_INVALID_BACKBUF)) {
+return;
+  }
+
+  if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0)) {
+Base *base = BKE_view_layer_base_find(view_layer, obact);
+

[Bf-blender-cvs] [12f747a0597] undo-experiments-swap-reread-datablocks: Merge branch 'undo-experiments' into undo-experiments-swap-reread-datablocks

2020-02-07 Thread Bastien Montagne
Commit: 12f747a059777e95cf2c9bce5d18dc1ff32e3da4
Author: Bastien Montagne
Date:   Fri Feb 7 11:22:12 2020 +0100
Branches: undo-experiments-swap-reread-datablocks
https://developer.blender.org/rB12f747a059777e95cf2c9bce5d18dc1ff32e3da4

Merge branch 'undo-experiments' into undo-experiments-swap-reread-datablocks

===



===



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


[Bf-blender-cvs] [46ef4736995] undo-experiments-swap-reread-datablocks: Merge branch 'master' into undo-experiments-swap-reread-datablocks

2020-02-07 Thread Bastien Montagne
Commit: 46ef473699528fc6367dc4ed1b5815b3035988a4
Author: Bastien Montagne
Date:   Fri Feb 7 11:22:04 2020 +0100
Branches: undo-experiments-swap-reread-datablocks
https://developer.blender.org/rB46ef473699528fc6367dc4ed1b5815b3035988a4

Merge branch 'master' into undo-experiments-swap-reread-datablocks

===



===



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


[Bf-blender-cvs] [6fbfb835c0a] undo-experiments: Merge branch 'master' into undo-experiments

2020-02-07 Thread Bastien Montagne
Commit: 6fbfb835c0a75a9fc9eb46fa0a8f834a3b00943a
Author: Bastien Montagne
Date:   Fri Feb 7 11:21:35 2020 +0100
Branches: undo-experiments
https://developer.blender.org/rB6fbfb835c0a75a9fc9eb46fa0a8f834a3b00943a

Merge branch 'master' into undo-experiments

===



===



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


[Bf-blender-cvs] [638adb2f1a2] master: Merge branch 'blender-v2.82-release'

2020-02-07 Thread Sebastián Barschkis
Commit: 638adb2f1a20a345542682dbe36fa313a865764c
Author: Sebastián Barschkis
Date:   Fri Feb 7 11:05:03 2020 +0100
Branches: master
https://developer.blender.org/rB638adb2f1a20a345542682dbe36fa313a865764c

Merge branch 'blender-v2.82-release'

===



===



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


[Bf-blender-cvs] [f12b4e53aaf] blender-v2.82-release: Fluid: Fixed try/catch exception issue and unsed variable issue

2020-02-07 Thread Sebastián Barschkis
Commit: f12b4e53aaf768d54bd85ec4713f94e77aaf72f6
Author: Sebastián Barschkis
Date:   Fri Feb 7 11:02:55 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rBf12b4e53aaf768d54bd85ec4713f94e77aaf72f6

Fluid: Fixed try/catch exception issue and unsed variable issue

Sergey just pointed this out, fixing in it the release branch to avoid any 
compilation issues during the actual release. Thx!

===

M   intern/mantaflow/intern/MANTA_main.cpp

===

diff --git a/intern/mantaflow/intern/MANTA_main.cpp 
b/intern/mantaflow/intern/MANTA_main.cpp
index 798ad9c2854..c0c7ef5dbf2 100644
--- a/intern/mantaflow/intern/MANTA_main.cpp
+++ b/intern/mantaflow/intern/MANTA_main.cpp
@@ -2894,7 +2894,7 @@ int MANTA::updateGridFromVDB(const char *filename, float 
*grid)
   try {
 file.open();
   }
-  catch (const openvdb::IoError) {
+  catch (const openvdb::IoError &) {
 std::cout << "MANTA::updateGridFromVDB(): IOError, invalid OpenVDB file: " 
<< filename
   << std::endl;
 return 0;
@@ -2941,6 +2941,7 @@ int MANTA::updateGridFromRaw(const char *filename, float 
*grid)
   readBytes = gzread(gzf, grid, expectedBytes);
 
   assert(expectedBytes == readBytes);
+  (void)readBytes;  // Unused in release.
 
   gzclose(gzf);
   return 1;

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


[Bf-blender-cvs] [753323af15d] master: Fix crash when linking.

2020-02-07 Thread Bastien Montagne
Commit: 753323af15d7d8986efbdc4ad8d81331ddeee470
Author: Bastien Montagne
Date:   Fri Feb 7 10:58:18 2020 +0100
Branches: master
https://developer.blender.org/rB753323af15d7d8986efbdc4ad8d81331ddeee470

Fix crash when linking.

Stupid mistake in yesterday's own refactoring of readfile code...

===

M   source/blender/blenloader/intern/readfile.c

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index c1a39711bf8..9547e4cd05a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -10194,14 +10194,14 @@ static void expand_id_private_id(FileData *fd, Main 
*mainvar, ID *id)
   /* Handle 'private IDs'. */
   bNodeTree *nodetree = ntreeFromID(id);
   if (nodetree != NULL) {
-expand_id(fd, mainvar, id);
+expand_id(fd, mainvar, >id);
 expand_nodetree(fd, mainvar, nodetree);
   }
 
   if (GS(id->name) == ID_SCE) {
 Scene *scene = (Scene *)id;
 if (scene->master_collection != NULL) {
-  expand_id(fd, mainvar, id);
+  expand_id(fd, mainvar, >master_collection->id);
   expand_collection(fd, mainvar, scene->master_collection);
 }
   }

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