[Bf-blender-cvs] [18540f41d78] master: Cleanup: improve comments

2019-08-03 Thread Campbell Barton
Commit: 18540f41d78fdf766aec5c99dbc63ef623fc003e
Author: Campbell Barton
Date:   Sun Aug 4 12:52:01 2019 +1000
Branches: master
https://developer.blender.org/rB18540f41d78fdf766aec5c99dbc63ef623fc003e

Cleanup: improve comments

===

M   source/blender/editors/interface/interface_templates.c
M   source/blender/editors/space_view3d/view3d_edit.c

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index 654483c2182..fb8c2f59748 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -4064,8 +4064,11 @@ static void curvemap_buttons_reset(bContext *C, void 
*cb_v, void *cumap_v)
   rna_update_cb(C, cb_v, NULL);
 }
 
-/* still unsure how this call evolves...
- * we use labeltype for defining what curve-channels to show */
+/**
+ * \note Still unsure how this call evolves.
+ *
+ * \param labeltype: Used for defining which curve-channels to show.
+ */
 static void curvemap_buttons_layout(uiLayout *layout,
 PointerRNA *ptr,
 char labeltype,
diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index 62673d9bd5a..ff0052c1fd1 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -183,6 +183,10 @@ typedef struct ViewOpsData {
   bool use_dyn_ofs;
 } ViewOpsData;
 
+/**
+ * Size of the sphere being dragged for trackball rotation withing the view 
bounds.
+ * also affects speed (smaller is faster).
+ */
 #define TRACKBALLSIZE (1.1f)
 
 static void calctrackballvec(const rcti *rect, const int event_xy[2], float 
r_dir[3])
@@ -190,8 +194,8 @@ static void calctrackballvec(const rcti *rect, const int 
event_xy[2], float r_di
   const float radius = TRACKBALLSIZE;
   const float t = radius / (float)M_SQRT2;
   const float size[2] = {BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)};
-  /* Aspect correct so dragging in a non-square view doesn't squash the,
-   * so diagonal motion rotates diagonally too. */
+  /* Aspect correct so dragging in a non-square view doesn't squash the 
direction.
+   * So diagonal motion rotates the same direction the cursor is moving. */
   const float size_min = min_ff(size[0], size[1]);
   const float aspect[2] = {size_min / size[0], size_min / size[1]};

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


[Bf-blender-cvs] [2425401a594] master: Cleanup: spelling

2019-08-03 Thread Campbell Barton
Commit: 2425401a594649abff263d49b902e335a7d614e0
Author: Campbell Barton
Date:   Sun Aug 4 12:51:44 2019 +1000
Branches: master
https://developer.blender.org/rB2425401a594649abff263d49b902e335a7d614e0

Cleanup: spelling

===

M   intern/cycles/device/opencl/opencl_split.cpp
M   intern/cycles/device/opencl/opencl_util.cpp
M   intern/cycles/util/util_task.cpp
M   intern/iksolver/intern/IK_Math.h
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/studiolight.c
M   source/blender/blenloader/intern/versioning_260.c
M   source/blender/compositor/operations/COM_TextureOperation.cpp
M   source/blender/editors/interface/interface_widgets.c
M   source/blender/editors/physics/particle_edit.c
M   source/blender/editors/space_outliner/outliner_draw.c
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/freestyle/intern/geometry/GeomCleaner.h
M   source/blender/freestyle/intern/scene_graph/NodeTransform.h
M   source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h
M   source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h
M   source/blender/freestyle/intern/stroke/BasicStrokeShaders.h
M   source/blender/makesrna/intern/rna_pose.c
M   source/blender/modifiers/intern/MOD_correctivesmooth.c
M   source/blender/python/mathutils/mathutils_Matrix.c
M   source/blender/python/mathutils/mathutils_Quaternion.c
M   source/blender/python/mathutils/mathutils_Vector.c
M   source/blender/render/intern/source/imagetexture.c

===

diff --git a/intern/cycles/device/opencl/opencl_split.cpp 
b/intern/cycles/device/opencl/opencl_split.cpp
index 442b92100bb..79474fb0814 100644
--- a/intern/cycles/device/opencl/opencl_split.cpp
+++ b/intern/cycles/device/opencl/opencl_split.cpp
@@ -194,7 +194,7 @@ string OpenCLDevice::get_build_options(const 
DeviceRequestedFeatures _
 DeviceRequestedFeatures features(requested_features);
 enable_default_features(features);
 
-/* Always turn off baking at this point. Baking is only usefull when 
building the bake kernel.
+/* Always turn off baking at this point. Baking is only useful when 
building the bake kernel.
  * this also makes sure that the kernels that are build during baking can 
be reused
  * when not doing any baking. */
 features.use_baking = false;
diff --git a/intern/cycles/device/opencl/opencl_util.cpp 
b/intern/cycles/device/opencl/opencl_util.cpp
index cc40ad42b06..dc9b4072841 100644
--- a/intern/cycles/device/opencl/opencl_util.cpp
+++ b/intern/cycles/device/opencl/opencl_util.cpp
@@ -746,7 +746,7 @@ bool OpenCLInfo::device_supported(const string 
_name, const cl_device_i
   }
   VLOG(3) << "OpenCL driver version " << driver_major << "." << driver_minor;
 
-  /* It is possible tyo have Iris GPU on AMD/Apple OpenCL framework
+  /* It is possible to have Iris GPU on AMD/Apple OpenCL framework
* (aka, it will not be on Intel framework). This isn't supported
* and needs an explicit blacklist.
*/
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
index fdbc3800806..24286116dfb 100644
--- a/intern/cycles/util/util_task.cpp
+++ b/intern/cycles/util/util_task.cpp
@@ -283,8 +283,8 @@ vector distribute_threads_on_nodes(const int 
num_threads)
 }
 ++current_node_index;
   }
