[Bf-blender-cvs] [fda791ab124] master: Overlay Engine: Fix T72147 Blender crashes when Lock Object Modes off

2019-12-03 Thread Clément Foucault
Commit: fda791ab1241534e377bee84b3a214e1343094af
Author: Clément Foucault
Date:   Tue Dec 3 18:56:45 2019 +0100
Branches: master
https://developer.blender.org/rBfda791ab1241534e377bee84b3a214e1343094af

Overlay Engine: Fix T72147 Blender crashes when Lock Object Modes off

Also fix sculpt mask inverted

===

M   source/blender/draw/engines/overlay/overlay_sculpt.c
M   source/blender/draw/engines/overlay/shaders/sculpt_mask_vert.glsl

===

diff --git a/source/blender/draw/engines/overlay/overlay_sculpt.c 
b/source/blender/draw/engines/overlay/overlay_sculpt.c
index 3b7f12ed804..4e7daf1862d 100644
--- a/source/blender/draw/engines/overlay/overlay_sculpt.c
+++ b/source/blender/draw/engines/overlay/overlay_sculpt.c
@@ -51,7 +51,7 @@ void OVERLAY_sculpt_cache_populate(OVERLAY_Data *vedata, 
Object *ob)
   const bool use_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d);
 
   if (use_pbvh || !ob->sculpt->deform_modifiers_active || 
ob->sculpt->shapekey_active) {
-if (pbvh_has_mask(pbvh)) {
+if (!use_pbvh || pbvh_has_mask(pbvh)) {
   DRW_shgroup_call_sculpt(pd->sculpt_mask_grp, ob, false, true, false);
 }
   }
diff --git a/source/blender/draw/engines/overlay/shaders/sculpt_mask_vert.glsl 
b/source/blender/draw/engines/overlay/shaders/sculpt_mask_vert.glsl
index 18a096da61b..38559677706 100644
--- a/source/blender/draw/engines/overlay/shaders/sculpt_mask_vert.glsl
+++ b/source/blender/draw/engines/overlay/shaders/sculpt_mask_vert.glsl
@@ -11,8 +11,7 @@ void main()
   vec3 world_pos = point_object_to_world(pos);
   gl_Position = point_world_to_ndc(world_pos);
 
-  float mask = 1.0 - (msk * maskOpacity);
-  finalColor = vec4(0.0, 0.0, 0.0, mask);
+  finalColor = vec4(0.0, 0.0, 0.0, msk * maskOpacity);
 
 #ifdef USE_WORLD_CLIP_PLANES
   world_clip_planes_calc_clip_distance(world_pos);

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


[Bf-blender-cvs] [723db77e10a] greasepencil-object: GPencil: Fix memory leak with sliders

2019-12-03 Thread Antonio Vazquez
Commit: 723db77e10a0e6192d7d1844745a226895de72fc
Author: Antonio Vazquez
Date:   Tue Dec 3 17:45:20 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB723db77e10a0e6192d7d1844745a226895de72fc

GPencil: Fix memory leak with sliders

===

M   source/blender/editors/animation/anim_channels_defines.c

===

diff --git a/source/blender/editors/animation/anim_channels_defines.c 
b/source/blender/editors/animation/anim_channels_defines.c
index 9c316436ba7..a3d8695d186 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -5085,6 +5085,7 @@ void ANIM_channel_draw_widgets(const bContext *C,
   width * 3,
   channel_height);
   }
+  MEM_freeN(gp_rna_path);
 
   /* Mask Layer. */
   UI_block_emboss_set(block, UI_EMBOSS_NONE);
@@ -5103,6 +5104,7 @@ void ANIM_channel_draw_widgets(const bContext *C,
   width,
   channel_height);
   }
+  MEM_freeN(gp_rna_path);
 
   /* Layer onion skinning switch. */
   prop = RNA_struct_find_property(, "use_onion_skinning");
@@ -5120,6 +5122,7 @@ void ANIM_channel_draw_widgets(const bContext *C,
   width,
   channel_height);
   }
+  MEM_freeN(gp_rna_path);
 }
 
 /* Only if RNA-Path found. */

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


[Bf-blender-cvs] [574a59dfb02] master: Fix T72112: Perpendicular snapping with closest not working

2019-12-03 Thread mano-wii
Commit: 574a59dfb02b40d369d3b02b17de3f2dbd598bec
Author: mano-wii
Date:   Tue Dec 3 12:20:27 2019 -0300
Branches: master
https://developer.blender.org/rB574a59dfb02b40d369d3b02b17de3f2dbd598bec

Fix T72112: Perpendicular snapping with closest not working

The closest target is calculated only after a snap point is found.
So use `center_global` while the target is not calculated.

===

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

===

diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index 99429db6af7..4b6ab2045c0 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1362,6 +1362,7 @@ static void TargetSnapClosest(TransInfo *t)
 short snapObjectsTransform(
 TransInfo *t, const float mval[2], float *dist_px, float r_loc[3], float 
r_no[3])
 {
+  float *target = (t->tsnap.status & TARGET_INIT) ? t->tsnap.snapTarget : 
t->center_global;
   return ED_transform_snap_object_project_view3d_ex(
   t->tsnap.object_context,
   t->scene->toolsettings->snap_mode,
@@ -1373,7 +1374,7 @@ short snapObjectsTransform(
SCE_SNAP_BACKFACE_CULLING) != 0,
   },
   mval,
-  t->tsnap.snapTarget,
+  target,
   dist_px,
   r_loc,
   r_no,

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


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

2019-12-03 Thread Antonio Vazquez
Commit: 9db6144e4ef0273ba4138ee128b6cc0bc8e71a19
Author: Antonio Vazquez
Date:   Tue Dec 3 16:17:41 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB9db6144e4ef0273ba4138ee128b6cc0bc8e71a19

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] [b81939716de] master: Fix T70378: Grease pencil armature modifier not normalizing weights as expected.

2019-12-03 Thread Jean First
Commit: b81939716de822b3d35c8c4ae30a9f9b1ea23bbc
Author: Jean First
Date:   Tue Dec 3 15:53:22 2019 +0100
Branches: master
https://developer.blender.org/rBb81939716de822b3d35c8c4ae30a9f9b1ea23bbc

Fix T70378: Grease pencil armature modifier not normalizing weights as expected.

The function armature_vert_task had a special case for Vertex Paints in Grease 
Pencil data. This patch
removes this special case. Not sure why it was needed in the first place.

Reviewed By: antoniov

Maniphest Tasks: T70378

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

===

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

===

