[Bf-blender-cvs] [2714db0531a] temp-topbar-ui: Work in progress redesign of topbar ui

2019-04-20 Thread Campbell Barton
Commit: 2714db0531ae4cbad2ff785453706d8824b758c8
Author: Campbell Barton
Date:   Sat Apr 20 17:01:04 2019 +0200
Branches: temp-topbar-ui
https://developer.blender.org/rB2714db0531ae4cbad2ff785453706d8824b758c8

Work in progress redesign of topbar ui

===

M   release/scripts/startup/bl_ui/space_topbar.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/space_buttons/space_buttons.c

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index e75f4d1bb5d..4ba7e02cbcd 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -599,27 +599,6 @@ class TOPBAR_MT_workspace_menu(Menu):
 props.direction = 'NEXT'
 
 
-class TOPBAR_PT_active_tool(Panel):
-bl_space_type = 'PROPERTIES'
-bl_region_type = 'WINDOW'
-bl_category = ""
-bl_context = ".active_tool"  # dot on purpose (access from tool settings)
-bl_label = "Active Tool"
-bl_options = {'HIDE_HEADER'}
-
-def draw(self, context):
-layout = self.layout
-
-# Panel display of topbar tool settings.
-# currently displays in tool settings, keep here since the same 
functionality is used for the topbar.
-
-layout.use_property_split = True
-layout.use_property_decorate = False
-
-from .space_toolsystem_common import ToolSelectPanelHelper
-ToolSelectPanelHelper.draw_active_tool_header(context, layout, 
show_tool_name=True)
-
-
 # Grease Pencil Object - Primitive curve
 class TOPBAR_PT_gpencil_primitive(Panel):
 bl_space_type = 'VIEW_3D'