-  /* Second pass: keep scheduling threads to each node one by one, uniformly
-   * fillign them in.
+  /* Second pass: keep scheduling threads to each node one by one,
+   * uniformly filling them in.
* This is where things becomes tricky to predict for the maximum
* performance: on the one hand this avoids too much threading overhead on
* few nodes, but for the final performance having all the overhead on one
diff --git a/intern/iksolver/intern/IK_Math.h b/intern/iksolver/intern/IK_Math.h
index ce99c3923f3..f8f8b774787 100644
--- a/intern/iksolver/intern/IK_Math.h
+++ b/intern/iksolver/intern/IK_Math.h
@@ -166,8 +166,8 @@ static inline Eigen::Vector3d 
SphericalRangeParameters(const Eigen::Matrix3d )
   // singularity at pi
   if (fabs(num) < IK_EPSILON)
 // TODO: this does now rotation of size pi over z axis, but could
-// be any axis, how to deal with this i'm not sure, maybe don't
-// enforce limits at all then
+// be any axis, how to deal with this I'm not sure, maybe don't
+// enforce limits at all then.
 return Eigen::Vector3d(0.0, tau, 1.0);
 
   num = 1.0 / sqrt(num);
diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index eb2f23a7b2a..d95c02cdf7f 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2226,7 +2226,7 @@ static bool ob_parcurve(Object *ob, Object *par, float 
mat[4][4])
* dependency cycles. We can't correct 

[Bf-blender-cvs] [9c146a94503] soc-2019-cycles-procedural: Fix Vector Math backward compatibility. Update average operator.

2019-08-03 Thread OmarSquircleArt
Commit: 9c146a9450379679e067153ef60ae7acd310865d
Author: OmarSquircleArt
Date:   Sat Aug 3 23:07:21 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB9c146a9450379679e067153ef60ae7acd310865d

Fix Vector Math backward compatibility. Update average operator.

===

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

===

diff --git a/source/blender/blenloader/intern/versioning_cycles.c 
b/source/blender/blenloader/intern/versioning_cycles.c
index 70e1ee8871b..4eab08c8f47 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -730,6 +730,75 @@ static void update_vector_normalize_operators(bNodeTree 
*ntree)
   }
 }
 
+/* The Average operator is no longer available in the Vector Math node.
+ * The Vector output was equal to the normalized sum of inputs vectors while
+ * the Value output was equal to the length of the sum of input vectors.
+ * To correct this, we convert the node into an Add node and add a length
+ * or a normalize node if needed.
+ */
+static void update_vector_average_operator(bNodeTree *ntree)
+{
+  bool need_update = false;
+
+  for (bNode *node = ntree->nodes.first; node; node = node->next) {
+if (node->type == SH_NODE_VECTOR_MATH) {
+  if (node->custom1 == NODE_VECTOR_MATH_AVERAGE) {
+node->custom1 = NODE_VECTOR_MATH_ADD;
+bNodeSocket *sockOutVector = nodeFindSocket(node, SOCK_OUT, "Vector");
+if (socket_is_used(sockOutVector)) {
+  bNode *normalizeNode = nodeAddStaticNode(NULL, ntree, 
SH_NODE_VECTOR_MATH);
+  normalizeNode->custom1 = NODE_VECTOR_MATH_NORMALIZE;
+  normalizeNode->locx = node->locx + node->width + 20.0f;
+  normalizeNode->locy = node->locy;
+  bNodeSocket *sockNormalizeOut = nodeFindSocket(normalizeNode, 
SOCK_OUT, "Vector");
+
+  /* Iterate backwards from end so we don't encounter newly added 
links. */
+  for (bNodeLink *link = ntree->links.last; link; link = link->prev) {
+if (link->fromsock == sockOutVector) {
+  nodeAddLink(ntree, normalizeNode, sockNormalizeOut, 
link->tonode, link->tosock);
+  nodeRemLink(ntree, link);
+}
+  }
+  bNodeSocket *sockNormalizeA = nodeFindSocket(normalizeNode, SOCK_IN, 
"A");
+  nodeAddLink(ntree, node, sockOutVector, normalizeNode, 
sockNormalizeA);
+
+  need_update = true;
+}
+
+bNodeSocket *sockOutValue = nodeFindSocket(node, SOCK_OUT, "Value");
+if (socket_is_used(sockOutValue)) {
+  bNode *lengthNode = nodeAddStaticNode(NULL, ntree, 
SH_NODE_VECTOR_MATH);
+  lengthNode->custom1 = NODE_VECTOR_MATH_LENGTH;
+  lengthNode->locx = node->locx + node->width + 20.0f;
+  if (socket_is_used(sockOutVector)) {
+lengthNode->locy = node->locy - lengthNode->height - 20.0f;
+  }
+  else {
+lengthNode->locy = node->locy;
+  }
+  bNodeSocket *sockLengthOut = nodeFindSocket(lengthNode, SOCK_OUT, 
"Value");
+
+  /* Iterate backwards from end so we don't encounter newly added 
links. */
+  for (bNodeLink *link = ntree->links.last; link; link = link->prev) {
+if (link->fromsock == sockOutValue) {
+  nodeAddLink(ntree, lengthNode, sockLengthOut, link->tonode, 
link->tosock);
+  nodeRemLink(ntree, link);
+}
+  }
+  bNodeSocket *sockLengthA = nodeFindSocket(lengthNode, SOCK_IN, "A");
+  nodeAddLink(ntree, node, sockOutVector, lengthNode, sockLengthA);
+
+  need_update = true;
+}
+  }
+}
+  }
+
+  if (need_update) {
+ntreeUpdateTree(NULL, ntree);
+  }
+}
+
 void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main 
*bmain)
 {
   /* Particle shape shared with Eevee. */
@@ -888,10 +957,12 @@ void do_versions_after_linking_cycles(Main *bmain)
   if (ntree->type == NTREE_SHADER) {
 update_single_operand_math_operators(ntree);
 update_math_clamp_option(ntree);
+
 update_vector_add_and_subtract_operators(ntree);
 update_vector_dot_product_operator(ntree);
 update_vector_cross_product_operator(ntree);
 update_vector_normalize_operators(ntree);
+update_vector_average_operator(ntree);
   }
 }
 FOREACH_NODETREE_END;

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


[Bf-blender-cvs] [364e7e08495] soc-2019-outliner: Outliner: Cleanup walk select and syncing code

2019-08-03 Thread Nathan Craddock
Commit: 364e7e08495cde7c108d6af34555afb4c4e723a4
Author: Nathan Craddock
Date:   Sat Aug 3 14:22:17 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB364e7e08495cde7c108d6af34555afb4c4e723a4

Outliner: Cleanup walk select and syncing code

===

M   source/blender/editors/space_outliner/outliner_select.c
M   source/blender/editors/space_outliner/outliner_sync.c
M   source/blender/makesdna/DNA_outliner_types.h

===

