[Bf-blender-cvs] [232049dd940] master: Armature: use BKE_armature_transform when applying transformation

2019-08-22 Thread Campbell Barton
Commit: 232049dd9408e15d2082181e60ddd775b375ff19
Author: Campbell Barton
Date:   Fri Aug 23 11:53:45 2019 +1000
Branches: master
https://developer.blender.org/rB232049dd9408e15d2082181e60ddd775b375ff19

Armature: use BKE_armature_transform when applying transformation

Keep ED_armature_transform for RNA Armature.transform
since it operates on edit-bones in edit-mode.

Rename ED_armature_transform_bones to ED_armature_edit_transform
since it wasn't obviously an edit-mode function.

===

M   source/blender/editors/armature/armature_edit.c
M   source/blender/editors/include/ED_armature.h
M   source/blender/editors/object/object_transform.c
M   source/blender/makesrna/intern/rna_armature.c

===

diff --git a/source/blender/editors/armature/armature_edit.c 
b/source/blender/editors/armature/armature_edit.c
index 4e6661b1d15..c4c10549da3 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -62,22 +62,10 @@
 /* ** Object Tools Exports 
*** */
 /* NOTE: these functions are exported to the Object module to be called from 
the tools there */
 
-void ED_armature_transform_apply(Main *bmain, Object *ob, float mat[4][4], 
const bool do_props)
-{
-  bArmature *arm = ob->data;
-
-  /* Put the armature into editmode */
-  ED_armature_to_edit(arm);
-
-  /* Transform the bones */
-  ED_armature_transform_bones(arm, mat, do_props);
-
-  /* Turn the list into an armature */
-  ED_armature_from_edit(bmain, arm);
-  ED_armature_edit_free(arm);
-}
-
-void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const 
bool do_props)
+/**
+ * See #BKE_armature_transform for object-mode transform.
+ */
+void ED_armature_edit_transform(bArmature *arm, const float mat[4][4], const 
bool do_props)
 {
   EditBone *ebone;
   float scale = mat4_to_scale(mat); /* store the scale of the matrix here to 
use on envelopes */
@@ -114,21 +102,13 @@ void ED_armature_transform_bones(struct bArmature *arm, 
float mat[4][4], const b
   }
 }
 
-void ED_armature_transform(Main *bmain, bArmature *arm, float mat[4][4], const 
bool do_props)
+void ED_armature_transform(bArmature *arm, const float mat[4][4], const bool 
do_props)
 {
   if (arm->edbo) {
-ED_armature_transform_bones(arm, mat, do_props);
+ED_armature_edit_transform(arm, mat, do_props);
   }
   else {
-/* Put the armature into editmode */
-ED_armature_to_edit(arm);
-
-/* Transform the bones */
-ED_armature_transform_bones(arm, mat, do_props);
-
-/* Go back to object mode*/
-ED_armature_from_edit(bmain, arm);
-ED_armature_edit_free(arm);
+BKE_armature_transform(arm, mat, do_props);
   }
 }
 
diff --git a/source/blender/editors/include/ED_armature.h 
b/source/blender/editors/include/ED_armature.h
index 76be0e82aa4..8dbe832d18b 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -229,15 +229,9 @@ void ED_armature_edit_transform_mirror_update(struct 
Object *obedit);
 void ED_armature_origin_set(
 struct Main *bmain, struct Object *ob, const float cursor[3], int 
centermode, int around);
 
-void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const 
bool do_props);
-void ED_armature_transform_apply(struct Main *bmain,
- struct Object *ob,
- float mat[4][4],
- const bool do_props);
-void ED_armature_transform(struct Main *bmain,
-   struct bArmature *arm,
-   float mat[4][4],
-   const bool do_props);
+void ED_armature_edit_transform(struct bArmature *arm, const float mat[4][4], 
const bool do_props);
+
+void ED_armature_transform(struct bArmature *arm, const float mat[4][4], const 
bool do_props);
 
 #define ARM_GROUPS_NAME 1
 #define ARM_GROUPS_ENVELOPE 2