@@ -736,7 +715,6 @@ classes = (
 TOPBAR_MT_render,
 TOPBAR_MT_window,
 TOPBAR_MT_help,
-TOPBAR_PT_active_tool,
 TOPBAR_PT_gpencil_layers,
 TOPBAR_PT_gpencil_primitive,
 TOPBAR_PT_gpencil_fill,
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 0c3bfe2caf1..7e79493a806 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -55,133 +55,6 @@ class VIEW3D_HT_tool_header(Header):
 
 self.draw_tool_settings(context)
 
-layout.separator_spacer()
-
-# Mode & Transform Settings
-scene = context.scene
-
-# Orientation
-if object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL'} or has_pose_mode:
-orient_slot = scene.transform_orientation_slots[0]
-row = layout.row(align=True)
-
-sub = row.row()
-sub.ui_units_x = 4
-sub.prop_with_popover(
-orient_slot,
-"type",
-text="",
-panel="VIEW3D_PT_transform_orientations",
-)
-
-# Pivot
-if object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL', 'SCULPT_GPENCIL'} 
or has_pose_mode:
-layout.prop_with_popover(
-tool_settings,
-"transform_pivot_point",
-text="",
-icon_only=True,
-panel="VIEW3D_PT_pivot_point",
-)
-
-# Snap
-show_snap = False
-if obj is None:
-show_snap = True
-else:
-if (object_mode not in {
-'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT',
-'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'
-}) or has_pose_mode:
-show_snap = True
-else:
-
-from .properties_paint_common import UnifiedPaintPanel
-paint_settings = UnifiedPaintPanel.paint_settings(context)
-
-if paint_settings:
-brush = paint_settings.brush
-if brush and brush.stroke_method == 'CURVE':
-show_snap = True
-
-if show_snap:
-snap_items = 
bpy.types.ToolSettings.bl_rna.properties["snap_elements"].enum_items
-snap_elements = tool_settings.snap_elements
-if len(snap_elements) == 1:
-text = ""
-for elem in snap_elements:
-icon = snap_items[elem].icon
-break
-else:
-text = "Mix"
-icon = 'NONE'
-del snap_items, snap_elements
-
-row = layout.row(align=True)
-row.prop(tool_settings, "use_snap", text="")
-
-sub = row.row(align=True)
-sub.popover(
-panel="VIEW3D_PT_snapping",
-icon=icon,
-text=text,
-)
-
-# Proportional editing
-gpd = context.gpencil_data
-if object_mode in {'EDIT', 'PARTICLE_EDIT'}:
-row = layout.row(ali

[Bf-blender-cvs] [93c19a5a2cf] master: Cleanup: comments (mainly long lines)

2019-04-20 Thread Campbell Barton
Commit: 93c19a5a2cf58b75aa3072ce79de5e5d571f3d55
Author: Campbell Barton
Date:   Sun Apr 21 13:44:06 2019 +1000
Branches: master
https://developer.blender.org/rB93c19a5a2cf58b75aa3072ce79de5e5d571f3d55

Cleanup: comments (mainly long lines)

Comments after code can cause awkward line breaks.

===

M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/intern/constraint.c
M   source/blender/blenkernel/intern/library_remap.c
M   source/blender/blenkernel/intern/mesh_remap.c
M   source/blender/blenkernel/intern/object_dupli.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/compositor/nodes/COM_DilateErodeNode.h
M   source/blender/draw/engines/eevee/eevee_lightcache.c
M   source/blender/draw/intern/draw_manager.h
M   source/blender/draw/intern/draw_manager_exec.c
M   source/blender/makesrna/intern/rna_internal_types.h
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/nodes/intern/node_exec.h
M   source/blender/python/intern/bpy_rna_id_collection.c

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index e89e1b05029..d4ad0e771d3 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -325,22 +325,25 @@ void BKE_edges_sharp_from_angle_set(const struct MVert 
*mverts,
  * References a contiguous loop-fan with normal offset vars.
  */
 typedef struct MLoopNorSpace {
-  float vec_lnor[3];  /* Automatically computed loop normal. */
-  float vec_ref[3];   /* Reference vector, orthogonal to vec_lnor. */
-  float vec_ortho[3]; /* Third vector, orthogonal to vec_lnor and vec_ref. */
-  float
-  ref_alpha; /* Reference angle, around vec_ortho, in ]0, pi] range (0.0 
marks that space as invalid). */
-  float
-  ref_beta; /* Reference angle, around vec_lnor, in ]0, 2pi] range (0.0 
marks that space as invalid). */
-  /* All loops using this lnor space (i.e. smooth fan of loops),
+  /** Automatically computed loop normal. */
+  float vec_lnor[3];
+  /** Reference vector, orthogonal to vec_lnor. */
+  float vec_ref[3];
+  /** Third vector, orthogonal to vec_lnor and vec_ref. */
+  float vec_ortho[3];
+  /** Reference angle, around vec_ortho, in ]0, pi] range (0.0 marks that 
space as invalid). */
+  float ref_alpha;
+  /** Reference angle, around vec_lnor, in ]0, 2pi] range (0.0 marks that 
space as invalid). */
+  float ref_beta;
+  /** All loops using this lnor space (i.e. smooth fan of loops),
* as (depending on owning MLoopNorSpaceArrary.data_type):
* - Indices (uint_in_ptr), or
* - BMLoop pointers. */
   struct LinkNode *loops;
   char flags;
 
-  void *
-  user_data; /* To be used for extended processing related to loop normal 
spaces (aka smooth fans). */
+  /** To be used for extended processing related to loop normal spaces (aka 
smooth fans). */
+  void *user_data;
 } MLoopNorSpace;
 /**
  * MLoopNorSpace.flags
diff --git a/source/blender/blenkernel/intern/constraint.c 
b/source/blender/blenkernel/intern/constraint.c
index 01dc7c6b3ad..1ceaf8f6821 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1404,8 +1404,9 @@ static void followpath_evaluate(bConstraint *con, 
bConstraintOb *cob, ListBase *
 mul_m4_m4m4(cob->matrix, ct->matrix, obmat);
 
 /* un-apply scaling caused by path */
-if ((data->followflag & FOLLOWPATH_RADIUS) ==
-0) { /* XXX - assume that scale correction means that radius will have 
some scale error in it - Campbell */
+if ((data->followflag & FOLLOWPATH_RADIUS) == 0) {
+  /* XXX: Assume that scale correction means that radius
+   * will have some scale error in it - Campbell. */
   float obsize[3];
 
   mat4_to_size(obsize, cob->matrix);
diff --git a/source/blender/blenkernel/intern/library_remap.c 
b/source/blender/blenkernel/intern/library_remap.c
index d334804dcd6..5baa7fb3cf8 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -145,14 +145,18 @@ typedef struct IDRemap {
   Main *bmain; /* Only used to trigger depsgraph updates in the right bmain. */
   ID *old_id;
   ID *new_id;
-  ID *id; /* The ID in which we are replacing old_id by new_id usages. */
+  /** The ID in which we are replacing old_id by new_id usages. */
+  ID *id;
   short flag;
 
   /* 'Output' data. */
   short status;
-  int skipped_direct; /* Number of direct usecases that could not be remapped 
(e.g.: obdata when in edit mode). */
-  int skipped_indirect;   /* Number of indirect usecases that could not be 
remapped. */
-  int skipped_refcounted; /* Number of skipped usecases that refcount the 
datablock. */
+  /** Number of direct usecases that could not be remapped (e.g.: obdata when 
in edit mode). */
+  int 

[Bf-blender-cvs] [9d72efe108c] master: Merge branch 'blender2.7'

2019-04-20 Thread Brecht Van Lommel
Commit: 9d72efe108cb5819d07e524f311f613d002d3b61
Author: Brecht Van Lommel
Date:   Sun Apr 21 03:08:58 2019 +0200
Branches: master
https://developer.blender.org/rB9d72efe108cb5819d07e524f311f613d002d3b61

Merge branch 'blender2.7'

===



===



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


[Bf-blender-cvs] [8982f0cfee4] blender2.7: Fix T62408: Cycles viewport adaptive subdivision hangs after updates

2019-04-20 Thread Brecht Van Lommel
Commit: 8982f0cfee417f3cc9612666db1eac4f3e965de9
Author: Brecht Van Lommel
Date:   Thu Apr 4 20:06:22 2019 +0200
Branches: blender2.7
https://developer.blender.org/rB8982f0cfee417f3cc9612666db1eac4f3e965de9

Fix T62408: Cycles viewport adaptive subdivision hangs after updates

Backporting fix from the master branch.

===

M   intern/cycles/app/cycles_xml.cpp
M   intern/cycles/blender/blender_mesh.cpp
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_util.h
M   intern/cycles/render/camera.cpp
M   intern/cycles/render/camera.h
M   intern/cycles/render/mesh.cpp

===

diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index d4ee284e24b..86491adb3a4 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -516,8 +516,6 @@ static void xml_read_mesh(const XMLReadState& state, 
xml_node node)
xml_read_float(&sdparams.dicing_rate, node, "dicing_rate");
sdparams.dicing_rate = std::max(0.1f, sdparams.dicing_rate);
 
-   state.scene->camera->update(state.scene);
-   sdparams.camera = state.scene->camera;
sdparams.objecttoworld = state.tfm;
}
 
diff --git a/intern/cycles/blender/blender_mesh.cpp 
b/intern/cycles/blender/blender_mesh.cpp
index 46ecd60be77..8dd11f2f97f 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -1027,8 +1027,6 @@ static void create_subd_mesh(Scene *scene,
sdparams.dicing_rate = max(0.1f, RNA_float_get(&cobj, "dicing_rate") * 
dicing_rate);
sdparams.max_level = max_subdivisions;
 
-   scene->dicing_camera->update(scene);
-   sdparams.camera = scene->dicing_camera;
sdparams.objecttoworld = get_transform(b_ob.matrix_world());
 }
 
diff --git a/intern/cycles/blender/blender_sync.cpp 
b/intern/cycles/blender/blender_sync.cpp
index 841af87000f..ced9511ee81 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -104,10 +104,10 @@ bool BlenderSync::sync_recalc()
if(b_lamp->is_updated() || (b_lamp->node_tree() && 
b_lamp->node_tree().is_updated()))
shader_map.set_recalc(*b_lamp);
 
-   bool dicing_prop_changed = false;
-
if(experimental) {
+   /* Mark all meshes as needing to be exported again if dicing 
changed. */
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
+   bool dicing_prop_changed = false;
 
float updated_dicing_rate = preview ? RNA_float_get(&cscene, 
"preview_dicing_rate")
: RNA_float_get(&cscene, 
"dicing_rate");
@@ -123,6 +123,15 @@ bool BlenderSync::sync_recalc()
max_subdivisions = updated_max_subdivisions;
dicing_prop_changed = true;
}
+
+   if(dicing_prop_changed) {
+   for(const pair& iter: 
mesh_map.key_to_scene_data()) {
+   Mesh *mesh = iter.second;
+   if(mesh->subdivision_type != 
Mesh::SUBDIVISION_NONE) {
+   mesh_map.set_recalc(iter.first);
+   }
+   }
+   }
}
 
BL::BlendData::objects_iterator b_ob;
@@ -134,9 +143,7 @@ bool BlenderSync::sync_recalc()
}
 
if(object_is_mesh(*b_ob)) {
-   if(b_ob->is_updated_data() || b_ob->data().is_updated() 
||
-  (dicing_prop_changed && 
object_subdivision_type(*b_ob, preview, experimental) != 
Mesh::SUBDIVISION_NONE))
-   {
+   if(b_ob->is_updated_data() || 
b_ob->data().is_updated()) {
BL::ID key = BKE_object_is_modified(*b_ob)? 
*b_ob: b_ob->data();
mesh_map.set_recalc(key);
}
diff --git a/intern/cycles/blender/blender_util.h 
b/intern/cycles/blender/blender_util.h
index a2c1a68c454..745d153be47 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -644,6 +644,11 @@ public:
b_recalc.insert(id.ptr.data);
}
 
+   void set_recalc(void *id_ptr)
+   {
+   b_recalc.insert(id_ptr);
+   }
+
bool has_recalc()
{
return !(b_recalc.empty());
@@ -739,6 +744,11 @@ public:
return deleted;
}
 
+   const map& key_to_scene_data()
+   {
+   return b_map;
+   }
+
 protected:
vector *scene_data;
map b_map;
diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp
index 5715892ba70..82aeb324

[Bf-blender-cvs] [1de3c81d268] master: Fix T63431: crash adding driver to a keyframed property with Ctrl+D

2019-04-20 Thread Brecht Van Lommel
Commit: 1de3c81d268ba67128b2dd67335523a94320b0d2
Author: Brecht Van Lommel
Date:   Sun Apr 21 02:34:26 2019 +0200
Branches: master
https://developer.blender.org/rB1de3c81d268ba67128b2dd67335523a94320b0d2

Fix T63431: crash adding driver to a keyframed property with Ctrl+D

===

M   source/blender/editors/animation/drivers.c
M   source/blender/editors/space_graph/graph_buttons.c

===

diff --git a/source/blender/editors/animation/drivers.c 
b/source/blender/editors/animation/drivers.c
index d6564be9574..92c292f67e8 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -899,10 +899,21 @@ static bool add_driver_button_poll(bContext *C)
   PointerRNA ptr = {{NULL}};
   PropertyRNA *prop = NULL;
   int index;
+  bool driven, special;
 
   /* this operator can only run if there's a property button active, and it 
can be animated */
   UI_context_active_but_prop_get(C, &ptr, &prop, &index);
-  return (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, 
prop));
+
+  if (!(ptr.id.data && ptr.data && prop)) {
+return false;
+  }
+  if (!RNA_property_animateable(&ptr, prop)) {
+return false;
+  }
+
+  /* Don't do anything if there is an fcurve for animation without a driver. */
+  FCurve *fcu = rna_get_fcurve_context_ui(C, &ptr, prop, index, NULL, NULL, 
&driven, &special);
+  return (fcu == NULL || fcu->driver);
 }
 
 /* Wrapper for creating a driver without knowing what the targets will be yet 
(i.e. "manual/add later") */
diff --git a/source/blender/editors/space_graph/graph_buttons.c 
b/source/blender/editors/space_graph/graph_buttons.c
index 8742f5d408c..20ddf434f5f 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -1255,7 +1255,7 @@ static void graph_panel_drivers_popover(const bContext 
*C, Panel *pa)
 uiLayoutSetContextFromBut(layout, but);
 
 /* Populate Panel - With a combination of the contents of the Driven and 
Driver panels */
-if (fcu) {
+if (fcu && fcu->driver) {
   ID *id = ptr.id.data;
 
   /* Driven Property Settings */

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


[Bf-blender-cvs] [543614a17d2] master: Fix T63415: no Cycles displacement update when updating OSL code

2019-04-20 Thread Brecht Van Lommel
Commit: 543614a17d235ad6bf09a4cc82969bf92f16e1de
Author: Brecht Van Lommel
Date:   Sun Apr 21 02:18:19 2019 +0200
Branches: master
https://developer.blender.org/rB543614a17d235ad6bf09a4cc82969bf92f16e1de

Fix T63415: no Cycles displacement update when updating OSL code

===

M   intern/cycles/blender/blender_shader.cpp
M   intern/cycles/render/graph.cpp
M   intern/cycles/render/graph.h
M   intern/cycles/render/nodes.cpp

===

diff --git a/intern/cycles/blender/blender_shader.cpp 
b/intern/cycles/blender/blender_shader.cpp
index 5fd60ff7970..d1f823bc2b8 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -908,7 +908,7 @@ static ShaderNode *add_node(Scene *scene,
 
 static bool node_use_modified_socket_name(ShaderNode *node)
 {
-  if (node->special_type == SHADER_SPECIAL_TYPE_SCRIPT)
+  if (node->special_type == SHADER_SPECIAL_TYPE_OSL)
 return false;
 
   return true;
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index c284c64b5bf..e5fd39f08b7 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -721,6 +721,13 @@ void ShaderGraph::compute_displacement_hash()
   int link_id = (input->link) ? input->link->parent->id : 0;
   md5.append((uint8_t *)&link_id, sizeof(link_id));
 }
+
+if (node->special_type == SHADER_SPECIAL_TYPE_OSL) {
+  /* Hash takes into account socket values, to detect changes
+   * in the code of the node we need an exception. */
+  OSLNode *oslnode = static_cast(node);
+  md5.append(oslnode->bytecode_hash);
+}
   }
 
   displacement_hash = md5.get_hex();
diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h
index a2c030fd226..b1aa5cf3168 100644
--- a/intern/cycles/render/graph.h
+++ b/intern/cycles/render/graph.h
@@ -61,7 +61,7 @@ enum ShaderNodeSpecialType {
   SHADER_SPECIAL_TYPE_PROXY,
   SHADER_SPECIAL_TYPE_AUTOCONVERT,
   SHADER_SPECIAL_TYPE_GEOMETRY,
-  SHADER_SPECIAL_TYPE_SCRIPT,
+  SHADER_SPECIAL_TYPE_OSL,
   SHADER_SPECIAL_TYPE_IMAGE_SLOT,
   SHADER_SPECIAL_TYPE_CLOSURE,
   SHADER_SPECIAL_TYPE_COMBINE_CLOSURE,
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 30968ab0c5e..16416a9a009 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -5718,7 +5718,7 @@ void SetNormalNode::compile(OSLCompiler &compiler)
 
 OSLNode::OSLNode() : ShaderNode(new NodeType(NodeType::SHADER))
 {
-  special_type = SHADER_SPECIAL_TYPE_SCRIPT;
+  special_type = SHADER_SPECIAL_TYPE_OSL;
 }
 
 OSLNode::~OSLNode()

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


[Bf-blender-cvs] [a5d5f152dd3] master: Fix T63681: bad clipping of very long tooltips

2019-04-20 Thread Brecht Van Lommel
Commit: a5d5f152dd317b4d39c112da36bce34d40fa7120
Author: Brecht Van Lommel
Date:   Sun Apr 21 01:22:07 2019 +0200
Branches: master
https://developer.blender.org/rBa5d5f152dd317b4d39c112da36bce34d40fa7120

Fix T63681: bad clipping of very long tooltips

===

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

===

diff --git a/source/blender/blenlib/intern/rct.c 
b/source/blender/blenlib/intern/rct.c
index 2723e1708cb..0cf3e928f7c 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -700,6 +700,9 @@ bool BLI_rcti_clamp_pt_v(const rcti *rect, int xy[2])
 /**
  * Clamp \a rect within \a rect_bounds, setting \a r_xy to the offset.
  *
+ * Keeps the top left corner within the bounds, which for user interface
+ * elements is typically where the most important information is.
+ *
  * \return true if a change is made.
  */
 bool BLI_rctf_clamp(rctf *rect, const rctf *rect_bounds, float r_xy[2])
@@ -709,16 +712,16 @@ bool BLI_rctf_clamp(rctf *rect, const rctf *rect_bounds, 
float r_xy[2])
   r_xy[0] = 0.0f;
   r_xy[1] = 0.0f;
 
-  if (rect->xmin < rect_bounds->xmin) {
-float ofs = rect_bounds->xmin - rect->xmin;
+  if (rect->xmax > rect_bounds->xmax) {
+float ofs = rect_bounds->xmax - rect->xmax;
 rect->xmin += ofs;
 rect->xmax += ofs;
 r_xy[0] += ofs;
 changed = true;
   }
 
-  if (rect->xmax > rect_bounds->xmax) {
-float ofs = rect_bounds->xmax - rect->xmax;
+  if (rect->xmin < rect_bounds->xmin) {
+float ofs = rect_bounds->xmin - rect->xmin;
 rect->xmin += ofs;
 rect->xmax += ofs;
 r_xy[0] += ofs;
@@ -751,16 +754,16 @@ bool BLI_rcti_clamp(rcti *rect, const rcti *rect_bounds, 
int r_xy[2])
   r_xy[0] = 0;
   r_xy[1] = 0;
 
-  if (rect->xmin < rect_bounds->xmin) {
-int ofs = rect_bounds->xmin - rect->xmin;
+  if (rect->xmax > rect_bounds->xmax) {
+int ofs = rect_bounds->xmax - rect->xmax;
 rect->xmin += ofs;
 rect->xmax += ofs;
 r_xy[0] += ofs;
 changed = true;
   }
 
-  if (rect->xmax > rect_bounds->xmax) {
-int ofs = rect_bounds->xmax - rect->xmax;
+  if (rect->xmin < rect_bounds->xmin) {
+int ofs = rect_bounds->xmin - rect->xmin;
 rect->xmin += ofs;
 rect->xmax += ofs;
 r_xy[0] += ofs;

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


[Bf-blender-cvs] [92d93dd9358] master: Fix T63686: missing data path for 3D cursor location and rotation.

2019-04-20 Thread Brecht Van Lommel
Commit: 92d93dd935817d8a3b5aef9a2faf84fe8b69c3dd
Author: Brecht Van Lommel
Date:   Sun Apr 21 01:11:12 2019 +0200
Branches: master
https://developer.blender.org/rB92d93dd935817d8a3b5aef9a2faf84fe8b69c3dd

Fix T63686: missing data path for 3D cursor location and rotation.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index ccf9c0c254d..857730beac7 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1839,6 +1839,11 @@ static void 
rna_View3DCursor_rotation_axis_angle_set(PointerRNA *ptr, const floa
   copy_v3_v3(cursor->rotation_axis, &value[1]);
 }
 
+static char *rna_View3DCursor_path(PointerRNA *UNUSED(ptr))
+{
+  return BLI_strdup("cursor");
+}
+
 static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[], int frame)
 {
   TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
@@ -2530,6 +2535,7 @@ static void rna_def_view3d_cursor(BlenderRNA *brna)
 
   srna = RNA_def_struct(brna, "View3DCursor", NULL);
   RNA_def_struct_sdna(srna, "View3DCursor");
+  RNA_def_struct_path_func(srna, "rna_View3DCursor_path");
   RNA_def_struct_ui_text(srna, "3D Cursor", "");
 
   prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ_LENGTH);

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


[Bf-blender-cvs] [b8bb0391d64] master: Fix T63764: error when using library.users_id() function

2019-04-20 Thread Brecht Van Lommel
Commit: b8bb0391d645747125bb70cb47f9c227eedc9a8e
Author: Brecht Van Lommel
Date:   Sun Apr 21 00:58:38 2019 +0200
Branches: master
https://developer.blender.org/rBb8bb0391d645747125bb70cb47f9c227eedc9a8e

Fix T63764: error when using library.users_id() function

Fix suggested by Vilem Duha.

===

M   release/scripts/modules/bpy_types.py

===

diff --git a/release/scripts/modules/bpy_types.py 
b/release/scripts/modules/bpy_types.py
index fb4ccfaff7a..86fb09ffb4b 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -61,7 +61,7 @@ class Library(bpy_types.ID):
 # See: readblenentry.c, IDTYPE_FLAGS_ISLINKABLE,
 # we could make this an attribute in rna.
 attr_links = ("actions", "armatures", "brushes", "cameras",
-  "curves", "grease_pencil", "collections", "images",
+  "curves", "grease_pencils", "collections", "images",
   "lights", "lattices", "materials", "metaballs",
   "meshes", "node_groups", "objects", "scenes",
   "sounds", "speakers", "textures", "texts",

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


[Bf-blender-cvs] [33df4b78d0a] master: make.bat: remove --expand-tabs from "make format" on windows.

2019-04-20 Thread Ray Molenkamp
Commit: 33df4b78d0a48dab8b3dc78d6bae4c12a93a2bf2
Author: Ray Molenkamp
Date:   Sat Apr 20 13:10:30 2019 -0600
Branches: master
https://developer.blender.org/rB33df4b78d0a48dab8b3dc78d6bae4c12a93a2bf2

make.bat: remove --expand-tabs from "make format" on windows.

following the change on linux.

===

M   build_files/windows/format.cmd

===

diff --git a/build_files/windows/format.cmd b/build_files/windows/format.cmd
index ca5330dc37c..04610944e16 100644
--- a/build_files/windows/format.cmd
+++ b/build_files/windows/format.cmd
@@ -20,6 +20,6 @@ set 
FORMAT_PATHS=%BLENDER_DIR%\source\tools\utils_maintenance\clang_format_paths
 REM The formatting script expects clang-format to be in the current PATH.
 set PATH=%CF_PATH%;%PATH%
 
-%PYTHON% %FORMAT_PATHS% --expand-tabs
+%PYTHON% %FORMAT_PATHS%
 
 :EOF

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


[Bf-blender-cvs] [d37e530de5f] master: Correct error in last commit

2019-04-20 Thread Campbell Barton
Commit: d37e530de5f010ea9b74f5210d02dbaf0c3d5cb9
Author: Campbell Barton
Date:   Sun Apr 21 04:58:52 2019 +1000
Branches: master
https://developer.blender.org/rBd37e530de5f010ea9b74f5210d02dbaf0c3d5cb9

Correct error in last commit

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_text.py 
b/release/scripts/startup/bl_ui/space_text.py
index 0b83aca6fb4..6956a8379bd 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -36,9 +36,9 @@ class TEXT_HT_header(Header):
 TEXT_MT_editor_menus.draw_collapsible(context, layout)
 
 if text and text.is_modified:
-sub = row.row(align=True)
-sub.alert = True
-sub.operator("text.resolve_conflict", text="", icon='HELP')
+row = layout.row(align=True)
+row.alert = True
+row.operator("text.resolve_conflict", text="", icon='HELP')
 
 layout.separator_spacer()

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


[Bf-blender-cvs] [9a77fb553c7] master: UI: remove redundant row for header template

2019-04-20 Thread Campbell Barton
Commit: 9a77fb553c7aeb5a7dae24e53721b586142cc4f4
Author: Campbell Barton
Date:   Sun Apr 21 04:49:19 2019 +1000
Branches: master
https://developer.blender.org/rB9a77fb553c7aeb5a7dae24e53721b586142cc4f4

UI: remove redundant row for header template

If it's members need to be aligned the template can handle it.

===

M   release/scripts/startup/bl_ui/space_clip.py
M   release/scripts/startup/bl_ui/space_dopesheet.py
M   release/scripts/startup/bl_ui/space_graph.py
M   release/scripts/startup/bl_ui/space_image.py
M   release/scripts/startup/bl_ui/space_nla.py
M   release/scripts/startup/bl_ui/space_node.py
M   release/scripts/startup/bl_ui/space_outliner.py
M   release/scripts/startup/bl_ui/space_properties.py
M   release/scripts/startup/bl_ui/space_sequencer.py
M   release/scripts/startup/bl_ui/space_text.py

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 59e74f96862..ffc047ed175 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -267,8 +267,7 @@ class CLIP_HT_header(Header):
 
 sc = context.space_data
 
-row = layout.row(align=True)
-row.template_header()
+layout.template_header()
 
 layout.prop(sc, "mode", text="")
 if sc.mode == 'TRACKING':
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py 
b/release/scripts/startup/bl_ui/space_dopesheet.py
index 61db70866e2..94f1292a3cc 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -210,8 +210,7 @@ class DOPESHEET_HT_header(Header):
 
 st = context.space_data
 
-row = layout.row(align=True)
-row.template_header()
+layout.template_header()
 
 if st.mode == 'TIMELINE':
 from .space_time import (
diff --git a/release/scripts/startup/bl_ui/space_graph.py 
b/release/scripts/startup/bl_ui/space_graph.py
index eaa3d94babf..b71c0582dd9 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -34,8 +34,7 @@ class GRAPH_HT_header(Header):
 
 st = context.space_data
 
-row = layout.row(align=True)
-row.template_header()
+layout.template_header()
 
 # Now a exposed as a sub-space type
 # layout.prop(st, "mode", text="")
diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index 15a3f798c61..28edc6df3ce 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -513,7 +513,7 @@ class IMAGE_HT_tool_header(Header):
 def draw(self, context):
 layout = self.layout
 
-layout.row(align=True).template_header()
+layout.template_header()
 
 self.draw_tool_settings(context)
 
@@ -644,7 +644,7 @@ class IMAGE_HT_header(Header):
 show_maskedit = sima.show_maskedit
 
 if not sima.show_region_tool_header:
-layout.row(align=True).template_header()
+layout.template_header()
 
 if sima.mode != 'UV':
 layout.prop(sima, "ui_mode", text="")
diff --git a/release/scripts/startup/bl_ui/space_nla.py 
b/release/scripts/startup/bl_ui/space_nla.py
index 8c5c360de93..ba94769d2c0 100644
--- a/release/scripts/startup/bl_ui/space_nla.py
+++ b/release/scripts/startup/bl_ui/space_nla.py
@@ -33,8 +33,7 @@ class NLA_HT_header(Header):
 
 st = context.space_data
 
-row = layout.row(align=True)
-row.template_header()
+layout.template_header()
 
 NLA_MT_editor_menus.draw_collapsible(context, layout)
 
diff --git a/release/scripts/startup/bl_ui/space_node.py 
b/release/scripts/startup/bl_ui/space_node.py
index caab7938c3e..f31b8def2c9 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -51,8 +51,7 @@ class NODE_HT_header(Header):
 id_from = snode.id_from
 tool_settings = context.tool_settings
 
-row = layout.row(align=True)
-row.template_header()
+layout.template_header()
 
 # Now expanded via the 'ui_type'
 # layout.prop(snode, "tree_type", text="")
diff --git a/release/scripts/startup/bl_ui/space_outliner.py 
b/release/scripts/startup/bl_ui/space_outliner.py
index 6107542c123..43907f985c0 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -32,8 +32,7 @@ class OUTLINER_HT_header(Header):
 scene = context.scene
 ks = context.scene.keying_sets.active
 
-row = layout.row(align=True)
-row.template_header()
+layout.template_header()
 
 layout.prop(space, "display_mode", icon_only=True)
 
dif

[Bf-blender-cvs] [6b9ce24338d] master: GNUMakefile: disable tab expansion for 'make format'

2019-04-20 Thread Campbell Barton
Commit: 6b9ce24338de1a33dbf41e14e85a1630b1a2b899
Author: Campbell Barton
Date:   Sun Apr 21 04:36:16 2019 +1000
Branches: master
https://developer.blender.org/rB6b9ce24338de1a33dbf41e14e85a1630b1a2b899

GNUMakefile: disable tab expansion for 'make format'

This was only needed for initial migration.

===

M   GNUmakefile

===

diff --git a/GNUmakefile b/GNUmakefile
index b85e69a2cac..821b2f5ef7d 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -517,7 +517,7 @@ update: .FORCE
 
 format: .FORCE
PATH="../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
-   python3 source/tools/utils_maintenance/clang_format_paths.py 
--expand-tabs $(PATHS)
+   python3 source/tools/utils_maintenance/clang_format_paths.py 
$(PATHS)
 
 
 # -

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


[Bf-blender-cvs] [2fb9c8ef125] master: Cleanup: add missing macros to clang-format

2019-04-20 Thread Campbell Barton
Commit: 2fb9c8ef125f975596b6ef9c8f021403f8279bdf
Author: Campbell Barton
Date:   Sun Apr 21 04:40:16 2019 +1000
Branches: master
https://developer.blender.org/rB2fb9c8ef125f975596b6ef9c8f021403f8279bdf

Cleanup: add missing macros to clang-format

===

M   .clang-format
M   source/blender/blenkernel/BKE_main.h
M   source/blender/blenkernel/intern/blendfile.c
M   source/blender/blenkernel/intern/library.c
M   source/blender/blenkernel/intern/library_override.c
M   source/blender/blenkernel/intern/library_query.c
M   source/blender/blenkernel/intern/library_remap.c
M   source/blender/blenkernel/intern/main.c
M   source/blender/blenkernel/intern/node.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenkernel/intern/pbvh_bmesh.c
M   source/blender/blenkernel/intern/studiolight.c
M   source/blender/blenlib/intern/edgehash.c
M   source/blender/blenloader/intern/blend_validate.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/bmesh/intern/bmesh_core.c
M   source/blender/bmesh/intern/bmesh_edgeloop.c
M   source/blender/bmesh/intern/bmesh_mods.c
M   source/blender/bmesh/intern/bmesh_polygon.c
M   source/blender/bmesh/intern/bmesh_query.c
M   source/blender/bmesh/operators/bmo_extrude.c
M   source/blender/bmesh/operators/bmo_planar_faces.c
M   source/blender/bmesh/operators/bmo_primitive.c
M   source/blender/bmesh/operators/bmo_rotate_edges.c
M   source/blender/bmesh/operators/bmo_smooth_laplacian.c
M   source/blender/bmesh/operators/bmo_subdivide.c
M   source/blender/bmesh/operators/bmo_subdivide_edgering.c
M   source/blender/bmesh/operators/bmo_utils.c
M   source/blender/bmesh/tools/bmesh_bisect_plane.c
M   source/blender/bmesh/tools/bmesh_region_match.c
M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M   source/blender/draw/intern/draw_cache_impl_mesh.c
M   source/blender/draw/intern/draw_manager_exec.c
M   source/blender/editors/animation/anim_filter.c
M   source/blender/editors/armature/armature_add.c
M   source/blender/editors/armature/armature_edit.c
M   source/blender/editors/armature/pose_edit.c
M   source/blender/editors/armature/pose_select.c
M   source/blender/editors/armature/pose_utils.c
M   source/blender/editors/mesh/editmesh_utils.c
M   source/blender/editors/mesh/mesh_data.c
M   source/blender/editors/object/object_collection.c
M   source/blender/editors/object/object_constraint.c
M   source/blender/editors/space_outliner/outliner_edit.c
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform_constraints.c
M   source/blender/editors/transform/transform_conversions.c
M   source/blender/editors/transform/transform_generics.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/uvedit/uvedit_ops.c
M   source/blender/editors/uvedit/uvedit_smart_stitch.c
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/imbuf/intern/jp2.c
M   source/blender/makesrna/intern/rna_mesh.c
M   source/blender/python/bmesh/bmesh_py_ops_call.c
M   source/blender/python/bmesh/bmesh_py_types.c
M   source/blender/python/intern/bpy_rna_id_collection.c
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
M   source/blender/windowmanager/intern/wm_event_system.c

===

diff --git a/.clang-format b/.clang-format
index 0ce77f88785..6374b48f2b6 100644
--- a/.clang-format
+++ b/.clang-format
@@ -159,18 +159,27 @@ PenaltyBreakString: 100
 
 # There are macros in Blender for custom for loops; tell Clang to treat them
 # like loops rather than an expression, and so put the { on the same line.
+#
+# To find these use multi-line regex search:
+# "^\s+[A-Z][A-Z0-9_]+\s*\([^\n]*\)\n\s*\{"
 ForEachMacros:
+  - BEGIN_ANIMFILTER_SUBCHANNELS
+  - BLI_FOREACH_SPARSE_RANGE
   - BLI_SMALLSTACK_ITER_BEGIN
   - BMO_ITER
+  - BMO_ITER_INDEX
   - BMW_ITER
   - BM_FACES_OF_VERT_ITER_BEGIN
+  - BM_ITER_BPY_BM_SEQ
   - BM_ITER_ELEM
+  - BM_ITER_ELEM_INDEX
   - BM_ITER_MESH
   - BM_ITER_MESH_INDEX
   - BM_ITER_MESH_MUTABLE
   - BM_LOOPS_OF_VERT_ITER_BEGIN
   - BOOST_FOREACH
   - CTX_DATA_BEGIN
+  - CTX_DATA_BEGIN_WITH_ID
   - DEG_OBJECT_ITER_BEGIN
   - DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN
   - DRIVER_TARGETS_LOOPER_BEGIN
@@ -179,9 +188,13 @@ ForEachMacros:
   - FOREACH_BASE_IN_EDIT_MODE_BEGIN
   - FOREACH_BASE_IN_MODE_BEGIN
   - FOREACH_BEGIN
+  - FOREACH_COLLECTION_BEGIN
   - FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN
   - FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN
   - FOREACH_EDIT_OBJECT_BEGIN
+  - FOREACH_MAIN_ID_BEGIN
+  - FOREACH_MAIN_LISTBASE_BEGIN
+  - FOREACH_MAIN_LISTBASE_ID_BEGIN
   - FOREACH_NODETREE_BEGIN
   - FOREACH_OBJECT_BE

[Bf-blender-cvs] [ae85eeda3e8] master: UI Overlays: One line layout for Mask opacity.

2019-04-20 Thread Pablo Vazquez
Commit: ae85eeda3e88f5b11ecb162c3d74f2e751dedd36
Author: Pablo Vazquez
Date:   Sat Apr 20 19:01:03 2019 +0200
Branches: master
https://developer.blender.org/rBae85eeda3e88f5b11ecb162c3d74f2e751dedd36

UI Overlays: One line layout for Mask opacity.

Saves one line of space and matches Wireframe, X-Ray, Shadows.

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index bb56946e154..44a716487ce 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5576,10 +5576,12 @@ class VIEW3D_PT_overlay_sculpt(Panel):
 overlay = view.overlay
 
 layout.prop(sculpt, "show_diffuse_color")
-layout.prop(sculpt, "show_mask")
-row = layout.row()
-row.active = sculpt.show_mask
-row.prop(overlay, "sculpt_mode_mask_opacity", text="Opacity")
+
+row = layout.row(align=True)
+row.prop(sculpt, "show_mask", text="")
+sub = row.row()
+sub.active = sculpt.show_mask
+sub.prop(overlay, "sculpt_mode_mask_opacity", text="Mask")
 
 
 class VIEW3D_PT_overlay_pose(Panel):

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


[Bf-blender-cvs] [d11d5403f0a] master: UI Overlays: Align checkbox with slider for Wireframes, X-Ray, Shadows.

2019-04-20 Thread Pablo Vazquez
Commit: d11d5403f0a4548f3731776309e38defc165bd95
Author: Pablo Vazquez
Date:   Sat Apr 20 19:01:46 2019 +0200
Branches: master
https://developer.blender.org/rBd11d5403f0a4548f3731776309e38defc165bd95

UI Overlays: Align checkbox with slider for Wireframes, X-Ray, Shadows.

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 44a716487ce..0c3bfe2caf1 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5007,7 +5007,7 @@ class VIEW3D_PT_shading_options(Panel):
 if shading.type != 'WIREFRAME':
 col.prop(shading, "show_backface_culling")
 
-row = col.row()
+row = col.row(align=True)
 
 if shading.type == 'WIREFRAME':
 row.prop(shading, "show_xray_wireframe", text="")
@@ -5022,7 +5022,7 @@ class VIEW3D_PT_shading_options(Panel):
 #X-ray mode is off when alpha is 1.0
 xray_active = shading.show_xray and shading.xray_alpha != 1
 
-row = col.row()
+row = col.row(align=True)
 row.prop(shading, "show_shadows", text="")
 row.active = not xray_active
 sub = row.row(align=True)
@@ -5265,7 +5265,7 @@ class VIEW3D_PT_overlay_geometry(Panel):
 col = layout.column()
 col.active = display_all
 
-row = col.row()
+row = col.row(align=True)
 if not is_wireframes:
 row.prop(overlay, "show_wireframes", text="")
 sub = row.row()

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


[Bf-blender-cvs] [d4200f3c61c] temp-topbar-ui: Work in progress redesign of topbar ui

2019-04-20 Thread Campbell Barton
Commit: d4200f3c61c40917ba42a7502c0a1a236d8ada56
Author: Campbell Barton
Date:   Sat Apr 20 17:01:04 2019 +0200
Branches: temp-topbar-ui
https://developer.blender.org/rBd4200f3c61c40917ba42a7502c0a1a236d8ada56

Work in progress redesign of topbar ui

===

M   release/scripts/startup/bl_ui/space_topbar.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/space_buttons/space_buttons.c

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index e75f4d1bb5d..4ba7e02cbcd 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -599,27 +599,6 @@ class TOPBAR_MT_workspace_menu(Menu):
 props.direction = 'NEXT'
 
 
-class TOPBAR_PT_active_tool(Panel):
-bl_space_type = 'PROPERTIES'
-bl_region_type = 'WINDOW'
-bl_category = ""
-bl_context = ".active_tool"  # dot on purpose (access from tool settings)
-bl_label = "Active Tool"
-bl_options = {'HIDE_HEADER'}
-
-def draw(self, context):
-layout = self.layout
-
-# Panel display of topbar tool settings.
-# currently displays in tool settings, keep here since the same 
functionality is used for the topbar.
-
-layout.use_property_split = True
-layout.use_property_decorate = False
-
-from .space_toolsystem_common import ToolSelectPanelHelper
-ToolSelectPanelHelper.draw_active_tool_header(context, layout, 
show_tool_name=True)
-
-
 # Grease Pencil Object - Primitive curve
 class TOPBAR_PT_gpencil_primitive(Panel):
 bl_space_type = 'VIEW_3D'
@@ -736,7 +715,6 @@ classes = (
 TOPBAR_MT_render,
 TOPBAR_MT_window,
 TOPBAR_MT_help,
-TOPBAR_PT_active_tool,
 TOPBAR_PT_gpencil_layers,
 TOPBAR_PT_gpencil_primitive,
 TOPBAR_PT_gpencil_fill,
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index bb56946e154..df72b93573d 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -55,133 +55,6 @@ class VIEW3D_HT_tool_header(Header):
 
 self.draw_tool_settings(context)
 
-layout.separator_spacer()
-
-# Mode & Transform Settings
-scene = context.scene
-
-# Orientation
-if object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL'} or has_pose_mode:
-orient_slot = scene.transform_orientation_slots[0]
-row = layout.row(align=True)
-
-sub = row.row()
-sub.ui_units_x = 4
-sub.prop_with_popover(
-orient_slot,
-"type",
-text="",
-panel="VIEW3D_PT_transform_orientations",
-)
-
-# Pivot
-if object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL', 'SCULPT_GPENCIL'} 
or has_pose_mode:
-layout.prop_with_popover(
-tool_settings,
-"transform_pivot_point",
-text="",
-icon_only=True,
-panel="VIEW3D_PT_pivot_point",
-)
-
-# Snap
-show_snap = False
-if obj is None:
-show_snap = True
-else:
-if (object_mode not in {
-'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT',
-'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'
-}) or has_pose_mode:
-show_snap = True
-else:
-
-from .properties_paint_common import UnifiedPaintPanel
-paint_settings = UnifiedPaintPanel.paint_settings(context)
-
-if paint_settings:
-brush = paint_settings.brush
-if brush and brush.stroke_method == 'CURVE':
-show_snap = True
-
-if show_snap:
-snap_items = 
bpy.types.ToolSettings.bl_rna.properties["snap_elements"].enum_items
-snap_elements = tool_settings.snap_elements
-if len(snap_elements) == 1:
-text = ""
-for elem in snap_elements:
-icon = snap_items[elem].icon
-break
-else:
-text = "Mix"
-icon = 'NONE'
-del snap_items, snap_elements
-
-row = layout.row(align=True)
-row.prop(tool_settings, "use_snap", text="")
-
-sub = row.row(align=True)
-sub.popover(
-panel="VIEW3D_PT_snapping",
-icon=icon,
-text=text,
-)
-
-# Proportional editing
-gpd = context.gpencil_data
-if object_mode in {'EDIT', 'PARTICLE_EDIT'}:
-row = layout.row(ali

[Bf-blender-cvs] [40d8a407d79] master: Fix invalid stack memory use with GPencil drawing

2019-04-20 Thread Campbell Barton
Commit: 40d8a407d79f5feba82966e6ba6c5ecd3d20fb3a
Author: Campbell Barton
Date:   Sat Apr 20 13:35:14 2019 +0200
Branches: master
https://developer.blender.org/rB40d8a407d79f5feba82966e6ba6c5ecd3d20fb3a

Fix invalid stack memory use with GPencil drawing

===

M   source/blender/editors/space_action/action_draw.c

===

diff --git a/source/blender/editors/space_action/action_draw.c 
b/source/blender/editors/space_action/action_draw.c
index b2baace1592..a517aa3573c 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -271,9 +271,9 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction 
*saction, ARegion *ar)
 }
 else if (ac->datatype == ANIMCONT_GPENCIL) {
   unsigned char *color;
+  unsigned char gpl_col[4];
   if ((show_group_colors) && (ale->type == ANIMTYPE_GPLAYER)) {
 bGPDlayer *gpl = (bGPDlayer *)ale->data;
-unsigned char gpl_col[4];
 rgb_float_to_uchar(gpl_col, gpl->color);
 gpl_col[3] = col1[3];

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


[Bf-blender-cvs] [b24dfff9b70] master: Fix error in recent image preference change

2019-04-20 Thread Campbell Barton
Commit: b24dfff9b70815e3dd2d7ea4fb925add30fee206
Author: Campbell Barton
Date:   Sat Apr 20 15:13:04 2019 +0200
Branches: master
https://developer.blender.org/rBb24dfff9b70815e3dd2d7ea4fb925add30fee206

Fix error in recent image preference change

===

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

===

diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index 488143da316..c704b296f75 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -4595,6 +4595,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
0,
"GLSL",
"Use GLSL shaders for display transform and draw image with 2D 
texture"},
+  {0, NULL, 0, NULL, NULL},
   };
 
   srna = RNA_def_struct(brna, "PreferencesSystem", NULL);

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


[Bf-blender-cvs] [f22397206f4] master: NLA: check that properties are animatable.

2019-04-20 Thread Alexander Gavrilov
Commit: f22397206f4d20ffbc862c02b025c572be900866
Author: Alexander Gavrilov
Date:   Sat Apr 20 14:15:30 2019 +0300
Branches: master
https://developer.blender.org/rBf22397206f4d20ffbc862c02b025c572be900866

NLA: check that properties are animatable.

===

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

===

diff --git a/source/blender/blenkernel/intern/anim_sys.c 
b/source/blender/blenkernel/intern/anim_sys.c
index 785c3eedcfc..b4b699f998a 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -2541,6 +2541,9 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA 
*ptr, NlaEvalData *nlaeval,
 return *p_path_nec;
   }
 
+  /* Cache NULL result for now. */
+  *p_path_nec = NULL;
+
   /* Resolve the property and look it up in the key hash. */
   NlaEvalChannelKey key;
 
@@ -2553,8 +2556,11 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA 
*ptr, NlaEvalData *nlaeval,
 path);
 }
 
-/* Cache NULL result. */
-*p_path_nec = NULL;
+return NULL;
+  }
+
+  /* Check that the property can be animated. */
+  if (ptr->id.data != NULL && !RNA_property_animateable(&key.ptr, key.prop)) {
 return NULL;
   }

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


[Bf-blender-cvs] [7cbb8f20a4b] master: GPU: automatically draw images with GLSL shader depending on resolution

2019-04-20 Thread Brecht Van Lommel
Commit: 7cbb8f20a4b479380dac1d2a2f7c7f85ede408be
Author: Brecht Van Lommel
Date:   Sat Apr 20 12:47:06 2019 +0200
Branches: master
https://developer.blender.org/rB7cbb8f20a4b479380dac1d2a2f7c7f85ede408be

GPU: automatically draw images with GLSL shader depending on resolution

This adds a new "Automatic" image display method which uses GLSL shaders for
most images. It only does CPU side color management for higher res images
where sending big float buffers to the GPU is likely to be a bottleneck or
cause memory usage problem.

Automatic is the default now, previously it was 2D Texture.

===

M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenloader/intern/versioning_userdef.c
M   source/blender/editors/include/BIF_glutil.h
M   source/blender/editors/render/render_internal.c
M   source/blender/editors/screen/glutil.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_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 0566ecf3444..2433b856697 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -27,7 +27,7 @@
  * \note Use #STRINGIFY() rather than defining with quotes.
  */
 #define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 57
+#define BLENDER_SUBVERSION 58
 /** Several breakages with 280, e.g. collections vs layers. */
 #define BLENDER_MINVERSION 280
 #define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenloader/intern/versioning_userdef.c 
b/source/blender/blenloader/intern/versioning_userdef.c
index 65a19ca80c1..069b1907cce 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -491,6 +491,12 @@ void BLO_version_defaults_userpref_blend(Main *bmain, 
UserDef *userdef)
 userdef->move_threshold = 2;
   }
 
+  if (!USER_VERSION_ATLEAST(280, 58)) {
+if (userdef->image_draw_method != IMAGE_DRAW_METHOD_GLSL) {
+  userdef->image_draw_method = IMAGE_DRAW_METHOD_AUTO;
+}
+  }
+
   /**
* Include next version bump.
*/
@@ -505,9 +511,6 @@ void BLO_version_defaults_userpref_blend(Main *bmain, 
UserDef *userdef)
   if (userdef->pixelsize == 0.0f)
 userdef->pixelsize = 1.0f;
 
-  if (userdef->image_draw_method == 0)
-userdef->image_draw_method = IMAGE_DRAW_METHOD_2DTEXTURE;
-
   for (bTheme *btheme = userdef->themes.first; btheme; btheme = btheme->next) {
 do_versions_theme(userdef, btheme);
   }
diff --git a/source/blender/editors/include/BIF_glutil.h 
b/source/blender/editors/include/BIF_glutil.h
index c30674907da..c88277c2ea5 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -167,6 +167,8 @@ void ED_draw_imbuf_ctx_clipping(const struct bContext *C,
 float zoom_x,
 float zoom_y);
 
+int ED_draw_imbuf_method(struct ImBuf *ibuf);
+
 /* OpenGL drawing utility functions. Do not use these in new code, these
  * are intended to be moved or removed in the future. */
 
diff --git a/source/blender/editors/render/render_internal.c 
b/source/blender/editors/render/render_internal.c
index 6df1ba5e0aa..d9a68a060f8 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -72,6 +72,8 @@
 #include "ED_undo.h"
 #include "ED_view3d.h"
 
+#include "BIF_glutil.h"
+
 #include "RE_pipeline.h"
 #include "RE_engine.h"
 
@@ -607,7 +609,7 @@ static void image_rect_update(void *rjv, RenderResult *rr, 
volatile rcti *renrec
  * operate with.
  */
 if (rr->do_exr_tile || !rj->supports_glsl_draw || ibuf->channels == 1 ||
-U.image_draw_method != IMAGE_DRAW_METHOD_GLSL) {
+ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL) {
   image_buffer_rect_update(rj, rr, ibuf, &rj->iuser, renrect, viewname);
 }
 
diff --git a/source/blender/editors/screen/glutil.c 
b/source/blender/editors/screen/glutil.c
index 868bc982c51..c22d9d66251 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -557,7 +557,7 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf,
   force_fallback |= ibuf->channels == 1;
 
   /* If user decided not to use GLSL, fallback to glaDrawPixelsAuto */
-  force_fallback |= (U.image_draw_method != IMAGE_DRAW_METHOD_GLSL);
+  force_fallback |= (ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL);
 
   /* Try to draw buffer using GLSL display transform */
   if (force_fallback == false) {
@@ -731,6 +731,22 @@ void ED_draw_imbuf_ctx(
   ED_draw_imbuf_ctx_clipping(C, ibuf, x, y, zoomfilter, 0.0f, 0.0f, 0.0f, 
0.0f, zoom_x, zoom_y);
 }
 
+int ED_draw

[Bf-blender-cvs] [ed0c9654ddf] master: Cleanup: remove unused OpenGL functions, rename some for clarity

2019-04-20 Thread Brecht Van Lommel
Commit: ed0c9654ddfdcbe19d8094d4b4a43f0f06d9ee5c
Author: Brecht Van Lommel
Date:   Sat Apr 20 12:56:29 2019 +0200
Branches: master
https://developer.blender.org/rBed0c9654ddfdcbe19d8094d4b4a43f0f06d9ee5c

Cleanup: remove unused OpenGL functions, rename some for clarity

===

M   source/blender/editors/include/BIF_glutil.h
M   source/blender/editors/screen/glutil.c
M   source/blender/editors/space_clip/clip_draw.c
M   source/blender/editors/space_image/image_draw.c
M   source/blender/editors/space_node/drawnode.c
M   source/blender/imbuf/intern/colormanagement.c

===

diff --git a/source/blender/editors/include/BIF_glutil.h 
b/source/blender/editors/include/BIF_glutil.h
index a2e8d6afd4b..c30674907da 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -32,35 +32,6 @@ struct ColorManagedViewSettings;
 struct ImBuf;
 struct bContext;
 
-/* A few functions defined here are being DEPRECATED for Blender 2.8
- *
- * Do not use them in new code, and you are encouraged to
- * convert existing code to draw without these.
- *
- * These will be deleted before we ship 2.8!
- * - merwin
- */
-
-/**
- * Returns a float value as obtained by glGetFloatv.
- * The param must cause only one value to be gotten from GL.
- */
-float glaGetOneFloat(int param);
-int glaGetOneInt(int param);
-
-/**
- * Functions like glRasterPos2i, except ensures that the resulting
- * raster position is valid. \a known_good_x and \a known_good_y
- * should be coordinates of a point known to be within the current
- * view frustum.
- * \attention This routine should be used when the distance of \a x
- * and \a y away from the known good point is small (ie. for small icons
- * and for bitmap characters), when drawing large+zoomed images it is
- * possible for overflow to occur, the glaDrawPixelsSafe routine should
- * be used instead.
- */
-void glaRasterPosSafe2f(float x, float y, float known_good_x, float 
known_good_y);
-
 typedef struct IMMDrawPixelsTexState {
   struct GPUShader *shader;
   unsigned int pos;
@@ -148,29 +119,47 @@ void 
immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
  float yzoom,
  float color[4]);
 
-void set_inverted_drawing(int enable);
-
-/* own working polygon offset */
-float bglPolygonOffsetCalc(const float winmat[16], float viewdist, float dist);
-void bglPolygonOffset(float viewdist, float dist);
-
-/*  Color management helper functions for GLSL display/transform * */
-
-/* Draw imbuf on a screen, preferably using GLSL display transform */
-void glaDrawImBuf_glsl(struct ImBuf *ibuf,
+/* Image buffer drawing functions, with display transform
+ *
+ * The view and display settings can either be specified manually, or retrived
+ * from the context with the _ctx variations.
+ *
+ * For better performance clipping coordinates can be specified so parts of the
+ * image outside the view are skipped. */
+
+void ED_draw_imbuf(struct ImBuf *ibuf,
+   float x,
+   float y,
+   int zoomfilter,
+   struct ColorManagedViewSettings *view_settings,
+   struct ColorManagedDisplaySettings *display_settings,
+   float zoom_x,
+   float zoom_y);
+void ED_draw_imbuf_clipping(struct ImBuf *ibuf,
+float x,
+float y,
+int zoomfilter,
+struct ColorManagedViewSettings *view_settings,
+struct ColorManagedDisplaySettings 
*display_settings,
+float clip_min_x,
+float clip_min_y,
+float clip_max_x,
+float clip_max_y,
+float zoom_x,
+float zoom_y);
+
+void ED_draw_imbuf_ctx(const struct bContext *C,
+   struct ImBuf *ibuf,
float x,
float y,
int zoomfilter,
-   struct ColorManagedViewSettings *view_settings,
-   struct ColorManagedDisplaySettings *display_settings,
float zoom_x,
float zoom_y);
-void glaDrawImBuf_glsl_clipping(struct ImBuf *ibuf,
+void ED_draw_imbuf_ctx_clipping(const struct bContext *C,
+struct ImBuf *ibuf,
 float x,
 float y,
 int zoomfilter,
-struct ColorManagedViewSettings *view_settings,
-struct ColorManagedDisplaySettings 
*display_settings,
 

[Bf-blender-cvs] [3d26d1938a1] master: UI: correct accidental removal of TOPBAR_PT_name

2019-04-20 Thread Campbell Barton
Commit: 3d26d1938a1e9088ca3962a0c7b615903118b138
Author: Campbell Barton
Date:   Sat Apr 20 13:28:16 2019 +0200
Branches: master
https://developer.blender.org/rB3d26d1938a1e9088ca3962a0c7b615903118b138

UI: correct accidental removal of TOPBAR_PT_name

Mistake in 9573bf432c4b0

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index dade943ffd2..e75f4d1bb5d 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -740,6 +740,7 @@ classes = (
 TOPBAR_PT_gpencil_layers,
 TOPBAR_PT_gpencil_primitive,
 TOPBAR_PT_gpencil_fill,
+TOPBAR_PT_name,
 )
 
 if __name__ == "__main__":  # only for live edit.

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


[Bf-blender-cvs] [857b63f1d49] master: Cleanup: re-use test for ELEM & STR_ELEM

2019-04-20 Thread Campbell Barton
Commit: 857b63f1d492eb48b40ce87abffc95d11e21803d
Author: Campbell Barton
Date:   Sat Apr 20 13:02:20 2019 +0200
Branches: master
https://developer.blender.org/rB857b63f1d492eb48b40ce87abffc95d11e21803d

Cleanup: re-use test for ELEM & STR_ELEM

Avoid having same test running at the end of each macro.

===

M   source/blender/blenlib/BLI_string.h
M   source/blender/blenlib/BLI_utildefines.h

===

diff --git a/source/blender/blenlib/BLI_string.h 
b/source/blender/blenlib/BLI_string.h
index 95ee5c81be9..70ffb46e952 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -160,34 +160,42 @@ int BLI_string_find_split_words(const char *str,
  * Follows #ELEM macro convention.
  * \{ */
 
+/* Manual line breaks for readability. */
+/* clang-format off */
 /* STR_ELEM#(v, ...): is the first arg equal any others? */
 /* Internal helpers. */
 #define _VA_STR_ELEM2(v, a) (strcmp(v, a) == 0)
-#define _VA_STR_ELEM3(v, a, b) (_VA_STR_ELEM2(v, a) || (strcmp(v, b) == 0))
-#define _VA_STR_ELEM4(v, a, b, c) (_VA_STR_ELEM3(v, a, b) || (strcmp(v, c) == 
0))
-#define _VA_STR_ELEM5(v, a, b, c, d) (_VA_STR_ELEM4(v, a, b, c) || (strcmp(v, 
d) == 0))
-#define _VA_STR_ELEM6(v, a, b, c, d, e) (_VA_STR_ELEM5(v, a, b, c, d) || 
(strcmp(v, e) == 0))
-#define _VA_STR_ELEM7(v, a, b, c, d, e, f) (_VA_STR_ELEM6(v, a, b, c, d, e) || 
(strcmp(v, f) == 0))
+#define _VA_STR_ELEM3(v, a, b) \
+  (_VA_STR_ELEM2(v, a) || (_VA_STR_ELEM2(v, b)))
+#define _VA_STR_ELEM4(v, a, b, c) \
+  (_VA_STR_ELEM3(v, a, b) || (_VA_STR_ELEM2(v, c)))
+#define _VA_STR_ELEM5(v, a, b, c, d) \
+  (_VA_STR_ELEM4(v, a, b, c) || (_VA_STR_ELEM2(v, d)))
+#define _VA_STR_ELEM6(v, a, b, c, d, e) \
+  (_VA_STR_ELEM5(v, a, b, c, d) || (_VA_STR_ELEM2(v, e)))
+#define _VA_STR_ELEM7(v, a, b, c, d, e, f) \
+  (_VA_STR_ELEM6(v, a, b, c, d, e) || (_VA_STR_ELEM2(v, f)))
 #define _VA_STR_ELEM8(v, a, b, c, d, e, f, g) \
-  (_VA_STR_ELEM7(v, a, b, c, d, e, f) || (strcmp(v, g) == 0))
+  (_VA_STR_ELEM7(v, a, b, c, d, e, f) || (_VA_STR_ELEM2(v, g)))
 #define _VA_STR_ELEM9(v, a, b, c, d, e, f, g, h) \
-  (_VA_STR_ELEM8(v, a, b, c, d, e, f, g) || (strcmp(v, h) == 0))
+  (_VA_STR_ELEM8(v, a, b, c, d, e, f, g) || (_VA_STR_ELEM2(v, h)))
 #define _VA_STR_ELEM10(v, a, b, c, d, e, f, g, h, i) \
-  (_VA_STR_ELEM9(v, a, b, c, d, e, f, g, h) || (strcmp(v, i) == 0))
+  (_VA_STR_ELEM9(v, a, b, c, d, e, f, g, h) || (_VA_STR_ELEM2(v, i)))
 #define _VA_STR_ELEM11(v, a, b, c, d, e, f, g, h, i, j) \
-  (_VA_STR_ELEM10(v, a, b, c, d, e, f, g, h, i) || (strcmp(v, j) == 0))
+  (_VA_STR_ELEM10(v, a, b, c, d, e, f, g, h, i) || (_VA_STR_ELEM2(v, j)))
 #define _VA_STR_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k) \
-  (_VA_STR_ELEM11(v, a, b, c, d, e, f, g, h, i, j) || (strcmp(v, k) == 0))
+  (_VA_STR_ELEM11(v, a, b, c, d, e, f, g, h, i, j) || (_VA_STR_ELEM2(v, k)))
 #define _VA_STR_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l) \
-  (_VA_STR_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k) || (strcmp(v, l) == 0))
+  (_VA_STR_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k) || (_VA_STR_ELEM2(v, l)))
 #define _VA_STR_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m) \
-  (_VA_STR_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l) || (strcmp(v, m) == 
0))
+  (_VA_STR_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l) || (_VA_STR_ELEM2(v, 
m)))
 #define _VA_STR_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n) \
-  (_VA_STR_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m) || (strcmp(v, n) 
== 0))
+  (_VA_STR_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m) || 
(_VA_STR_ELEM2(v, n)))
 #define _VA_STR_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) \
-  (_VA_STR_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n) || (strcmp(v, 
o) == 0))
+  (_VA_STR_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n) || 
(_VA_STR_ELEM2(v, o)))
 #define _VA_STR_ELEM17(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