diff --git a/source/blender/editors/space_outliner/outliner_select.c 
b/source/blender/editors/space_outliner/outliner_select.c
index 6b6272ffee0..b8372dafcec 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1100,8 +1100,8 @@ eOLDrawState tree_element_type_active(bContext *C,
 
 void outliner_element_activate(SpaceOutliner *soops, TreeStoreElem *tselem)
 {
-  outliner_flag_set(>tree, TSE_ACTIVE | TSE_WALK, false);
-  tselem->flag |= TSE_ACTIVE | TSE_WALK;
+  outliner_flag_set(>tree, TSE_ACTIVE | TSE_ACTIVE_WALK, false);
+  tselem->flag |= TSE_ACTIVE | TSE_ACTIVE_WALK;
 }
 
 /**
@@ -1275,17 +1275,17 @@ static void do_outliner_range_select_recursive(ListBase 
*lb,
 static void do_outliner_range_select(SpaceOutliner *soops, TreeElement *cursor)
 {
   TreeElement *active = outliner_find_element_with_flag(>tree, 
TSE_ACTIVE);
-  outliner_flag_set(>tree, TSE_WALK, false);
+  outliner_flag_set(>tree, TSE_ACTIVE_WALK, false);
 
   if (!active) {
-TREESTORE(cursor)->flag |= TSE_SELECTED | TSE_ACTIVE | TSE_WALK;
+TREESTORE(cursor)->flag |= TSE_SELECTED | TSE_ACTIVE | TSE_ACTIVE_WALK;
 return;
   }
 
   TreeStoreElem *tselem = TREESTORE(active);
   const bool active_selected = (tselem->flag & TSE_SELECTED);
 
-  outliner_flag_set(>tree, TSE_SELECTED | TSE_WALK, false);
+  outliner_flag_set(>tree, TSE_SELECTED | TSE_ACTIVE_WALK, false);
 
   /* Select active if under cursor */
   if (active == cursor) {
@@ -1296,7 +1296,7 @@ static void do_outliner_range_select(SpaceOutliner 
*soops, TreeElement *cursor)
   /* If active is not selected, just select the element under the cursor */
   if (!active_selected || !outliner_is_element_visible(active)) {
 tselem->flag &= ~TSE_ACTIVE;
-TREESTORE(cursor)->flag |= TSE_SELECTED | TSE_ACTIVE | TSE_WALK;
+TREESTORE(cursor)->flag |= TSE_SELECTED | TSE_ACTIVE | TSE_ACTIVE_WALK;
 return;
   }
 
@@ -1677,7 +1677,7 @@ static TreeElement *do_outliner_select_walk(SpaceOutliner 
*soops,
   if (!extend) {
 outliner_flag_set(>tree, TSE_SELECTED, false);
   }
-  tselem->flag &= ~TSE_WALK;
+  tselem->flag &= ~TSE_ACTIVE_WALK;
 
   switch (direction) {
 case OUTLINER_SELECT_WALK_UP:
@@ -1703,7 +1703,7 @@ static TreeElement *do_outliner_select_walk(SpaceOutliner 
*soops,
(tselem->flag | 
TSE_SELECTED);
   }
 
-  tselem_new->flag |= TSE_SELECTED | TSE_WALK;
+  tselem_new->flag |= TSE_SELECTED | TSE_ACTIVE_WALK;
 
   return walk_element;
 }
@@ -1712,7 +1712,7 @@ static TreeElement *do_outliner_select_walk(SpaceOutliner 
*soops,
  * Changed is set to true if walk element is found, false if it was set */
 static TreeElement *find_walk_select_start_element(SpaceOutliner *soops, bool 
*changed)
 {
-  TreeElement *walk_element = outliner_find_element_with_flag(>tree, 
TSE_WALK);
+  TreeElement *walk_element = outliner_find_element_with_flag(>tree, 
TSE_ACTIVE_WALK);
 
   *changed = false;
 
@@ -1733,7 +1733,7 @@ static TreeElement 
*find_walk_select_start_element(SpaceOutliner *soops, bool *c
 
   /* If walk element is not visible, set that element's first visible parent 
as walk element */
   if (!outliner_is_element_visible(walk_element)) {
-TREESTORE(walk_element)->flag &= ~TSE_WALK;
+TREESTORE(walk_element)->flag &= ~TSE_ACTIVE_WALK;
 
 while (!outliner_is_element_visible(walk_element)) {
   walk_element = walk_element->parent;
@@ -1777,7 +1777,7 @@ static int outliner_walk_select_invoke(bContext *C, 
wmOperator *op, const wmEven
 walk_element = do_outliner_select_walk(soops, walk_element, direction, 
extend, toggle_all);
   }
   else {
-TREESTORE(walk_element)->flag |= TSE_SELECTED | TSE_WALK;
+TREESTORE(walk_element)->flag |= TSE_SELECTED | TSE_ACTIVE_WALK;
   }
 
   /* Scroll outliner to focus on walk element */
diff --git a/source/blender/editors/space_outliner/outliner_sync.c 
b/source/blender/editors/space_outliner/outliner_sync.c
index 10fa564f94b..f0b5fb005af 100644
--- a/source/blender/editors/space_outliner/outliner_sync.c
+++ b/source/blender/editors/space_outliner/outliner_sync.c
@@ -54,9 +54,9 @@ static void outliners_mark_dirty(const bContext *C)
   Main *bmain = CTX_data_main(C);
   for (bScreen *screen = bmain->screens.first; screen; screen = 
screen->id.next) {
 for (ScrArea *sa = screen->areabase.first; sa; 

[Bf-blender-cvs] [85a7cebd537] master: UI: Fix Small inconsistency in particle emission

2019-08-03 Thread Your Name
Commit: 85a7cebd537d3782299be180dd1859555d2e12d0
Author: Your Name
Date:   Sat Aug 3 16:14:23 2019 -0400
Branches: master
https://developer.blender.org/rB85a7cebd537d3782299be180dd1859555d2e12d0

UI: Fix Small inconsistency in particle emission

This property was being called something
else depending on the distribution type

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_particle.py 
b/release/scripts/startup/bl_ui/properties_particle.py
index c4b6168be61..02b809cdfb4 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -315,7 +315,7 @@ class PARTICLE_PT_emission_source(ParticleButtonsPanel, 
Panel):
 col.prop(part, "invert_grid")
 col.prop(part, "hexagonal_grid")
 else:
-col.prop(part, "use_emit_random")
+col.prop(part, "use_emit_random", text="Random Order")
 col.prop(part, "use_even_distribution")
 
 if part.emit_from == 'FACE' or part.emit_from == 'VOLUME':

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


[Bf-blender-cvs] [aeb5f21d209] soc-2019-cycles-procedural: Allow unavailable sockets to be taged as "in use".

2019-08-03 Thread OmarSquircleArt
Commit: aeb5f21d20915215711352a3422f4cb8485bd456
Author: OmarSquircleArt
Date:   Sat Aug 3 22:15:58 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rBaeb5f21d20915215711352a3422f4cb8485bd456

Allow unavailable sockets to be taged as "in use".

Unavailable sockets can and may still be linked, not tagging them as "in use" 
implies that they aren't linked, which is not true. This causes problems when 
the developer use the SOCK_IN_USE flag as an indication of the linking status 
of a socket. An example for this would be versioning code.

===

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

===

diff --git a/source/blender/blenkernel/intern/node.c 
b/source/blender/blenkernel/intern/node.c
index 9bd2160b512..ce54015da8f 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -3232,11 +3232,6 @@ void ntreeTagUsedSockets(bNodeTree *ntree)
   }
 
   for (link = ntree->links.first; link; link = link->next) {
-/* link is unused if either side is disabled */
-if ((link->fromsock->flag & SOCK_UNAVAIL) || (link->tosock->flag & 
SOCK_UNAVAIL)) {
-  continue;
-}
-
 link->fromsock->flag |= SOCK_IN_USE;
 link->tosock->flag |= SOCK_IN_USE;
   }

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


[Bf-blender-cvs] [7eb5f9501a1] soc-2019-outliner: Merge branch 'master' into soc-2019-outliner

2019-08-03 Thread Nathan Craddock
Commit: 7eb5f9501a1d02c5b17bad2d795189390beb5f37
Author: Nathan Craddock
Date:   Sat Aug 3 13:38:56 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB7eb5f9501a1d02c5b17bad2d795189390beb5f37

Merge branch 'master' into soc-2019-outliner

===



===



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


[Bf-blender-cvs] [e55e23a9d5d] soc-2019-outliner: Datadropper: Cleanup

2019-08-03 Thread Nathan Craddock
Commit: e55e23a9d5d73af02f1ea70ad5e9a60f9b254969
Author: Nathan Craddock
Date:   Sat Aug 3 13:59:45 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBe55e23a9d5d73af02f1ea70ad5e9a60f9b254969

Datadropper: Cleanup

Renamed area_current to cursor_area for clarity

===

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

===

diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c 
b/source/blender/editors/interface/interface_eyedropper_datablock.c
index dc1b8d786ff..efbe5922aa5 100644
--- a/source/blender/editors/interface/interface_eyedropper_datablock.c
+++ b/source/blender/editors/interface/interface_eyedropper_datablock.c
@@ -68,7 +68,7 @@ typedef struct DataDropper {
 
   ID *init_id; /* for resetting on cancel */
 
-  ScrArea *area_current;
+  ScrArea *cursor_area; /* Area under the cursor */
   ARegionType *art;
   void *draw_handle_pixel;
   char name[200];
@@ -105,7 +105,7 @@ static int datadropper_init(bContext *C, wmOperator *op)
 
   ddr->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
 
-  ddr->area_current = CTX_wm_area(C);
+  ddr->cursor_area = CTX_wm_area(C);
   ddr->art = art;
   ddr->draw_handle_pixel = ED_region_draw_cb_activate(
   art, datadropper_draw_cb, ddr, REGION_DRAW_POST_PIXEL);
@@ -252,18 +252,18 @@ static void datadropper_set_draw_callback_region(bContext 
*C,
 
   if (sa) {
 /* If spacetype changed */
-if (sa->spacetype != ddr->area_current->spacetype) {
+if (sa->spacetype != ddr->cursor_area->spacetype) {
   /* Remove old callback */
   ED_region_draw_cb_exit(ddr->art, ddr->draw_handle_pixel);
 
   /* Redraw old area */
-  ARegion *ar = BKE_area_find_region_type(ddr->area_current, 
RGN_TYPE_WINDOW);
+  ARegion *ar = BKE_area_find_region_type(ddr->cursor_area, 
RGN_TYPE_WINDOW);
   ED_region_tag_redraw(ar);
 
   /* Set draw callback in new region */
   ARegionType *art = BKE_regiontype_from_id(sa->type, RGN_TYPE_WINDOW);
 
-  ddr->area_current = sa;
+  ddr->cursor_area = sa;
   ddr->art = art;
   ddr->draw_handle_pixel = ED_region_draw_cb_activate(
   art, datadropper_draw_cb, ddr, REGION_DRAW_POST_PIXEL);

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


[Bf-blender-cvs] [e4f23f7e173] soc-2019-outliner: Cleanup: Comments in collection parent activation

2019-08-03 Thread Nathan Craddock
Commit: e4f23f7e17346b5c1fadc29154064387bfccb7e3
Author: Nathan Craddock
Date:   Sat Aug 3 14:01:42 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBe4f23f7e17346b5c1fadc29154064387bfccb7e3

Cleanup: Comments in collection parent activation

===

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

===

diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index 027cd537460..de105b9b62a 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -494,9 +494,7 @@ static LayerCollection *collection_from_index(ListBase *lb, 
const int number, in
 }
 
 /**
- * Return true if the elements in a collection are visible
- * Used to set active collection after excluding or restricting
- * collection visiblility
+ * Determine if a collection is hidden, viewport visibility restricted, or 
excluded
  */
 static bool layer_collection_hidden(ViewLayer *view_layer, LayerCollection *lc)
 {
@@ -569,8 +567,9 @@ LayerCollection 
*BKE_layer_collection_activate_parent(ViewLayer *view_layer, Lay
 lc = NULL;
   }
 
+  /* Don't activate excluded or hidden collections to prevent creating objects 
in a hidden
+   * collection from the UI */
   if (lc && layer_collection_hidden(view_layer, lc)) {
-/* Don't activate excluded collections. */
 return BKE_layer_collection_activate_parent(view_layer, lc);
   }

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


[Bf-blender-cvs] [459fa783f66] soc-2019-cycles-procedural: Fix Vector Math backward compatibility. Update normalize operator.

2019-08-03 Thread OmarSquircleArt
Commit: 459fa783f66a668d88e6b51483289f7fafc7e403
Author: OmarSquircleArt
Date:   Sat Aug 3 19:21:19 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB459fa783f66a668d88e6b51483289f7fafc7e403

Fix Vector Math backward compatibility. Update normalize operator.

===

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

===

diff --git a/source/blender/blenloader/intern/versioning_cycles.c 
b/source/blender/blenloader/intern/versioning_cycles.c
index a002c6a6ee0..70e1ee8871b 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -683,6 +683,53 @@ static void update_vector_cross_product_operator(bNodeTree 
*ntree)
   }
 }
 
+/* The Value output of the Vector Math node is no longer available in the
+ * Normalize operator. This Value output was equal to the length of the
+ * the input vector A. To correct this, we either add a Length node or
+ * convert the Normalize node into a Length node, depending on if the
+ * Vector output is needed.
+ */
+static void update_vector_normalize_operators(bNodeTree *ntree)
+{
+  bool need_update = false;
+
+  for (bNode *node = ntree->nodes.first; node; node = node->next) {
+if (node->type == SH_NODE_VECTOR_MATH) {
+  bNodeSocket *sockOutValue = nodeFindSocket(node, SOCK_OUT, "Value");
+  if (node->custom1 == NODE_VECTOR_MATH_NORMALIZE && 
socket_is_used(sockOutValue)) {
+bNodeSocket *sockOutVector = nodeFindSocket(node, SOCK_OUT, "Vector");
+if (socket_is_used(sockOutVector)) {
+  bNode *lengthNode = nodeAddStaticNode(NULL, ntree, 
SH_NODE_VECTOR_MATH);
+  lengthNode->custom1 = NODE_VECTOR_MATH_LENGTH;
+  lengthNode->locx = node->locx + node->width + 20.0f;
+  lengthNode->locy = node->locy;
+  bNodeSocket *sockLengthValue = nodeFindSocket(lengthNode, SOCK_OUT, 
"Value");
+
+  /* Iterate backwards from end so we don't encounter newly added 
links. */
+  for (bNodeLink *link = ntree->links.last; link; link = link->prev) {
+if (link->fromsock == sockOutValue) {
+  nodeAddLink(ntree, lengthNode, sockLengthValue, link->tonode, 
link->tosock);
+  nodeRemLink(ntree, link);
+}
+  }
+  bNodeLink *link = nodeFindSocket(node, SOCK_IN, "A")->link;
+  bNodeSocket *sockLengthA = nodeFindSocket(lengthNode, SOCK_IN, "A");
+  nodeAddLink(ntree, link->fromnode, link->fromsock, lengthNode, 
sockLengthA);
+
+  need_update = true;
+}
+else {
+  node->custom1 = NODE_VECTOR_MATH_LENGTH;
+}
+  }
+}
+  }
+
+  if (need_update) {
+ntreeUpdateTree(NULL, ntree);
+  }
+}
+
 void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main 
*bmain)
 {
   /* Particle shape shared with Eevee. */
@@ -844,6 +891,7 @@ void do_versions_after_linking_cycles(Main *bmain)
 update_vector_add_and_subtract_operators(ntree);
 update_vector_dot_product_operator(ntree);
 update_vector_cross_product_operator(ntree);
+update_vector_normalize_operators(ntree);
   }
 }
 FOREACH_NODETREE_END;

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


[Bf-blender-cvs] [edcefb739ae] master: Cleanup: Fix build error with msvc

2019-08-03 Thread Lazydodo
Commit: edcefb739ae0e5263dbf73fea677b2700a06a96e
Author: Lazydodo
Date:   Sat Aug 3 10:47:35 2019 -0600
Branches: master
https://developer.blender.org/rBedcefb739ae0e5263dbf73fea677b2700a06a96e

Cleanup: Fix build error with msvc

math.h does not define M_PI on windows, needs BLI_math_base.h to get them.

thanks to @quollism on chat for spotting it.

===

M   release/datafiles/userdef/userdef_default.c

===

diff --git a/release/datafiles/userdef/userdef_default.c 
b/release/datafiles/userdef/userdef_default.c
index 73146e59123..99c8cd72dba 100644
--- a/release/datafiles/userdef/userdef_default.c
+++ b/release/datafiles/userdef/userdef_default.c
@@ -17,7 +17,7 @@
 /* Preferences Data File 'U_default'. */
 
 /* For constants. */
-#include 
+#include "BLI_math_base.h"
 
 #include "DNA_userdef_types.h"
 #include "DNA_curve_types.h"

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


[Bf-blender-cvs] [1fe9c29e995] soc-2019-cycles-procedural: Fix Vector Math Backward compatibility. Update cross product operator.

2019-08-03 Thread OmarSquircleArt
Commit: 1fe9c29e9955c75b710c71a88f9326e48cb1ae36
Author: OmarSquircleArt
Date:   Sat Aug 3 18:24:48 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB1fe9c29e9955c75b710c71a88f9326e48cb1ae36

Fix Vector Math Backward compatibility. Update cross product operator.

===

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

===

diff --git a/source/blender/blenloader/intern/versioning_cycles.c 
b/source/blender/blenloader/intern/versioning_cycles.c
index 57901db558c..a002c6a6ee0 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -616,6 +616,73 @@ static void update_vector_dot_product_operator(bNodeTree 
*ntree)
   }
 }
 
+/* Previously, the Vector output of the cross product operator was normalized.
+ * To correct this, a Normalize node is added to normalize the output if used.
+ * Moreover, the Value output was removed. This Value was equal to the length
+ * of the cross product. To correct this, a Length node is added.
+ */
+static void update_vector_cross_product_operator(bNodeTree *ntree)
+{
+  bool need_update = false;
+
+  for (bNode *node = ntree->nodes.first; node; node = node->next) {
+if (node->type == SH_NODE_VECTOR_MATH) {
+  if (node->custom1 == NODE_VECTOR_MATH_CROSS_PRODUCT) {
+bNodeSocket *sockOutVector = nodeFindSocket(node, SOCK_OUT, "Vector");
+if (socket_is_used(sockOutVector)) {
+  bNode *normalizeNode = nodeAddStaticNode(NULL, ntree, 
SH_NODE_VECTOR_MATH);
+  normalizeNode->custom1 = NODE_VECTOR_MATH_NORMALIZE;
+  normalizeNode->locx = node->locx + node->width + 20.0f;
+  normalizeNode->locy = node->locy;
+  bNodeSocket *sockNormalizeOut = nodeFindSocket(normalizeNode, 
SOCK_OUT, "Vector");
+
+  /* Iterate backwards from end so we don't encounter newly added 
links. */
+  for (bNodeLink *link = ntree->links.last; link; link = link->prev) {
+if (link->fromsock == sockOutVector) {
+  nodeAddLink(ntree, normalizeNode, sockNormalizeOut, 
link->tonode, link->tosock);
+  nodeRemLink(ntree, link);
+}
+  }
+  bNodeSocket *sockNormalizeA = nodeFindSocket(normalizeNode, SOCK_IN, 
"A");
+  nodeAddLink(ntree, node, sockOutVector, normalizeNode, 
sockNormalizeA);
+
+  need_update = true;
+}
+
+bNodeSocket *sockOutValue = nodeFindSocket(node, SOCK_OUT, "Value");
+if (socket_is_used(sockOutValue)) {
+  bNode *lengthNode = nodeAddStaticNode(NULL, ntree, 
SH_NODE_VECTOR_MATH);
+  lengthNode->custom1 = NODE_VECTOR_MATH_LENGTH;
+  lengthNode->locx = node->locx + node->width + 20.0f;
+  if (socket_is_used(sockOutVector)) {
+lengthNode->locy = node->locy - lengthNode->height - 20.0f;
+  }
+  else {
+lengthNode->locy = node->locy;
+  }
+  bNodeSocket *sockLengthOut = nodeFindSocket(lengthNode, SOCK_OUT, 
"Value");
+
+  /* Iterate backwards from end so we don't encounter newly added 
links. */
+  for (bNodeLink *link = ntree->links.last; link; link = link->prev) {
+if (link->fromsock == sockOutValue) {
+  nodeAddLink(ntree, lengthNode, sockLengthOut, link->tonode, 
link->tosock);
+  nodeRemLink(ntree, link);
+}
+  }
+  bNodeSocket *sockLengthA = nodeFindSocket(lengthNode, SOCK_IN, "A");
+  nodeAddLink(ntree, node, sockOutVector, lengthNode, sockLengthA);
+
+  need_update = true;
+}
+  }
+}
+  }
+
+  if (need_update) {
+ntreeUpdateTree(NULL, ntree);
+  }
+}
+
 void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main 
*bmain)
 {
   /* Particle shape shared with Eevee. */
@@ -776,6 +843,7 @@ void do_versions_after_linking_cycles(Main *bmain)
 update_math_clamp_option(ntree);
 update_vector_add_and_subtract_operators(ntree);
 update_vector_dot_product_operator(ntree);
+update_vector_cross_product_operator(ntree);
   }
 }
 FOREACH_NODETREE_END;

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


[Bf-blender-cvs] [27aef8b551b] master: 3D View: aspect correct trackball rotation

2019-08-03 Thread Campbell Barton
Commit: 27aef8b551bd30817bac13cfe77d5a142ac0d037
Author: Campbell Barton
Date:   Sun Aug 4 01:19:22 2019 +1000
Branches: master
https://developer.blender.org/rB27aef8b551bd30817bac13cfe77d5a142ac0d037

3D View: aspect correct trackball rotation

Hard coded aspect was used, doubling horizontal input
however this caused sliding for views which didn't match this aspect.

Calculate the aspect based on the view bounds instead.

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index af862345824..0d0cfce07d7 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -189,10 +189,15 @@ static void calctrackballvec(const rcti *rect, const int 
event_xy[2], float r_di
 {
   const float radius = TRACKBALLSIZE;
   const float t = radius / (float)M_SQRT2;
+  const float size[2] = {BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)};
+  /* Aspect correct so dragging in a non-square view doesn't squash the,
+   * so diagonal motion rotates diagonally too. */
+  const float size_min = min_ff(size[0], size[1]);
+  const float aspect[2] = {size_min / size[0], size_min / size[1]};
 
   /* Normalize x and y. */
-  r_dir[0] = (event_xy[0] - BLI_rcti_cent_x(rect)) / 
((float)BLI_rcti_size_x(rect) / 4.0);
-  r_dir[1] = (event_xy[1] - BLI_rcti_cent_x(rect)) / 
((float)BLI_rcti_size_y(rect) / 2.0);
+  r_dir[0] = (event_xy[0] - BLI_rcti_cent_x(rect)) / ((size[0] * aspect[0]) / 
2.0);
+  r_dir[1] = (event_xy[1] - BLI_rcti_cent_x(rect)) / ((size[1] * aspect[1]) / 
2.0);
   const float d = len_v2(r_dir);
   if (d < t) {
 /* Inside sphere. */

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


[Bf-blender-cvs] [7f8d620e20c] master: Cleanup: trackball direction calculation

2019-08-03 Thread Campbell Barton
Commit: 7f8d620e20c2369838c9bc528fde0b785b345afc
Author: Campbell Barton
Date:   Sun Aug 4 01:18:23 2019 +1000
Branches: master
https://developer.blender.org/rB7f8d620e20c2369838c9bc528fde0b785b345afc

Cleanup: trackball direction calculation

Remove z axis flipping, only needed because x & y were flipped.

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index 826eddc63d1..af862345824 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -185,28 +185,23 @@ typedef struct ViewOpsData {
 
 #define TRACKBALLSIZE (1.1f)
 
-static void calctrackballvec(const rcti *rect, const int event_xy[2], float 
vec[3])
+static void calctrackballvec(const rcti *rect, const int event_xy[2], float 
r_dir[3])
 {
   const float radius = TRACKBALLSIZE;
   const float t = radius / (float)M_SQRT2;
-  float x, y, z, d;
 
-  /* normalize x and y */
-  x = BLI_rcti_cent_x(rect) - event_xy[0];
-  x /= (float)(BLI_rcti_size_x(rect) / 4);
-  y = BLI_rcti_cent_y(rect) - event_xy[1];
-  y /= (float)(BLI_rcti_size_y(rect) / 2);
-  d = sqrtf(x * x + y * y);
-  if (d < t) { /* Inside sphere */
-z = sqrtf(radius * radius - d * d);
+  /* Normalize x and y. */
+  r_dir[0] = (event_xy[0] - BLI_rcti_cent_x(rect)) / 
((float)BLI_rcti_size_x(rect) / 4.0);
+  r_dir[1] = (event_xy[1] - BLI_rcti_cent_x(rect)) / 
((float)BLI_rcti_size_y(rect) / 2.0);
+  const float d = len_v2(r_dir);
+  if (d < t) {
+/* Inside sphere. */
+r_dir[2] = sqrtf(SQUARE(radius) - SQUARE(d));
   }
-  else { /* On hyperbola */
-z = t * t / d;
+  else {
+/* On hyperbola. */
+r_dir[2] = SQUARE(t) / d;
   }
-
-  vec[0] = x;
-  vec[1] = y;
-  vec[2] = -z; /* yah yah! */
 }
 
 /**

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


[Bf-blender-cvs] [e82b7f15270] master: 3D View: preferences for rotate sensitivity

2019-08-03 Thread Campbell Barton
Commit: e82b7f15270eb4e4dbcd119ea09d1f0204f1dc11
Author: Campbell Barton
Date:   Sun Aug 4 01:22:38 2019 +1000
Branches: master
https://developer.blender.org/rBe82b7f15270eb4e4dbcd119ea09d1f0204f1dc11

3D View: preferences for rotate sensitivity

Added because the current default is too fast
for painting with tablets, see D5385.

Turntable and trackball have different settings because
turn-table uses an angle-per-pixel, where as trackball
values are relative to the view-port size so a scale is used.

The sensitivity is scaled by the pixel size so hi-dpi views don't rotate faster.

===

M   release/datafiles/userdef/userdef_default.c
M   release/scripts/startup/bl_ui/space_userpref.py
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/space_view3d/view3d_edit.c
M   source/blender/makesdna/DNA_userdef_types.h
M   source/blender/makesrna/intern/rna_userdef.c

===

diff --git a/release/datafiles/userdef/userdef_default.c 
b/release/datafiles/userdef/userdef_default.c
index e41e801c2f2..73146e59123 100644
--- a/release/datafiles/userdef/userdef_default.c
+++ b/release/datafiles/userdef/userdef_default.c
@@ -16,9 +16,14 @@
 
 /* Preferences Data File 'U_default'. */
 
+/* For constants. */
+#include 
+
 #include "DNA_userdef_types.h"
 #include "DNA_curve_types.h"
 
+#include "BLI_math_rotation.h"
+
 #include "BKE_blender_version.h"
 
 const UserDef U_default = {
@@ -153,6 +158,8 @@ const UserDef U_default = {
 .autokey_flag = AUTOKEY_FLAG_XYZ2RGB,
 .text_render = 0,
 .navigation_mode = VIEW_NAVIGATION_WALK,
+.view_rotate_sensitivity_turntable = DEG2RAD(0.4),
+.view_rotate_sensitivity_trackball = 1.0f,
 
 /** Initialized by #BKE_colorband_init. */
 .coba_weight = {0},
diff --git a/release/scripts/startup/bl_ui/space_userpref.py 
b/release/scripts/startup/bl_ui/space_userpref.py
index 6a18766fae2..08f36bb15bb 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -1459,6 +1459,11 @@ class USERPREF_PT_navigation_orbit(PreferencePanel, 
Panel):
 flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, 
even_rows=False, align=False)
 
 flow.row().prop(inputs, "view_rotate_method", expand=True)
+if inputs.view_rotate_method == 'TURNTABLE':
+flow.prop(inputs, "view_rotate_sensitivity_turntable")
+else:
+flow.prop(inputs, "view_rotate_sensitivity_trackball")
+
 flow.prop(inputs, "use_rotate_around_active")
 flow.prop(inputs, "use_auto_perspective")
 flow.prop(inputs, "use_mouse_depth_navigate")
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 1a79b7c9b5a..5780221bcc5 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3551,5 +3551,9 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 
   {
 /* Versioning code until next subversion bump goes here. */
+if (U.view_rotate_sensitivity_turntable == 0) {
+  U.view_rotate_sensitivity_turntable = DEG2RADF(0.4f);
+  U.view_rotate_sensitivity_trackball = 1.0f;
+}
   }
 }
diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index 0d0cfce07d7..62673d9bd5a 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -729,6 +729,10 @@ static void viewrotate_apply(ViewOpsData *vod, const int 
event_xy[2])
 
 angle = (len_v3(dvec) / (2.0f * TRACKBALLSIZE)) * (float)M_PI;
 
+/* Before applying the sensitivity this is rotating 1:1,
+ * where the cursor would match the surface of a sphere in the view. */
+angle *= U.view_rotate_sensitivity_trackball;
+
 /* Allow for rotation beyond the interval [-pi, pi] */
 angle = angle_wrap_rad(angle);
 
@@ -751,11 +755,8 @@ static void viewrotate_apply(ViewOpsData *vod, const int 
event_xy[2])
 const float zvec_global[3] = {0.0f, 0.0f, 1.0f};
 float xaxis[3];
 
-/* Sensitivity will control how fast the viewport rotates.  0.007 was
- * obtained experimentally by looking at viewport rotation sensitivities
- * on other modeling programs. */
-/* Perhaps this should be a configurable user parameter. */
-const float sensitivity = 0.007f;
+/* Radians per-pixel. */
+const float sensitivity = U.view_rotate_sensitivity_turntable / 
U.pixelsize;
 
 /* Get the 3x3 matrix and its inverse from the quaternion */
 quat_to_mat3(m, vod->curr.viewquat);
diff --git a/source/blender/makesdna/DNA_userdef_types.h 
b/source/blender/makesdna/DNA_userdef_types.h
index 2d3d091c65d..b90f1fd16df 100644
--- 

[Bf-blender-cvs] [f89be0af55c] soc-2019-cycles-procedural: Use function instead of macro.

2019-08-03 Thread OmarSquircleArt
Commit: f89be0af55c2dbf6de5082330a4d4c150ed6d3af
Author: OmarSquircleArt
Date:   Sat Aug 3 13:54:16 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rBf89be0af55c2dbf6de5082330a4d4c150ed6d3af

Use function instead of macro.

===

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

===

diff --git a/source/blender/blenloader/intern/versioning_cycles.c 
b/source/blender/blenloader/intern/versioning_cycles.c
index 6e538e30184..63cbda67177 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -44,7 +44,10 @@
 #include "BLO_readfile.h"
 #include "readfile.h"
 
-#define IS_SOCKET_IN_USE(sock) (sock->flag & SOCK_IN_USE)
+static bool socket_is_used(bNodeSocket *sock)
+{
+  return sock->flag & SOCK_IN_USE;
+}
 
 static float *cycles_node_socket_float_value(bNodeSocket *socket)
 {
@@ -533,7 +536,7 @@ static void 
update_vector_add_and_subtract_operators(bNodeTree *ntree)
   for (bNode *node = ntree->nodes.first; node; node = node->next) {
 if (node->type == SH_NODE_VECTOR_MATH) {
   bNodeSocket *sockOutValue = nodeFindSocket(node, SOCK_OUT, "Value");
-  if (IS_SOCKET_IN_USE(sockOutValue) &&
+  if (socket_is_used(sockOutValue) &&
   ELEM(node->custom1, NODE_VECTOR_MATH_ADD, 
NODE_VECTOR_MATH_SUBTRACT)) {
 
 bNode *absNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);

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


[Bf-blender-cvs] [0bc86e6f5af] soc-2019-cycles-procedural: Fix Vector Math backeard compatibility. Update Dot Product operator.

2019-08-03 Thread OmarSquircleArt
Commit: 0bc86e6f5afb15b3d2c1cda1b4a7ce027e2cdbbe
Author: OmarSquircleArt
Date:   Sat Aug 3 14:42:52 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB0bc86e6f5afb15b3d2c1cda1b4a7ce027e2cdbbe

Fix Vector Math backeard compatibility. Update Dot Product operator.

===

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

===

diff --git a/source/blender/blenloader/intern/versioning_cycles.c 
b/source/blender/blenloader/intern/versioning_cycles.c
index 63cbda67177..57901db558c 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -578,6 +578,44 @@ static void 
update_vector_add_and_subtract_operators(bNodeTree *ntree)
   }
 }
 
+/* The Vector output of the Vector Math node is no longer available in the Dot
+ * Product operator. Previously, this Vector was always zero initialized. To
+ * correct this, we zero out any socket the Vector Output was connected to.
+ */
+static void update_vector_dot_product_operator(bNodeTree *ntree)
+{
+  bool need_update = false;
+
+  for (bNode *node = ntree->nodes.first; node; node = node->next) {
+if (node->type == SH_NODE_VECTOR_MATH) {
+  bNodeSocket *sockOutVector = nodeFindSocket(node, SOCK_OUT, "Vector");
+  if (socket_is_used(sockOutVector) && node->custom1 == 
NODE_VECTOR_MATH_DOT_PRODUCT) {
+for (bNodeLink *link = ntree->links.first; link; link = link->next) {
+  if (link->fromsock == sockOutVector) {
+switch (link->tosock->type) {
+  case SOCK_FLOAT:
+*cycles_node_socket_float_value(link->tosock) = 0.0f;
+break;
+  case SOCK_VECTOR:
+copy_v3_fl(cycles_node_socket_vector_value(link->tosock), 
0.0f);
+break;
+  case SOCK_RGBA:
+copy_v4_fl(cycles_node_socket_rgba_value(link->tosock), 0.0f);
+break;
+}
+nodeRemLink(ntree, link);
+  }
+}
+need_update = true;
+  }
+}
+  }
+
+  if (need_update) {
+ntreeUpdateTree(NULL, ntree);
+  }
+}
+
 void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main 
*bmain)
 {
   /* Particle shape shared with Eevee. */
@@ -733,12 +771,12 @@ void do_versions_after_linking_cycles(Main *bmain)
 
   if (1) {
 FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
-  if (ntree->type != NTREE_SHADER) {
-continue;
+  if (ntree->type == NTREE_SHADER) {
+update_single_operand_math_operators(ntree);
+update_math_clamp_option(ntree);
+update_vector_add_and_subtract_operators(ntree);
+update_vector_dot_product_operator(ntree);
   }
-  update_single_operand_math_operators(ntree);
-  update_math_clamp_option(ntree);
-  update_vector_add_and_subtract_operators(ntree);
 }
 FOREACH_NODETREE_END;
   }

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


[Bf-blender-cvs] [0193cc12e53] soc-2019-cycles-procedural: Fix Vector Math backward compatibility. Update add and subtract operators.

2019-08-03 Thread OmarSquircleArt
Commit: 0193cc12e531036b5c84a81d44a0098758c5b080
Author: OmarSquircleArt
Date:   Sat Aug 3 13:06:43 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB0193cc12e531036b5c84a81d44a0098758c5b080

Fix Vector Math backward compatibility. Update add and subtract operators.

===

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

===

diff --git a/source/blender/blenloader/intern/versioning_cycles.c 
b/source/blender/blenloader/intern/versioning_cycles.c
index 761778bb72e..6e538e30184 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -44,6 +44,8 @@
 #include "BLO_readfile.h"
 #include "readfile.h"
 
+#define IS_SOCKET_IN_USE(sock) (sock->flag & SOCK_IN_USE)
+
 static float *cycles_node_socket_float_value(bNodeSocket *socket)
 {
   bNodeSocketValueFloat *socket_data = socket->default_value;
@@ -56,6 +58,12 @@ static float *cycles_node_socket_rgba_value(bNodeSocket 
*socket)
   return socket_data->value;
 }
 
+static float *cycles_node_socket_vector_value(bNodeSocket *socket)
+{
+  bNodeSocketValueVector *socket_data = socket->default_value;
+  return socket_data->value;
+}
+
 static IDProperty *cycles_properties_from_ID(ID *id)
 {
   IDProperty *idprop = IDP_GetProperties(id, false);
@@ -504,6 +512,69 @@ static void 
update_vector_math_socket_names_and_identifiers(bNodeTree *ntree)
   }
 }
 
+/* The Value output of the Vector Math node is no longer available in the Add
+ * and Subtract operators. Previously, this Value output was computed from the
+ * Vector output V as follows:
+ *
+ *   Value = (abs(V.x) + abs(V.y) + abs(V.z)) / 3
+ *
+ * Or more compactly using vector operators:
+ *
+ *   Value = dot(abs(V), (1 / 3, 1 / 3, 1 / 3))
+ *
+ * To correct this, if the Value output was used, we are going to compute
+ * it using the second equation by adding an absolute and a dot node, then
+ * connect them appropriately.
+ */
+static void update_vector_add_and_subtract_operators(bNodeTree *ntree)
+{
+  bool need_update = false;
+
+  for (bNode *node = ntree->nodes.first; node; node = node->next) {
+if (node->type == SH_NODE_VECTOR_MATH) {
+  bNodeSocket *sockOutValue = nodeFindSocket(node, SOCK_OUT, "Value");
+  if (IS_SOCKET_IN_USE(sockOutValue) &&
+  ELEM(node->custom1, NODE_VECTOR_MATH_ADD, 
NODE_VECTOR_MATH_SUBTRACT)) {
+
+bNode *absNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
+absNode->custom1 = NODE_VECTOR_MATH_ABSOLUTE;
+absNode->locx = node->locx + node->width + 20.0f;
+absNode->locy = node->locy;
+
+bNode *dotNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
+dotNode->custom1 = NODE_VECTOR_MATH_DOT_PRODUCT;
+dotNode->locx = absNode->locx + absNode->width + 20.0f;
+dotNode->locy = absNode->locy;
+bNodeSocket *sockDotB = nodeFindSocket(dotNode, SOCK_IN, "B");
+bNodeSocket *sockDotOutValue = nodeFindSocket(dotNode, SOCK_OUT, 
"Value");
+copy_v3_fl(cycles_node_socket_vector_value(sockDotB), 1 / 3.0f);
+
+/* Iterate backwards from end so we don't encounter newly added links. 
*/
+for (bNodeLink *link = ntree->links.last; link; link = link->prev) {
+  if (link->fromsock == sockOutValue) {
+nodeAddLink(ntree, dotNode, sockDotOutValue, link->tonode, 
link->tosock);
+nodeRemLink(ntree, link);
+  }
+}
+
+bNodeSocket *sockAbsA = nodeFindSocket(absNode, SOCK_IN, "A");
+bNodeSocket *sockDotA = nodeFindSocket(dotNode, SOCK_IN, "A");
+bNodeSocket *sockOutVector = nodeFindSocket(node, SOCK_OUT, "Vector");
+bNodeSocket *sockAbsOutVector = nodeFindSocket(absNode, SOCK_OUT, 
"Vector");
+
+nodeAddLink(ntree, node, sockOutVector, absNode, sockAbsA);
+nodeAddLink(ntree, absNode, sockAbsOutVector, dotNode, sockDotA);
+
+need_update = true;
+  }
+}
+  }
+
+  if (need_update) {
+ntreeUpdateTree(NULL, ntree);
+  }
+}
+
 void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main 
*bmain)
 {
   /* Particle shape shared with Eevee. */
@@ -664,6 +735,7 @@ void do_versions_after_linking_cycles(Main *bmain)
   }
   update_single_operand_math_operators(ntree);
   update_math_clamp_option(ntree);
+  update_vector_add_and_subtract_operators(ntree);
 }
 FOREACH_NODETREE_END;
   }

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


[Bf-blender-cvs] [5e5cf9ea9f7] master: Fix T68161: typo in ui_text of RNA scene.objects

2019-08-03 Thread Philipp Oeser
Commit: 5e5cf9ea9f7b27dd6bbafcc474221d9240c83fa8
Author: Philipp Oeser
Date:   Sat Aug 3 12:14:49 2019 +0200
Branches: master
https://developer.blender.org/rB5e5cf9ea9f7b27dd6bbafcc474221d9240c83fa8

Fix T68161: typo in ui_text of RNA scene.objects

===

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 9af9895d461..ef8b671116a 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -6276,7 +6276,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, 
PropertyRNA *cprop)
   RNA_def_property_srna(cprop, "SceneObjects");
   srna = RNA_def_struct(brna, "SceneObjects", NULL);
   RNA_def_struct_sdna(srna, "Scene");
-  RNA_def_struct_ui_text(srna, "Scene Objects", "All the of scene objects");
+  RNA_def_struct_ui_text(srna, "Scene Objects", "All of the scene objects");
 }
 
 /* scene.timeline_markers */

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