diff --git a/source/blender/blenkernel/intern/armature.c 
b/source/blender/blenkernel/intern/armature.c
index a694a335069..4ecb4093692 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1561,7 +1561,6 @@ static void armature_vert_task(void *__restrict userdata,
 MDeformWeight *dw = dvert->dw;
 int deformed = 0;
 unsigned int j;
-float acum_weight = 0;
 for (j = dvert->totweight; j != 0; j--, dw++) {
   const int index = dw->def_nr;
   if (index >= 0 && index < data->defbase_tot && (pchan = 
data->defnrToPC[index])) {
@@ -1575,20 +1574,8 @@ static void armature_vert_task(void *__restrict userdata,
   co, bone->arm_head, bone->arm_tail, bone->rad_head, 
bone->rad_tail, bone->dist);
 }
 
-/* check limit of weight */
-if (data->target->type == OB_GPENCIL) {
-  if (acum_weight + weight >= 1.0f) {
-weight = 1.0f - acum_weight;
-  }
-  acum_weight += weight;
-}
-
 pchan_bone_deform(pchan, weight, vec, dq, smat, co, );
 
-/* if acumulated weight limit exceed, exit loop */
-if ((data->target->type == OB_GPENCIL) && (acum_weight >= 1.0f)) {
-  break;
-}
   }
 }
 /* if there are vertexgroups but not groups with bones

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


[Bf-blender-cvs] [dcded195077] master: Overlay: Armature: Fix Crash entering armature edit mode

2019-12-03 Thread Clément Foucault
Commit: dcded19507789ee59b6cda54f678802bd6a3ff69
Author: Clément Foucault
Date:   Tue Dec 3 16:14:47 2019 +0100
Branches: master
https://developer.blender.org/rBdcded19507789ee59b6cda54f678802bd6a3ff69

Overlay: Armature: Fix Crash entering armature edit mode

===

M   source/blender/draw/engines/overlay/overlay_armature.c

===

diff --git a/source/blender/draw/engines/overlay/overlay_armature.c 
b/source/blender/draw/engines/overlay/overlay_armature.c
index 8930ccb94b3..a45397e9d81 100644
--- a/source/blender/draw/engines/overlay/overlay_armature.c
+++ b/source/blender/draw/engines/overlay/overlay_armature.c
@@ -999,7 +999,8 @@ static const float *get_bone_solid_with_consts_color(const 
ArmatureDrawContext *
   const float *col = get_bone_solid_color(ctx, eBone, pchan, arm, boneflag, 
constflag);
 
   static float consts_color[4];
-  if (set_pchan_color(ctx, PCHAN_COLOR_CONSTS, boneflag, constflag, 
consts_color)) {
+  if ((arm->flag & ARM_POSEMODE) &&
+  set_pchan_color(ctx, PCHAN_COLOR_CONSTS, boneflag, constflag, 
consts_color)) {
 interp_v3_v3v3(consts_color, col, consts_color, 0.5f);
   }
   else {

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


[Bf-blender-cvs] [d709399b641] functions: new Get Normal on Surface node

2019-12-03 Thread Jacques Lucke
Commit: d709399b641ebcd4fee2fc22cd7677b7da391f1e
Author: Jacques Lucke
Date:   Tue Dec 3 16:00:02 2019 +0100
Branches: functions
https://developer.blender.org/rBd709399b641ebcd4fee2fc22cd7677b7da391f1e

new Get Normal on Surface node

===

M   release/scripts/startup/nodes/function_nodes/object_mesh.py
M   
source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
M   source/blender/functions/intern/multi_functions/mixed.cc
M   source/blender/functions/intern/multi_functions/mixed.h
M   source/blender/simulations/bparticles/node_frontend.cpp

===

diff --git a/release/scripts/startup/nodes/function_nodes/object_mesh.py 
b/release/scripts/startup/nodes/function_nodes/object_mesh.py
index a505c9e1962..5b18ff87c0a 100644
--- a/release/scripts/startup/nodes/function_nodes/object_mesh.py
+++ b/release/scripts/startup/nodes/function_nodes/object_mesh.py
@@ -39,6 +39,15 @@ class GetPositionOnSurfaceNode(bpy.types.Node, FunctionNode):
 builder.fixed_output("position", "Position", "Vector")
 
 
+class GetNormalOnSurfaceNode(bpy.types.Node, FunctionNode):
+bl_idname = "fn_GetNormalOnSurfaceNode"
+bl_label = "Get Normal on Surface"
+
+def declaration(self, builder):
+builder.fixed_input("location", "Location", "Surface Location")
+builder.fixed_output("normal", "Normal", "Vector")
+
+
 class GetWeightOnSurfaceNode(bpy.types.Node, FunctionNode):
 bl_idname = "fn_GetWeightOnSurfaceNode"
 bl_label = "Get Weight on Surface"
diff --git 
a/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
 
b/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
index 14ca7251ab7..7bed07f0424 100644
--- 
a/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
+++ 
b/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
@@ -65,6 +65,11 @@ static void 
INSERT_get_position_on_surface(VNodeMFNetworkBuilder )
   builder.set_constructed_matching_fn();
 }
 
+static void INSERT_get_normal_on_surface(VNodeMFNetworkBuilder )
+{
+  builder.set_constructed_matching_fn();
+}
+
 static void INSERT_get_weight_on_surface(VNodeMFNetworkBuilder )
 {
   std::string group_name = builder.string_from_property("vertex_group_name");
@@ -385,6 +390,7 @@ void 
add_inlined_tree_node_mapping_info(VTreeMultiFunctionMappings )
   mappings.xnode_inserters.add_new("fn_ObjectTransformsNode", 
INSERT_object_location);
   mappings.xnode_inserters.add_new("fn_ObjectMeshNode", 
INSERT_object_mesh_info);
   mappings.xnode_inserters.add_new("fn_GetPositionOnSurfaceNode", 
INSERT_get_position_on_surface);
+  mappings.xnode_inserters.add_new("fn_GetNormalOnSurfaceNode", 
INSERT_get_normal_on_surface);
   mappings.xnode_inserters.add_new("fn_GetWeightOnSurfaceNode", 
INSERT_get_weight_on_surface);
   mappings.xnode_inserters.add_new("fn_GetImageColorOnSurfaceNode",
INSERT_get_image_color_on_surface);
diff --git a/source/blender/functions/intern/multi_functions/mixed.cc 
b/source/blender/functions/intern/multi_functions/mixed.cc
index 6969bc0d649..5d89ff100d3 100644
--- a/source/blender/functions/intern/multi_functions/mixed.cc
+++ b/source/blender/functions/intern/multi_functions/mixed.cc
@@ -286,25 +286,25 @@ void MF_GetPositionOnSurface::call(MFMask mask, MFParams 
params, MFContext conte
 {
   VirtualListRef locations = 
params.readonly_single_input(
   0, "Surface Location");
-  MutableArrayRef positions = 
params.uninitialized_single_output(1, "Position");
+  MutableArrayRef r_positions = 
params.uninitialized_single_output(1, "Position");
 
   auto persistent_surfaces_opt =
   context.element_contexts().find_first();
   if (!persistent_surfaces_opt.has_value()) {
-positions.fill_indices(mask.indices(), {0, 0, 0});
+r_positions.fill_indices(mask.indices(), {0, 0, 0});
 return;
   }
 
   for (uint i : mask.indices()) {
 SurfaceLocation location = locations[i];
 if (!location.is_valid()) {
-  positions[i] = {0, 0, 0};
+  r_positions[i] = {0, 0, 0};
   continue;
 }
 
 Object *object = 
persistent_surfaces_opt->data->lookup((uint32_t)location.surface_id());
 if (object == nullptr) {
-  positions[i] = {0, 0, 0};
+  r_positions[i] = {0, 0, 0};
   continue;
 }
 
@@ -313,7 +313,7 @@ void MF_GetPositionOnSurface::call(MFMask mask, MFParams 
params, MFContext conte
 int triangle_amount = BKE_mesh_runtime_looptri_len(mesh);
 
 if (location.triangle_index() >= triangle_amount) {
-  positions[i] = {0, 0, 0};
+  r_positions[i] = {0, 0, 0};
   continue;
 }
 
@@ -327,7 +327,70 @@ void MF_GetPositionOnSurface::call(MFMask mask, MFParams 
params, MFContext conte
 float4x4 local_to_world = object->obmat;
 position 

[Bf-blender-cvs] [7fb768e2c40] functions: cleanup: remove unused class

2019-12-03 Thread Jacques Lucke
Commit: 7fb768e2c40afb343f25f4e7369b518a3b2e6ea0
Author: Jacques Lucke
Date:   Tue Dec 3 15:17:38 2019 +0100
Branches: functions
https://developer.blender.org/rB7fb768e2c40afb343f25f4e7369b518a3b2e6ea0

cleanup: remove unused class

===

D   source/blender/blenlib/BLI_chained_strings.h
M   source/blender/blenlib/CMakeLists.txt
D   tests/gtests/blenlib/BLI_chained_strings_test.cc
M   tests/gtests/blenlib/CMakeLists.txt

===

diff --git a/source/blender/blenlib/BLI_chained_strings.h 
b/source/blender/blenlib/BLI_chained_strings.h
deleted file mode 100644
index 07449399ef5..000
--- a/source/blender/blenlib/BLI_chained_strings.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-
-/** \file
- * \ingroup bli
- *
- * These classes help storing multiple strings more compactly.
- * This should only be used when:
- *   - All strings are freed at the same time.
- *   - The length of individual strings does not change.
- *   - All string lengths are known in the beginning. */
-
-#pragma once
-
-#include "BLI_string_ref.h"
-#include "BLI_vector.h"
-
-namespace BLI {
-
-class ChainedStringRef {
-  uint32_t m_start : 24;
-  uint32_t m_size : 8;
-
- public:
-  ChainedStringRef(uint start, uint size) : m_start(start), m_size(size)
-  {
-BLI_assert(size < (1 << 8));
-BLI_assert(start < (1 << 24));
-  }
-
-  uint size() const
-  {
-return m_size;
-  }
-
-  StringRefNull to_string_ref(const char *ptr) const
-  {
-return StringRefNull(ptr + m_start, m_size);
-  }
-};
-
-class ChainedStringsBuilder {
- public:
-  ChainedStringRef add(StringRef str)
-  {
-ChainedStringRef ref(m_chars.size(), str.size());
-m_chars.extend(str.data(), str.size());
-m_chars.append(0);
-return ref;
-  }
-
-  char *build()
-  {
-char *ptr = (char *)MEM_mallocN(m_chars.size(), __func__);
-memcpy(ptr, m_chars.begin(), m_chars.size());
-return ptr;
-  }
-
- private:
-  Vector m_chars;
-};
-
-}  // namespace BLI
diff --git a/source/blender/blenlib/CMakeLists.txt 
b/source/blender/blenlib/CMakeLists.txt
index 629058d67ca..fb088d23f48 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -258,7 +258,6 @@ set(SRC
   BLI_dot_export.h
   BLI_dot_export_attribute_enums.h
   intern/dot_export.cc
-  BLI_chained_strings.h
   BLI_lazy_init.h
   BLI_lazy_init_cxx.h
   intern/BLI_lazy_init.cc
diff --git a/tests/gtests/blenlib/BLI_chained_strings_test.cc 
b/tests/gtests/blenlib/BLI_chained_strings_test.cc
deleted file mode 100644
index 1fdf9959124..000
--- a/tests/gtests/blenlib/BLI_chained_strings_test.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "testing/testing.h"
-#include "BLI_chained_strings.h"
-
-using BLI::ChainedStringRef;
-using BLI::ChainedStringsBuilder;
-
-TEST(chained_strings, BuildEmpty)
-{
-  ChainedStringsBuilder builder;
-  char *str = builder.build();
-  EXPECT_NE(str, nullptr);
-  MEM_freeN(str);
-}
-
-TEST(chained_strings, BuildSingleString)
-{
-  ChainedStringsBuilder builder;
-  auto ref = builder.add("Hello");
-
-  char *str = builder.build();
-
-  EXPECT_EQ(ref.size(), 5);
-  EXPECT_EQ(ref.to_string_ref(str), "Hello");
-
-  MEM_freeN(str);
-}
-
-TEST(chained_strings, BuildMultiple)
-{
-  ChainedStringsBuilder builder;
-  auto ref1 = builder.add("Why");
-  auto ref2 = builder.add("What");
-  auto ref3 = builder.add("Where");
-
-  char *str = builder.build();
-
-  EXPECT_EQ(ref1.size(), 3);
-  EXPECT_EQ(ref2.size(), 4);
-  EXPECT_EQ(ref3.size(), 5);
-
-  EXPECT_EQ(ref1.to_string_ref(str), "Why");
-  EXPECT_EQ(ref2.to_string_ref(str), "What");
-  EXPECT_EQ(ref3.to_string_ref(str), "Where");
-
-  MEM_freeN(str);
-}
diff --git a/tests/gtests/blenlib/CMakeLists.txt 
b/tests/gtests/blenlib/CMakeLists.txt
index 9327bb790f7..752a6601e98 100644
--- a/tests/gtests/blenlib/CMakeLists.txt
+++ b/tests/gtests/blenlib/CMakeLists.txt
@@ -43,7 +43,6 @@ BLENDER_TEST(BLI_array_ref "bf_blenlib")
 BLENDER_TEST(BLI_array_store "bf_blenlib")
 BLENDER_TEST(BLI_array_utils "bf_blenlib")
 BLENDER_TEST(BLI_bit_array_ref "bf_blenlib")
-BLENDER_TEST(BLI_chained_strings "bf_blenlib")
 BLENDER_TEST(BLI_chunked_range 

[Bf-blender-cvs] [f6e39cc95da] functions: add StringMap.add method

2019-12-03 Thread Jacques Lucke
Commit: f6e39cc95da8dead77b8d74349b9a6f32c3b6a10
Author: Jacques Lucke
Date:   Tue Dec 3 15:11:46 2019 +0100
Branches: functions
https://developer.blender.org/rBf6e39cc95da8dead77b8d74349b9a6f32c3b6a10

add StringMap.add method

===

M   source/blender/blenlib/BLI_string_map.h
M   source/blender/simulations/bparticles/world_state.hpp
M   tests/gtests/blenlib/BLI_string_map_test.cc

===

diff --git a/source/blender/blenlib/BLI_string_map.h 
b/source/blender/blenlib/BLI_string_map.h
index 458a48cad5e..1378c3ae79e 100644
--- a/source/blender/blenlib/BLI_string_map.h
+++ b/source/blender/blenlib/BLI_string_map.h
@@ -190,6 +190,22 @@ template class StringMap {
 this->add_new__impl(key, std::move(value));
   }
 
+  /**
+   * Add a new element to the map if the key does not exist yet.
+   */
+  void add(StringRef key, const T )
+  {
+if (!this->contains(key)) {
+  this->add_new(key, value);
+}
+  }
+  void add(StringRef key, T &)
+  {
+if (!this->contains(key)) {
+  this->add_new(key, std::move(value));
+}
+  }
+
   /**
* Return true when the key exists in the map, otherwise false.
*/
diff --git a/source/blender/simulations/bparticles/world_state.hpp 
b/source/blender/simulations/bparticles/world_state.hpp
index fbdd1f4c298..6b842700421 100644
--- a/source/blender/simulations/bparticles/world_state.hpp
+++ b/source/blender/simulations/bparticles/world_state.hpp
@@ -69,17 +69,17 @@ class WorldState {
  public:
   void store_state(StringRef main_id, StringRef sub_id, float value)
   {
-m_states_float.add_new(main_id + sub_id, value);
+m_states_float.add(main_id + sub_id, value);
   }
 
   void store_state(StringRef main_id, StringRef sub_id, float3 value)
   {
-m_states_float3.add_new(main_id + sub_id, value);
+m_states_float3.add(main_id + sub_id, value);
   }
 
   void store_state(StringRef main_id, StringRef sub_id, float4x4 value)
   {
-m_states_float4x4.add_new(main_id + sub_id, value);
+m_states_float4x4.add(main_id + sub_id, value);
   }
 };
 
diff --git a/tests/gtests/blenlib/BLI_string_map_test.cc 
b/tests/gtests/blenlib/BLI_string_map_test.cc
index 59620dd2799..2fc238d9a1d 100644
--- a/tests/gtests/blenlib/BLI_string_map_test.cc
+++ b/tests/gtests/blenlib/BLI_string_map_test.cc
@@ -43,6 +43,21 @@ TEST(string_map, MoveConstructor)
   EXPECT_EQ(map2.lookup("B")[5], 6);
 }
 
+TEST(string_map, Add)
+{
+  StringMap map;
+  EXPECT_EQ(map.size(), 0);
+
+  map.add("test", 1);
+  EXPECT_EQ(map.lookup("test"), 1);
+
+  map.add("test", 2);
+  EXPECT_EQ(map.lookup("test"), 1);
+
+  map.add("test2", 2);
+  EXPECT_EQ(map.lookup("test2"), 2);
+}
+
 TEST(string_map, AddNew)
 {
   StringMap map;

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


[Bf-blender-cvs] [4127c7ff876] functions: make execute and influence sockets work in groups

2019-12-03 Thread Jacques Lucke
Commit: 4127c7ff87600bae3da7b74a85b152d49ca5f166
Author: Jacques Lucke
Date:   Tue Dec 3 15:07:40 2019 +0100
Branches: functions
https://developer.blender.org/rB4127c7ff87600bae3da7b74a85b152d49ca5f166

make execute and influence sockets work in groups

===

M   release/scripts/startup/nodes/declaration/__init__.py
M   release/scripts/startup/nodes/declaration/bparticles.py
M   release/scripts/startup/nodes/function_nodes/groups.py
M   release/scripts/startup/nodes/function_tree.py
M   release/scripts/startup/nodes/node_builder.py
M   release/scripts/startup/nodes/node_operators.py
M   source/blender/blenkernel/intern/inlined_node_tree.cc
M   
source/blender/functions/intern/inlined_tree_multi_function_network/generate.cc
M   source/blender/simulations/bparticles/particle_function.cpp

===

diff --git a/release/scripts/startup/nodes/declaration/__init__.py 
b/release/scripts/startup/nodes/declaration/__init__.py
index a67bcbfe059..ea1185b4b5a 100644
--- a/release/scripts/startup/nodes/declaration/__init__.py
+++ b/release/scripts/startup/nodes/declaration/__init__.py
@@ -8,5 +8,6 @@ from . vectorized import VectorizedInputDecl, 
VectorizedOutputDecl
 from . bparticles import (
 InfluencesSocketDecl,
 ExecuteOutputDecl,
+ExecuteInputDecl,
 ExecuteInputListDecl,
 )
diff --git a/release/scripts/startup/nodes/declaration/bparticles.py 
b/release/scripts/startup/nodes/declaration/bparticles.py
index f4b2d96c810..cd7bf1fc49a 100644
--- a/release/scripts/startup/nodes/declaration/bparticles.py
+++ b/release/scripts/startup/nodes/declaration/bparticles.py
@@ -56,6 +56,27 @@ class ExecuteOutputDecl(SocketDeclBase):
 return False
 return True
 
+
+class ExecuteInputDecl(SocketDeclBase):
+def __init__(self, node, identifier: str, display_name: str):
+self.node = node
+self.identifier = identifier
+self.display_name = display_name
+
+def build(self, node_sockets):
+return [node_sockets.new("fn_ExecuteSocket", self.display_name, 
identifier=self.identifier)]
+
+def amount(self):
+return 1
+
+def validate(self, sockets):
+if len(sockets) != 1:
+return False
+if sockets[0].bl_idname != "fn_ExecuteSocket":
+return False
+return True
+
+
 class ExecuteInputListDecl(SocketDeclBase):
 def __init__(self, node, identifier: str, prop_name: str, display_name: 
str):
 self.node = node
diff --git a/release/scripts/startup/nodes/function_nodes/groups.py 
b/release/scripts/startup/nodes/function_nodes/groups.py
index a3d765d29a8..db306aeff87 100644
--- a/release/scripts/startup/nodes/function_nodes/groups.py
+++ b/release/scripts/startup/nodes/function_nodes/groups.py
@@ -6,62 +6,106 @@ from .. function_tree import FunctionTree
 from .. node_builder import NodeBuilder
 from .. ui import NodeSidebarPanel
 
-class GroupInputNode(BaseNode):
-sort_index: IntProperty()
-
-class GroupOutputNode(BaseNode):
-sort_index: IntProperty()
+interface_type_items = [
+("DATA", "Data", "Some data type like integer or vector", "NONE", 0),
+("EXECUTE", "Control Flow", "", "NONE", 1),
+("INFLUENCES", "Influences", "", "NONE", 2),
+]
 
-class GroupDataInputNode(bpy.types.Node, GroupInputNode):
-bl_idname = "fn_GroupDataInputNode"
-bl_label = "Group Data Input"
+class GroupInputNode(bpy.types.Node, BaseNode):
+bl_idname = "fn_GroupInputNode"
+bl_label = "Group Input"
 
 input_name: StringProperty(
 default="Name",
-update=GroupInputNode.sync_tree,
+update=BaseNode.sync_tree,
+)
+
+sort_index: IntProperty()
+
+interface_type: EnumProperty(
+items=interface_type_items,
+default="DATA",
+update= BaseNode.sync_tree,
 )
 
 data_type: StringProperty(
 default="Float",
-update=GroupInputNode.sync_tree,
+update=BaseNode.sync_tree,
 )
 
 def declaration(self, builder: NodeBuilder):
-builder.fixed_output("value", "Value", self.data_type)
+builder.background_color((0.8, 0.8, 0.8))
+
+if self.interface_type == "DATA":
+builder.fixed_output("value", "Value", self.data_type)
+elif self.interface_type == "EXECUTE":
+builder.execute_output("execute", "Execute")
+elif self.interface_type == "INFLUENCES":
+builder.influences_output("influences", "Influences")
+else:
+assert False
 
 def draw(self, layout):
-layout.prop(self, "input_name", text="")
+col = layout.column()
+col.prop(self, "input_name", text="")
+
+if self.interface_type == "DATA":
+if hasattr(self.outputs[0], "draw_property"):
+self.outputs[0].draw_property(col, self, "Default")
 
-if 

[Bf-blender-cvs] [adb6be36e49] master: Buildbot: Correct timestamp argument for Windows codesign

2019-12-03 Thread Sergey Sharybin
Commit: adb6be36e496262380eae2611f695b967ffce0f2
Author: Sergey Sharybin
Date:   Tue Dec 3 14:39:53 2019 +0100
Branches: master
https://developer.blender.org/rBadb6be36e496262380eae2611f695b967ffce0f2

Buildbot: Correct timestamp argument for Windows codesign

The current authority we use RFC 3161 time stamp server,
so need to pass different command line argument.

===

M   build_files/buildbot/codesign/windows_code_signer.py

===

diff --git a/build_files/buildbot/codesign/windows_code_signer.py 
b/build_files/buildbot/codesign/windows_code_signer.py
index 9481b66ee1e..638f098d8bc 100644
--- a/build_files/buildbot/codesign/windows_code_signer.py
+++ b/build_files/buildbot/codesign/windows_code_signer.py
@@ -53,7 +53,7 @@ class WindowsCodeSigner(BaseCodeSigner):
 return [
 'signtool', 'sign', '/v',
 '/f', self.config.CERTIFICATE_FILEPATH,
-'/t', self.config.TIMESTAMP_AUTHORITY_URL]
+'/tr', self.config.TIMESTAMP_AUTHORITY_URL]
 
 def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
 # NOTE: Sign files one by one to avoid possible command line length

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


[Bf-blender-cvs] [4a440ecb99d] blender-v2.81-release: Fix T72071: Crash on snap to edge

2019-12-03 Thread mano-wii
Commit: 4a440ecb99d7f365c754e533023d127a9b806115
Author: mano-wii
Date:   Mon Dec 2 10:30:37 2019 -0300
Branches: blender-v2.81-release
https://developer.blender.org/rB4a440ecb99d7f365c754e533023d127a9b806115

Fix T72071: Crash on snap to edge

Caused when the vertices index is dirty due to some mesh editing
operation like Extrude

===

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

===

diff --git a/source/blender/editors/transform/transform_snap_object.c 
b/source/blender/editors/transform/transform_snap_object.c
index f35a2808f22..c8fa48fefee 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -1312,7 +1312,7 @@ static short snap_mesh_polygon(SnapObjectContext *sctx,
 l_iter = l_first = BM_FACE_FIRST_LOOP(f);
 if (snapdata->snap_to_flag & SCE_SNAP_MODE_EDGE) {
   elem = SCE_SNAP_MODE_EDGE;
-  BM_mesh_elem_index_ensure(em->bm, BM_EDGE);
+  BM_mesh_elem_index_ensure(em->bm, BM_VERT | BM_EDGE);
   BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE);
   do {
 cb_snap_edge(,

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


[Bf-blender-cvs] [bdfcee347eb] blender-v2.81-release: Fix T71864: Broken 'Select' > 'More' in face mode in UV Editor

2019-12-03 Thread Philipp Oeser
Commit: bdfcee347ebe26cda5b5d51ce6006a6766e97842
Author: Philipp Oeser
Date:   Wed Nov 27 11:06:49 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rBbdfcee347ebe26cda5b5d51ce6006a6766e97842

Fix T71864: Broken 'Select' > 'More' in face mode in UV Editor

Caused by rBeead6a604602.

Above commit didnt account for different element types being tagged (face
select mode tagged faces, others tagged loops) and always flushed from
loops.

Now restore to flush from faces if we are in face select mode.

Maniphest Tasks: T71864

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

===

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

===

diff --git a/source/blender/editors/uvedit/uvedit_ops.c 
b/source/blender/editors/uvedit/uvedit_ops.c
index 0d258ba542b..eb3d47ba1b5 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -1478,6 +1478,8 @@ static int uv_select_more_less(bContext *C, const bool 
select)
   Object **objects = 
BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
   view_layer, ((View3D *)NULL), _len);
 
+  const bool is_uv_face_selectmode = (ts->uv_selectmode == UV_SELECT_FACE);
+
   for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
 Object *obedit = objects[ob_index];
 BMEditMesh *em = BKE_editmesh_from_object(obedit);
@@ -1499,7 +1501,7 @@ static int uv_select_more_less(bContext *C, const bool 
select)
   continue;
 }
 
-if (ts->uv_selectmode == UV_SELECT_FACE) {
+if (is_uv_face_selectmode) {
 
   /* clear tags */
   BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, false);
@@ -1562,8 +1564,14 @@ static int uv_select_more_less(bContext *C, const bool 
select)
 }
 
 if (changed) {
-  /* Select tagged loops. */
-  uv_select_flush_from_tag_loop(sima, scene, obedit, select);
+  if (is_uv_face_selectmode) {
+/* Select tagged faces. */
+uv_select_flush_from_tag_face(sima, scene, obedit, select);
+  }
+  else {
+/* Select tagged loops. */
+uv_select_flush_from_tag_loop(sima, scene, obedit, select);
+  }
   DEG_id_tag_update(obedit->data, ID_RECALC_SELECT);
   WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 }

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


[Bf-blender-cvs] [60e817693ce] blender-v2.81-release: Fix T69332: 'Reset to Default Value' on a custom string property crashes

2019-12-03 Thread Philipp Oeser
Commit: 60e817693ce707842dc8521a6ee94ce1778e6372
Author: Philipp Oeser
Date:   Thu Nov 21 13:58:56 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rB60e817693ce707842dc8521a6ee94ce1778e6372

Fix T69332: 'Reset to Default Value' on a custom string property crashes

Thx @campbellbarton for the heads up!

Maniphest Tasks: T69332

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

===

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

===

diff --git a/source/blender/makesrna/intern/rna_access.c 
b/source/blender/makesrna/intern/rna_access.c
index aeb6d528cdb..78cd99837c3 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -3604,7 +3604,7 @@ char *RNA_property_string_get_default_alloc(PointerRNA 
*ptr,
 /* this is the length without \0 terminator */
 int RNA_property_string_default_length(PointerRNA *UNUSED(ptr), PropertyRNA 
*prop)
 {
-  StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+  StringPropertyRNA *sprop = (StringPropertyRNA *)rna_ensure_property(prop);
 
   BLI_assert(RNA_property_type(prop) == PROP_STRING);

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


[Bf-blender-cvs] [ceab47f3479] master: Cleanup: text-view comments, variable names, const args

2019-12-03 Thread Campbell Barton
Commit: ceab47f34790b5598453720fe276e5e6d521c4be
Author: Campbell Barton
Date:   Tue Dec 3 23:24:12 2019 +1100
Branches: master
https://developer.blender.org/rBceab47f34790b5598453720fe276e5e6d521c4be

Cleanup: text-view comments, variable names, const args

===

M   source/blender/editors/space_console/console_draw.c
M   source/blender/editors/space_console/console_intern.h
M   source/blender/editors/space_info/info_draw.c
M   source/blender/editors/space_info/info_intern.h
M   source/blender/editors/space_info/textview.c
M   source/blender/editors/space_info/textview.h
M   source/blender/makesdna/DNA_space_types.h

===

diff --git a/source/blender/editors/space_console/console_draw.c 
b/source/blender/editors/space_console/console_draw.c
index 5476bde8af5..bf6683ffc33 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -154,12 +154,12 @@ static int console_textview_line_color(struct 
TextViewContext *tvc,
 uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
 xy[1] += tvc->lheight / 6;
 
-console_cursor_wrap_offset(sc->prompt, tvc->console_width, , , 
NULL);
-console_cursor_wrap_offset(cl->line, tvc->console_width, , , 
cl->line + cl->cursor);
+console_cursor_wrap_offset(sc->prompt, tvc->columns, , , NULL);
+console_cursor_wrap_offset(cl->line, tvc->columns, , , cl->line 
+ cl->cursor);
 pen[0] = tvc->cwidth * offc;
 pen[1] = -2 - tvc->lheight * offl;
 
-console_cursor_wrap_offset(cl->line + cl->cursor, tvc->console_width, 
, , NULL);
+console_cursor_wrap_offset(cl->line + cl->cursor, tvc->columns, , 
, NULL);
 pen[1] += tvc->lheight * offl;
 
 /* cursor */
@@ -196,16 +196,16 @@ static void console_textview_draw_rect_calc(const ARegion 
*ar, rcti *draw_rect)
 }
 
 static int console_textview_main__internal(struct SpaceConsole *sc,
-   ARegion *ar,
-   int draw,
+   const ARegion *ar,
+   const bool do_draw,
const int mval[2],
-   void **mouse_pick,
-   int *pos_pick)
+   void **r_mval_pick_item,
+   int *r_mval_pick_offset)
 {
   ConsoleLine cl_dummy = {NULL};
   int ret = 0;
 
-  View2D *v2d = >v2d;
+  const View2D *v2d = >v2d;
 
   TextViewContext tvc = {0};
 
@@ -230,32 +230,32 @@ static int console_textview_main__internal(struct 
SpaceConsole *sc,
   console_textview_draw_rect_calc(ar, _rect);
 
   console_scrollback_prompt_begin(sc, _dummy);
-  ret = textview_draw(, draw, mval, mouse_pick, pos_pick);
+  ret = textview_draw(, do_draw, mval, r_mval_pick_item, 
r_mval_pick_offset);
   console_scrollback_prompt_end(sc, _dummy);
 
   return ret;
 }
 
-void console_textview_main(struct SpaceConsole *sc, ARegion *ar)
+void console_textview_main(struct SpaceConsole *sc, const ARegion *ar)
 {
   const int mval[2] = {INT_MAX, INT_MAX};
-  console_textview_main__internal(sc, ar, 1, mval, NULL, NULL);
+  console_textview_main__internal(sc, ar, true, mval, NULL, NULL);
 }
 
-int console_textview_height(struct SpaceConsole *sc, ARegion *ar)
+int console_textview_height(struct SpaceConsole *sc, const ARegion *ar)
 {
   const int mval[2] = {INT_MAX, INT_MAX};
-  return console_textview_main__internal(sc, ar, 0, mval, NULL, NULL);
+  return console_textview_main__internal(sc, ar, false, mval, NULL, NULL);
 }
 
-int console_char_pick(struct SpaceConsole *sc, ARegion *ar, const int mval[2])
+int console_char_pick(struct SpaceConsole *sc, const ARegion *ar, const int 
mval[2])
 {
-  int pos_pick = 0;
-  void *mouse_pick = NULL;
+  int r_mval_pick_offset = 0;
+  void *mval_pick_item = NULL;
 
   rcti draw_rect;
   console_textview_draw_rect_calc(ar, _rect);
 
-  console_textview_main__internal(sc, ar, 0, mval, _pick, _pick);
-  return pos_pick;
+  console_textview_main__internal(sc, ar, false, mval, _pick_item, 
_mval_pick_offset);
+  return r_mval_pick_offset;
 }
diff --git a/source/blender/editors/space_console/console_intern.h 
b/source/blender/editors/space_console/console_intern.h
index 2a5675b9c3b..def7fbc193b 100644
--- a/source/blender/editors/space_console/console_intern.h
+++ b/source/blender/editors/space_console/console_intern.h
@@ -28,10 +28,10 @@ struct bContext;
 struct wmOperatorType;
 
 /* console_draw.c */
-void console_textview_main(struct SpaceConsole *sc, struct ARegion *ar);
+void console_textview_main(struct SpaceConsole *sc, const struct ARegion *ar);
 /* needed to calculate the scrollbar */
-int console_textview_height(struct 

[Bf-blender-cvs] [aee9d9a4a48] master: Cleanup: unused variables

2019-12-03 Thread Campbell Barton
Commit: aee9d9a4a48270878c089c6c371a33c12b670e8b
Author: Campbell Barton
Date:   Tue Dec 3 23:25:56 2019 +1100
Branches: master
https://developer.blender.org/rBaee9d9a4a48270878c089c6c371a33c12b670e8b

Cleanup: unused variables

===

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

===

diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index 46317a30b19..17163095d4b 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -168,7 +168,7 @@ static void rna_GPencil_editmode_update(Main 
*UNUSED(bmain), Scene *UNUSED(scene
 }
 
 /* Recalc UVs and Fill for all strokes. */
-static void rna_GPencil_strokes_update(Main *bmain, Scene *scene, PointerRNA 
*ptr)
+static void rna_GPencil_strokes_update(Main *UNUSED(bmain), Scene 
*UNUSED(scene), PointerRNA *ptr)
 {
   bGPdata *gpd = (bGPdata *)ptr->owner_id;
   if (gpd) {

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


[Bf-blender-cvs] [781c9f52063] temp-lanpr-review: LANPR: Grease pencil mode init code fix.

2019-12-03 Thread YimingWu
Commit: 781c9f520632798d1d550e8738794c1e4cf939bd
Author: YimingWu
Date:   Tue Dec 3 20:23:43 2019 +0800
Branches: temp-lanpr-review
https://developer.blender.org/rB781c9f520632798d1d550e8738794c1e4cf939bd

LANPR: Grease pencil mode init code fix.

===

M   source/blender/draw/engines/lanpr/lanpr_engine.c
M   source/blender/editors/include/ED_lanpr.h
M   source/blender/editors/lanpr/lanpr_cpu.c

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_engine.c 
b/source/blender/draw/engines/lanpr/lanpr_engine.c
index bc31b8cc11c..0a3dee19f6e 100644
--- a/source/blender/draw/engines/lanpr/lanpr_engine.c
+++ b/source/blender/draw/engines/lanpr/lanpr_engine.c
@@ -128,10 +128,13 @@ static void lanpr_engine_init(void *ved)
 {GPU_ATTACHMENT_TEXTURE(txl->ms_resolve_depth),
  
GPU_ATTACHMENT_TEXTURE(txl->ms_resolve_color)});
 
-  BLI_spin_init(_share.lock_loader);
-  BLI_spin_init(_share.lock_render_status);
+  if (!(lanpr_share.init_complete & LANPR_INIT_LOCKS)) {
+BLI_spin_init(_share.lock_loader);
+BLI_spin_init(_share.lock_render_status);
+lanpr_share.init_complete |= LANPR_INIT_LOCKS;
+  }
 
-  lanpr_share.init_complete = 1;
+  lanpr_share.init_complete |= LANPR_INIT_ENGINE;
 }
 
 void DRW_scene_lanpr_freecache(Scene *sce)
diff --git a/source/blender/editors/include/ED_lanpr.h 
b/source/blender/editors/include/ED_lanpr.h
index b891dc5ddde..497085c2d6c 100644
--- a/source/blender/editors/include/ED_lanpr.h
+++ b/source/blender/editors/include/ED_lanpr.h
@@ -276,6 +276,11 @@ typedef enum LANPR_RenderStatus {
   LANPR_RENDER_FINISHED = 3,
 } LANPR_RenderStatus;
 
+typedef enum LANPR_INIT_STATUS {
+  LANPR_INIT_ENGINE = (1 << 0),
+  LANPR_INIT_LOCKS = (1 << 1),
+} LANPR_INIT_STATUS;
+
 typedef struct LANPR_SharedResource {
 
   /* We only allocate once for all */
@@ -308,7 +313,7 @@ typedef struct LANPR_SharedResource {
   void *ved_viewport;
   void *ved_render;
 
-  int init_complete;
+  LANPR_INIT_STATUS init_complete;
 
   /** To bypass or cancel rendering.
* This status flag should be kept in lanpr_share not render_buffer,
diff --git a/source/blender/editors/lanpr/lanpr_cpu.c 
b/source/blender/editors/lanpr/lanpr_cpu.c
index 601bc5aa229..106054bb32f 100644
--- a/source/blender/editors/lanpr/lanpr_cpu.c
+++ b/source/blender/editors/lanpr/lanpr_cpu.c
@@ -2610,6 +2610,12 @@ LANPR_RenderBuffer *ED_lanpr_create_render_buffer(Scene 
*s)
   BLI_spin_init(>lock_task);
   BLI_spin_init(>render_data_pool.lock_mem);
 
+  if (!(lanpr_share.init_complete & LANPR_INIT_LOCKS)) {
+BLI_spin_init(_share.lock_loader);
+BLI_spin_init(_share.lock_render_status);
+lanpr_share.init_complete |= LANPR_INIT_LOCKS;
+  }
+
   return rb;
 }

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


[Bf-blender-cvs] [73ce35d3325] blender-v2.81-release: Fix segfault when polling `MESH_OT_paint_mask_extract`

2019-12-03 Thread Sybren A. Stüvel
Commit: 73ce35d33258eb43965c58f9aeafa985faa88435
Author: Sybren A. Stüvel
Date:   Tue Nov 26 12:12:29 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rB73ce35d33258eb43965c58f9aeafa985faa88435

Fix segfault when polling `MESH_OT_paint_mask_extract`

`CTX_data_active_object(C)` returns `NULL` when there is no active object,
and this was not tested for in the code.

===

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

===

diff --git a/source/blender/editors/mesh/editmesh_mask_extract.c 
b/source/blender/editors/mesh/editmesh_mask_extract.c
index 25d3118b3a9..1f6211cb10b 100644
--- a/source/blender/editors/mesh/editmesh_mask_extract.c
+++ b/source/blender/editors/mesh/editmesh_mask_extract.c
@@ -59,7 +59,7 @@
 static bool paint_mask_extract_poll(bContext *C)
 {
   Object *ob = CTX_data_active_object(C);
-  if (ob->mode == OB_MODE_SCULPT) {
+  if (ob != NULL && ob->mode == OB_MODE_SCULPT) {
 if (ob->sculpt->bm) {
   CTX_wm_operator_poll_msg_set(C, "The mask can not be extracted with 
dyntopo activated.");
   return false;

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


[Bf-blender-cvs] [90529a8d4d7] functions: Merge branch 'master' into functions

2019-12-03 Thread Jacques Lucke
Commit: 90529a8d4d778070c4300f8ebe6dd5c5cca5164d
Author: Jacques Lucke
Date:   Tue Dec 3 11:55:39 2019 +0100
Branches: functions
https://developer.blender.org/rB90529a8d4d778070c4300f8ebe6dd5c5cca5164d

Merge branch 'master' into functions

===



===

diff --cc source/blender/blenkernel/CMakeLists.txt
index e550fb94757,88a3629ea3f..14229bcb016
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@@ -128,8 -128,8 +128,9 @@@ set(SR
intern/image.c
intern/image_gen.c
intern/image_save.c
 +  intern/inlined_node_tree.cc
intern/ipo.c
+   intern/kelvinlet.c
intern/key.c
intern/keyconfig.c
intern/lattice.c
@@@ -294,8 -292,8 +295,9 @@@
BKE_idprop.h
BKE_image.h
BKE_image_save.h
 +  BKE_inlined_node_tree.h
BKE_ipo.h
+   BKE_kelvinlet.h
BKE_key.h
BKE_keyconfig.h
BKE_lattice.h
diff --cc tests/gtests/CMakeLists.txt
index a04fddf07da,54a1ee41198..51d573a9b98
--- a/tests/gtests/CMakeLists.txt
+++ b/tests/gtests/CMakeLists.txt
@@@ -13,9 -13,10 +13,10 @@@ if(WITH_GTESTS
  
add_subdirectory(testing)
add_subdirectory(blenlib)
+   add_subdirectory(blenloader)
add_subdirectory(guardedalloc)
 -  add_subdirectory(bmesh)
 -  if(WITH_ALEMBIC)
 -add_subdirectory(alembic)
 -  endif()
 +  # add_subdirectory(bmesh)
 +  # if(WITH_ALEMBIC)
 +  #   add_subdirectory(alembic)
 +  # endif()
  endif()

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


[Bf-blender-cvs] [9c102058e10] functions: new Get Image Color on Surface node

2019-12-03 Thread Jacques Lucke
Commit: 9c102058e10bdac48efdfb311392ad332be72a5f
Author: Jacques Lucke
Date:   Tue Dec 3 11:51:47 2019 +0100
Branches: functions
https://developer.blender.org/rB9c102058e10bdac48efdfb311392ad332be72a5f

new Get Image Color on Surface node

===

M   release/scripts/startup/nodes/function_nodes/object_mesh.py
M   source/blender/functions/CMakeLists.txt
M   
source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
M   source/blender/functions/intern/multi_functions/mixed.cc
M   source/blender/functions/intern/multi_functions/mixed.h

===

diff --git a/release/scripts/startup/nodes/function_nodes/object_mesh.py 
b/release/scripts/startup/nodes/function_nodes/object_mesh.py
index 514348fcc60..a505c9e1962 100644
--- a/release/scripts/startup/nodes/function_nodes/object_mesh.py
+++ b/release/scripts/startup/nodes/function_nodes/object_mesh.py
@@ -1,6 +1,7 @@
 import bpy
 from bpy.props import *
 from .. base import FunctionNode
+from .. node_builder import NodeBuilder
 
 class ObjectMeshNode(bpy.types.Node, FunctionNode):
 bl_idname = "fn_ObjectMeshNode"
@@ -52,4 +53,21 @@ class GetWeightOnSurfaceNode(bpy.types.Node, FunctionNode):
 builder.fixed_output("weight", "Weight", "Float")
 
 def draw(self, layout):
-layout.prop(self, "vertex_group_name", text="", icon="GROUP_VERTEX")
\ No newline at end of file
+layout.prop(self, "vertex_group_name", text="", icon="GROUP_VERTEX")
+
+
+class GetImageColorOnSurfaceNode(bpy.types.Node, FunctionNode):
+bl_idname = "fn_GetImageColorOnSurfaceNode"
+bl_label = "Get Image Color on Surface"
+
+image: PointerProperty(
+name="Image",
+type=bpy.types.Image,
+)
+
+def declaration(self, builder: NodeBuilder):
+builder.fixed_input("location", "Location", "Surface Location")
+builder.fixed_output("color", "Color", "Color")
+
+def draw(self, layout):
+layout.prop(self, "image", text="")
\ No newline at end of file
diff --git a/source/blender/functions/CMakeLists.txt 
b/source/blender/functions/CMakeLists.txt
index 81c31b155ec..3c23d7244c1 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -6,9 +6,10 @@ set(INC
   ../blenkernel
   ../depsgraph
   ../windowmanager
+  ../imbuf
   ../../../intern/guardedalloc
 )
-
+ 
 set(INC_SYS
   ${LLVM_INCLUDE_DIRS}
   ${PYTHON_INCLUDE_DIRS}
diff --git 
a/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
 
b/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
index e1cb56d7424..14ca7251ab7 100644
--- 
a/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
+++ 
b/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
@@ -71,6 +71,12 @@ static void 
INSERT_get_weight_on_surface(VNodeMFNetworkBuilder )
   
builder.set_constructed_matching_fn(std::move(group_name));
 }
 
+static void INSERT_get_image_color_on_surface(VNodeMFNetworkBuilder )
+{
+  Image *image = (Image *)RNA_pointer_get(builder.rna(), "image").data;
+  builder.set_constructed_matching_fn(image);
+}
+
 static void INSERT_particle_is_in_group(VNodeMFNetworkBuilder )
 {
   builder.set_constructed_matching_fn();
@@ -173,60 +179,69 @@ static void build_variadic_math_fn(VNodeMFNetworkBuilder 
,
 
 static void INSERT_add_floats(VNodeMFNetworkBuilder )
 {
-  build_variadic_math_fn(builder, +[](float a, float b) -> float { return a + 
b; }, 0.0f);
+  build_variadic_math_fn(
+  builder, +[](float a, float b) -> float { return a + b; }, 0.0f);
 }
 
 static void INSERT_multiply_floats(VNodeMFNetworkBuilder )
 {
-  build_variadic_math_fn(builder, +[](float a, float b) -> float { return a * 
b; }, 1.0f);
+  build_variadic_math_fn(
+  builder, +[](float a, float b) -> float { return a * b; }, 1.0f);
 }
 
 static void INSERT_minimum_floats(VNodeMFNetworkBuilder )
 {
-  build_variadic_math_fn(builder, +[](float a, float b) -> float { return 
std::min(a, b); }, 0.0f);
+  build_variadic_math_fn(
+  builder, +[](float a, float b) -> float { return std::min(a, b); }, 
0.0f);
 }
 
 static void INSERT_maximum_floats(VNodeMFNetworkBuilder )
 {
-  build_variadic_math_fn(builder, +[](float a, float b) -> float { return 
std::max(a, b); }, 0.0f);
+  build_variadic_math_fn(
+  builder, +[](float a, float b) -> float { return std::max(a, b); }, 
0.0f);
 }
 
 static void INSERT_subtract_floats(VNodeMFNetworkBuilder )
 {
-  build_math_fn(builder, +[](float a, float b) -> float { return a - b; });
+  build_math_fn(
+  builder, +[](float a, float b) -> float { return a - b; });
 }
 
 static void INSERT_divide_floats(VNodeMFNetworkBuilder )
 {
-  build_math_fn(builder, +[](float a, float b) -> float { return (b != 0.0f) ? 
a / b : 0.0f; });
+  

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

2019-12-03 Thread Antonio Vazquez
Commit: cb7440201abe2c24913488ba42f16406bf0ecc34
Author: Antonio Vazquez
Date:   Tue Dec 3 12:13:04 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBcb7440201abe2c24913488ba42f16406bf0ecc34

Merge branch 'master' into greasepencil-object

 Conflicts:
source/blender/draw/engines/gpencil/gpencil_draw_utils.c

===



===



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


[Bf-blender-cvs] [a51f7c8a50c] master: Fix T72134: Adaptive UVs does not affect strokes that are already drawn

2019-12-03 Thread Antonio Vazquez
Commit: a51f7c8a50c8dd0858577957fc6a7fe7f48278a0
Author: Antonio Vazquez
Date:   Tue Dec 3 12:09:20 2019 +0100
Branches: master
https://developer.blender.org/rBa51f7c8a50c8dd0858577957fc6a7fe7f48278a0

Fix T72134: Adaptive UVs does not affect strokes that are already drawn

Now when change the setting the strokes are recalculated.

To do this, it was necessary to move the UV recalc to BKE module in order to 
share with Draw Engine. If the recalc it was done in draw engine, the factor 
was only calculated for evaluated version and there was a problem when draw a 
new sytroke.

Now, the RNA parameter recalc the original datablock instead of tag for be 
calculated in Draw Engine.

===

M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index 21356db8abf..6400a4f959e 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -233,6 +233,7 @@ void BKE_gpencil_stroke_2d_flat_ref(const struct bGPDspoint 
*ref_points,
 float (*points2d)[2],
 const float scale,
 int *r_direction);
+void BKE_gpencil_triangulate_stroke_fill(struct bGPdata *gpd, struct 
bGPDstroke *gps);
 
 void BKE_gpencil_transform(struct bGPdata *gpd, float mat[4][4]);
 
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index d0da5c6c0f1..4744d2cf1c0 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -34,6 +34,7 @@
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 #include "BLI_math_vector.h"
+#include "BLI_polyfill_2d.h"
 #include "BLI_string_utils.h"
 
 #include "BLT_translation.h"
@@ -2517,6 +2518,134 @@ void BKE_gpencil_stroke_2d_flat_ref(const bGPDspoint 
*ref_points,
   *r_direction = (int)locy[2];
 }
 
+/* calc bounding box in 2d using flat projection data */
+static void gpencil_calc_2d_bounding_box(const float (*points2d)[2],
+ int totpoints,
+ float minv[2],
+ float maxv[2])
+{
+  minv[0] = points2d[0][0];
+  minv[1] = points2d[0][1];
+  maxv[0] = points2d[0][0];
+  maxv[1] = points2d[0][1];
+
+  for (int i = 1; i < totpoints; i++) {
+/* min */
+if (points2d[i][0] < minv[0]) {
+  minv[0] = points2d[i][0];
+}
+if (points2d[i][1] < minv[1]) {
+  minv[1] = points2d[i][1];
+}
+/* max */
+if (points2d[i][0] > maxv[0]) {
+  maxv[0] = points2d[i][0];
+}
+if (points2d[i][1] > maxv[1]) {
+  maxv[1] = points2d[i][1];
+}
+  }
+  /* use a perfect square */
+  if (maxv[0] > maxv[1]) {
+maxv[1] = maxv[0];
+  }
+  else {
+maxv[0] = maxv[1];
+  }
+}
+
+/* calc texture coordinates using flat projected points */
+static void gpencil_calc_stroke_fill_uv(const float (*points2d)[2],
+int totpoints,
+const float minv[2],
+float maxv[2],
+float (*r_uv)[2])
+{
+  float d[2];
+  d[0] = maxv[0] - minv[0];
+  d[1] = maxv[1] - minv[1];
+  for (int i = 0; i < totpoints; i++) {
+r_uv[i][0] = (points2d[i][0] - minv[0]) / d[0];
+r_uv[i][1] = (points2d[i][1] - minv[1]) / d[1];
+  }
+}
+
+/* Triangulate stroke for high quality fill (this is done only if cache is 
null or stroke was
+ * modified) */
+void BKE_gpencil_triangulate_stroke_fill(bGPdata *gpd, bGPDstroke *gps)
+{
+  BLI_assert(gps->totpoints >= 3);
+
+  /* allocate memory for temporary areas */
+  gps->tot_triangles = gps->totpoints - 2;
+  uint(*tmp_triangles)[3] = MEM_mallocN(sizeof(*tmp_triangles) * 
gps->tot_triangles,
+"GP Stroke temp triangulation");
+  float(*points2d)[2] = MEM_mallocN(sizeof(*points2d) * gps->totpoints,
+"GP Stroke temp 2d points");
+  float(*uv)[2] = MEM_mallocN(sizeof(*uv) * gps->totpoints, "GP Stroke temp 2d 
uv data");
+
+  int direction = 0;
+
+  /* convert to 2d and triangulate */
+  BKE_gpencil_stroke_2d_flat(gps->points, gps->totpoints, points2d, 
);
+  BLI_polyfill_calc(points2d, (uint)gps->totpoints, direction, tmp_triangles);
+
+  /* calc texture coordinates automatically */
+  float minv[2];
+  float maxv[2];
+  /* first needs bounding box data */
+  if (gpd->flag & 

[Bf-blender-cvs] [d6fe8cea736] master: DrawManager: Bounding Box Drawing

2019-12-03 Thread Jeroen Bakker
Commit: d6fe8cea736957fc8ef8164159d555e1d1b7cfe8
Author: Jeroen Bakker
Date:   Tue Dec 3 09:13:17 2019 +0100
Branches: master
https://developer.blender.org/rBd6fe8cea736957fc8ef8164159d555e1d1b7cfe8

DrawManager: Bounding Box Drawing

Fix for T72136: Bounding boxes were still drawn even with disabled
overlays. Also the outline displayed the original mesh

Reviewed By: fclem

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

===

M   source/blender/draw/engines/overlay/overlay_engine.c
M   source/blender/draw/engines/overlay/overlay_outline.c

===

diff --git a/source/blender/draw/engines/overlay/overlay_engine.c 
b/source/blender/draw/engines/overlay/overlay_engine.c
index 667172e5bb5..e83a5c04eaf 100644
--- a/source/blender/draw/engines/overlay/overlay_engine.c
+++ b/source/blender/draw/engines/overlay/overlay_engine.c
@@ -336,7 +336,9 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
   }
 
   /* Relationship, object center, bounbox ... */
-  OVERLAY_extra_cache_populate(vedata, ob);
+  if (!pd->hide_overlays) {
+OVERLAY_extra_cache_populate(vedata, ob);
+  }
 
   if (dupli) {
 dupli->base_flag = ob->base_flag;
diff --git a/source/blender/draw/engines/overlay/overlay_outline.c 
b/source/blender/draw/engines/overlay/overlay_outline.c
index a0c7f575677..cb5344630c3 100644
--- a/source/blender/draw/engines/overlay/overlay_outline.c
+++ b/source/blender/draw/engines/overlay/overlay_outline.c
@@ -271,6 +271,12 @@ void OVERLAY_outline_cache_populate(OVERLAY_Data *vedata,
   const DRWContextState *draw_ctx = DRW_context_state_get();
   struct GPUBatch *geom;
   DRWShadingGroup *shgroup = NULL;
+  const bool draw_outline = ob->dt > OB_BOUNDBOX;
+
+  /* Early exit: outlines of bounding boxes are not drawn. */
+  if (!draw_outline) {
+return;
+  }
 
   if (ob->type == OB_LIGHTPROBE) {
 outline_lightprobe(pd, ob, draw_ctx->view_layer);

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


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

2019-12-03 Thread Antonio Vazquez
Commit: 405074f674ed9611e04c00644d16b4fd1761011e
Author: Antonio Vazquez
Date:   Tue Dec 3 11:20:54 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB405074f674ed9611e04c00644d16b4fd1761011e

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] [fdb4dc34131] greasepencil-object: GPencil: Remove duplicate panel code for layer properties

2019-12-03 Thread Antonio Vazquez
Commit: fdb4dc34131674e2e9bd55f05266aa0f47ce6a68
Author: Antonio Vazquez
Date:   Tue Dec 3 11:20:27 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBfdb4dc34131674e2e9bd55f05266aa0f47ce6a68

GPencil: Remove duplicate panel code for layer properties

Now it uses a parent class for both panels.

===

M   release/scripts/startup/bl_ui/properties_data_gpencil.py
M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   release/scripts/startup/bl_ui/space_dopesheet.py

===

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py 
b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index 5e7fc368fbc..fde5b0272ce 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -21,6 +21,11 @@ import bpy
 from bpy.types import Menu, Panel, UIList
 from rna_prop_ui import PropertyPanel
 
+from bl_ui.properties_grease_pencil_common import (
+GreasePencilLayerAdjustmentsPanel,
+GreasePencilLayerRelationsPanel,
+GreasePencilLayerDisplayPanel,
+)
 
 ###
 # Base-Classes (for shared stuff - e.g. poll, attributes, etc.)
@@ -173,87 +178,23 @@ class DATA_PT_gpencil_layers(DataButtonsPanel, Panel):
 col.prop(gpl, "opacity", text="Opacity", slider=True)
 
 
-class DATA_PT_gpencil_layer_adjustments(LayerDataButtonsPanel, Panel):
+class DATA_PT_gpencil_layer_adjustments(LayerDataButtonsPanel, 
GreasePencilLayerAdjustmentsPanel, Panel):
 bl_label = "Adjustments"
 bl_parent_id = 'DATA_PT_gpencil_layers'
 bl_options = {'DEFAULT_CLOSED'}
 
-def draw(self, context):
-layout = self.layout
-layout.use_property_split = True
-scene = context.scene
-
-gpd = context.gpencil
-gpl = gpd.layers.active
-layout.active = not gpl.lock
-
-# Layer options
-# Offsets - Color Tint
-layout.enabled = not gpl.lock
-col = layout.column(align=True)
-col.prop(gpl, "tint_color")
-col.prop(gpl, "tint_factor", text="Factor", slider=True)
-
-# Vertex Paint Opacity
-col = layout.row(align=True)
-col.prop(gpl, "vertex_paint_opacity", text="Vertex Paint Opacity")
-
-# Offsets - Thickness
-col = layout.row(align=True)
-col.prop(gpl, "line_change", text="Stroke Thickness")
-
-col = layout.row(align=True)
-col.prop(gpl, "pass_index")
-
-col = layout.row(align=True)
-col.prop_search(gpl, "viewlayer_render", scene, "view_layers", 
text="View Layer")
-
-col = layout.row(align=True)
-col.prop(gpl, "lock_material")
 
-
-class DATA_PT_gpencil_layer_relations(LayerDataButtonsPanel, Panel):
+class DATA_PT_gpencil_layer_relations(LayerDataButtonsPanel, 
GreasePencilLayerRelationsPanel, Panel):
 bl_label = "Relations"
 bl_parent_id = 'DATA_PT_gpencil_layers'
 bl_options = {'DEFAULT_CLOSED'}
 
-def draw(self, context):
-layout = self.layout
-layout.use_property_split = True
-layout.use_property_decorate = False
-
-gpd = context.gpencil
-gpl = gpd.layers.active
 
-col = layout.column()
-col.active = not gpl.lock
-col.prop(gpl, "parent")
-col.prop(gpl, "parent_type", text="Type")
-parent = gpl.parent
-
-if parent and gpl.parent_type == 'BONE' and parent.type == 'ARMATURE':
-col.prop_search(gpl, "parent_bone", parent.data, "bones", 
text="Bone")
-
-
-class DATA_PT_gpencil_layer_display(LayerDataButtonsPanel, Panel):
+class DATA_PT_gpencil_layer_display(LayerDataButtonsPanel, 
GreasePencilLayerDisplayPanel, Panel):
 bl_label = "Display"
 bl_parent_id = 'DATA_PT_gpencil_layers'
 bl_options = {'DEFAULT_CLOSED'}
 
-def draw(self, context):
-layout = self.layout
-layout.use_property_split = True
-layout.use_property_decorate = False
-
-gpd = context.gpencil
-gpl = gpd.layers.active
-
-col = layout.row(align=True)
-col.prop(gpl, "channel_color")
-
-col = layout.row(align=True)
-col.prop(gpl, "use_solo_mode", text="Show Only On Keyframed")
-
 
 class DATA_PT_gpencil_onion_skinning(DataButtonsPanel, Panel):
 bl_label = "Onion Skinning"
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 571944eb65f..45f2e36c936 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -813,6 +813,91 @@ class GreasePencilSimplifyPanel:
 sub.prop(rd, "simplify_gpencil_remove_lines", text="Lines")
 
 
+class GreasePencilLayerAdjustmentsPanel:
+bl_label = "Adjustments"
+

[Bf-blender-cvs] [3a344a61e84] blender-v2.81-release: Fix T71612: Viewport rotate doesn't work

2019-12-03 Thread Campbell Barton
Commit: 3a344a61e84d711ea487c71a693c0b9c1460511b
Author: Campbell Barton
Date:   Sun Nov 24 22:47:47 2019 +1100
Branches: blender-v2.81-release
https://developer.blender.org/rB3a344a61e84d711ea487c71a693c0b9c1460511b

Fix T71612: Viewport rotate doesn't work

Error in version patching.

===

M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/blenloader/intern/versioning_userdef.c

===

diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 9e0d3b7a419..993344ee891 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3710,10 +3710,6 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
   }
 
   if (!MAIN_VERSION_ATLEAST(bmain, 281, 3)) {
-if (U.view_rotate_sensitivity_turntable == 0) {
-  U.view_rotate_sensitivity_turntable = DEG2RADF(0.4f);
-  U.view_rotate_sensitivity_trackball = 1.0f;
-}
 for (bScreen *screen = bmain->screens.first; screen; screen = 
screen->id.next) {
   for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
 for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
diff --git a/source/blender/blenloader/intern/versioning_userdef.c 
b/source/blender/blenloader/intern/versioning_userdef.c
index 8328893f524..bbcdba8e0c2 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -664,6 +664,10 @@ void BLO_version_defaults_userpref_blend(Main *bmain, 
UserDef *userdef)
* Include next version bump.
*/
   {
+if (userdef->view_rotate_sensitivity_turntable == 0.0f) {
+  userdef->view_rotate_sensitivity_turntable = DEG2RADF(0.4f);
+  userdef->view_rotate_sensitivity_trackball = 1.0f;
+}
 /* pass */
   }

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


[Bf-blender-cvs] [54bff9dc897] blender-v2.81-release: Fix T71147 Eevee stops rendering after selection attempt

2019-12-03 Thread Clément Foucault
Commit: 54bff9dc8972240d2683c58e31d21ce9324003a4
Author: Clément Foucault
Date:   Thu Nov 28 18:39:08 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rB54bff9dc8972240d2683c58e31d21ce9324003a4

Fix T71147 Eevee stops rendering after selection attempt

This is caused by the fallback path used by OSX, which is reconfiguring
the same default VAO. But it seems to be an issue on certain drivers.

===

M   source/blender/gpu/intern/gpu_batch.c

===

diff --git a/source/blender/gpu/intern/gpu_batch.c 
b/source/blender/gpu/intern/gpu_batch.c
index 168d741f92a..23692cb20ec 100644
--- a/source/blender/gpu/intern/gpu_batch.c
+++ b/source/blender/gpu/intern/gpu_batch.c
@@ -655,11 +655,24 @@ void GPU_batch_draw_advanced(GPUBatch *batch, int 
v_first, int v_count, int i_fi
   // BLI_assert(v_first + v_count <=
   //(batch->elem ? batch->elem->index_len : 
batch->verts[0]->vertex_len));
 
+#ifdef __APPLE__
+  GLuint vao = 0;
+#endif
+
   if (!GPU_arb_base_instance_is_supported()) {
 if (i_first > 0) {
+#ifdef __APPLE__
+  /**
+   * There seems to be a nasty bug when drawing using the same VAO 
reconfiguring. (see T71147)
+   * We just use a throwaway VAO for that. Note that this is likely to 
degrade performance.
+   **/
+  glGenVertexArrays(1, );
+  glBindVertexArray(vao);
+#else
   /* If using offset drawing with instancing, we must
* use the default VAO and redo bindings. */
   glBindVertexArray(GPU_vao_default());
+#endif
   batch_update_program_bindings(batch, i_first);
 }
 else {
@@ -698,6 +711,12 @@ void GPU_batch_draw_advanced(GPUBatch *batch, int v_first, 
int v_count, int i_fi
 glEnable(GL_PRIMITIVE_RESTART);
 #endif
   }
+
+#ifdef __APPLE__
+  if (vao != 0) {
+glDeleteVertexArrays(1, );
+  }
+#endif
 }
 
 /* just draw some vertices and let shader place them where we want. */

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


[Bf-blender-cvs] [893c29c15ca] blender-v2.81-release: Fix T71213: Mask or Mirror before Armature breaks weight paint.

2019-12-03 Thread Alexander Gavrilov
Commit: 893c29c15ca2fd95de79e9390b5650aaeabc999f
Author: Alexander Gavrilov
Date:   Sat Nov 30 19:07:44 2019 +0300
Branches: blender-v2.81-release
https://developer.blender.org/rB893c29c15ca2fd95de79e9390b5650aaeabc999f

Fix T71213: Mask or Mirror before Armature breaks weight paint.

This is a revert of a small fraction of commit rB5e332fd700
that introduced the issue according to bisect.

Doing a break here is wrong, because BKE_crazyspace_build_sculpt
assumes that processing stopped at the first deform modifier
without deformMatrices, and thus skips all modifiers until it
finds one like that. Thus this early loop exit makes the behavior
worse, as instead of skipping just Mask and Mirror, it skips all.

===

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

===

diff --git a/source/blender/blenkernel/intern/crazyspace.c 
b/source/blender/blenkernel/intern/crazyspace.c
index f2ed84b4125..8f25feedff9 100644
--- a/source/blender/blenkernel/intern/crazyspace.c
+++ b/source/blender/blenkernel/intern/crazyspace.c
@@ -415,12 +415,12 @@ int BKE_sculpt_get_first_deform_matrices(struct Depsgraph 
*depsgraph,
 mti->deformMatrices(md, , me_eval, deformedVerts, defmats, 
me_eval->totvert);
   }
   else {
+/* More complex handling will continue in BKE_crazyspace_build_sculpt.
+ * Exiting the loop on a non-deform modifier causes issues - T71213. */
+BLI_assert(crazyspace_modifier_supports_deform(md));
 break;
   }
 }
-else {
-  break;
-}
   }
 
   for (; md; md = md->next) {

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


[Bf-blender-cvs] [c14b164e8a3] blender-v2.81-release: Blender 2.81: Begin corrective 'a' release cycle

2019-12-03 Thread Sergey Sharybin
Commit: c14b164e8a3a470f01f01f6b534bc8de212f3889
Author: Sergey Sharybin
Date:   Tue Dec 3 10:41:42 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rBc14b164e8a3a470f01f01f6b534bc8de212f3889

Blender 2.81: Begin corrective 'a' release cycle

===

M   source/blender/blenkernel/BKE_blender_version.h

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 60c2284285c..4f49d087a8f 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -34,7 +34,7 @@
 
 /** Used by packaging tools. */
 /** Can be left blank, otherwise a,b,c... etc with no quotes. */
-#define BLENDER_VERSION_CHAR
+#define BLENDER_VERSION_CHAR a
 /** alpha/beta/rc/release, docs use this. */
 #define BLENDER_VERSION_CYCLE release
 /** Optionally set to 1,2,... for example to to get alpha1 or rc2. */

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


[Bf-blender-cvs] [6334f97093d] blender-v2.81-release: Fix T71558: Hair particles: Brush effect not occluded by emitter geometry

2019-12-03 Thread mano-wii
Commit: 6334f97093d356835c0a5e48a20fd38ee72cdb4d
Author: mano-wii
Date:   Thu Nov 28 13:40:44 2019 -0300
Branches: blender-v2.81-release
https://developer.blender.org/rB6334f97093d356835c0a5e48a20fd38ee72cdb4d

Fix T71558: Hair particles: Brush effect not occluded by emitter geometry

===

M   source/blender/draw/intern/draw_manager.c

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 9e28627ba3d..e3464ae7320 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2668,6 +2668,9 @@ void DRW_draw_depth_object(ARegion *ar, GPUViewport 
*viewport, Object *object)
   RegionView3D *rv3d = ar->regiondata;
 
   DRW_opengl_context_enable();
+  GPU_matrix_projection_set(rv3d->winmat);
+  GPU_matrix_set(rv3d->viewmat);
+  GPU_matrix_mul(object->obmat);
 
   /* Setup framebuffer */
   DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport);
@@ -2675,7 +2678,6 @@ void DRW_draw_depth_object(ARegion *ar, GPUViewport 
*viewport, Object *object)
   GPU_framebuffer_bind(fbl->depth_only_fb);
   GPU_framebuffer_clear_depth(fbl->depth_only_fb, 1.0f);
   GPU_depth_test(true);
-  GPU_matrix_mul(object->obmat);
 
   const float(*world_clip_planes)[4] = NULL;
   if (rv3d->rflag & RV3D_CLIPPING) {

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


[Bf-blender-cvs] [2ccc52a7f18] blender-v2.81-release: Fix T71741: Crash showing the object relations menu

2019-12-03 Thread Campbell Barton
Commit: 2ccc52a7f18ae2cf242dbf178d5c59b304990c29
Author: Campbell Barton
Date:   Sat Nov 23 02:55:07 2019 +1100
Branches: blender-v2.81-release
https://developer.blender.org/rB2ccc52a7f18ae2cf242dbf178d5c59b304990c29

Fix T71741: Crash showing the object relations menu

===

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

===

diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index abcb4afa37d..303e53fa5ee 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -923,6 +923,7 @@ bool edit_modifier_poll_generic(bContext *C,
 {
   PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type);
   Object *ob = (ptr.owner_id) ? (Object *)ptr.owner_id : 
ED_object_active_context(C);
+  ModifierData *mod = ptr.data; /* May be NULL. */
 
   if (!ob || ID_IS_LINKED(ob)) {
 return 0;
@@ -935,8 +936,10 @@ bool edit_modifier_poll_generic(bContext *C,
   }
 
   if (ID_IS_OVERRIDE_LIBRARY(ob)) {
-CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library 
override");
-return (((ModifierData *)ptr.data)->flag & 
eModifierFlag_OverrideLibrary_Local) != 0;
+if ((mod != NULL) && (mod->flag & eModifierFlag_OverrideLibrary_Local) == 
0) {
+  CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from 
library override");
+  return 0;
+}
   }
 
   if (!is_editmode_allowed && CTX_data_edit_object(C) != NULL) {

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


[Bf-blender-cvs] [c7e64f67ed8] master: Cleanup: rename textview ymin/max

2019-12-03 Thread Campbell Barton
Commit: c7e64f67ed8e0a0f1f7a4f3fa1bab55210140543
Author: Campbell Barton
Date:   Tue Dec 3 19:58:06 2019 +1100
Branches: master
https://developer.blender.org/rBc7e64f67ed8e0a0f1f7a4f3fa1bab55210140543

Cleanup: rename textview ymin/max

This is used for scrolling which wasn't obvious.

===

M   source/blender/editors/space_console/console_draw.c
M   source/blender/editors/space_info/info_draw.c
M   source/blender/editors/space_info/textview.c
M   source/blender/editors/space_info/textview.h

===

diff --git a/source/blender/editors/space_console/console_draw.c 
b/source/blender/editors/space_console/console_draw.c
index 02278934c20..5476bde8af5 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -224,8 +224,8 @@ static int console_textview_main__internal(struct 
SpaceConsole *sc,
   tvc.sel_start = sc->sel_start;
   tvc.sel_end = sc->sel_end;
   tvc.lheight = sc->lheight * UI_DPI_FAC;
-  tvc.ymin = v2d->cur.ymin;
-  tvc.ymax = v2d->cur.ymax;
+  tvc.scroll_ymin = v2d->cur.ymin;
+  tvc.scroll_ymax = v2d->cur.ymax;
 
   console_textview_draw_rect_calc(ar, _rect);
 
diff --git a/source/blender/editors/space_info/info_draw.c 
b/source/blender/editors/space_info/info_draw.c
index a22983c15a8..f2f8b2da4db 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -266,8 +266,8 @@ static int info_textview_main__internal(struct SpaceInfo 
*sinfo,
   tvc.sel_start = 0;
   tvc.sel_end = 0;
   tvc.lheight = 14 * UI_DPI_FAC;  // sc->lheight;
-  tvc.ymin = v2d->cur.ymin;
-  tvc.ymax = v2d->cur.ymax;
+  tvc.scroll_ymin = v2d->cur.ymin;
+  tvc.scroll_ymax = v2d->cur.ymax;
 
   info_textview_draw_rect_calc(ar, _rect);
 
diff --git a/source/blender/editors/space_info/textview.c 
b/source/blender/editors/space_info/textview.c
index 0ebd8bdc065..a112929cf25 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -52,7 +52,7 @@ typedef struct ConsoleDrawContext {
   /** number of characters that fit into the width of the console (fixed 
width) */
   int console_width;
   const rcti *draw_rect;
-  int ymin, ymax;
+  int scroll_ymin, scroll_ymax;
   int *xy;   // [2]
   int *sel;  // [2]
   /* bottom of view == 0, top of file == combine chars, end of line is lower 
then start. */
@@ -169,7 +169,7 @@ static int console_draw_string(ConsoleDrawContext *cdc,
 MEM_freeN(offsets);
 return 1;
   }
-  else if (y_next < cdc->ymin) {
+  else if (y_next < cdc->scroll_ymin) {
 /* have not reached the drawable area so don't break */
 cdc->xy[1] = y_next;
 
@@ -236,7 +236,7 @@ static int console_draw_string(ConsoleDrawContext *cdc,
   cdc->xy[1] += cdc->lheight;
 
   /* check if were out of view bounds */
-  if (cdc->xy[1] > cdc->ymax) {
+  if (cdc->xy[1] > cdc->scroll_ymax) {
 MEM_freeN(offsets);
 return 0;
   }
@@ -275,7 +275,7 @@ static int console_draw_string(ConsoleDrawContext *cdc,
 
 cdc->xy[1] += cdc->lheight;
 
-if (cdc->xy[1] > cdc->ymax) {
+if (cdc->xy[1] > cdc->scroll_ymax) {
   MEM_freeN(offsets);
   return 0;
 }
@@ -309,7 +309,7 @@ int textview_draw(
   CLAMPIS(mval_init[0], tvc->draw_rect.xmin, tvc->draw_rect.xmax) - 
tvc->draw_rect.xmin,
   (mval_init[1] == INT_MAX) ?
   INT_MAX :
-  CLAMPIS(mval_init[1], tvc->draw_rect.ymin, tvc->draw_rect.ymax) + 
tvc->ymin,
+  CLAMPIS(mval_init[1], tvc->draw_rect.ymin, tvc->draw_rect.ymax) + 
tvc->scroll_ymin,
   };
 
   if (pos_pick) {
@@ -329,8 +329,8 @@ int textview_draw(
 cdc.console_width = 1;
   }
   cdc.draw_rect = >draw_rect;
-  cdc.ymin = tvc->ymin;
-  cdc.ymax = tvc->ymax;
+  cdc.scroll_ymin = tvc->scroll_ymin;
+  cdc.scroll_ymax = tvc->scroll_ymax;
   cdc.xy = xy;
   cdc.sel = sel;
   cdc.pos_pick = pos_pick;
diff --git a/source/blender/editors/space_info/textview.h 
b/source/blender/editors/space_info/textview.h
index ca5744dbe90..f7ec61fe65d 100644
--- a/source/blender/editors/space_info/textview.h
+++ b/source/blender/editors/space_info/textview.h
@@ -32,7 +32,8 @@ typedef struct TextViewContext {
   /** Area to draw: (0, 0, winx, winy) with a margin applied and scroll-bar 
subtracted. */
   rcti draw_rect;
 
-  int ymin, ymax;
+  /** Scroll offset in pixels. */
+  int scroll_ymin, scroll_ymax;
 
   /* callbacks */
   int (*begin)(struct TextViewContext *tvc);

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


[Bf-blender-cvs] [1fdea43c29a] master: Fix minor errors with text view margins for console/info editor

2019-12-03 Thread Campbell Barton
Commit: 1fdea43c29a7a0ffb65ec8049da574d4198d22af
Author: Campbell Barton
Date:   Tue Dec 3 19:37:51 2019 +1100
Branches: master
https://developer.blender.org/rB1fdea43c29a7a0ffb65ec8049da574d4198d22af

Fix minor errors with text view margins for console/info editor

- Margins used duplicate define between files.
- Cursor selection ignored margins.
- Cursor wasn't scaling with DPI.

Add a 'draw_rect' member which is the region rect with margins applied
to make these checks clearer.

This resolves issue pointed out in D6300,
which complicated further refactoring.

===

M   source/blender/editors/space_console/console_draw.c
M   source/blender/editors/space_info/info_draw.c
M   source/blender/editors/space_info/textview.c
M   source/blender/editors/space_info/textview.h

===

diff --git a/source/blender/editors/space_console/console_draw.c 
b/source/blender/editors/space_console/console_draw.c
index 4d6b05df609..02278934c20 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -80,8 +80,6 @@ void console_scrollback_prompt_end(struct SpaceConsole *sc, 
ConsoleLine *cl_dumm
   BLI_remlink(>scrollback, cl_dummy);
 }
 
-#define CONSOLE_DRAW_MARGIN 4
-
 /* console textview callbacks */
 static int console_textview_begin(TextViewContext *tvc)
 {
@@ -150,7 +148,7 @@ static int console_textview_line_color(struct 
TextViewContext *tvc,
 const SpaceConsole *sc = (SpaceConsole *)tvc->arg1;
 const ConsoleLine *cl = (ConsoleLine *)sc->history.last;
 int offl = 0, offc = 0;
-int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN};
+int xy[2] = {tvc->draw_rect.xmin, tvc->draw_rect.ymin};
 int pen[2];
 GPUVertFormat *format = immVertexFormat();
 uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
@@ -169,9 +167,9 @@ static int console_textview_line_color(struct 
TextViewContext *tvc,
 immUniformThemeColor(TH_CONSOLE_CURSOR);
 
 immRectf(pos,
- (xy[0] + pen[0]) - 1,
+ (xy[0] + pen[0]) - U.pixelsize,
  (xy[1] + pen[1]),
- (xy[0] + pen[0]) + 1,
+ (xy[0] + pen[0]) + U.pixelsize,
  (xy[1] + pen[1] + tvc->lheight));
 
 immUnbindProgram();
@@ -187,8 +185,22 @@ static void console_textview_const_colors(TextViewContext 
*UNUSED(tvc), unsigned
   UI_GetThemeColor4ubv(TH_CONSOLE_SELECT, bg_sel);
 }
 
-static int console_textview_main__internal(
-struct SpaceConsole *sc, ARegion *ar, int draw, int mval[2], void 
**mouse_pick, int *pos_pick)
+static void console_textview_draw_rect_calc(const ARegion *ar, rcti *draw_rect)
+{
+  const int margin = 4 * UI_DPI_FAC;
+  draw_rect->xmin = margin;
+  draw_rect->xmax = ar->winx - (margin + V2D_SCROLL_WIDTH);
+  draw_rect->ymin = margin;
+  /* No margin at the top (allow text to scroll off the window). */
+  draw_rect->ymax = ar->winy;
+}
+
+static int console_textview_main__internal(struct SpaceConsole *sc,
+   ARegion *ar,
+   int draw,
+   const int mval[2],
+   void **mouse_pick,
+   int *pos_pick)
 {
   ConsoleLine cl_dummy = {NULL};
   int ret = 0;
@@ -214,7 +226,8 @@ static int console_textview_main__internal(
   tvc.lheight = sc->lheight * UI_DPI_FAC;
   tvc.ymin = v2d->cur.ymin;
   tvc.ymax = v2d->cur.ymax;
-  tvc.winx = ar->winx - V2D_SCROLL_WIDTH;
+
+  console_textview_draw_rect_calc(ar, _rect);
 
   console_scrollback_prompt_begin(sc, _dummy);
   ret = textview_draw(, draw, mval, mouse_pick, pos_pick);
@@ -225,13 +238,13 @@ static int console_textview_main__internal(
 
 void console_textview_main(struct SpaceConsole *sc, ARegion *ar)
 {
-  int mval[2] = {INT_MAX, INT_MAX};
+  const int mval[2] = {INT_MAX, INT_MAX};
   console_textview_main__internal(sc, ar, 1, mval, NULL, NULL);
 }
 
 int console_textview_height(struct SpaceConsole *sc, ARegion *ar)
 {
-  int mval[2] = {INT_MAX, INT_MAX};
+  const int mval[2] = {INT_MAX, INT_MAX};
   return console_textview_main__internal(sc, ar, 0, mval, NULL, NULL);
 }
 
@@ -239,11 +252,10 @@ int console_char_pick(struct SpaceConsole *sc, ARegion 
*ar, const int mval[2])
 {
   int pos_pick = 0;
   void *mouse_pick = NULL;
-  int mval_clamp[2];
 
-  mval_clamp[0] = CLAMPIS(mval[0], CONSOLE_DRAW_MARGIN, ar->winx - 
CONSOLE_DRAW_MARGIN);
-  mval_clamp[1] = CLAMPIS(mval[1], CONSOLE_DRAW_MARGIN, ar->winy - 
CONSOLE_DRAW_MARGIN);
+  rcti draw_rect;
+  console_textview_draw_rect_calc(ar, _rect);
 
-  console_textview_main__internal(sc, ar, 0, mval_clamp, _pick, 
_pick);
+  console_textview_main__internal(sc, ar, 0, mval, _pick, _pick);
   return pos_pick;
 }
diff --git