-  (_VA_STR_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) || 
(strcmp(v, p) == 0))
+  (_VA_STR_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) || 
(_VA_STR_ELEM2(v, p)))
+/* clang-format on */
 
 /* reusable STR_ELEM macro */
 #define STR_ELEM(...) VA_NARGS_CALL_OVERLOAD(_VA_STR_ELEM, __VA_ARGS__)
diff --git a/source/blender/blenlib/BLI_utildefines.h 
b/source/blender/blenlib/BLI_utildefines.h
index f2f30265ea0..970c64e012e 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -246,32 +246,43 @@ extern "C" {
 /** \name Equal to Any Element (ELEM) Macro
  * \{ */
 
+/* Manual line breaks for readability. */
+/* clang-format off */
+
 /* ELEM#(v, ...): is the first arg equal any others? */
-/* internal helpers*/
+/* internal helpers. */
 #define _VA_ELEM2(v, a) ((v) == (a))
-#define _VA_ELEM3(v, a, b) (_VA_ELEM2(v, a) || ((v) == (b)))
-#define _VA_ELEM4(v, a, b, c) (_VA_ELEM3(v, a, b) || ((v) == (c)))
-#defi

[Bf-blender-cvs] [83b0e975b92] master: Cleanup: quiet warning for NULL pointer use

2019-04-20 Thread Campbell Barton
Commit: 83b0e975b92c7678376b83b468450f2be0af1bf3
Author: Campbell Barton
Date:   Sat Apr 20 12:31:22 2019 +0200
Branches: master
https://developer.blender.org/rB83b0e975b92c7678376b83b468450f2be0af1bf3

Cleanup: quiet warning for NULL pointer use

Warning was false positive but avoid repeating the same check.

===

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

===

diff --git a/source/blender/editors/transform/transform_conversions.c 
b/source/blender/editors/transform/transform_conversions.c
index 4346decd4a7..4f288f56f8f 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2934,20 +2934,24 @@ static void createTransEditVerts(TransInfo *t)
   }
 
   /* CrazySpace */