diff --git a/source/blender/editors/object/object_transform.c 
b/source/blender/editors/object/object_transform.c
index 9b39c5b2a88..76a45f219fe 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -768,7 +768,8 @@ static int apply_objects_internal(bContext *C,
   BKE_mesh_calc_normals(me);
 }
 else if (ob->type == OB_ARMATURE) {
-  ED_armature_transform_apply(bmain, ob, mat, do_props);
+  bArmature *arm = ob->data;
+  BKE_armature_transform(arm, mat, do_props);
 }
 else if (ob->type == OB_LATTICE) {
   Lattice *lt = ob->data;
diff --git a/source/blender/makesrna/intern/rna_armature.c 
b/source/blender/makesrna/intern/rna_armature.c
index bc6d3b6e743..c0e3404f78c 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -604,9 

[Bf-blender-cvs] [30582c59ccd] master: Armature: add BKE_armature_transform

2019-08-22 Thread Campbell Barton
Commit: 30582c59ccd00fc5c3221540c078947d25fc1bfd
Author: Campbell Barton
Date:   Fri Aug 23 10:38:30 2019 +1000
Branches: master
https://developer.blender.org/rB30582c59ccd00fc5c3221540c078947d25fc1bfd

Armature: add BKE_armature_transform

ED_armature_transform uses edit-mode conversion which re-creates bones.
Needed for efficiently transforming object-data in object-mode.

===

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

===

diff --git a/source/blender/blenkernel/BKE_armature.h 
b/source/blender/blenkernel/BKE_armature.h
index c1f04894880..ee6336a98db 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -78,6 +78,8 @@ struct bArmature *BKE_armature_copy(struct Main *bmain, const 
struct bArmature *
 void BKE_armature_copy_bone_transforms(struct bArmature *armature_dst,
const struct bArmature *armature_src);
 
+void BKE_armature_transform(struct bArmature *arm, const float mat[4][4], 
const bool do_props);
+
 /* Bounding box. */
 struct BoundBox *BKE_armature_boundbox_get(struct Object *ob);
 
diff --git a/source/blender/blenkernel/intern/armature.c 
b/source/blender/blenkernel/intern/armature.c
index 89ba5e38c39..168422a4454 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -268,6 +268,90 @@ void BKE_armature_copy_bone_transforms(bArmature 
*armature_dst, const bArmature
   }
 }
 
+/** Helper for #ED_armature_transform */
+static void armature_transform_recurse(ListBase *bonebase,
+   const float mat[4][4],
+   const bool do_props,
+   /* Cached from 'mat'. */
+   const float mat3[3][3],
+   const float scale,
+   /* Child bones. */
+   const Bone *bone_parent,
+   const float arm_mat_parent_inv[4][4])
+{
+  for (Bone *bone = bonebase->first; bone; bone = bone->next) {
+
+/* Transform the bone's roll. */
+if (bone_parent == NULL) {
+
+  float roll_mat[3][3];
+  {
+float delta[3];
+sub_v3_v3v3(delta, bone->tail, bone->head);
+vec_roll_to_mat3(delta, bone->roll, roll_mat);
+  }
+
+  /* Transform the roll matrix. */
+  mul_m3_m3m3(roll_mat, mat3, roll_mat);
+
+  /* Apply the transformed roll back. */
+  mat3_to_vec_roll(roll_mat, NULL, >roll);
+}
+
+mul_m4_v3(mat, bone->arm_head);
+mul_m4_v3(mat, bone->arm_tail);
+
+/* Get the new head and tail */
+if (bone_parent) {
+  sub_v3_v3v3(bone->head, bone->arm_head, bone_parent->arm_tail);
+  sub_v3_v3v3(bone->tail, bone->arm_tail, bone_parent->arm_tail);
+
+  mul_mat3_m4_v3(arm_mat_parent_inv, bone->head);
+  mul_mat3_m4_v3(arm_mat_parent_inv, bone->tail);
+}
+else {
+  copy_v3_v3(bone->head, bone->arm_head);
+  copy_v3_v3(bone->tail, bone->arm_tail);
+}
+
+BKE_armature_where_is_bone(bone, bone_parent, false);
+
+{
+  float arm_mat3[3][3];
+  copy_m3_m4(arm_mat3, bone->arm_mat);
+  mat3_to_vec_roll(arm_mat3, NULL, >arm_roll);
+}
+
+if (do_props) {
+  bone->rad_head *= scale;
+  bone->rad_tail *= scale;
+  bone->dist *= scale;
+
+  /* we could be smarter and scale by the matrix along the x & z axis */
+  bone->xwidth *= scale;
+  bone->zwidth *= scale;
+}
+
+if (!BLI_listbase_is_empty(>childbase)) {
+  float arm_mat_inv[4][4];
+  invert_m4_m4(arm_mat_inv, bone->arm_mat);
+  armature_transform_recurse(>childbase, mat, do_props, mat3, scale, 
bone, arm_mat_inv);
+}
+  }
+}
+
+void BKE_armature_transform(bArmature *arm, const float mat[4][4], const bool 
do_props)
+{
+  /* Store the scale of the matrix here to use on envelopes. */
+  float scale = mat4_to_scale(mat);
+  float mat3[3][3];
+
+  copy_m3_m4(mat3, mat);
+  normalize_m3(mat3);
+
+  armature_transform_recurse(>bonebase, mat, do_props, mat3, scale, NULL, 
NULL);
+}
+
 static Bone *get_named_bone_bonechildren(ListBase *lb, const char *name)
 {
   Bone *curBone, *rbone;

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


[Bf-blender-cvs] [adfb9ec87ce] master: Cleanup: const args, naming, doxy groups, clang-format

2019-08-22 Thread Campbell Barton
Commit: adfb9ec87cebafe61e8870c5dfd7593d32e9eb0a
Author: Campbell Barton
Date:   Fri Aug 23 09:03:57 2019 +1000
Branches: master
https://developer.blender.org/rBadfb9ec87cebafe61e8870c5dfd7593d32e9eb0a

Cleanup: const args, naming, doxy groups, clang-format

===

M   source/blender/blenkernel/BKE_armature.h
M   source/blender/blenkernel/BKE_mball.h
M   source/blender/blenkernel/intern/armature.c
M   source/blender/blenkernel/intern/mball.c
M   source/blender/editors/screen/screen_ops.c
M   source/blender/editors/space_node/node_draw.c

===

diff --git a/source/blender/blenkernel/BKE_armature.h 
b/source/blender/blenkernel/BKE_armature.h
index 99c6bb405b5..c1f04894880 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -100,7 +100,7 @@ float distfactor_to_bone(
 
 void BKE_armature_where_is(struct bArmature *arm);
 void BKE_armature_where_is_bone(struct Bone *bone,
-struct Bone *prevbone,
+const struct Bone *bone_parent,
 const bool use_recursion);
 void BKE_pose_clear_pointers(struct bPose *pose);
 void BKE_pose_remap_bone_pointers(struct bArmature *armature, struct bPose 
*pose);
diff --git a/source/blender/blenkernel/BKE_mball.h 
b/source/blender/blenkernel/BKE_mball.h
index b582e88f9cb..5447fd00866 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -63,7 +63,7 @@ bool BKE_mball_minmax_ex(const struct MetaBall *mb,
 bool BKE_mball_minmax(const struct MetaBall *mb, float min[3], float max[3]);
 bool BKE_mball_center_median(const struct MetaBall *mb, float r_cent[3]);
 bool BKE_mball_center_bounds(const struct MetaBall *mb, float r_cent[3]);
-void BKE_mball_transform(struct MetaBall *mb, float mat[4][4], const bool 
do_props);
+void BKE_mball_transform(struct MetaBall *mb, const float mat[4][4], const 
bool do_props);
 void BKE_mball_translate(struct MetaBall *mb, const float offset[3]);
 
 struct MetaElem *BKE_mball_element_add(struct MetaBall *mb, const int type);
diff --git a/source/blender/blenkernel/intern/armature.c 
b/source/blender/blenkernel/intern/armature.c
index ea927ca9333..89ba5e38c39 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -2285,7 +2285,7 @@ void vec_roll_to_mat3(const float vec[3], const float 
roll, float mat[3][3])
 
 /* recursive part, calculates restposition of entire tree of children */
 /* used by exiting editmode too */
-void BKE_armature_where_is_bone(Bone *bone, Bone *prevbone, const bool 
use_recursion)
+void BKE_armature_where_is_bone(Bone *bone, const Bone *bone_parent, const 
bool use_recursion)
 {
   float vec[3];
 
@@ -2301,13 +2301,13 @@ void BKE_armature_where_is_bone(Bone *bone, Bone 
*prevbone, const bool use_recur
 bone->segments = 1;
   }
 
-  if (prevbone) {
+  if (bone_parent) {
 float offs_bone[4][4];
 /* yoffs(b-1) + root(b) + bonemat(b) */
 BKE_bone_offset_matrix_get(bone, offs_bone);
 
 /* Compose the matrix for this bone  */
-mul_m4_m4m4(bone->arm_mat, prevbone->arm_mat, offs_bone);
+mul_m4_m4m4(bone->arm_mat, bone_parent->arm_mat, offs_bone);
   }
   else {
 copy_m4_m3(bone->arm_mat, bone->bone_mat);
@@ -2316,9 +2316,9 @@ void BKE_armature_where_is_bone(Bone *bone, Bone 
*prevbone, const bool use_recur
 
   /* and the kiddies */
   if (use_recursion) {
-prevbone = bone;
+bone_parent = bone;
 for (bone = bone->childbase.first; bone; bone = bone->next) {
-  BKE_armature_where_is_bone(bone, prevbone, use_recursion);
+  BKE_armature_where_is_bone(bone, bone_parent, use_recursion);
 }
   }
 }
diff --git a/source/blender/blenkernel/intern/mball.c 
b/source/blender/blenkernel/intern/mball.c
index 0820f0ebbb1..19009322975 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -526,7 +526,7 @@ bool BKE_mball_center_bounds(const MetaBall *mb, float 
r_cent[3])
   return false;
 }
 
-void BKE_mball_transform(MetaBall *mb, float mat[4][4], const bool do_props)
+void BKE_mball_transform(MetaBall *mb, const float mat[4][4], const bool 
do_props)
 {
   float quat[4];
   const float scale = mat4_to_scale(mat);
diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index 9f0dc38750d..0fccfd19795 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1118,6 +1118,8 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot)
   RNA_def_int(ot->srna, "modifier", 0, 0, 2, "Modifier", "Modifier state", 0, 
2);
 }
 
+/** \} */
+
 /*  */
 /** \name Area edge detection utility
  * \{ */
@@ -1157,6 +1159,8 @@ 

[Bf-blender-cvs] [6b69b5349be] soc-2019-openxr: Address and remove some TODOs marked in code

2019-08-22 Thread Julian Eisel
Commit: 6b69b5349be81ff941bb60920e0a382931483c50
Author: Julian Eisel
Date:   Thu Aug 22 23:23:46 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB6b69b5349be81ff941bb60920e0a382931483c50

Address and remove some TODOs marked in code

===

M   intern/ghost/intern/GHOST_XrContext.cpp
M   intern/ghost/intern/GHOST_XrSession.cpp
M   intern/ghost/intern/GHOST_Xr_intern.h
M   source/blender/windowmanager/intern/wm_xr.c

===

diff --git a/intern/ghost/intern/GHOST_XrContext.cpp 
b/intern/ghost/intern/GHOST_XrContext.cpp
index 7fbcb30196b..fbced7dceaa 100644
--- a/intern/ghost/intern/GHOST_XrContext.cpp
+++ b/intern/ghost/intern/GHOST_XrContext.cpp
@@ -65,8 +65,6 @@ GHOST_XrContext::GHOST_XrContext(const 
GHOST_XrContextCreateInfo *create_info)
 }
 GHOST_XrContext::~GHOST_XrContext()
 {
-  // TODO OpenXR calls here can fail, but we should not throw an exception in 
the destructor.
-
   /* Destroy session data first. Otherwise xrDestroyInstance will implicitly 
do it, before the
* session had a chance to do so explicitly. */
   m_session = nullptr;
@@ -76,7 +74,7 @@ GHOST_XrContext::~GHOST_XrContext()
 m_oxr->s_xrDestroyDebugUtilsMessengerEXT_fn(m_oxr->debug_messenger);
   }
   if (m_oxr->instance != XR_NULL_HANDLE) {
-xrDestroyInstance(m_oxr->instance);
+CHECK_XR_ASSERT(xrDestroyInstance(m_oxr->instance));
 m_oxr->instance = XR_NULL_HANDLE;
   }
 }
diff --git a/intern/ghost/intern/GHOST_XrSession.cpp 
b/intern/ghost/intern/GHOST_XrSession.cpp
index b388ba07c0f..52db74ded5b 100644
--- a/intern/ghost/intern/GHOST_XrSession.cpp
+++ b/intern/ghost/intern/GHOST_XrSession.cpp
@@ -69,19 +69,17 @@ GHOST_XrSession::GHOST_XrSession(GHOST_XrContext 
*xr_context)
 
 GHOST_XrSession::~GHOST_XrSession()
 {
-  // TODO OpenXR calls here can fail, but we should not throw an exception in 
the destructor.
-
   unbindGraphicsContext();
 
   for (XrSwapchain  : m_oxr->swapchains) {
-xrDestroySwapchain(swapchain);
+CHECK_XR_ASSERT(xrDestroySwapchain(swapchain));
   }
   m_oxr->swapchains.clear();
   if (m_oxr->reference_space != XR_NULL_HANDLE) {
-xrDestroySpace(m_oxr->reference_space);
+CHECK_XR_ASSERT(xrDestroySpace(m_oxr->reference_space));
   }
   if (m_oxr->session != XR_NULL_HANDLE) {
-xrDestroySession(m_oxr->session);
+CHECK_XR_ASSERT(xrDestroySession(m_oxr->session));
   }
 
   m_oxr->session = XR_NULL_HANDLE;
diff --git a/intern/ghost/intern/GHOST_Xr_intern.h 
b/intern/ghost/intern/GHOST_Xr_intern.h
index df68ccedd4f..2f3346c1925 100644
--- a/intern/ghost/intern/GHOST_Xr_intern.h
+++ b/intern/ghost/intern/GHOST_Xr_intern.h
@@ -32,7 +32,15 @@
 if (XR_FAILED(_res)) { \
   throw GHOST_XrException(error_msg, __FILE__, __LINE__, _res); \
 } \
-  }
+  } \
+  (void)0
+
+#define CHECK_XR_ASSERT(call) \
+  { \
+XrResult _res = call; \
+assert(_res == XR_SUCCESS); \
+  } \
+  (void)0
 
 #define THROW_XR(error_msg) throw GHOST_XrException(error_msg, __FILE__, 
__LINE__);
 
diff --git a/source/blender/windowmanager/intern/wm_xr.c 
b/source/blender/windowmanager/intern/wm_xr.c
index 772c13089fd..a514eb31c5b 100644
--- a/source/blender/windowmanager/intern/wm_xr.c
+++ b/source/blender/windowmanager/intern/wm_xr.c
@@ -187,8 +187,16 @@ static void wm_xr_session_begin_info_create(const Scene 
*scene,
 {
   if (scene->camera) {
 copy_v3_v3(begin_info->base_pose.position, scene->camera->loc);
-/* TODO will only work if rotmode is euler */
-eul_to_quat(begin_info->base_pose.orientation_quat, scene->camera->rot);
+if (ELEM(scene->camera->rotmode, ROT_MODE_AXISANGLE, ROT_MODE_QUAT)) {
+  axis_angle_to_quat(
+  begin_info->base_pose.orientation_quat, scene->camera->rotAxis, 
scene->camera->rotAngle);
+}
+else if (scene->camera->rotmode == ROT_MODE_QUAT) {
+  copy_v4_v4(begin_info->base_pose.orientation_quat, scene->camera->quat);
+}
+else {
+  eul_to_quat(begin_info->base_pose.orientation_quat, scene->camera->rot);
+}
   }
   else {
 copy_v3_fl(begin_info->base_pose.position, 0.0f);
@@ -404,8 +412,8 @@ GHOST_ContextHandle wm_xr_draw_view(const 
GHOST_XrDrawViewInfo *draw_view, void
 {
   bContext *C = customdata;
   wmXrSurfaceData *surface_data = g_xr_surface->customdata;
-  const float clip_start = 0.01, clip_end = 500.0f;
-  const float lens = 50.0f; /* TODO get from OpenXR */
+  const float clip_start = 0.01f, clip_end = 500.0f;
+  const float lens = 50.0f;
   const rcti rect = {
   .xmin = 0, .ymin = 0, .xmax = draw_view->width - 1, .ymax = 
draw_view->height - 1};

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


[Bf-blender-cvs] [daba8140c22] soc-2019-openxr: Cleanup: Unused functions, add comments, sync to master

2019-08-22 Thread Julian Eisel
Commit: daba8140c22837325a7d426972357d8d1d7e3758
Author: Julian Eisel
Date:   Thu Aug 22 23:02:01 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBdaba8140c22837325a7d426972357d8d1d7e3758

Cleanup: Unused functions, add comments, sync to master

===

M   intern/ghost/GHOST_C-api.h
M   intern/ghost/GHOST_IContext.h
M   intern/ghost/GHOST_IWindow.h
M   intern/ghost/intern/GHOST_C-api.cpp
M   intern/ghost/intern/GHOST_Context.h
M   intern/ghost/intern/GHOST_SystemWin32.h
M   intern/ghost/intern/GHOST_Window.h
M   intern/ghost/intern/GHOST_XrSession.cpp
M   source/blender/windowmanager/intern/wm_xr.c
M   source/blender/windowmanager/wm_surface.h
M   tests/python/bl_load_py_modules.py

===

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 03cf3a1c7a0..1f3b013fba9 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -197,8 +197,6 @@ GHOST_TSuccess 
GHOST_DisposeDirectXContext(GHOST_SystemHandle systemhandle,
GHOST_ContextHandle contexthandle);
 #endif
 
-extern GHOST_ContextHandle GHOST_GetWindowContext(GHOST_WindowHandle 
windowhandle);
-
 /**
  * Returns the window user data.
  * \param windowhandle The handle to the window
@@ -673,13 +671,6 @@ extern GHOST_TSuccess 
GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle,
  */
 extern GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle);
 
-/**
- * Swaps front and back buffers of a context.
- * \param contexthandle The handle to the context
- * \return A success indicator.
- */
-extern GHOST_TSuccess GHOST_SwapContextBuffers(GHOST_ContextHandle 
contexthandle);
-
 /**
  * Sets the swap interval for swapBuffers.
  * \param interval The swap interval to use.
diff --git a/intern/ghost/GHOST_IContext.h b/intern/ghost/GHOST_IContext.h
index d114df428b0..33422b8e351 100644
--- a/intern/ghost/GHOST_IContext.h
+++ b/intern/ghost/GHOST_IContext.h
@@ -60,6 +60,9 @@ class GHOST_IContext {
 
   virtual GHOST_TSuccess swapBuffers() = 0;
 
+  /**
+   * Returns if the window is rendered upside down compared to OpenGL.
+   */
   virtual bool isUpsideDown() const = 0;
 
 #ifdef WITH_CXX_GUARDEDALLOC
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 547ae1d3ec3..a257116cba1 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -77,8 +77,6 @@ class GHOST_IWindow {
*/
   virtual GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type) 
= 0;
 
-  virtual class GHOST_IContext *getDrawingContext() = 0;
-
   /**
* Sets the title displayed in the title bar.
* \param title The title to display in the title bar.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp 
b/intern/ghost/intern/GHOST_C-api.cpp
index 898378460c6..d0f068f5e3c 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -150,13 +150,6 @@ GHOST_TSuccess 
GHOST_DisposeDirectXContext(GHOST_SystemHandle systemhandle,
 
 #endif
 
-GHOST_ContextHandle GHOST_GetWindowContext(GHOST_WindowHandle windowhandle)
-{
-  GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
-
-  return (GHOST_ContextHandle)window->getDrawingContext();
-}
-
 GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
   const char *title,
   GHOST_TInt32 left,
@@ -623,13 +616,6 @@ GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle 
windowhandle)
   return window->swapBuffers();
 }
 
-GHOST_TSuccess GHOST_SwapContextBuffers(GHOST_ContextHandle contexthandle)
-{
-  GHOST_IContext *context = (GHOST_IContext *)contexthandle;
-
-  return context->swapBuffers();
-}
-
 GHOST_TSuccess GHOST_SetSwapInterval(GHOST_WindowHandle windowhandle, int 
interval)
 {
   GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
diff --git a/intern/ghost/intern/GHOST_Context.h 
b/intern/ghost/intern/GHOST_Context.h
index af801112bda..a257f383518 100644
--- a/intern/ghost/intern/GHOST_Context.h
+++ b/intern/ghost/intern/GHOST_Context.h
@@ -120,6 +120,9 @@ class GHOST_Context : public GHOST_IContext {
 return m_stereoVisual;
   }
 
+  /**
+   * Returns if the window is rendered upside down compared to OpenGL.
+   */
   inline bool isUpsideDown() const
   {
 return false;
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h 
b/intern/ghost/intern/GHOST_SystemWin32.h
index c911cafc567..34b244e46e1 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -242,6 +242,11 @@ class GHOST_SystemWin32 : public GHOST_System {
*/
   GHOST_TSuccess exit();
 
+  /**
+   * Create a new offscreen DirectX context.
+   * Never explicitly delete the window, use disposeContext() instead.
+   * \return  The new context (or 0 if creation 

[Bf-blender-cvs] [1de7717ed71] master: Outliner: new icons for sequences and contraints

2019-08-22 Thread Nathan Craddock
Commit: 1de7717ed711c53755a2f1393ab103fd98bf6b32
Author: Nathan Craddock
Date:   Thu Aug 22 14:00:22 2019 -0600
Branches: master
https://developer.blender.org/rB1de7717ed711c53755a2f1393ab103fd98bf6b32

Outliner: new icons for sequences and contraints

Adds a new icon for the action constraint so the icon draws with the
constraints color. Also adds two new icons for sequencer meta strips
and duplicate strips for use in the outliner sequence display mode.

The meta strip icon could be used in the sequencer sidebar.

===

M   release/datafiles/blender_icons.svg
A   release/datafiles/blender_icons16/icon16_con_action.dat
A   release/datafiles/blender_icons16/icon16_seq_strip_duplicate.dat
A   release/datafiles/blender_icons16/icon16_seq_strip_meta.dat
A   release/datafiles/blender_icons32/icon32_con_action.dat
A   release/datafiles/blender_icons32/icon32_seq_strip_duplicate.dat
A   release/datafiles/blender_icons32/icon32_seq_strip_meta.dat
M   source/blender/editors/include/UI_icons.h
M   source/blender/editors/space_outliner/outliner_draw.c

===

diff --git a/release/datafiles/blender_icons.svg 
b/release/datafiles/blender_icons.svg
index c34657bc231..2633ece87fc 100644
--- a/release/datafiles/blender_icons.svg
+++ b/release/datafiles/blender_icons.svg
@@ -1,6 +1,6 @@
 
 
-http://purl.org/dc/elements/1.1/; 
xmlns:cc="http://creativecommons.org/ns#; 
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#; 
xmlns:svg="http://www.w3.org/2000/svg; xmlns="http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; 
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape; width="602" 
height="640" id="svg2" sodipodi:version="0.32" inkscape:version="0.92.3 
(2405546, 2018- [...]
+http://purl.org/dc/elements/1.1/; 
xmlns:cc="http://creativecommons.org/ns#; 
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#; 
xmlns:svg="http://www.w3.org/2000/svg; xmlns="http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd; 
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape; width="602" 
height="640" id="svg2" sodipodi:version="0.32" inkscape:version="0.92.3 
(2405546, 2018- [...]
   
   
 
@@ -3016,7 +3016,7 @@
   
 
   
-  
+  
 
 
@@ -3295,10 +3295,6 @@
 
   
-  
-  
 
   https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [22ebc579872] master: UI: Changes to Area Options Menu

2019-08-22 Thread Harley Acheson
Commit: 22ebc579872bb4c3d8e9428505058709f76db155
Author: Harley Acheson
Date:   Thu Aug 22 13:19:11 2019 -0700
Branches: master
https://developer.blender.org/rB22ebc579872bb4c3d8e9428505058709f76db155

UI: Changes to Area Options Menu

Adds more options to the context menu that pops up on area edges. Both Split 
types, Join, and Swap.

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

Reviewed by Brecht Van Lommel

===

M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   source/blender/editors/screen/screen_ops.c
M   source/tools

===

diff --git a/release/datafiles/locale b/release/datafiles/locale
index ad82c4ce43e..5557cda2a6d 16
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit ad82c4ce43ef2801ef51e75af1f9702992478b02
+Subproject commit 5557cda2a6dc34fc2e18d89fde8e5aa50e374e33
diff --git a/release/scripts/addons b/release/scripts/addons
index 8e6f485cf5b..4a66c4e0b80 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 8e6f485cf5b160c425d7da7c743879b20f3d6a96
+Subproject commit 4a66c4e0b80f5483c8434554c615a56fef71d627
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 7077ff07384..80e2be8ff8e 16
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 7077ff07384491d1f7630484995557f1c7302dae
+Subproject commit 80e2be8ff8e23dad3487d4ceef82ce7067cee412
diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index 7821540d045..9f0dc38750d 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1118,7 +1118,44 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot)
   RNA_def_int(ot->srna, "modifier", 0, 0, 2, "Modifier", "Modifier state", 0, 
2);
 }
 
-/** \} */
+/*  */
+/** \name Area edge detection utility
+ * \{ */
+
+static ScrEdge *screen_area_edge_from_cursor(const bContext *C,
+ const int cursor[2],
+ ScrArea **r_sa1,
+ ScrArea **r_sa2)
+{
+  wmWindow *win = CTX_wm_window(C);
+  bScreen *sc = CTX_wm_screen(C);
+  ScrEdge *actedge;
+  rcti window_rect;
+  WM_window_rect_calc(win, _rect);
+  actedge = screen_geom_area_map_find_active_scredge(
+  AREAMAP_FROM_SCREEN(sc), _rect, cursor[0], cursor[1]);
+  *r_sa1 = NULL;
+  *r_sa2 = NULL;
+  if (actedge == NULL) {
+return NULL;
+  }
+  int borderwidth = (4 * UI_DPI_FAC);
+  ScrArea *sa1, *sa2;
+  if (screen_geom_edge_is_horizontal(actedge)) {
+sa1 = BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, cursor[0], cursor[1] + 
borderwidth);
+sa2 = BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, cursor[0], cursor[1] - 
borderwidth);
+  }
+  else {
+sa1 = BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, cursor[0] + borderwidth, 
cursor[1]);
+sa2 = BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, cursor[0] - borderwidth, 
cursor[1]);
+  }
+  bool isGlobal = ((sa1 && ED_area_is_global(sa1)) || (sa2 && 
ED_area_is_global(sa2)));
+  if (!isGlobal) {
+*r_sa1 = sa1;
+*r_sa2 = sa2;
+  }
+  return actedge;
+}
 
 /*  */
 /** \name Swap Area Operator
@@ -1139,6 +1176,7 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot)
  * callbacks:
  *
  * invoke() gets called on shift+lmb drag in action-zone
+ * exec()   execute without any user interaction, based on properties
  * call init(), add handler
  *
  * modal()  accept modal events while doing it
@@ -1229,6 +1267,19 @@ static int area_swap_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
   return OPERATOR_RUNNING_MODAL;
 }
 
+static int area_swap_exec(bContext *C, wmOperator *op)
+{
+  ScrArea *sa1, *sa2;
+  int cursor[2];
+  RNA_int_get_array(op->ptr, "cursor", cursor);
+  screen_area_edge_from_cursor(C, cursor, , );
+  if (sa1 == NULL || sa2 == NULL) {
+return OPERATOR_CANCELLED;
+  }
+  ED_area_swapspace(C, sa1, sa2);
+  return OPERATOR_FINISHED;
+}
+
 static void SCREEN_OT_area_swap(wmOperatorType *ot)
 {
   ot->name = "Swap Areas";
@@ -1237,10 +1288,15 @@ static void SCREEN_OT_area_swap(wmOperatorType *ot)
 
   ot->invoke = area_swap_invoke;
   ot->modal = area_swap_modal;
-  ot->poll = ED_operator_areaactive;
+  ot->exec = area_swap_exec;
+  ot->poll = screen_active_editable;
   ot->cancel = area_swap_cancel;
 
   ot->flag = OPTYPE_BLOCKING;
+
+  /* rna */
+  RNA_def_int_vector(
+  ot->srna, "cursor", 2, NULL, INT_MIN, INT_MAX, "Cursor", "", INT_MIN, 
INT_MAX);
 }
 
 /** \} */
@@ -3180,40 +3236,19 @@ static void area_join_draw_cb(const struct wmWindow 

[Bf-blender-cvs] [7c3bbe93aaa] master: Cleanup/Refactor: Simplify/deduplicate bvhutils code

2019-08-22 Thread mano-wii
Commit: 7c3bbe93aaa293a27d9b88a0d4104e0b2661ef1a
Author: mano-wii
Date:   Thu Aug 22 14:07:40 2019 -0300
Branches: master
https://developer.blender.org/rB7c3bbe93aaa293a27d9b88a0d4104e0b2661ef1a

Cleanup/Refactor: Simplify/deduplicate bvhutils code

This is a step that allow using `bvh_cache` for `EditMeshe`s.

===

M   source/blender/blenkernel/BKE_bvhutils.h
M   source/blender/blenkernel/intern/bvhutils.c
M   source/blender/blenkernel/intern/mesh_remap.c

===

diff --git a/source/blender/blenkernel/BKE_bvhutils.h 
b/source/blender/blenkernel/BKE_bvhutils.h
index c88a64097bb..d010f5dd836 100644
--- a/source/blender/blenkernel/BKE_bvhutils.h
+++ b/source/blender/blenkernel/BKE_bvhutils.h
@@ -115,7 +115,9 @@ BVHTree *bvhtree_from_mesh_verts_ex(struct BVHTreeFromMesh 
*data,
 int verts_num_active,
 float epsilon,
 int tree_type,
-int axis);
+int axis,
+const int bvh_cache_type,
+BVHCache **bvh_cache);
 
 BVHTree *bvhtree_from_editmesh_edges(BVHTreeFromEditMesh *data,
  struct BMEditMesh *em,
@@ -141,7 +143,9 @@ BVHTree *bvhtree_from_mesh_edges_ex(struct BVHTreeFromMesh 
*data,
 int edges_num_active,
 float epsilon,
 int tree_type,
-int axis);
+int axis,
+const int bvh_cache_type,
+BVHCache **bvh_cache);
 
 BVHTree *bvhtree_from_mesh_faces_ex(struct BVHTreeFromMesh *data,
 const struct MVert *vert,
@@ -153,7 +157,9 @@ BVHTree *bvhtree_from_mesh_faces_ex(struct BVHTreeFromMesh 
*data,
 int numFaces_active,
 float epsilon,
 int tree_type,
-int axis);
+int axis,
+const int bvh_cache_type,
+BVHCache **bvh_cache);
 
 BVHTree *bvhtree_from_editmesh_looptri(BVHTreeFromEditMesh *data,
struct BMEditMesh *em,
@@ -182,7 +188,9 @@ BVHTree *bvhtree_from_mesh_looptri_ex(struct 
BVHTreeFromMesh *data,
   int looptri_num_active,
   float epsilon,
   int tree_type,
-  int axis);
+  int axis,
+  const int bvh_cache_type,
+  BVHCache **bvh_cache);
 
 BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
struct Mesh *mesh,
diff --git a/source/blender/blenkernel/intern/bvhutils.c 
b/source/blender/blenkernel/intern/bvhutils.c
index 8c125d1609b..1210e6f18ce 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -580,13 +580,40 @@ BVHTree *bvhtree_from_mesh_verts_ex(BVHTreeFromMesh *data,
 int verts_num_active,
 float epsilon,
 int tree_type,
-int axis)
+int axis,
+const int bvh_cache_type,
+BVHCache **bvh_cache)
 {
-  BVHTree *tree = bvhtree_from_mesh_verts_create_tree(
-  epsilon, tree_type, axis, vert, verts_num, verts_mask, verts_num_active);
+  bool in_cache = false;
+  BVHTree *tree = NULL;
+  if (bvh_cache) {
+BLI_rw_mutex_lock(_rwlock, THREAD_LOCK_READ);
+in_cache = bvhcache_find(*bvh_cache, bvh_cache_type, );
+BLI_rw_mutex_unlock(_rwlock);
+if (in_cache == false) {
+  BLI_rw_mutex_lock(_rwlock, THREAD_LOCK_WRITE);
+  in_cache = bvhcache_find(*bvh_cache, bvh_cache_type, );
+  if (in_cache) {
+BLI_rw_mutex_unlock(_rwlock);
+  }
+}
+  }
+
+  if (in_cache == false) {
+tree = bvhtree_from_mesh_verts_create_tree(
+epsilon, tree_type, axis, vert, verts_num, verts_mask, 
verts_num_active);
+
+if (bvh_cache) {
+  /* Save on cache for later use */
+  /* printf("BVHTree built and saved on cache\n"); */
+  bvhcache_insert(bvh_cache, tree, bvh_cache_type);
+  BLI_rw_mutex_unlock(_rwlock);
+  in_cache = true;
+}
+  }
 
   /* Setup BVHTreeFromMesh */
-  

[Bf-blender-cvs] [d09b1ff1a67] master: Cleanup: undeclared variable warnings

2019-08-22 Thread Campbell Barton
Commit: d09b1ff1a674bdf3f85d419b15b5869ee9820221
Author: Campbell Barton
Date:   Fri Aug 23 02:22:23 2019 +1000
Branches: master
https://developer.blender.org/rBd09b1ff1a674bdf3f85d419b15b5869ee9820221

Cleanup: undeclared variable warnings

Forward declare variables, or make them static.

===

M   release/datafiles/userdef/userdef_default.c
M   source/blender/draw/engines/eevee/eevee_lut.c
M   source/blender/draw/intern/draw_cache_extract_mesh.c
M   source/blender/makesrna/intern/rna_nodetree.c

===

diff --git a/release/datafiles/userdef/userdef_default.c 
b/release/datafiles/userdef/userdef_default.c
index 99c8cd72dba..4ad3ada 100644
--- a/release/datafiles/userdef/userdef_default.c
+++ b/release/datafiles/userdef/userdef_default.c
@@ -26,6 +26,8 @@
 
 #include "BKE_blender_version.h"
 
+#include "BLO_readfile.h" /* own include */
+
 const UserDef U_default = {
 .versionfile = BLENDER_VERSION,
 .subversionfile = BLENDER_SUBVERSION,
diff --git a/source/blender/draw/engines/eevee/eevee_lut.c 
b/source/blender/draw/engines/eevee/eevee_lut.c
index 8db45e4cee6..b380269db99 100644
--- a/source/blender/draw/engines/eevee/eevee_lut.c
+++ b/source/blender/draw/engines/eevee/eevee_lut.c
@@ -21,6 +21,8 @@
  * \ingroup gpu
  */
 
+#include "eevee_lut.h" /* own include */
+
 const float ltc_mat_ggx[64 * 64 * 4] = {
 1.00, 0.00,  0.00, 0.20, 1.00, 0.00,  0.00,  
0.000504,
 1.00, 0.00,  0.00, 0.002016, 1.00, 0.00,  0.00,  
0.004535,
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c 
b/source/blender/draw/intern/draw_cache_extract_mesh.c
index bd057f92d62..b0a0766eedb 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.c
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.c
@@ -537,18 +537,20 @@ static void extract_tris_finish(const MeshRenderData *mr, 
void *ibo, void *_data
   MEM_freeN(data);
 }
 
-const MeshExtract extract_tris = {extract_tris_init,
-  extract_tris_looptri_bmesh,
-  extract_tris_looptri_mesh,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  extract_tris_finish,
-  0,
-  false};
+static const MeshExtract extract_tris = {
+extract_tris_init,
+extract_tris_looptri_bmesh,
+extract_tris_looptri_mesh,
+NULL,
+NULL,
+NULL,
+NULL,
+NULL,
+NULL,
+extract_tris_finish,
+0,
+false,
+};
 
 /** \} */
 
@@ -648,18 +650,20 @@ static void extract_lines_finish(const MeshRenderData 
*mr, void *ibo, void *elb)
   }
 }
 
-const MeshExtract extract_lines = {extract_lines_init,
-   NULL,
-   NULL,
-   extract_lines_loop_bmesh,
-   extract_lines_loop_mesh,
-   extract_lines_ledge_bmesh,
-   extract_lines_ledge_mesh,
-   NULL,
-   NULL,
-   extract_lines_finish,
-   0,
-   false};
+static const MeshExtract extract_lines = {
+extract_lines_init,
+NULL,
+NULL,
+extract_lines_loop_bmesh,
+extract_lines_loop_mesh,
+extract_lines_ledge_bmesh,
+extract_lines_ledge_mesh,
+NULL,
+NULL,
+extract_lines_finish,
+0,
+false,
+};
 
 /** \} */
 
@@ -753,18 +757,20 @@ static void extract_points_finish(const MeshRenderData 
*UNUSED(mr), void *ibo, v
   MEM_freeN(elb);
 }
 
-const MeshExtract extract_points = {extract_points_init,
-NULL,
-NULL,
-extract_points_loop_bmesh,
-extract_points_loop_mesh,
-extract_points_ledge_bmesh,
-extract_points_ledge_mesh,
-extract_points_lvert_bmesh,
-extract_points_lvert_mesh,
-extract_points_finish,
-0,
-false};
+static const MeshExtract extract_points = {
+extract_points_init,
+NULL,
+NULL,
+extract_points_loop_bmesh,
+extract_points_loop_mesh,
+extract_points_ledge_bmesh,
+extract_points_ledge_mesh,
+extract_points_lvert_bmesh,
+

[Bf-blender-cvs] [4457c92fa30] master: GPencil: Fix missing variable due typo error

2019-08-22 Thread Antonio Vazquez
Commit: 4457c92fa304509343135c88adc8a3fb3834d087
Author: Antonio Vazquez
Date:   Thu Aug 22 18:28:00 2019 +0200
Branches: master
https://developer.blender.org/rB4457c92fa304509343135c88adc8a3fb3834d087

GPencil: Fix missing variable due typo error

===

M   source/blender/editors/gpencil/gpencil_select.c

===

diff --git a/source/blender/editors/gpencil/gpencil_select.c 
b/source/blender/editors/gpencil/gpencil_select.c
index 4c185b7fb8a..71ccf740153 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -76,7 +76,7 @@ static int 
gpencil_select_mode_from_sculpt(eGP_Sculpt_SelectMaskFlag mode)
   else if (mode & GP_SCULPT_MASK_SELECTMODE_STROKE) {
 return GP_SELECTMODE_STROKE;
   }
-  else if (GP_SCULPT_MASK_SELECTMODE_SEGMENT) {
+  else if (mode & GP_SCULPT_MASK_SELECTMODE_SEGMENT) {
 return GP_SELECTMODE_SEGMENT;
   }
   else {

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


[Bf-blender-cvs] [5888a2283e0] master: Cmake/MSVC: Enable Edit and Continue for debug builds.

2019-08-22 Thread Lazydodo
Commit: 5888a2283e0b47f2a8991d2548eb8e4d4c156dea
Author: Lazydodo
Date:   Thu Aug 22 10:20:40 2019 -0600
Branches: master
https://developer.blender.org/rB5888a2283e0b47f2a8991d2548eb8e4d4c156dea

Cmake/MSVC: Enable Edit and Continue for debug builds.

This change switches the debug symbol format from /Zi to /ZI for
debug builds of blender, allowing Edit and Continue to work.

This allows limited [1] code changes in the debugger without
having to stop the process and recompile a new binary leading
to improved developer productivity.

All MSVC versions we support support this flag, Clang on
windows does not mind the /ZI flag, but doesn't currently
emit the required information to have this feature work.

[1] 
https://docs.microsoft.com/en-us/visualstudio/debugger/supported-code-changes-cpp

===

M   build_files/cmake/platform/platform_win32.cmake

===

diff --git a/build_files/cmake/platform/platform_win32.cmake 
b/build_files/cmake/platform/platform_win32.cmake
index 42ac285f88d..b2277c440fe 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -135,8 +135,8 @@ else()
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj")
 endif()
 
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
-set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd /ZI")
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd /ZI")
 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
 set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MT")

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


[Bf-blender-cvs] [05f15a3fd70] newboolean: Better modeling of outputs of individual intersections.

2019-08-22 Thread Howard Trickey
Commit: 05f15a3fd704e79671b1bd58575897a3c4c67150
Author: Howard Trickey
Date:   Thu Aug 22 12:04:08 2019 -0400
Branches: newboolean
https://developer.blender.org/rB05f15a3fd704e79671b1bd58575897a3c4c67150

Better modeling of outputs of individual intersections.

With new IntersectOutput structure, can see all the algorithms
needed to get from a union of individual IntersectOutputs to
an edit to a Mesh.

===

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

===

diff --git a/source/blender/bmesh/tools/bmesh_boolean.c 
b/source/blender/bmesh/tools/bmesh_boolean.c
index 9b02cb9f4d4..f48f5e9fa8c 100644
--- a/source/blender/bmesh/tools/bmesh_boolean.c
+++ b/source/blender/bmesh/tools/bmesh_boolean.c
@@ -17,18 +17,14 @@
 /** \file
  * \ingroup bmesh
  *
- * Cut meshes along intersections.
- *
- * Boolean-like modeling operation (without calculating inside/outside).
+ * Cut meshes along intersections and boolean operations on the intersections.
  *
  * Supported:
  * - Concave faces.
  * - Non-planar faces.
+ * - Coplanar intersections
  * - Custom-data (UV's etc).
  *
- * Unsupported:
- * - Intersecting between different meshes.
- * - No support for holes (cutting a hole into a single face).
  */
 
 #include "MEM_guardedalloc.h"
@@ -47,6 +43,11 @@
 
 #include "BLI_strict_flags.h"
 
+/* NOTE: Work in progress. Initial implementation using slow data structures 
and algorithms
+ * just to get the correct calculations down. After that, will replace data 
structures with
+ * faster-lookup versions (hash tables, kd-trees, bvh structures) and will 
parallelize.
+ */
+
 /* A Mesh Interface.
  * This would be an abstract interface in C++,
  * but similate that effect in C.
@@ -85,7 +86,7 @@ typedef struct MeshPart {
  * TODO: faster structure for looking up by plane.
  */
 typedef struct MeshPartSet {
-  LinkNode *meshparts; /* list where links are MeshParts* */
+  LinkNode *meshparts; /* links are MeshParts* */
   int tot_part;
 } MeshPartSet;
 
@@ -94,19 +95,68 @@ typedef struct MeshPartSet {
  * TODO: faster structure for lookup.
  */
 typedef struct IndexedIntSet {
-  LinkNodePair listhead;
+  LinkNodePair listhead; /* links are ints */
   int size;
 } IndexedIntSet;
 
-/* A result of intersectings parts.
- * The coordinates in the cdt_result should be turned
- * back into 3d coords by multplying them by mat_2d_inv,
- * after putting z_for_inverse into the 3rd component.
+/* A set of 3d coords, where each member gets an index
+ * that can be used to access the member.
+ * Comparisons for equality will be fuzzy (within epsilon).
+ * TODO: faster structure for lookup.
+ */
+typedef struct IndexedCoordSet {
+  LinkNodePair listhead; /* Links are pointers to 3 floats, allocated from 
arena. */
+  int index_offset;  /* "index" of an element will be position in above 
list plus offset. */
+  int size;
+} IndexedCoordSet;
+
+/* A map from int -> int.
+ * TODO: faster structure for lookup.
+ */
+typedef struct IntIntMap {
+  LinkNodePair listhead; /* Links are pointers to IntPair, allocated from 
arena. */
+} IntIntMap;
+
+typedef struct IntPair {
+  int first;
+  int second;
+} IntPair;
+
+/* A result of intersectings parts of an implict IMesh.
+ * Designed so that can combine these in pairs, eventually ending up
+ * with a single IntersectOutput that can be turned into an edit on the
+ * underlying original IMesh.
  */
 typedef struct IntersectOutput {
-  CDT_result *cdt_result;
-  float mat_2d_inv[3][3];
-  float z_for_inverse;
+  /* All the individual CDT_results. Links are CDT_result pointers. */
+  LinkNodePair cdt_outputs;
+
+  /* Parallel to cdt_outputs list. The corresponding map link is
+   * a pointer to an IntInt map, where the key is a vert index in the
+   * output vert space of the CDT_result, and the value is a vert index
+   * in the original IMesh, or, if greater than orig_mesh_verts_tot,
+   * then an index in new_verts.
+   * Links are pointers to IntIntMap, allocated from arena.
+   */
+  LinkNodePair vertmaps;
+
+  /* Set of new vertices (not in original mesh) in resulting intersection.
+   * They get an index in the range from orig_mesh_verts_tot to that
+   * number plus the size of new_verts - 1.
+   * This should be a de-duplicated set of coordinates.
+   */
+  IndexedCoordSet new_verts;
+
+  /* A map recording which verts in the original mesh get merged to
+   * other verts in that mesh.
+   * If there is an entry for an index v (< orig_mesh_verts_tot), then
+   * v is merged to the value of the map at v.
+   * Otherwise v is not merged to anything.
+   */
+  IntIntMap merge_to;
+
+  /* Number of verts in the original IMesh that this is based on. */
+  int orig_mesh_verts_tot;
 } IntersectOutput;
 
 typedef struct BoolState {
@@ -134,6 +184,11 @@ static void dump_part(MeshPart *part, const char *label);
 static void dump_partset(MeshPartSet *pset, const char 

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

2019-08-22 Thread Antonio Vazquez
Commit: c3f8800d47e3d8574c154e425f6657d13fe39505
Author: Antonio Vazquez
Date:   Thu Aug 22 18:01:59 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc3f8800d47e3d8574c154e425f6657d13fe39505

Merge branch 'master' into greasepencil-object

===



===



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


[Bf-blender-cvs] [ec073400044] master: UI: Remove "Show Frame Indicator" option

2019-08-22 Thread Jacques Lucke
Commit: ec07340004480abe037015b9888390b6b637f317
Author: Jacques Lucke
Date:   Thu Aug 22 17:55:21 2019 +0200
Branches: master
https://developer.blender.org/rBec07340004480abe037015b9888390b6b637f317

UI: Remove "Show Frame Indicator" option

This option was doing nothing in Blender 2.80.
I don't really see a reason for keeping it around.

Reviewers: campbellbarton

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

===

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_nla.py
M   release/scripts/startup/bl_ui/space_sequencer.py
M   release/scripts/startup/bl_ui/space_time.py
M   source/blender/makesdna/DNA_action_types.h
M   source/blender/makesdna/DNA_space_types.h
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py 
b/release/scripts/startup/bl_ui/space_dopesheet.py
index 3b1b33b26e9..cb0dcb86ce4 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -318,7 +318,6 @@ class DOPESHEET_MT_view(Menu):
 layout.separator()
 
 layout.prop(st, "use_realtime_update")
-layout.prop(st, "show_frame_indicator")
 layout.prop(st, "show_sliders")
 layout.prop(st, "show_group_colors")
 layout.prop(st, "show_interpolation")
diff --git a/release/scripts/startup/bl_ui/space_graph.py 
b/release/scripts/startup/bl_ui/space_graph.py
index b6195d1626a..1a3ef82efa1 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -114,7 +114,6 @@ class GRAPH_MT_view(Menu):
 layout.separator()
 
 layout.prop(st, "use_realtime_update")
-layout.prop(st, "show_frame_indicator")
 layout.prop(st, "show_cursor")
 layout.prop(st, "show_sliders")
 layout.prop(st, "show_group_colors")
diff --git a/release/scripts/startup/bl_ui/space_nla.py 
b/release/scripts/startup/bl_ui/space_nla.py
index aaa971cfa55..825e4b41609 100644
--- a/release/scripts/startup/bl_ui/space_nla.py
+++ b/release/scripts/startup/bl_ui/space_nla.py
@@ -91,7 +91,6 @@ class NLA_MT_view(Menu):
 layout.separator()
 
 layout.prop(st, "use_realtime_update")
-layout.prop(st, "show_frame_indicator")
 
 layout.prop(st, "show_seconds")
 layout.prop(st, "show_locked_time")
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 19a2ed4186b..f2eaed62276 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -265,7 +265,6 @@ class SEQUENCER_MT_view(Menu):
 layout.separator()
 layout.operator_context = 'INVOKE_DEFAULT'
 
-#   layout.prop(st, "show_frame_indicator") #Do not have any function 
and do not work.
 layout.prop(st, "show_strip_offset")
 layout.prop(st, "show_marker_lines")
 
diff --git a/release/scripts/startup/bl_ui/space_time.py 
b/release/scripts/startup/bl_ui/space_time.py
index d2c41f13ee3..500f889eea9 100644
--- a/release/scripts/startup/bl_ui/space_time.py
+++ b/release/scripts/startup/bl_ui/space_time.py
@@ -135,7 +135,6 @@ class TIME_MT_view(Menu):
 layout.separator()
 
 layout.prop(st, "show_marker_lines")
-layout.prop(st, "show_frame_indicator")
 layout.prop(scene, "show_keys_from_selected_only")
 
 layout.separator()
diff --git a/source/blender/makesdna/DNA_action_types.h 
b/source/blender/makesdna/DNA_action_types.h
index a4cd31a1357..b7834e2c7e0 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -847,8 +847,7 @@ typedef enum eSAction_Flag {
   SACTION_POSEMARKERS_SHOW = (1 << 6),
   /* don't draw action channels using group colors (where applicable) */
   SACTION_NODRAWGCOLORS = (1 << 7),
-  /* don't draw current frame number beside frame indicator */
-  SACTION_NODRAWCFRANUM = (1 << 8),
+  /* SACTION_NODRAWCFRANUM = (1 << 8), DEPRECATED */
   /* don't perform realtime updates */
   SACTION_NOREALTIMEUPDATES = (1 << 10),
   /* move markers as well as keyframes */
diff --git a/source/blender/makesdna/DNA_space_types.h 
b/source/blender/makesdna/DNA_space_types.h
index ad846fd0476..1691d873f9b 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -427,8 +427,7 @@ typedef enum eGraphEdit_Flag {
   SIPO_NOTRANSKEYCULL = (1 << 1),
   /* don't show any keyframe handles at all */
   SIPO_NOHANDLES = (1 << 2),
-  /* don't show current frame number beside indicator line */
-  SIPO_NODRAWCFRANUM = (1 << 3),
+  /* SIPO_NODRAWCFRANUM = (1 << 3), DEPRECATED */
   /* show timing in 

[Bf-blender-cvs] [b8be8f54dfa] greasepencil-object: GPencil: Verify duplicate SVG materials only for SOLID

2019-08-22 Thread Antonio Vazquez
Commit: b8be8f54dfaa417d8748c9cf0d9084baa2809707
Author: Antonio Vazquez
Date:   Thu Aug 22 16:46:58 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb8be8f54dfaa417d8748c9cf0d9084baa2809707

GPencil: Verify duplicate SVG materials only for SOLID

For gradient types, each color is a different material.

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index e8b028edd1c..2482496a13d 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2850,7 +2850,7 @@ static int gpencil_check_same_material_color(Object 
*ob_gp, float color[4], Mate
 float hsv2[4];
 rgb_to_hsv_v(gp_style->fill_rgba, hsv2);
 hsv2[3] = gp_style->fill_rgba[3];
-if (compare_v4v4(hsv1, hsv2, 0.01f)) {
+if ((gp_style->fill_style == GP_STYLE_FILL_STYLE_SOLID) && 
(compare_v4v4(hsv1, hsv2, 0.01f))) {
   r_mat = ma;
   return i - 1;
 }

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


[Bf-blender-cvs] [e6f3d8b3e11] master: Revert "Fix T68971: Copy As New Driver from Material node creates a bad reference."

2019-08-22 Thread Bastien Montagne
Commit: e6f3d8b3e1158ebdc89ceae1de5ce7bc5c420f51
Author: Bastien Montagne
Date:   Thu Aug 22 16:00:59 2019 +0200
Branches: master
https://developer.blender.org/rBe6f3d8b3e1158ebdc89ceae1de5ce7bc5c420f51

Revert "Fix T68971: Copy As New Driver from Material node creates a bad 
reference."

This reverts commits 54fd8176d7e91, 4c5becb6b1 and 8f578150e.

Those kind of commits must be reviewed and approved by project owners.

That one:
* Broke Collada building by not properly updating all calls to modified
function.
* Broke *whole* ID management by not properly updating library_query.c.

And in general, I am strongly against backward ID pointers, those are
*always* a serious PITA for ID management. Sometimes  they cannot be
avoided, but in general other ways to get that kind of info should be
investigated first.

===

M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/light.c
M   source/blender/blenkernel/intern/linestyle.c
M   source/blender/blenkernel/intern/material.c
M   source/blender/blenkernel/intern/node.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenkernel/intern/texture.c
M   source/blender/blenkernel/intern/world.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/editors/animation/drivers.c
M   source/blender/editors/include/ED_keyframing.h
M   source/blender/editors/interface/interface_ops.c
M   source/blender/editors/space_node/node_add.c
M   source/blender/editors/space_node/node_edit.c
M   source/blender/editors/space_node/node_group.c
M   
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_main_api.c

===

diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index a593f0f2ca6..e3d0588b607 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -366,10 +366,7 @@ struct GHashIterator *ntreeTypeGetIterator(void);
 void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree);
 
 void ntreeInitDefault(struct bNodeTree *ntree);
-struct bNodeTree *ntreeAddTree(struct Main *bmain,
-   const char *name,
-   const char *idname,
-   struct ID *owner);
+struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const 
char *idname);
 
 /* copy/free funcs, need to manage ID users */
 void ntreeFreeTree(struct bNodeTree *ntree);
@@ -379,15 +376,10 @@ void BKE_node_tree_copy_data(struct Main *bmain,
  struct bNodeTree *ntree_dst,
  const struct bNodeTree *ntree_src,
  const int flag);
-void BKE_nodetree_copy_owned_ex(
-struct Main *bmain, struct bNodeTree *src, struct bNodeTree **dst, struct 
ID *owner, int flag);
 struct bNodeTree *ntreeCopyTree_ex(const struct bNodeTree *ntree,
struct Main *bmain,
-   struct ID *owner,
const bool do_id_user);
-struct bNodeTree *ntreeCopyTree(struct Main *bmain,
-const struct bNodeTree *ntree,
-struct ID *owner);
+struct bNodeTree *ntreeCopyTree(struct Main *bmain, const struct bNodeTree 
*ntree);
 /* node->id user count */
 void ntreeUserIncrefID(struct bNodeTree *ntree);
 void ntreeUserDecrefID(struct bNodeTree *ntree);
diff --git a/source/blender/blenkernel/intern/light.c 
b/source/blender/blenkernel/intern/light.c
index 654abef389d..75c9e0e42a5 100644
--- a/source/blender/blenkernel/intern/light.c
+++ b/source/blender/blenkernel/intern/light.c
@@ -113,7 +113,7 @@ void BKE_light_copy_data(Main *bmain, Light *la_dst, const 
Light *la_src, const
   if (la_src->nodetree) {
 /* Note: nodetree is *not* in bmain, however this specific case is handled 
at lower level
  *   (see BKE_libblock_copy_ex()). */
-BKE_nodetree_copy_owned_ex(bmain, la_src->nodetree, _dst->nodetree, 
_dst->id, flag);
+BKE_id_copy_ex(bmain, (ID *)la_src->nodetree, (ID **)_dst->nodetree, 
flag);
   }
 
   if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
diff --git a/source/blender/blenkernel/intern/linestyle.c 
b/source/blender/blenkernel/intern/linestyle.c
index b682e4265ad..7bfe5a7c8ff 100644
--- a/source/blender/blenkernel/intern/linestyle.c
+++ b/source/blender/blenkernel/intern/linestyle.c
@@ -178,8 +178,7 @@ void BKE_linestyle_copy_data(struct Main *bmain,
   if (linestyle_src->nodetree) {
 /* Note: nodetree is *not* in bmain, however this specific case is handled 
at lower level
  *   (see BKE_libblock_copy_ex()). */
-BKE_nodetree_copy_owned_ex(
-bmain, 

[Bf-blender-cvs] [eae9b862978] master: Fix crash using 'Mesh > Normals > Point to Target' from the header menu

2019-08-22 Thread Philipp Oeser
Commit: eae9b86297876d2172681e880fe2bcc8450a01ed
Author: Philipp Oeser
Date:   Thu Aug 22 14:53:44 2019 +0200
Branches: master
https://developer.blender.org/rBeae9b86297876d2172681e880fe2bcc8450a01ed

Fix crash using 'Mesh > Normals > Point to Target' from the header menu

This was working from Alt+N menu but was passing wrong ARegion
(alongside wrong mouse coords) to ED_view3d_win_to_3d_int when called
from the header menu.

Operator context INVOKE_REGION_WIN takes care of this.

This also fixes wrong behavior of 'Mesh > Normals > Rotate' when called
from the header menu.

part of T69019

Reviewers: billreynish, mont29

Maniphest Tasks: T69019

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

===

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 9b9623eaa60..6ef268f9321 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3802,7 +3802,7 @@ class VIEW3D_MT_edit_mesh_normals(Menu):
 
 layout.operator("mesh.set_normals_from_faces", text="Set From Faces")
 
-layout.operator_context = 'INVOKE_DEFAULT'
+layout.operator_context = 'INVOKE_REGION_WIN'
 layout.operator("transform.rotate_normal", text="Rotate...")
 layout.operator("mesh.point_normals", text="Point to Target...")
 layout.operator_context = 'EXEC_DEFAULT'

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


[Bf-blender-cvs] [54fd8176d7e] master: NodeTree: also assign the owner pointer when copying.

2019-08-22 Thread Alexander Gavrilov
Commit: 54fd8176d7e914da9fc834b465c22bffb6f3a620
Author: Alexander Gavrilov
Date:   Thu Aug 22 16:54:51 2019 +0300
Branches: master
https://developer.blender.org/rB54fd8176d7e914da9fc834b465c22bffb6f3a620

NodeTree: also assign the owner pointer when copying.

===

M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/light.c
M   source/blender/blenkernel/intern/linestyle.c
M   source/blender/blenkernel/intern/material.c
M   source/blender/blenkernel/intern/node.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenkernel/intern/texture.c
M   source/blender/blenkernel/intern/world.c
M   
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp

===

diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index b76e3777557..a593f0f2ca6 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -366,7 +366,10 @@ struct GHashIterator *ntreeTypeGetIterator(void);
 void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree);
 
 void ntreeInitDefault(struct bNodeTree *ntree);
-struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const 
char *idname, struct ID *owner);
+struct bNodeTree *ntreeAddTree(struct Main *bmain,
+   const char *name,
+   const char *idname,
+   struct ID *owner);
 
 /* copy/free funcs, need to manage ID users */
 void ntreeFreeTree(struct bNodeTree *ntree);
@@ -376,10 +379,15 @@ void BKE_node_tree_copy_data(struct Main *bmain,
  struct bNodeTree *ntree_dst,
  const struct bNodeTree *ntree_src,
  const int flag);
+void BKE_nodetree_copy_owned_ex(
+struct Main *bmain, struct bNodeTree *src, struct bNodeTree **dst, struct 
ID *owner, int flag);
 struct bNodeTree *ntreeCopyTree_ex(const struct bNodeTree *ntree,
struct Main *bmain,
+   struct ID *owner,
const bool do_id_user);
-struct bNodeTree *ntreeCopyTree(struct Main *bmain, const struct bNodeTree 
*ntree);
+struct bNodeTree *ntreeCopyTree(struct Main *bmain,
+const struct bNodeTree *ntree,
+struct ID *owner);
 /* node->id user count */
 void ntreeUserIncrefID(struct bNodeTree *ntree);
 void ntreeUserDecrefID(struct bNodeTree *ntree);
diff --git a/source/blender/blenkernel/intern/light.c 
b/source/blender/blenkernel/intern/light.c
index 75c9e0e42a5..654abef389d 100644
--- a/source/blender/blenkernel/intern/light.c
+++ b/source/blender/blenkernel/intern/light.c
@@ -113,7 +113,7 @@ void BKE_light_copy_data(Main *bmain, Light *la_dst, const 
Light *la_src, const
   if (la_src->nodetree) {
 /* Note: nodetree is *not* in bmain, however this specific case is handled 
at lower level
  *   (see BKE_libblock_copy_ex()). */
-BKE_id_copy_ex(bmain, (ID *)la_src->nodetree, (ID **)_dst->nodetree, 
flag);
+BKE_nodetree_copy_owned_ex(bmain, la_src->nodetree, _dst->nodetree, 
_dst->id, flag);
   }
 
   if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
diff --git a/source/blender/blenkernel/intern/linestyle.c 
b/source/blender/blenkernel/intern/linestyle.c
index cdef24b07fb..b682e4265ad 100644
--- a/source/blender/blenkernel/intern/linestyle.c
+++ b/source/blender/blenkernel/intern/linestyle.c
@@ -178,7 +178,8 @@ void BKE_linestyle_copy_data(struct Main *bmain,
   if (linestyle_src->nodetree) {
 /* Note: nodetree is *not* in bmain, however this specific case is handled 
at lower level
  *   (see BKE_libblock_copy_ex()). */
-BKE_id_copy_ex(bmain, (ID *)linestyle_src->nodetree, (ID 
**)_dst->nodetree, flag);
+BKE_nodetree_copy_owned_ex(
+bmain, linestyle_src->nodetree, _dst->nodetree, 
_dst->id, flag);
   }
 
   LineStyleModifier *m;
diff --git a/source/blender/blenkernel/intern/material.c 
b/source/blender/blenkernel/intern/material.c
index 1545ae4f48f..01df423d9d7 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -183,7 +183,7 @@ void BKE_material_copy_data(Main *bmain, Material *ma_dst, 
const Material *ma_sr
   if (ma_src->nodetree) {
 /* Note: nodetree is *not* in bmain, however this specific case is handled 
at lower level
  *   (see BKE_libblock_copy_ex()). */
-BKE_id_copy_ex(bmain, (ID *)ma_src->nodetree, (ID **)_dst->nodetree, 
flag);
+BKE_nodetree_copy_owned_ex(bmain, ma_src->nodetree, _dst->nodetree, 
_dst->id, flag);
   }
 
   if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
@@ -1562,7 +1562,7 @@ void copy_matcopybuf(Main *bmain, Material *ma)
   memcpy(, ma, sizeof(Material));
 
   

[Bf-blender-cvs] [33a287e5c05] master: Snapping System: Return element type in 'ED_transform_snap_object_project_view3d_ex'

2019-08-22 Thread mano-wii
Commit: 33a287e5c0508af0fcacca2026a1e89cbbc0d385
Author: mano-wii
Date:   Thu Aug 22 10:53:21 2019 -0300
Branches: master
https://developer.blender.org/rB33a287e5c0508af0fcacca2026a1e89cbbc0d385

Snapping System: Return element type in 
'ED_transform_snap_object_project_view3d_ex'

===

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

===

diff --git a/source/blender/editors/transform/transform_snap_object.c 
b/source/blender/editors/transform/transform_snap_object.c
index e8e3e6a67a1..7818f20060f 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -2913,8 +2913,7 @@ short 
ED_transform_snap_object_project_view3d_ex(SnapObjectContext *sctx,
  float r_obmat[4][4])
 {
   return transform_snap_context_project_view3d_mixed_impl(
- sctx, snap_to, params, mval, prev_co, dist_px, r_loc, r_no, 
r_index, r_ob, r_obmat) !=
- 0;
+  sctx, snap_to, params, mval, prev_co, dist_px, r_loc, r_no, r_index, 
r_ob, r_obmat);
 }
 
 /**

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


[Bf-blender-cvs] [8965a812716] master: Cleanup: Split some code out of rna_access.c

2019-08-22 Thread Bastien Montagne
Commit: 8965a81271661d017c8dea93446c75677ba2f7eb
Author: Bastien Montagne
Date:   Thu Aug 22 15:31:07 2019 +0200
Branches: master
https://developer.blender.org/rB8965a81271661d017c8dea93446c75677ba2f7eb

Cleanup: Split some code out of rna_access.c

That file was getting out of control, now comparison/override RNA code is
in `rna_access_compare_override.c`. 1K lines of code for now, but that
area is likely to grow more in the future...

Note that we can probably split more out of `rna_access.c`, but for now
that will do.

===

M   source/blender/makesrna/intern/CMakeLists.txt
M   source/blender/makesrna/intern/rna_access.c
A   source/blender/makesrna/intern/rna_access_compare_override.c
A   source/blender/makesrna/intern/rna_access_internal.h

===

diff --git a/source/blender/makesrna/intern/CMakeLists.txt 
b/source/blender/makesrna/intern/CMakeLists.txt
index 7c31f078b6d..2745cfa9740 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -364,9 +364,11 @@ add_custom_command(
 # Build bf_rna
 set(SRC
   rna_access.c
+  rna_access_compare_override.c
   ${GENSRC}
 
   ${SRC_RNA_INC}
+  rna_access_internal.h
   rna_internal.h
   rna_internal_types.h
   rna_mesh_utils.h
diff --git a/source/blender/makesrna/intern/rna_access.c 
b/source/blender/makesrna/intern/rna_access.c
index 7b7af5c12db..c4b0e43fd70 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -37,10 +37,6 @@
 #include "BLI_ghash.h"
 #include "BLI_math.h"
 
-#ifdef DEBUG_OVERRIDE_TIMEIT
-#  include "PIL_time_utildefines.h"
-#endif
-
 #include "BLF_api.h"
 #include "BLT_translation.h"
 
@@ -49,7 +45,6 @@
 #include "BKE_idcode.h"
 #include "BKE_idprop.h"
 #include "BKE_fcurve.h"
-#include "BKE_library_override.h"
 #include "BKE_main.h"
 #include "BKE_report.h"
 
@@ -67,6 +62,7 @@
 #include "WM_types.h"
 
 #include "rna_internal.h"
+#include "rna_access_internal.h"
 
 const PointerRNA PointerRNA_NULL = {{NULL}};
 
@@ -249,7 +245,7 @@ void RNA_pointer_recast(PointerRNA *ptr, PointerRNA *r_ptr)
 
 /* ID Properties */
 
-static void rna_idproperty_touch(IDProperty *idprop)
+void rna_idproperty_touch(IDProperty *idprop)
 {
   /* so the property is seen as 'set' by rna */
   idprop->flag &= ~IDP_FLAG_GHOST;
@@ -619,7 +615,7 @@ PropertyRNA *rna_ensure_property_realdata(PropertyRNA 
**prop, PointerRNA *ptr)
   return rna_idproperty_check_ex(prop, ptr, true);
 }
 
-static PropertyRNA *rna_ensure_property(PropertyRNA *prop)
+PropertyRNA *rna_ensure_property(PropertyRNA *prop)
 {
   /* the quick version if we don't need the idproperty */
 
@@ -1171,11 +1167,6 @@ int RNA_property_flag(PropertyRNA *prop)
   return rna_ensure_property(prop)->flag;
 }
 
-int RNA_property_override_flag(PropertyRNA *prop)
-{
-  return rna_ensure_property(prop)->flag_override;
-}
-
 /**
  * Get the tags set for \a prop as int bitfield.
  * \note Doesn't perform any validity check on the set bits. 
#RNA_def_property_tags does this
@@ -2194,77 +2185,6 @@ bool RNA_property_animated(PointerRNA *ptr, PropertyRNA 
*prop)
 
   return false;
 }
-
-/** \note Does not take into account editable status, this has to be checked 
separately
- * (using #RNA_property_editable_flag() usually). */
-bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop)
-{
-  if (prop->magic == RNA_MAGIC) {
-/* Special handling for insertions of constraints or modifiers... */
-/* TODO Note We may want to add a more generic system to RNA
- * (like a special property in struct of items)
- * if we get more overrideable collections,
- * for now we can live with those special-cases handling I think. */
-if (RNA_struct_is_a(ptr->type, _Constraint)) {
-  bConstraint *con = ptr->data;
-  if (con->flag & CONSTRAINT_OVERRIDE_LIBRARY_LOCAL) {
-return true;
-  }
-}
-else if (RNA_struct_is_a(ptr->type, _Modifier)) {
-  ModifierData *mod = ptr->data;
-  if (mod->flag & eModifierFlag_OverrideLibrary_Local) {
-return true;
-  }
-}
-/* If this is a RNA-defined property (real or 'virtual' IDProp),
- * we want to use RNA prop flag. */
-return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) &&
-   (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_LIBRARY);
-  }
-  else {
-/* If this is a real 'pure' IDProp (aka custom property), we want to use 
the IDProp flag. */
-return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) &&
-   (((IDProperty *)prop)->flag & IDP_FLAG_OVERRIDABLE_LIBRARY);
-  }
-}
-
-/* Should only be used for custom properties */
-bool RNA_property_overridable_library_set(PointerRNA *UNUSED(ptr),
-  PropertyRNA *prop,
-  const bool is_overridable)
-{
-  /* Only 

[Bf-blender-cvs] [662d94e020f] master: Multi-View user interface minor tweak

2019-08-22 Thread Dalai Felinto
Commit: 662d94e020f36e75b9c6b4a258f31c1625573ee8
Author: Dalai Felinto
Date:   Wed Aug 21 15:11:47 2019 -0300
Branches: master
https://developer.blender.org/rB662d94e020f36e75b9c6b4a258f31c1625573ee8

Multi-View user interface minor tweak

There is no reason to not expand this enum as we did for 2.79.
It is self explanatory enough and it has only two options.

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_output.py 
b/release/scripts/startup/bl_ui/properties_output.py
index 4d230520d11..748961bb40f 100644
--- a/release/scripts/startup/bl_ui/properties_output.py
+++ b/release/scripts/startup/bl_ui/properties_output.py
@@ -479,9 +479,7 @@ class RENDER_PT_stereoscopy(RenderOutputButtonsPanel, 
Panel):
 basic_stereo = rd.views_format == 'STEREO_3D'
 
 row = layout.row()
-row.use_property_split = True
-row.use_property_decorate = False
-row.prop(rd, "views_format")
+layout.row().prop(rd, "views_format", expand=True)
 
 if basic_stereo:
 row = layout.row()

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


[Bf-blender-cvs] [4c5becb6b14] master: Fix missing argument.

2019-08-22 Thread Alexander Gavrilov
Commit: 4c5becb6b143895c16b58e57b369258f61f0558e
Author: Alexander Gavrilov
Date:   Thu Aug 22 16:14:48 2019 +0300
Branches: master
https://developer.blender.org/rB4c5becb6b143895c16b58e57b369258f61f0558e

Fix missing argument.

Missed because of broken dependency tracking in msvc build process.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_main_api.c 
b/source/blender/makesrna/intern/rna_main_api.c
index fec991e16da..de6f271fd9c 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -312,7 +312,7 @@ static struct bNodeTree *rna_Main_nodetree_new(Main *bmain, 
const char *name, in
 
   bNodeTreeType *typeinfo = rna_node_tree_type_from_enum(type);
   if (typeinfo) {
-bNodeTree *ntree = ntreeAddTree(bmain, safe_name, typeinfo->idname);
+bNodeTree *ntree = ntreeAddTree(bmain, safe_name, typeinfo->idname, NULL);
 
 id_us_min(>id);
 return ntree;

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


[Bf-blender-cvs] [8f578150eaf] master: Fix T68971: Copy As New Driver from Material node creates a bad reference.

2019-08-22 Thread Alexander Gavrilov
Commit: 8f578150eaf494a03bed7389046e44f2bdf7d748
Author: Alexander Gavrilov
Date:   Thu Aug 22 15:40:10 2019 +0300
Branches: master
https://developer.blender.org/rB8f578150eaf494a03bed7389046e44f2bdf7d748

Fix T68971: Copy As New Driver from Material node creates a bad reference.

NodeTree structures of materials and some other data blocks are
effectively node group data block objects that are contained inside
the parent block. Thus, direct references to them are only valid
while blender is running, and are lost on save.

Fix Copy As New Driver to create a reference that goes through
the owner data block, by adding a new runtime field to bNodeTree.

===

M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/linestyle.c
M   source/blender/blenkernel/intern/node.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/editors/animation/drivers.c
M   source/blender/editors/include/ED_keyframing.h
M   source/blender/editors/interface/interface_ops.c
M   source/blender/editors/space_node/node_add.c
M   source/blender/editors/space_node/node_edit.c
M   source/blender/editors/space_node/node_group.c
M   source/blender/makesdna/DNA_node_types.h

===

diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index e3d0588b607..b76e3777557 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -366,7 +366,7 @@ struct GHashIterator *ntreeTypeGetIterator(void);
 void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree);
 
 void ntreeInitDefault(struct bNodeTree *ntree);
-struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const 
char *idname);
+struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const 
char *idname, struct ID *owner);
 
 /* copy/free funcs, need to manage ID users */
 void ntreeFreeTree(struct bNodeTree *ntree);
diff --git a/source/blender/blenkernel/intern/linestyle.c 
b/source/blender/blenkernel/intern/linestyle.c
index 7bfe5a7c8ff..cdef24b07fb 100644
--- a/source/blender/blenkernel/intern/linestyle.c
+++ b/source/blender/blenkernel/intern/linestyle.c
@@ -1456,7 +1456,7 @@ void BKE_linestyle_default_shader(const bContext *C, 
FreestyleLineStyle *linesty
 
   BLI_assert(linestyle->nodetree == NULL);
 
-  ntree = ntreeAddTree(NULL, "stroke_shader", "ShaderNodeTree");
+  ntree = ntreeAddTree(NULL, "stroke_shader", "ShaderNodeTree", 
>id);
 
   linestyle->nodetree = ntree;
 
diff --git a/source/blender/blenkernel/intern/node.c 
b/source/blender/blenkernel/intern/node.c
index 206c59c110a..59ffbbfea6f 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1394,7 +1394,7 @@ void ntreeInitDefault(bNodeTree *ntree)
   ntree_set_typeinfo(ntree, NULL);
 }
 
-bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname)
+bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname, ID 
*owner)
 {
   bNodeTree *ntree;
 
@@ -1408,6 +1408,7 @@ bNodeTree *ntreeAddTree(Main *bmain, const char *name, 
const char *idname)
 ntree = MEM_callocN(sizeof(bNodeTree), "new node tree");
 *((short *)ntree->id.name) = ID_NT;
 BLI_strncpy(ntree->id.name + 2, name, sizeof(ntree->id.name));
+ntree->owner = owner;
   }
 
   /* Types are fully initialized at this point,
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 1e3342cef04..47fa8704df9 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3477,13 +3477,15 @@ static void direct_link_node_socket(FileData *fd, 
bNodeSocket *sock)
 }
 
 /* ntree itself has been read! */
-static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
+static void direct_link_nodetree(FileData *fd, bNodeTree *ntree, ID *owner)
 {
   /* note: writing and reading goes in sync, for speed */
   bNode *node;
   bNodeSocket *sock;
   bNodeLink *link;
 
+  ntree->owner = owner;
+
   ntree->init = 0; /* to set callbacks and force setting types */
   ntree->is_updating = false;
   ntree->typeinfo = NULL;
@@ -3958,7 +3960,7 @@ static void direct_link_light(FileData *fd, Light *la)
   la->nodetree = newdataadr(fd, la->nodetree);
   if (la->nodetree) {
 direct_link_id(fd, >nodetree->id);
-direct_link_nodetree(fd, la->nodetree);
+direct_link_nodetree(fd, la->nodetree, >id);
   }
 
   la->preview = direct_link_preview_image(fd, la->preview);
@@ -4121,7 +4123,7 @@ static void direct_link_world(FileData *fd, World *wrld)
   wrld->nodetree = newdataadr(fd, wrld->nodetree);
   if (wrld->nodetree) {
 direct_link_id(fd, >nodetree->id);
-direct_link_nodetree(fd, wrld->nodetree);
+direct_link_nodetree(fd, wrld->nodetree, >id);
   }
 
   wrld->preview = 

[Bf-blender-cvs] [e3442c8864c] master: LibOverride: Cleanup: tget rid of G.main usage when we can get it from context.

2019-08-22 Thread Bastien Montagne
Commit: e3442c8864cdbdfeb7db6b21952b1be56b1a1e78
Author: Bastien Montagne
Date:   Thu Aug 22 14:31:39 2019 +0200
Branches: master
https://developer.blender.org/rBe3442c8864cdbdfeb7db6b21952b1be56b1a1e78

LibOverride: Cleanup: tget rid of G.main usage when we can get it from context.

===

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

===

diff --git a/source/blender/blenkernel/intern/undo_system.c 
b/source/blender/blenkernel/intern/undo_system.c
index 07cf5205cab..36b950fb8f9 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -503,7 +503,7 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack,
   /* Might not be final place for this to be called - probably only want to 
call it from some
* undo handlers, not all of them? */
   if (BKE_override_library_is_enabled()) {
-BKE_main_override_library_operations_create(G.main, false);
+BKE_main_override_library_operations_create(CTX_data_main(C), false);
   }
 
   /* Remove all undos after (also when 'ustack->step_active == NULL'). */

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


[Bf-blender-cvs] [443586f34d3] master: LibOverride: Enforce full override operations check on file save.

2019-08-22 Thread Bastien Montagne
Commit: 443586f34d3a0730c67b5d8787e519bec2af3656
Author: Bastien Montagne
Date:   Thu Aug 22 14:32:17 2019 +0200
Branches: master
https://developer.blender.org/rB443586f34d3a0730c67b5d8787e519bec2af3656

LibOverride: Enforce full override operations check on file save.

We try to avoid diffing too much things during edition, but when saving
a file we need to check all possible overridable IDs to ensure we have
all needed override operations...

Was pretty sure that was already in code, but apparently not (or it got
lost at some point...).

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_files.c 
b/source/blender/windowmanager/intern/wm_files.c
index d9f43b51f4d..e3370069bca 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -77,6 +77,7 @@
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_idprop.h"
+#include "BKE_library_override.h"
 #include "BKE_main.h"
 #include "BKE_packedFile.h"
 #include "BKE_report.h"
@@ -1355,6 +1356,9 @@ static bool wm_file_write(bContext *C, const char 
*filepath, int fileflags, Repo
* that way you can generate custom file thumbnail. */
   BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_PRE);
 
+  /* Enforce full override check/generation on file save. */
+  BKE_main_override_library_operations_create(bmain, true);
+
   /* blend file thumbnail */
   /* Save before exit_editmode, otherwise derivedmeshes for shared data 
corrupt T27765. */
   /* Main now can store a '.blend' thumbnail, useful for background mode

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


[Bf-blender-cvs] [df5237ec5e3] master: LibOverride: Fix broken logic in code checking and adding new override ops.

2019-08-22 Thread Bastien Montagne
Commit: df5237ec5e3e43627a997ba97baeffd991aa3735
Author: Bastien Montagne
Date:   Thu Aug 22 14:28:31 2019 +0200
Branches: master
https://developer.blender.org/rBdf5237ec5e3e43627a997ba97baeffd991aa3735

LibOverride: Fix broken logic in code checking and adding new override ops.

When we wanted to force all overidable IDs to be checked, code would end
up checking the whole Main DB, instead of only overrideable ones.

===

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

===

diff --git a/source/blender/blenkernel/intern/library_override.c 
b/source/blender/blenkernel/intern/library_override.c
index e435f07e38d..ce368575492 100644
--- a/source/blender/blenkernel/intern/library_override.c
+++ b/source/blender/blenkernel/intern/library_override.c
@@ -628,7 +628,7 @@ void BKE_main_override_library_operations_create(Main 
*bmain, const bool force_a
   ID *id;
 
   FOREACH_MAIN_ID_BEGIN (bmain, id) {
-if (force_auto ||
+if ((ID_IS_OVERRIDE_LIBRARY(id) && force_auto) ||
 (ID_IS_OVERRIDE_LIBRARY_AUTO(id) && (id->tag & 
LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH))) {
   BKE_override_library_operations_create(bmain, id, force_auto);
   id->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH;

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


[Bf-blender-cvs] [08ab3cbcce1] master: Shading: Add object color to Object Info node.

2019-08-22 Thread OmarSquircleArt
Commit: 08ab3cbcce1eb9c2de4953a83b50cabc44479d3c
Author: OmarSquircleArt
Date:   Thu Aug 22 14:26:09 2019 +0200
Branches: master
https://developer.blender.org/rB08ab3cbcce1eb9c2de4953a83b50cabc44479d3c

Shading: Add object color to Object Info node.

The object color property is added as an additional output in
the Object Info node.

Reviewers: brecht

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

===

M   intern/cycles/blender/blender_object.cpp
M   intern/cycles/kernel/geom/geom_object.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/osl/osl_services.cpp
M   intern/cycles/kernel/osl/osl_services.h
M   intern/cycles/kernel/shaders/node_object_info.osl
M   intern/cycles/kernel/svm/svm_geometry.h
M   intern/cycles/kernel/svm/svm_types.h
M   intern/cycles/render/nodes.cpp
M   intern/cycles/render/object.cpp
M   intern/cycles/render/object.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/intern/draw_manager.h
M   source/blender/draw/intern/draw_manager_data.c
M   source/blender/draw/intern/draw_manager_exec.c
M   source/blender/gpu/GPU_material.h
M   source/blender/gpu/GPU_shader_interface.h
M   source/blender/gpu/intern/gpu_codegen.c
M   source/blender/gpu/intern/gpu_shader_interface.c
M   source/blender/gpu/shaders/gpu_shader_material.glsl
M   source/blender/makesrna/intern/rna_object.c
M   source/blender/nodes/shader/nodes/node_shader_object_info.c

===

diff --git a/intern/cycles/blender/blender_object.cpp 
b/intern/cycles/blender/blender_object.cpp
index ab47da9c1a2..b670922ac88 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -444,6 +444,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph _depsgraph,
   if (object_updated || (object->mesh && object->mesh->need_update) || tfm != 
object->tfm) {
 object->name = b_ob.name().c_str();
 object->pass_id = b_ob.pass_index();
+object->color = get_float3(b_ob.color());
 object->tfm = tfm;
 object->motion.clear();
 
diff --git a/intern/cycles/kernel/geom/geom_object.h 
b/intern/cycles/kernel/geom/geom_object.h
index f410e6e27e2..af4e6fbd89b 100644
--- a/intern/cycles/kernel/geom/geom_object.h
+++ b/intern/cycles/kernel/geom/geom_object.h
@@ -227,6 +227,17 @@ ccl_device_inline float object_surface_area(KernelGlobals 
*kg, int object)
   return kernel_tex_fetch(__objects, object).surface_area;
 }
 
+/* Color of the object */
+
+ccl_device_inline float3 object_color(KernelGlobals *kg, int object)
+{
+  if (object == OBJECT_NONE)
+return make_float3(0.0f, 0.0f, 0.0f);
+
+  const ccl_global KernelObject *kobject = _tex_fetch(__objects, 
object);
+  return make_float3(kobject->color[0], kobject->color[1], kobject->color[2]);
+}
+
 /* Pass ID number of object */
 
 ccl_device_inline float object_pass_id(KernelGlobals *kg, int object)
diff --git a/intern/cycles/kernel/kernel_types.h 
b/intern/cycles/kernel/kernel_types.h
index f3f321e77dc..8aaa83045ea 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -1408,6 +1408,7 @@ typedef struct KernelObject {
   float surface_area;
   float pass_id;
   float random_number;
+  float color[3];
   int particle_index;
 
   float dupli_generated[3];
@@ -1420,11 +1421,9 @@ typedef struct KernelObject {
   uint patch_map_offset;
   uint attribute_map_offset;
   uint motion_offset;
-  uint pad1;
 
   float cryptomatte_object;
   float cryptomatte_asset;
-  float pad2, pad3;
 } KernelObject;
 static_assert_align(KernelObject, 16);
 
diff --git a/intern/cycles/kernel/osl/osl_services.cpp 
b/intern/cycles/kernel/osl/osl_services.cpp
index 3850d0fe94b..222475b3778 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -81,6 +81,7 @@ ustring OSLRenderServices::u_screen("screen");
 ustring OSLRenderServices::u_raster("raster");
 ustring OSLRenderServices::u_ndc("NDC");
 ustring OSLRenderServices::u_object_location("object:location");
+ustring OSLRenderServices::u_object_color("object:color");
 ustring OSLRenderServices::u_object_index("object:index");
 ustring OSLRenderServices::u_geom_dupli_generated("geom:dupli_generated");
 ustring OSLRenderServices::u_geom_dupli_uv("geom:dupli_uv");
@@ -668,6 +669,10 @@ bool OSLRenderServices::get_object_standard_attribute(
 float3 f = object_location(kg, sd);
 return set_attribute_float3(f, type, derivatives, val);
   }
+  else if (name == u_object_color) {
+float3 f = object_color(kg, sd->object);
+return set_attribute_float3(f, type, derivatives, val);
+  }
   else if (name == u_object_index) {
 float f = object_pass_id(kg, sd->object);
 return set_attribute_float(f, type, derivatives, val);
diff --git a/intern/cycles/kernel/osl/osl_services.h 

[Bf-blender-cvs] [c20301adf1f] functions: fix build error

2019-08-22 Thread Jacques Lucke
Commit: c20301adf1faa698a6499dd56e94336a50c1ebe5
Author: Jacques Lucke
Date:   Thu Aug 22 14:19:30 2019 +0200
Branches: functions
https://developer.blender.org/rBc20301adf1faa698a6499dd56e94336a50c1ebe5

fix build error

===

M   source/blender/blenlib/BLI_string_map.hpp

===

diff --git a/source/blender/blenlib/BLI_string_map.hpp 
b/source/blender/blenlib/BLI_string_map.hpp
index beebe86a9c9..d65612878ec 100644
--- a/source/blender/blenlib/BLI_string_map.hpp
+++ b/source/blender/blenlib/BLI_string_map.hpp
@@ -311,7 +311,7 @@ template 
class StringMap {
   }
 
  private:
-  constexpr uint32_t compute_string_hash(StringRef key) const
+  uint32_t compute_string_hash(StringRef key) const
   {
 /* TODO: check if this can be optimized more because we know the key 
length already. */
 uint32_t hash = 5381;

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


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

2019-08-22 Thread Jacques Lucke
Commit: ac4c2b3a48397b5010f6798586436f87655e1e52
Author: Jacques Lucke
Date:   Thu Aug 22 12:14:56 2019 +0200
Branches: functions
https://developer.blender.org/rBac4c2b3a48397b5010f6798586436f87655e1e52

Merge branch 'master' into functions

===



===



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


[Bf-blender-cvs] [75127b6be78] master: Revert "Fix grid snap value in recent snapping updates"

2019-08-22 Thread mano-wii
Commit: 75127b6be78a7ebd69410f989a13eff9e1188d82
Author: mano-wii
Date:   Thu Aug 22 09:03:20 2019 -0300
Branches: master
https://developer.blender.org/rB75127b6be78a7ebd69410f989a13eff9e1188d82

Revert "Fix grid snap value in recent snapping updates"

This reverts commit 48a7f979a5cf2669656d25767c4173fb65bfb67d.

Another solution to come.

===

M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index 57ec9e21c10..23a22237269 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1460,14 +1460,16 @@ typedef struct ToolSettings {
 
   char edge_mode_live_unwrap;
 
+  char _pad1[1];
+
   /* Transform */
   char transform_pivot_point;
   char transform_flag;
+  char snap_mode, snap_node_mode;
+  char snap_uv_mode;
   char snap_flag;
   char snap_target;
   char snap_transform_mode_flag;
-  short snap_mode, snap_node_mode;
-  short snap_uv_mode;
 
   char proportional_edit, prop_mode;
   /** Proportional edit, object mode. */
@@ -1490,7 +1492,7 @@ typedef struct ToolSettings {
   char vgroupsubset;
 
   /* UV painting */
-  char _pad2[1];
+  char _pad2[3];
   char uv_sculpt_settings;
   char uv_relax_method;
   /* XXX: these sculpt_paint_* fields are deprecated, use the

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


[Bf-blender-cvs] [a2443848646] master: Fix T68969: current value '0' matches no enum in 'ToolSettings', '(null)', 'snap_node_element'

2019-08-22 Thread mano-wii
Commit: a2443848646cdb5d13980157a8c62eb4cd578388
Author: mano-wii
Date:   Thu Aug 22 09:07:07 2019 -0300
Branches: master
https://developer.blender.org/rBa2443848646cdb5d13980157a8c62eb4cd578388

Fix T68969: current value '0' matches no enum in 'ToolSettings', '(null)', 
'snap_node_element'

I don't think a versioning solution is necessary in this case.
But it can still be implemented.

===

M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index 23a22237269..8fd02ccda6c 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -2051,11 +2051,11 @@ enum {
 #define SCE_SNAP_MODE_EDGE_PERPENDICULAR (1 << 6)
 
 /* ToolSettings.snap_node_mode */
-#define SCE_SNAP_MODE_NODE_X (1 << 6)
-#define SCE_SNAP_MODE_NODE_Y (1 << 7)
+#define SCE_SNAP_MODE_NODE_X (1 << 5)
+#define SCE_SNAP_MODE_NODE_Y (1 << 6)
 
 /* ToolSettings.snap_mode and ToolSettings.snap_node_mode */
-#define SCE_SNAP_MODE_GRID (1 << 8)
+#define SCE_SNAP_MODE_GRID (1 << 7)
 
 /** #ToolSettings.snap_transform_mode_flag */
 enum {

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


[Bf-blender-cvs] [c6f8ea7b45a] master: Fix T69044: OpenCL fail due to bad fract function.

2019-08-22 Thread OmarSquircleArt
Commit: c6f8ea7b45af72fa7f7d1a47140fd946c1db3d5e
Author: OmarSquircleArt
Date:   Thu Aug 22 13:47:24 2019 +0200
Branches: master
https://developer.blender.org/rBc6f8ea7b45af72fa7f7d1a47140fd946c1db3d5e

Fix T69044: OpenCL fail due to bad fract function.

The fract function in OpenCL does more than just return the fraction.
It also writes the floor to the second argument. Which wasn't put
in consideration.

Instead, we use a simple `a - floor(a)` like the Math node.

Reviewers: brecht

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

===

M   intern/cycles/kernel/svm/svm_math_util.h
M   intern/cycles/util/util_math_float3.h

===

diff --git a/intern/cycles/kernel/svm/svm_math_util.h 
b/intern/cycles/kernel/svm/svm_math_util.h
index c87ca0defa7..c07a1e4ed98 100644
--- a/intern/cycles/kernel/svm/svm_math_util.h
+++ b/intern/cycles/kernel/svm/svm_math_util.h
@@ -69,7 +69,7 @@ ccl_device void svm_vector_math(
   *vector = make_float3(safe_modulo(a.x, b.x), safe_modulo(a.y, b.y), 
safe_modulo(a.z, b.z));
   break;
 case NODE_VECTOR_MATH_FRACTION:
-  *vector = fract(a);
+  *vector = a - floor(a);
   break;
 case NODE_VECTOR_MATH_ABSOLUTE:
   *vector = fabs(a);
diff --git a/intern/cycles/util/util_math_float3.h 
b/intern/cycles/util/util_math_float3.h
index 0d7588da690..c9a5b34aa58 100644
--- a/intern/cycles/util/util_math_float3.h
+++ b/intern/cycles/util/util_math_float3.h
@@ -61,7 +61,6 @@ ccl_device_inline float3 rcp(const float3 );
 ccl_device_inline float3 sqrt(const float3 );
 ccl_device_inline float3 floor(const float3 );
 ccl_device_inline float3 ceil(const float3 );
-ccl_device_inline float3 fract(const float3 );
 #endif /* !__KERNEL_OPENCL__ */
 
 ccl_device_inline float min3(float3 a);
@@ -313,11 +312,6 @@ ccl_device_inline float3 ceil(const float3 )
 #  endif
 }
 
-ccl_device_inline float3 fract(const float3 )
-{
-  return a - floor(a);
-}
-
 ccl_device_inline float3 mix(const float3 , const float3 , float t)
 {
   return a + t * (b - a);

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


[Bf-blender-cvs] [599d0611b07] soc-2019-openxr: Improve batch file text for starting Blender with Oculus support

2019-08-22 Thread Julian Eisel
Commit: 599d0611b071cc0b1d5104ef437d79ce94b752d1
Author: Julian Eisel
Date:   Thu Aug 22 13:33:06 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB599d0611b071cc0b1d5104ef437d79ce94b752d1

Improve batch file text for starting Blender with Oculus support

===

M   release/windows/batch/blender_oculus.cmd

===

diff --git a/release/windows/batch/blender_oculus.cmd 
b/release/windows/batch/blender_oculus.cmd
index 39dcfebcbf1..d6e54ac6ce7 100644
--- a/release/windows/batch/blender_oculus.cmd
+++ b/release/windows/batch/blender_oculus.cmd
@@ -1,10 +1,8 @@
 @echo off
-echo Starting blender with oculus openXR support, this assumes the oculus 
runtime
-echo is installed in the default location, if this is not the case please 
adjust the
-echo path inside oculus.josn
-echo.
-echo please note that openXR support is EXTREMELY experimental at this point
+echo Starting Blender with Oculus OpenXR support. This assumes the Oculus 
runtime
+echo is installed in the default location. If this is not the case, please 
adjust
+echo the path inside oculus.json.
 echo.
 pause
 set XR_RUNTIME_JSON=%~dp0oculus.json
-blender 
\ No newline at end of file
+blender

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


[Bf-blender-cvs] [20278a37768] filebrowser_redesign: Merge branch 'master' into filebrowser_redesign

2019-08-22 Thread Julian Eisel
Commit: 20278a3776813286993c95f65791f4eaca513b81
Author: Julian Eisel
Date:   Thu Aug 22 13:25:50 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rB20278a3776813286993c95f65791f4eaca513b81

Merge branch 'master' into filebrowser_redesign

===



===

diff --cc source/blender/blenloader/intern/versioning_userdef.c
index 2ef1a5c096c,8bbfc29131e..67b8ce1d0de
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@@ -145,12 -150,6 +150,7 @@@ static void do_versions_theme(const Use
 * Include next version bump.
 */
{
- FROM_DEFAULT_V4_UCHAR(space_outliner.selected_highlight);
- FROM_DEFAULT_V4_UCHAR(space_outliner.active);
- 
- 
- 
 +FROM_DEFAULT_V4_UCHAR(space_file.execution_buts);
}
  
  #undef FROM_DEFAULT_V4_UCHAR

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


[Bf-blender-cvs] [b208096538a] master: Transform: Snap Perpendicular: Avoid snapping to snapTarget

2019-08-22 Thread mano-wii
Commit: b208096538aa65eb0b5df9ee080ad4b42441aca5
Author: mano-wii
Date:   Thu Aug 22 08:07:41 2019 -0300
Branches: master
https://developer.blender.org/rBb208096538aa65eb0b5df9ee080ad4b42441aca5

Transform: Snap Perpendicular: Avoid snapping to snapTarget

===

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

===

diff --git a/source/blender/editors/transform/transform_snap_object.c 
b/source/blender/editors/transform/transform_snap_object.c
index 761a13c1538..e8e3e6a67a1 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -1474,7 +1474,8 @@ static short snap_mesh_edge_verts_mixed(SnapObjectContext 
*sctx,
   if (IN_RANGE(lambda, 0.0f, 1.0f)) {
 interp_v3_v3v3(v_near, va_g, vb_g, lambda);
 
-if (test_projected_vert_dist(_precalc,
+if ((len_squared_v3v3(prev_co, v_near) > FLT_EPSILON) &&
+test_projected_vert_dist(_precalc,
  NULL,
  0,
  nearest2d.is_persp,

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


[Bf-blender-cvs] [3f9c0ab993a] master: Transform: Snap Perpendicular: Use `snapTarget` instead of `center_global`

2019-08-22 Thread mano-wii
Commit: 3f9c0ab993a598f45dbf00cbd3be8cc07fb2ef9b
Author: mano-wii
Date:   Thu Aug 22 08:00:53 2019 -0300
Branches: master
https://developer.blender.org/rB3f9c0ab993a598f45dbf00cbd3be8cc07fb2ef9b

Transform: Snap Perpendicular: Use `snapTarget` instead of `center_global`

===

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

===

diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index feaef9a17a1..23c1ece6f73 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1273,7 +1273,7 @@ bool snapObjectsTransform(
   .use_occlusion_test = t->scene->toolsettings->snap_mode != 
SCE_SNAP_MODE_FACE,
   },
   mval,
-  t->center_global,
+  t->tsnap.snapTarget,
   dist_px,
   r_loc,
   r_no);

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


[Bf-blender-cvs] [d13952e6037] master: LibOverride: Cleanup: rename parameters in RNA apply code.

2019-08-22 Thread Bastien Montagne
Commit: d13952e603781ebb8367796312e94ce6d3f61eb0
Author: Bastien Montagne
Date:   Thu Aug 22 12:19:37 2019 +0200
Branches: master
https://developer.blender.org/rBd13952e603781ebb8367796312e94ce6d3f61eb0

LibOverride: Cleanup: rename parameters in RNA apply code.

We cannot use local/reference here, that is very confusing, since at
that stage current local is kind of src of data for the future local ID,
that is currently a mere copy of the linked data... ;)

So we are much better with src/dst names here.

===

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

===

diff --git a/source/blender/makesrna/RNA_access.h 
b/source/blender/makesrna/RNA_access.h
index b0738b617f7..95ea5d75c9f 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -1504,8 +1504,8 @@ bool RNA_struct_override_store(struct Main *bmain,
struct IDOverrideLibrary *override);
 
 void RNA_struct_override_apply(struct Main *bmain,
-   struct PointerRNA *ptr_local,
-   struct PointerRNA *ptr_override,
+   struct PointerRNA *ptr_dst,
+   struct PointerRNA *ptr_src,
struct PointerRNA *ptr_storage,
struct IDOverrideLibrary *override);
 
diff --git a/source/blender/makesrna/intern/rna_access.c 
b/source/blender/makesrna/intern/rna_access.c
index fb3aad8ddba..7b7af5c12db 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -8452,18 +8452,18 @@ static bool rna_property_override_operation_store(Main 
*bmain,
 }
 
 static bool rna_property_override_operation_apply(Main *bmain,
-  PointerRNA *ptr_local,
-  PointerRNA *ptr_override,
+  PointerRNA *ptr_dst,
+  PointerRNA *ptr_src,
   PointerRNA *ptr_storage,
-  PropertyRNA *prop_local,
-  PropertyRNA *prop_override,
+  PropertyRNA *prop_dst,
+  PropertyRNA *prop_src,
   PropertyRNA *prop_storage,
-  PointerRNA *ptr_item_local,
-  PointerRNA 
*ptr_item_override,
+  PointerRNA *ptr_item_dst,
+  PointerRNA *ptr_item_src,
   PointerRNA *ptr_item_storage,
   
IDOverrideLibraryPropertyOperation *opop)
 {
-  int len_local, len_reference, len_storage = 0;
+  int len_dst, len_src, len_storage = 0;
 
   const short override_op = opop->operation;
 
@@ -8493,20 +8493,20 @@ static bool rna_property_override_operation_apply(Main 
*bmain,
 
   RNAPropOverrideApply override_apply = NULL;
   /* Special case for IDProps, we use default callback then. */
-  if (prop_local->magic != RNA_MAGIC) {
+  if (prop_dst->magic != RNA_MAGIC) {
 override_apply = rna_property_override_apply_default;
-if (prop_override->magic == RNA_MAGIC && prop_override->override_apply != 
override_apply) {
+if (prop_src->magic == RNA_MAGIC && prop_src->override_apply != 
override_apply) {
   override_apply = NULL;
 }
   }
-  else if (prop_override->magic != RNA_MAGIC) {
+  else if (prop_src->magic != RNA_MAGIC) {
 override_apply = rna_property_override_apply_default;
-if (prop_local->override_apply != override_apply) {
+if (prop_dst->override_apply != override_apply) {
   override_apply = NULL;
 }
   }
-  else if (prop_local->override_apply == prop_override->override_apply) {
-override_apply = prop_local->override_apply;
+  else if (prop_dst->override_apply == prop_src->override_apply) {
+override_apply = prop_dst->override_apply;
   }
 
   if (ptr_storage && prop_storage->magic == RNA_MAGIC &&
@@ -8517,23 +8517,22 @@ static bool rna_property_override_operation_apply(Main 
*bmain,
   if (override_apply == NULL) {
 #ifndef NDEBUG
 printf("'%s' gives unmatching or NULL RNA copy callbacks, should not 
happen (%d vs. %d).\n",
-   prop_local->magic != RNA_MAGIC ? ((IDProperty *)prop_local)->name :
-prop_local->identifier,
-   prop_local->magic == RNA_MAGIC,
-   prop_override->magic == RNA_MAGIC);
+   

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

2019-08-22 Thread Antonio Vazquez
Commit: cf251d5fd7c585e10858c1702ace1775ed221b3c
Author: Antonio Vazquez
Date:   Thu Aug 22 12:03:11 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBcf251d5fd7c585e10858c1702ace1775ed221b3c

Merge branch 'master' into greasepencil-object

===



===



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


[Bf-blender-cvs] [e9862431cc7] greasepencil-object: GPencil: Create Linear gradient fill colors in SVG conversion

2019-08-22 Thread Antonio Vazquez
Commit: e9862431cc7cea2d914a804129a4ba50857aedf6
Author: Antonio Vazquez
Date:   Thu Aug 22 12:02:31 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBe9862431cc7cea2d914a804129a4ba50857aedf6

GPencil: Create Linear gradient fill colors in SVG conversion

There are several limitations in this conversion because SVG support multiple 
color, but GP only 2. For GP only the extreme colors (first and last) are used.

The mix factor is always set to 0.5.

The angle of the gradient is calculated using the direction of the line defined 
in Linear gradient.

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index ed9f02cdb35..e8b028edd1c 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -3024,19 +3024,30 @@ static void gpencil_convert_spline(Main *bmain,
 
   int r_idx = gpencil_check_same_material_color(ob_gp, color, mat_gp);
   if (r_idx < 0) {
-Material *ma_stroke = NULL;
+Material *mat_curve = give_current_material(ob_cu, 1);
 mat_gp = gpencil_add_from_curve_material(bmain, ob_gp, color, 
gpencil_lines, fill, _idx);
+
+if ((mat_curve) && (mat_curve->gp_style != NULL)) {
+  MaterialGPencilStyle *gp_style_cur = mat_curve->gp_style;
+  MaterialGPencilStyle *gp_style_gp = mat_gp->gp_style;
+
+  copy_v4_v4(gp_style_gp->mix_rgba, gp_style_cur->mix_rgba);
+  gp_style_gp->fill_style = gp_style_cur->fill_style;
+  gp_style_gp->mix_factor = gp_style_cur->mix_factor;
+  gp_style_gp->gradient_angle = gp_style_cur->gradient_angle;
+}
+
 /* If object has more than 1 material, use second material for stroke 
color. */
 if ((ob_cu->totcol > 1) && (give_current_material(ob_cu, 2))) {
-  ma_stroke = give_current_material(ob_cu, 2);
-  linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, _stroke->r);
-  mat_gp->gp_style->stroke_rgba[3] = ma_stroke->a;
+  mat_curve = give_current_material(ob_cu, 2);
+  linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, _curve->r);
+  mat_gp->gp_style->stroke_rgba[3] = mat_curve->a;
 }
 else if (only_stroke) {
   /* Also use the first color if the fill is none for stroke color. */
-  ma_stroke = give_current_material(ob_cu, 1);
-  linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, _stroke->r);
-  mat_gp->gp_style->stroke_rgba[3] = ma_stroke->a;
+  mat_curve = give_current_material(ob_cu, 1);
+  linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, _curve->r);
+  mat_gp->gp_style->stroke_rgba[3] = mat_curve->a;
   /* Set stroke to on. */
   mat_gp->gp_style->flag |= GP_STYLE_STROKE_SHOW;
   /* Set fill to off. */

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


[Bf-blender-cvs] [9644f7c8c7f] functions: New boolean math node with And, Or and Not operation

2019-08-22 Thread Eitan
Commit: 9644f7c8c7f175dce134dcaeeb2c2d46c849317a
Author: Eitan
Date:   Thu Aug 22 11:47:30 2019 +0200
Branches: functions
https://developer.blender.org/rB9644f7c8c7f175dce134dcaeeb2c2d46c849317a

New boolean math node with And, Or and Not operation

===

A   release/scripts/startup/nodes/function_nodes/boolean.py
M   source/blender/functions/CMakeLists.txt
M   source/blender/functions/FN_functions.hpp
M   
source/blender/functions/frontends/data_flow_nodes/mappings/node_inserters.cpp
A   source/blender/functions/functions/boolean.cpp
A   source/blender/functions/functions/boolean.hpp

===

diff --git a/release/scripts/startup/nodes/function_nodes/boolean.py 
b/release/scripts/startup/nodes/function_nodes/boolean.py
new file mode 100644
index 000..1e67bc52388
--- /dev/null
+++ b/release/scripts/startup/nodes/function_nodes/boolean.py
@@ -0,0 +1,51 @@
+import bpy
+from bpy.props import *
+from .. base import FunctionNode
+from .. node_builder import NodeBuilder
+
+operation_items = [
+("AND", "And", "", "", 1),
+("OR", "Or", "", "", 2),
+("NOT", "Not", "", "", 3),
+]
+single_value_operations = {
+"NOT"
+}
+class BooleanMathNode(bpy.types.Node, FunctionNode):
+bl_idname = "fn_BooleanMathNode"
+bl_label = "Boolean Math"
+
+search_terms = (
+("And", {"operation" : "AND"}),
+("Or", {"operation" : "OR"}),
+("Not", {"operation" : "NOT"}),
+)
+
+operation: EnumProperty(
+name="Operation",
+items=operation_items,
+update=FunctionNode.sync_tree,
+)
+
+use_list__a: NodeBuilder.VectorizedProperty()
+use_list__b: NodeBuilder.VectorizedProperty()
+
+def declaration(self, builder: NodeBuilder):
+builder.vectorized_input(
+"a", "use_list__a",
+"A", "A", "Boolean")
+prop_names = ["use_list__a"]
+
+if self.operation not in single_value_operations:
+builder.vectorized_input(
+"b", "use_list__b",
+"B", "B", "Boolean")
+prop_names.append("use_list__b")
+
+
+builder.vectorized_output(
+"result", prop_names,
+"Result", "Result", "Boolean")
+
+def draw(self, layout):
+layout.prop(self, "operation", text="")
diff --git a/source/blender/functions/CMakeLists.txt 
b/source/blender/functions/CMakeLists.txt
index 1142db625d1..3b5115b4036 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -141,6 +141,8 @@ set(SRC
   functions/constants.cpp
   functions/color.hpp
   functions/color.cpp
+  functions/boolean.hpp
+  functions/boolean.cpp
 
   frontends/data_flow_nodes/vtree_data_graph_builder.hpp
   frontends/data_flow_nodes/vtree_data_graph_builder.cpp
diff --git a/source/blender/functions/FN_functions.hpp 
b/source/blender/functions/FN_functions.hpp
index d0e55721d89..b9498cdf370 100644
--- a/source/blender/functions/FN_functions.hpp
+++ b/source/blender/functions/FN_functions.hpp
@@ -13,3 +13,4 @@
 #include "functions/constants.hpp"
 #include "functions/color.hpp"
 #include "functions/array_execution.hpp"
+#include "functions/boolean.hpp"
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/mappings/node_inserters.cpp
 
b/source/blender/functions/frontends/data_flow_nodes/mappings/node_inserters.cpp
index 212ca7b4815..761911d0d23 100644
--- 
a/source/blender/functions/frontends/data_flow_nodes/mappings/node_inserters.cpp
+++ 
b/source/blender/functions/frontends/data_flow_nodes/mappings/node_inserters.cpp
@@ -351,7 +351,42 @@ static void INSERT_compare(VTreeDataGraphBuilder , 
VirtualNode *vnode)
{"use_list__b", Functions::GET_FN_output_float_0()}});
   builder.insert_matching_function(fn, vnode);
 }
+static SharedFunction _boolean_function(int operation)
+{
+  switch (operation) {
+case 1:
+  return Functions::GET_FN_and();
+case 2:
+  return Functions::GET_FN_or();
+case 3:
+  return Functions::GET_FN_not();
+default:
+  BLI_assert(false);
+  return *(SharedFunction *)nullptr;
+  }
+}
 
+static void INSERT_boolean(VTreeDataGraphBuilder , VirtualNode *vnode)
+{
+  PointerRNA rna = vnode->rna();
+  int operation = RNA_enum_get(, "operation");
+  SharedFunction _fn = get_boolean_function(operation);
+  uint input_amount = original_fn->input_amount();
+  if (input_amount == 1) {
+SharedFunction fn = get_vectorized_function(
+original_fn, rna, {{"use_list__a", Functions::GET_FN_output_false()}});
+builder.insert_matching_function(fn, vnode);
+  }
+  else {
+BLI_assert(input_amount == 2);
+SharedFunction fn = get_vectorized_function(
+original_fn,
+rna,
+{{"use_list__a", Functions::GET_FN_output_false()},
+ {"use_list__b", Functions::GET_FN_output_true()}});
+

[Bf-blender-cvs] [1a0a6420637] functions: fix boolean c++/llvm conversion

2019-08-22 Thread Jacques Lucke
Commit: 1a0a6420637c4f8e869935d7a772cc01adce21c5
Author: Jacques Lucke
Date:   Thu Aug 22 11:44:56 2019 +0200
Branches: functions
https://developer.blender.org/rB1a0a6420637c4f8e869935d7a772cc01adce21c5

fix boolean c++/llvm conversion

===

M   source/blender/functions/types/boolean.cpp

===

diff --git a/source/blender/functions/types/boolean.cpp 
b/source/blender/functions/types/boolean.cpp
index c2fe06bb1ef..eeb4b186f35 100644
--- a/source/blender/functions/types/boolean.cpp
+++ b/source/blender/functions/types/boolean.cpp
@@ -16,15 +16,17 @@ class LLVMBool : public TrivialLLVMTypeInfo {
 
   void build_store_ir__copy(CodeBuilder ,
 llvm::Value *value,
-llvm::Value *byte_addr) const override
+llvm::Value *address) const override
   {
+llvm::Value *byte_address = builder.CastToPointerOf(address, 
builder.getInt8Ty());
 llvm::Value *byte_value = builder.CreateCastIntTo8(value, false);
-builder.CreateStore(byte_value, byte_addr);
+builder.CreateStore(byte_value, byte_address);
   }
 
-  llvm::Value *build_load_ir__copy(CodeBuilder , llvm::Value 
*byte_addr) const override
+  llvm::Value *build_load_ir__copy(CodeBuilder , llvm::Value *address) 
const override
   {
-llvm::Value *byte_value = builder.CreateLoad(byte_addr);
+llvm::Value *byte_address = builder.CastToPointerOf(address, 
builder.getInt8Ty());
+llvm::Value *byte_value = builder.CreateLoad(byte_address);
 llvm::Value *value = builder.CreateCastIntTo1(byte_value);
 return value;
   }

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


[Bf-blender-cvs] [2ba233a31fe] master: Nodes: Support for socket shapes other than circle

2019-08-22 Thread Charlie Jolly
Commit: 2ba233a31fead52820763fb6637dcae20eeed574
Author: Charlie Jolly
Date:   Thu Aug 22 11:10:11 2019 +0200
Branches: master
https://developer.blender.org/rB2ba233a31fead52820763fb6637dcae20eeed574

Nodes: Support for socket shapes other than circle

Previously there was already "draw_shape" property,
but it was doing nothing. This commit renames the
property to "display_shape". Furthermore, different
shapes like SQUARE and DIAMOND are supported now.

Currently, the shapes are drawn using the shader that also
draws keyframes. In the future we might want to separate
this.

The new shapes are not used anywhere yet, but they can
be used by addon developers and will probably be useful
when we want to support different kinds node systems later.
For example, different shapes can be used to distinguish
between data and control flow.

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

===

M   source/blender/editors/animation/keyframes_draw.c
M   source/blender/editors/interface/interface_icons.c
M   source/blender/editors/space_clip/clip_dopesheet_draw.c
M   source/blender/editors/space_nla/nla_draw.c
M   source/blender/editors/space_node/node_draw.c
M   source/blender/gpu/shaders/gpu_shader_keyframe_diamond_vert.glsl
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c

===

diff --git a/source/blender/editors/animation/keyframes_draw.c 
b/source/blender/editors/animation/keyframes_draw.c
index 889d27480df..ca7e0eae136 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -814,8 +814,10 @@ static void draw_keylist(View2D *v2d,
   uint outline_color_id = GPU_vertformat_attr_add(
   format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
   uint flags_id = GPU_vertformat_attr_add(format, "flags", GPU_COMP_U32, 
1, GPU_FETCH_INT);
-  immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
+
   GPU_program_point_size(true);
+  immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
+  immUniform1f("outline_scale", 1.0f);
   immUniform2f(
   "ViewportSize", BLI_rcti_size_x(>mask) + 1, 
BLI_rcti_size_y(>mask) + 1);
   immBegin(GPU_PRIM_POINTS, key_len);
diff --git a/source/blender/editors/interface/interface_icons.c 
b/source/blender/editors/interface/interface_icons.c
index e9aa18394fa..2a9c5c7352a 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -317,8 +317,9 @@ static void vicon_keytype_draw_wrapper(
   format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
   uint flags_id = GPU_vertformat_attr_add(format, "flags", GPU_COMP_U32, 1, 
GPU_FETCH_INT);
 
-  immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
   GPU_program_point_size(true);
+  immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
+  immUniform1f("outline_scale", 1.0f);
   immUniform2f("ViewportSize", -1.0f, -1.0f);
   immBegin(GPU_PRIM_POINTS, 1);
 
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c 
b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index 599a92ff77f..3c2d3eb1d97 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -222,8 +222,9 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, 
Scene *scene)
   format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
   uint flags_id = GPU_vertformat_attr_add(format, "flags", GPU_COMP_U32, 
1, GPU_FETCH_INT);
 
-  immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
   GPU_program_point_size(true);
+  immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
+  immUniform1f("outline_scale", 1.0f);
   immUniform2f(
   "ViewportSize", BLI_rcti_size_x(>mask) + 1, 
BLI_rcti_size_y(>mask) + 1);
   immBegin(GPU_PRIM_POINTS, keyframe_len);
diff --git a/source/blender/editors/space_nla/nla_draw.c 
b/source/blender/editors/space_nla/nla_draw.c
index 5cf9646210e..9d6ccd6fe35 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -141,8 +141,10 @@ static void nla_action_draw_keyframes(
 uint outline_color_id = GPU_vertformat_attr_add(
 format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
 uint flags_id = GPU_vertformat_attr_add(format, "flags", GPU_COMP_U32, 1, 
GPU_FETCH_INT);
-immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
+
 GPU_program_point_size(true);
+immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
+immUniform1f("outline_scale", 1.0f);
 immUniform2f("ViewportSize", BLI_rcti_size_x(>mask) + 1, 
BLI_rcti_size_y(>mask) + 1);
 immBegin(GPU_PRIM_POINTS, key_len);
 
diff --git