-  if (defmats || (quats && BM_elem_flag_test(eve, BM_ELEM_TAG))) {
+  const bool use_quats = quats && BM_elem_flag_test(eve, BM_ELEM_TAG);
+  if (use_quats || defmats) {
 float mat[3][3], qmat[3][3], imat[3][3];
 
-/* use both or either quat and defmat correction */
-if (quats && BM_elem_flag_test(eve, BM_ELEM_TAG)) {
+/* Use both or either quat and defmat correction. */
+if (use_quats) {
   quat_to_mat3(qmat, quats[BM_elem_index_get(eve)]);
 
-  if (defmats)
+  if (defmats) {
 mul_m3_series(mat, defmats[a], qmat, mtx);
-  else
+  }
+  else {
 mul_m3_m3m3(mat, mtx, qmat);
+  }
 }
-else
+else {
   mul_m3_m3m3(mat, mtx, defmats[a]);
+}
 
 invert_m3_m3(imat, mat);

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


[Bf-blender-cvs] [f2792e91f03] master: 3D View: add opacity for sculpt mask display

2019-04-20 Thread Pablo Dobarro
Commit: f2792e91f034ed01469aa025503a4352a1e4455c
Author: Pablo Dobarro
Date:   Sat Apr 20 11:58:44 2019 +0200
Branches: master
https://developer.blender.org/rBf2792e91f034ed01469aa025503a4352a1e4455c

3D View: add opacity for sculpt mask display

This matches vertex/texture paint opacity options.

Useful because 0.75 is sometimes too dark to see the surface shading.

Resolves T63746

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/draw/modes/sculpt_mode.c
M   source/blender/draw/modes/shaders/sculpt_mask_vert.glsl
M   source/blender/editors/space_view3d/space_view3d.c
M   source/blender/makesdna/DNA_view3d_types.h
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index f572362b02b..bb56946e154 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5572,8 +5572,14 @@ class VIEW3D_PT_overlay_sculpt(Panel):
 tool_settings = context.tool_settings
 sculpt = tool_settings.sculpt
 
+view = context.space_data
+overlay = view.overlay
+
 layout.prop(sculpt, "show_diffuse_color")
 layout.prop(sculpt, "show_mask")
+row = layout.row()
+row.active = sculpt.show_mask
+row.prop(overlay, "sculpt_mode_mask_opacity", text="Opacity")
 
 
 class VIEW3D_PT_overlay_pose(Panel):
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index e43553cd64f..5f13bea1c28 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3177,6 +3177,20 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
   }
 }
 
+if (!DNA_struct_elem_find(
+fd->filesdna, "View3DOverlay", "float", 
"sculpt_mode_mask_opacity")) {
+  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) {
+if (sl->spacetype == SPACE_VIEW3D) {
+  View3D *v3d = (View3D *)sl;
+  v3d->overlay.sculpt_mode_mask_opacity = 0.75f;
+}
+  }
+}
+  }
+}
+
 /* Versioning code until next subversion bump goes here. */
   }
 }
diff --git a/source/blender/draw/modes/sculpt_mode.c 
b/source/blender/draw/modes/sculpt_mode.c
index b25a8af795b..e2b73a0fac7 100644
--- a/source/blender/draw/modes/sculpt_mode.c
+++ b/source/blender/draw/modes/sculpt_mode.c
@@ -135,9 +135,15 @@ static void SCULPT_cache_init(void *vedata)
   }
 
   {
+const DRWContextState *draw_ctx = DRW_context_state_get();
+View3D *v3d = draw_ctx->v3d;
+
 DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | 
DRW_STATE_MULTIPLY;
 psl->pass = DRW_pass_create("Sculpt Pass", state);
-stl->g_data->group_smooth = DRW_shgroup_create(e_data.shader_smooth, 
psl->pass);
+
+DRWShadingGroup *shgrp = DRW_shgroup_create(e_data.shader_smooth, 
psl->pass);
+DRW_shgroup_uniform_float(shgrp, "maskOpacity", 
&v3d->overlay.sculpt_mode_mask_opacity, 1);
+stl->g_data->group_smooth = shgrp;
   }
 }
 
diff --git a/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl 
b/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl
index 5ae97ec5cb9..e5e34fee57e 100644
--- a/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl
+++ b/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl
@@ -1,5 +1,6 @@
 
 uniform mat4 ModelViewProjectionMatrix;
+uniform float maskOpacity;
 
 in vec3 pos;
 in float msk;
@@ -10,6 +11,6 @@ void main()
 {
   gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
 
-  float mask = 1.0 - msk * 0.75;
+  float mask = 1.0 - (msk * maskOpacity);
   finalColor = vec4(mask, mask, mask, 1.0);
 }
diff --git a/source/blender/editors/space_view3d/space_view3d.c 
b/source/blender/editors/space_view3d/space_view3d.c
index 0b98ad3cacd..456a012020f 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -262,6 +262,10 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), 
const Scene *scene)
   v3d->overlay.texture_paint_mode_opacity = 1.0f;
   v3d->overlay.weight_paint_mode_opacity = 1.0f;
   v3d->overlay.vertex_paint_mode_opacity = 1.0f;
+  /* Intentionally different to vertex/paint mode,
+   * we typically want to see shading too. */
+  v3d->overlay.sculpt_mode_mask_opacity = 0.75f;
+
   v3d->overlay.edit_flag = V3D_OVERLAY_EDIT_FACES | V3D_OVERLAY_EDIT_SEAMS |
V3D_OVERLAY_EDIT_SHARP | 
V3D_OVERLAY_EDIT_FREESTY

[Bf-blender-cvs] [08f4cdebe40] master: Cleanup: de-duplicate flag setting macro

2019-04-20 Thread Campbell Barton
Commit: 08f4cdebe40a5ad5f45f37a07bf0f64c17cecb34
Author: Campbell Barton
Date:   Sat Apr 20 11:39:25 2019 +0200
Branches: master
https://developer.blender.org/rB08f4cdebe40a5ad5f45f37a07bf0f64c17cecb34

Cleanup: de-duplicate flag setting macro

===

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

===

diff --git a/source/blender/makesrna/intern/rna_rigidbody.c 
b/source/blender/makesrna/intern/rna_rigidbody.c
index 242bc63c09f..799705df2b4 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -146,14 +146,6 @@ static const EnumPropertyItem 
rigidbody_mesh_source_items[] = {
 
 #  include "WM_api.h"
 
-#  define RB_FLAG_SET(dest, value, flag) \
-{ \
-  if (value) \
-dest |= flag; \
-  else \
-dest &= ~flag; \
-}
-
 /*  */
 
 static void rna_RigidBodyWorld_reset(Main *UNUSED(bmain), Scene 
*UNUSED(scene), PointerRNA *ptr)
@@ -185,7 +177,7 @@ static void rna_RigidBodyWorld_split_impulse_set(PointerRNA 
*ptr, bool value)
 {
   RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
 
-  RB_FLAG_SET(rbw->flag, value, RBW_FLAG_USE_SPLIT_IMPULSE);
+  SET_FLAG_FROM_TEST(rbw->flag, value, RBW_FLAG_USE_SPLIT_IMPULSE);
 
 #  ifdef WITH_BULLET
   if (rbw->shared->physics_world) {
@@ -266,7 +258,7 @@ static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, 
bool value)
 {
   RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
 
-  RB_FLAG_SET(rbo->flag, !value, RBO_FLAG_DISABLED);
+  SET_FLAG_FROM_TEST(rbo->flag, !value, RBO_FLAG_DISABLED);
 
 #  ifdef WITH_BULLET
   /* update kinematic state if necessary - only needed for active bodies */
@@ -348,7 +340,7 @@ static void rna_RigidBodyOb_kinematic_state_set(PointerRNA 
*ptr, bool value)
 {
   RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
 
-  RB_FLAG_SET(rbo->flag, value, RBO_FLAG_KINEMATIC);
+  SET_FLAG_FROM_TEST(rbo->flag, value, RBO_FLAG_KINEMATIC);
 
 #  ifdef WITH_BULLET
   /* update kinematic state if necessary */
@@ -364,7 +356,7 @@ static void rna_RigidBodyOb_activation_state_set(PointerRNA 
*ptr, bool value)
 {
   RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
 
-  RB_FLAG_SET(rbo->flag, value, RBO_FLAG_USE_DEACTIVATION);
+  SET_FLAG_FROM_TEST(rbo->flag, value, RBO_FLAG_USE_DEACTIVATION);
 
 #  ifdef WITH_BULLET
   /* update activation state if necessary - only active bodies can be 
deactivated */
@@ -456,7 +448,7 @@ static void rna_RigidBodyCon_enabled_set(PointerRNA *ptr, 
bool value)
 {
   RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
 
-  RB_FLAG_SET(rbc->flag, value, RBC_FLAG_ENABLED);
+  SET_FLAG_FROM_TEST(rbc->flag, value, RBC_FLAG_ENABLED);
 
 #  ifdef WITH_BULLET
   if (rbc->physics_constraint) {
@@ -469,7 +461,7 @@ static void 
rna_RigidBodyCon_disable_collisions_set(PointerRNA *ptr, bool value)
 {
   RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
 
-  RB_FLAG_SET(rbc->flag, value, RBC_FLAG_DISABLE_COLLISIONS);
+  SET_FLAG_FROM_TEST(rbc->flag, value, RBC_FLAG_DISABLE_COLLISIONS);
 
   rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
 }
@@ -728,7 +720,7 @@ static void rna_RigidBodyCon_use_motor_lin_set(PointerRNA 
*ptr, bool value)
 {
   RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
 
-  RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_LIN);
+  SET_FLAG_FROM_TEST(rbc->flag, value, RBC_FLAG_USE_MOTOR_LIN);
 
 #  ifdef WITH_BULLET
   if (rbc->physics_constraint) {
@@ -743,7 +735,7 @@ static void rna_RigidBodyCon_use_motor_ang_set(PointerRNA 
*ptr, bool value)
 {
   RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
 
-  RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_ANG);
+  SET_FLAG_FROM_TEST(rbc->flag, value, RBC_FLAG_USE_MOTOR_ANG);
 
 #  ifdef WITH_BULLET
   if (rbc->physics_constraint) {

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


[Bf-blender-cvs] [bbc5c1e36fc] master: Cleanup: quiet extra-semicolon warning

2019-04-20 Thread Campbell Barton
Commit: bbc5c1e36fc93e33fce4156f5064dfebe1129a57
Author: Campbell Barton
Date:   Sat Apr 20 11:28:21 2019 +0200
Branches: master
https://developer.blender.org/rBbbc5c1e36fc93e33fce4156f5064dfebe1129a57

Cleanup: quiet extra-semicolon warning

===

M   source/blender/blenkernel/BKE_collection.h
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/particle.c
M   source/blender/blenkernel/intern/softbody.c
M   source/blender/blenkernel/intern/studiolight.c
M   source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M   source/blender/draw/intern/draw_manager.h
M   source/blender/editors/sculpt_paint/paint_image_proj.c
M   source/blender/gpu/intern/gpu_framebuffer.c
M   source/blender/makesdna/intern/makesdna.c
M   source/blender/makesrna/intern/rna_color.c
M   source/blender/python/mathutils/mathutils.h
M   source/blender/render/intern/include/texture.h
M   source/blender/render/intern/source/pipeline.c
M   source/blender/windowmanager/intern/wm_window.c

===

diff --git a/source/blender/blenkernel/BKE_collection.h 
b/source/blender/blenkernel/BKE_collection.h
index f06d9d1e64e..47786629aed 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -180,7 +180,8 @@ typedef void (*BKE_scene_collections_Cb)(struct Collection 
*ob, void *data);
 #define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END \
   } \
   } \
-  }
+  } \
+  ((void)0)
 
 #define FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(_collection, _object) \
   for (Base *_base = (Base 
*)BKE_collection_object_cache_get(_collection).first; _base; \
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 1f5bb2266d1..682d0b981fa 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -491,7 +491,8 @@ const char *nodeStaticSocketInterfaceType(int type, int 
subtype);
 #define NODE_SOCKET_TYPES_END \
   } \
   BLI_ghashIterator_free(__node_socket_type_iter__); \
-  }
+  } \
+  ((void)0)
 
 struct bNodeSocket *nodeFindSocket(struct bNode *node, int in_out, const char 
*identifier);
 struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree,
diff --git a/source/blender/blenkernel/intern/particle.c 
b/source/blender/blenkernel/intern/particle.c
index 9e121d279ba..5234c2fb0ef 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3143,7 +3143,7 @@ void psys_cache_edit_paths(Depsgraph *depsgraph,
   iter_data.use_weight = use_weight;
 
   if (use_weight) {
-; /* use weight painting colors now... */
+/* use weight painting colors now... */
   }
   else {
 iter_data.sel_col[0] = (float)edit->sel_col[0] / 255.0f;
diff --git a/source/blender/blenkernel/intern/softbody.c 
b/source/blender/blenkernel/intern/softbody.c
index 37b6211916c..3a7c6527a50 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -3515,7 +3515,7 @@ void sbObjectStep(struct Depsgraph *depsgraph,
 return;
   }
   else if (cache_result == PTCACHE_READ_OLD) {
-; /* do nothing */
+/* pass */
   }
   else if (/*ob->id.lib || */ (
   cache->flag &
diff --git a/source/blender/blenkernel/intern/studiolight.c 
b/source/blender/blenkernel/intern/studiolight.c
index df48e505f6f..b64f6a1d076 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -129,12 +129,13 @@ static const char *STUDIOLIGHT_MATCAP_DEFAULT = 
"basic_1.exr";
 static void studiolight_free(struct StudioLight *sl)
 {
 #define STUDIOLIGHT_DELETE_ICON(s) \
-  { \
+  do { \
 if (s != 0) { \
   BKE_icon_delete(s); \
   s = 0; \
 } \
-  }
+  } while (0)
+
   if (sl->free_function) {
 sl->free_function(sl, sl->free_function_data);
   }
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index b37ecb45ac8..c4a2fc71d1b 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -335,7 +335,7 @@ void DepsgraphNodeBuilder::begin_build()
 entry_tag.name = op_node->name;
 entry_tag.name_tag = op_node->name_tag;
 saved_entry_tags_.push_back(entry_tag);
-  };
+  }
   GSET_FOREACH_END();
 
   /* Make sure graph has no nodes left from previous state. */
diff --git a/source/blender/draw/intern/draw_manager.h 
b/source/blender/draw/intern/draw_manager.h
index 35e2ab86a80..f9ed5a864df 100644
--- a/source/blender/draw/intern/draw_manager.h
+++ b/source/blender/draw/intern/draw_manager.h
@@ -56,7 +56,9 @@
 
 #  define PROFILE_TIMER_FALLOFF 0.04
 
-#  define PROFILE_START(time_start) double time_start = 
PIL_check_seconds_timer()

[Bf-blender-cvs] [20bc30706b9] master: Fix T63732: GPencil Onion now working with multiwindows

2019-04-20 Thread Antonioya
Commit: 20bc30706b9c810ea774d98a768734767f9e91be
Author: Antonioya
Date:   Sat Apr 20 10:26:15 2019 +0200
Branches: master
https://developer.blender.org/rB20bc30706b9c810ea774d98a768734767f9e91be

Fix T63732: GPencil Onion now working with multiwindows

If you had several windows or, after last changes in topbar, several areas, the 
swith of overlays or Onion Skin was not working by area, but as whole switch, 
so it was impossible to have different status by window.

===

M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 5dda2faff42..8c2dee66d92 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1648,6 +1648,16 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data 
*e_data,
   int idx = 0;
   bool tag_first = false;
 
+  const DRWContextState *draw_ctx = DRW_context_state_get();
+  const View3D *v3d = draw_ctx->v3d;
+
+  const bool overlay = draw_ctx->v3d != NULL ?
+   (bool)((draw_ctx->v3d->flag2 & V3D_HIDE_OVERLAYS) 
== 0) :
+   true;
+  const bool main_onion = v3d != NULL ? (v3d->gp_flag & 
V3D_GP_SHOW_ONION_SKIN) : true;
+  const bool do_onion = (bool)((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0) 
&& main_onion &&
+DRW_gpencil_onion_active(gpd) && overlay;
+
   int start_stroke = 0;
   int start_point = 0;
   int start_fill = 0;
@@ -1707,14 +1717,14 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data 
*e_data,
   elm->onion,
   scale,
   cache_ob->shading_type);
-
-DRW_shgroup_call_range_add(shgrp,
-   cache->b_stroke.batch,
-   (!cache_ob->is_dup_ob) ? 
gpf->runtime.viewmatrix :
-cache_ob->obmat,
-   start_stroke,
-   len);
-
+if ((do_onion) || (elm->onion == false)) {
+  DRW_shgroup_call_range_add(shgrp,
+ cache->b_stroke.batch,
+ (!cache_ob->is_dup_ob) ? 
gpf->runtime.viewmatrix :
+  cache_ob->obmat,
+ start_stroke,
+ len);
+}
 stl->storage->shgroup_id++;
 start_stroke = elm->vertex_idx;
 break;
@@ -1736,13 +1746,14 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data 
*e_data,
  scale,
  cache_ob->shading_type);
 
-DRW_shgroup_call_range_add(shgrp,
-   cache->b_point.batch,
-   (!cache_ob->is_dup_ob) ? 
gpf->runtime.viewmatrix :
-cache_ob->obmat,
-   start_point,
-   len);
-
+if ((do_onion) || (elm->onion == false)) {
+  DRW_shgroup_call_range_add(shgrp,
+ cache->b_point.batch,
+ (!cache_ob->is_dup_ob) ? 
gpf->runtime.viewmatrix :
+  cache_ob->obmat,
+ start_point,
+ len);
+}
 stl->storage->shgroup_id++;
 start_point = elm->vertex_idx;
 break;
@@ -1761,13 +1772,14 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data 
*e_data,
 stl->storage->shgroup_id,
 cache_ob->shading_type);
 
-DRW_shgroup_call_range_add(shgrp,
-   cache->b_fill.batch,
-   (!cache_ob->is_dup_ob) ? 
gpf->runtime.viewmatrix :
-cache_ob->obmat,
-   start_fill,
-   len);
-
+if ((do_onion) || (elm->onion == false)) {
+  DRW_shgroup_call_range_add(shgrp,
+ cache->b_fill.batch,
+ (!cache_ob->is_dup_ob) ? 
gpf->runtime.viewmatrix :
+  cache_ob->obmat,
+ start_fill,
+   

[Bf-blender-cvs] [e63eb6ed269] master: Cleanup: comment line length (windowmanager)

2019-04-20 Thread Campbell Barton
Commit: e63eb6ed2696c5d52b35972ab7a1bbda7b5bdc90
Author: Campbell Barton
Date:   Sat Apr 20 10:02:28 2019 +0200
Branches: master
https://developer.blender.org/rBe63eb6ed2696c5d52b35972ab7a1bbda7b5bdc90

Cleanup: comment line length (windowmanager)

===

M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/WM_types.h
M   source/blender/windowmanager/gizmo/intern/wm_gizmo.c
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
M   source/blender/windowmanager/intern/wm_event_system.c
M   source/blender/windowmanager/intern/wm_files.c
M   source/blender/windowmanager/intern/wm_files_link.c
M   source/blender/windowmanager/intern/wm_gesture.c
M   source/blender/windowmanager/intern/wm_gesture_ops.c
M   source/blender/windowmanager/intern/wm_init_exit.c
M   source/blender/windowmanager/intern/wm_jobs.c
M   source/blender/windowmanager/intern/wm_keymap.c
M   source/blender/windowmanager/intern/wm_operator_type.c
M   source/blender/windowmanager/intern/wm_operators.c
M   source/blender/windowmanager/intern/wm_stereo.c
M   source/blender/windowmanager/intern/wm_toolsystem.c
M   source/blender/windowmanager/intern/wm_window.c
M   source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c
M   source/blender/windowmanager/wm_event_types.h

===

diff --git a/source/blender/windowmanager/WM_api.h 
b/source/blender/windowmanager/WM_api.h
index af6f2559cae..5cc70aecd8d 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -635,7 +635,8 @@ enum {
   WM_JOB_SUSPEND = (1 << 3),
 };
 
-/* identifying jobs by owner alone is unreliable, this isnt saved, order can 
change (keep 0 for 'any') */
+/** Identifying jobs by owner alone is unreliable, this isnt saved,
+ * order can change (keep 0 for 'any'). */
 enum {
   WM_JOB_TYPE_ANY = 0,
   WM_JOB_TYPE_COMPOSITE,
diff --git a/source/blender/windowmanager/WM_types.h 
b/source/blender/windowmanager/WM_types.h
index 425853c7a96..154c4837a68 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -427,7 +427,8 @@ typedef struct wmGesture {
   int modal_state;
 
   /* For modal operators which may be running idle, waiting for an event to 
activate the gesture.
-   * Typically this is set when the user is click-dragging the gesture (border 
and circle select for eg). */
+   * Typically this is set when the user is click-dragging the gesture
+   * (border and circle select for eg). */
   uint is_active : 1;
   /* Previous value of is-active (use to detect first run & edge cases). */
   uint is_active_prev : 1;
@@ -526,7 +527,8 @@ typedef enum { /* motion progress, for modal handlers */
 typedef struct wmNDOFMotionData {
   /* awfully similar to GHOST_TEventNDOFMotionData... */
   /* Each component normally ranges from -1 to +1, but can exceed that.
-   * These use blender standard view coordinates, with positive rotations 
being CCW about the axis. */
+   * These use blender standard view coordinates,
+   * with positive rotations being CCW about the axis. */
   float tvec[3]; /* translation */
   float rvec[3]; /* rotation: */
   /* axis = (rx,ry,rz).normalized */
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c 
b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
index 997afb1dc6c..e2e5096ef99 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
@@ -462,7 +462,8 @@ bool wm_gizmo_select_and_highlight(bContext *C, wmGizmoMap 
*gzmap, wmGizmo *gz)
 /**
  * Special function to run from setup so gizmos start out interactive.
  *
- * We could do this when linking them, but this complicates things since the 
window update code needs to run first.
+ * We could do this when linking them,
+ * but this complicates things since the window update code needs to run first.
  */
 void WM_gizmo_modal_set_from_setup(struct wmGizmoMap *gzmap,
struct bContext *C,
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c 
b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index b37991ec8cd..5aecab122a2 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -188,7 +188,8 @@ wmGizmo *wm_gizmogroup_find_intersected_gizmo(const 
wmGizmoGroup *gzgroup,
 }
 
 /**
- * Adds all gizmos of \a gzgroup that can be selected to the head of \a 
listbase. Added items need freeing!
+ * Adds all gizmos of \a gzgroup that can be selected to the head of \a 
listbase.
+ * Added items need freeing!
  */
 void wm_gizmogroup_intersectable_gizmos_to_list(const wmGizmoGroup *gzgroup, 
ListBase *listbase)
 

[Bf-blender-cvs] [e17e119a312] master: Cleanup: comment line length (tests)

2019-04-20 Thread Campbell Barton
Commit: e17e119a312528897d2b1f0ee73a9a8a6ecf6150
Author: Campbell Barton
Date:   Sat Apr 20 10:06:01 2019 +0200
Branches: master
https://developer.blender.org/rBe17e119a312528897d2b1f0ee73a9a8a6ecf6150

Cleanup: comment line length (tests)

===

M   source/creator/creator_args.c
M   tests/gtests/blenlib/BLI_ghash_performance_test.cc
M   tests/gtests/blenlib/BLI_ghash_test.cc
M   tests/gtests/blenlib/BLI_hash_mm2a_test.cc
M   tests/gtests/blenlib/BLI_math_base_test.cc
M   tests/gtests/blenlib/BLI_string_test.cc
M   tests/gtests/blenlib/BLI_string_utf8_test.cc
M   tests/gtests/blenlib/BLI_task_test.cc

===

diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index f3e4d976d85..e15a1f3e258 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -633,8 +633,8 @@ static int arg_handle_print_help(int UNUSED(argc), const 
char **UNUSED(argv), vo
 
   BLI_argsPrintArgDoc(ba, "--");
 
-  //printf("\n");
-  //printf("Experimental Features:\n");
+  // printf("\n");
+  // printf("Experimental Features:\n");
 
   /* Other options _must_ be last (anything not handled will show here) */
   printf("\n");
@@ -1944,7 +1944,7 @@ void main_args_setup(bContext *C, bArgs *ba)
 #  define CB(a) a##_doc, a
 #  define CB_EX(a, b) a##_doc_##b, a
 
-  //BLI_argsAdd(ba, pass, short_arg, long_arg, doc, cb, C);
+  // BLI_argsAdd(ba, pass, short_arg, long_arg, doc, cb, C);
 
   /* end argument processing after -- */
   BLI_argsAdd(ba, -1, "--", NULL, CB(arg_handle_arguments_end), NULL);
diff --git a/tests/gtests/blenlib/BLI_ghash_performance_test.cc 
b/tests/gtests/blenlib/BLI_ghash_performance_test.cc
index b7a6e16e42a..ba995e5014f 100644
--- a/tests/gtests/blenlib/BLI_ghash_performance_test.cc
+++ b/tests/gtests/blenlib/BLI_ghash_performance_test.cc
@@ -15,8 +15,12 @@ extern "C" {
 }
 
 /* Using 
http://corpora.uni-leipzig.de/downloads/eng_wikipedia_2010_1M-text.tar.gz
- * (1 million of words, about 122MB of text) from 
http://corpora.informatik.uni-leipzig.de/download.html */
-//#define TEXT_CORPUS_PATH 
"/path/to/Téléchargements/eng_wikipedia_2010_1M-text/eng_wikipedia_2010_1M-sentences.txt"
+ * (1 million of words, about 122MB of text) from
+ * http://corpora.informatik.uni-leipzig.de/download.html */
+#if 0
+#  define TEXT_CORPUS_PATH \
+
"/path/to/Téléchargements/eng_wikipedia_2010_1M-text/eng_wikipedia_2010_1M-sentences.txt"
+#endif
 
 /* Resizing the hash has a huge cost over global filling operation! */
 //#define GHASH_RESERVE
@@ -459,7 +463,8 @@ TEST(ghash, Int4Murmur2a2000)
 }
 #endif
 
-/* MultiSmall: create and manipulate a lot of very small ghashes (90% < 10 
items, 9% < 100 items, 1% < 1000 items). */
+/* MultiSmall: create and manipulate a lot of very small ghashes
+ * (90% < 10 items, 9% < 100 items, 1% < 1000 items). */
 
 static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned 
int nbr)
 {
diff --git a/tests/gtests/blenlib/BLI_ghash_test.cc 
b/tests/gtests/blenlib/BLI_ghash_test.cc
index c2ef064c8c9..d6841ad4d44 100644
--- a/tests/gtests/blenlib/BLI_ghash_test.cc
+++ b/tests/gtests/blenlib/BLI_ghash_test.cc
@@ -33,8 +33,8 @@ extern "C" {
   } \
   void(0)
 
-/* Note: for pure-ghash testing, nature of the keys and data have absolutely 
no importance! So here we just use mere
- *   random integers stored in pointers. */
+/* Note: for pure-ghash testing, nature of the keys and data have absolutely 
no importance! So here
+ * we just use mere random integers stored in pointers. */
 
 static void init_keys(unsigned int keys[TESTCASE_SIZE], const int seed)
 {
@@ -58,7 +58,8 @@ static void init_keys(unsigned int keys[TESTCASE_SIZE], const 
int seed)
   BLI_rng_free(rng);
 }
 
-/* Here we simply insert and then lookup all keys, ensuring we do get back the 
expected stored 'data'. */
+/* Here we simply insert and then lookup all keys, ensuring we do get back the 
expected stored
+ * 'data'. */
 TEST(ghash, InsertLookup)
 {
   GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, 
__func__);
@@ -81,7 +82,8 @@ TEST(ghash, InsertLookup)
   BLI_ghash_free(ghash, NULL, NULL);
 }
 
-/* Here we simply insert and then remove all keys, ensuring we do get an 
empty, unshrinked ghash. */
+/* Here we simply insert and then remove all keys, ensuring we do get an 
empty, unshrinked ghash.
+ */
 TEST(ghash, InsertRemove)
 {
   GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, 
__func__);
diff --git a/tests/gtests/blenlib/BLI_hash_mm2a_test.cc 
b/tests/gtests/blenlib/BLI_hash_mm2a_test.cc
index 16a2db6af56..4f6570d93ad 100644
--- a/tests/gtests/blenlib/BLI_hash_mm2a_test.cc
+++ b/tests/gtests/blenlib/BLI_hash_mm2a_test.cc
@@ -6,8 +6,9 @@ extern "C" {
 #include "BLI_hash_mm2a.h"
 }
 
-/* Note: Reference results are taken from reference implementation (cpp 

[Bf-blender-cvs] [44ca116ca2a] master: Cleanup: formatting, unused args

2019-04-20 Thread Campbell Barton
Commit: 44ca116ca2aec7651e1fdab9cba6f63c244a8f93
Author: Campbell Barton
Date:   Sat Apr 20 09:15:06 2019 +0200
Branches: master
https://developer.blender.org/rB44ca116ca2aec7651e1fdab9cba6f63c244a8f93

Cleanup: formatting, unused args

===

M   source/blender/draw/DRW_engine.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/editors/space_view3d/space_view3d.c
M   source/blender/editors/space_view3d/view3d_draw_legacy.c
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h
index d0b7c10a3cb..da1f5c7863a 100644
--- a/source/blender/draw/DRW_engine.h
+++ b/source/blender/draw/DRW_engine.h
@@ -133,7 +133,6 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph 
*depsgraph,
  struct View3D *v3d,
  struct GPUViewport *viewport);
 void DRW_draw_depth_object(struct ARegion *ar,
-   struct View3D *v3d,
struct GPUViewport *viewport,
struct Object *object);
 
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 6c3bc7eb021..89936d84275 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2494,7 +2494,7 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph 
*depsgraph,
 /**
  * Clears the Depth Buffer and draws only the specified object.
  */
-void DRW_draw_depth_object(ARegion *ar, View3D *v3d, GPUViewport *viewport, 
Object *object)
+void DRW_draw_depth_object(ARegion *ar, GPUViewport *viewport, Object *object)
 {
   RegionView3D *rv3d = ar->regiondata;
 
diff --git a/source/blender/editors/space_view3d/space_view3d.c 
b/source/blender/editors/space_view3d/space_view3d.c
index 8a0d1b5b322..0b98ad3cacd 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -1128,8 +1128,8 @@ static void view3d_header_region_listener(wmWindow 
*UNUSED(win),
   break;
   }
 
-  /* From topbar, which ones are needed? split per header? */
-  /* Disable for now, re-enable if neede, or remove - campbell. */
+/* From topbar, which ones are needed? split per header? */
+/* Disable for now, re-enable if neede, or remove - campbell. */
 #if 0
   /* context changes */
   switch (wmn->category) {
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c 
b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index e78eb790072..c705a8608d5 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -260,12 +260,11 @@ void ED_view3d_backbuf_depth_validate(ViewContext *vc)
 {
   if (vc->v3d->flag & V3D_INVALID_BACKBUF) {
 ARegion *ar = vc->ar;
-RegionView3D *rv3d = ar->regiondata;
 Object *obact_eval = DEG_get_evaluated_object(vc->depsgraph, vc->obact);
 
 if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE) != 0)) {
   GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0);
-  DRW_draw_depth_object(vc->ar, vc->v3d, viewport, obact_eval);
+  DRW_draw_depth_object(vc->ar, viewport, obact_eval);
 }
 
 vc->v3d->flag &= ~V3D_INVALID_BACKBUF;
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index ce6a2af8c8f..af1f37701ee 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -4079,8 +4079,9 @@ static void rna_def_space_image(BlenderRNA *brna)
   RNA_def_struct_sdna(srna, "SpaceImage");
   RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor 
space data");
 
-  rna_def_space_generic_show_region_toggles(
-  srna, (1 << RGN_TYPE_TOOL_HEADER) | (1 << RGN_TYPE_TOOLS) | (1 << 
RGN_TYPE_UI) | (1 << RGN_TYPE_HUD));
+  rna_def_space_generic_show_region_toggles(srna,
+((1 << RGN_TYPE_TOOL_HEADER) | (1 
<< RGN_TYPE_TOOLS) |
+ (1 << RGN_TYPE_UI) | (1 << 
RGN_TYPE_HUD)));
 
   /* image */
   prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);

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