[Bf-blender-cvs] [f889050aea7] master: Fix T62757: Mirror operator fails for non-modal execution

2019-03-19 Thread Campbell Barton
Commit: f889050aea70c2ff3c36c8c8600dd2b02d5e9f91
Author: Campbell Barton
Date:   Wed Mar 20 16:41:00 2019 +1100
Branches: master
https://developer.blender.org/rBf889050aea70c2ff3c36c8c8600dd2b02d5e9f91

Fix T62757: Mirror operator fails for non-modal execution

Unlike most transform operators that use an orientation and values,
Mirror uses the constraint axes to define which axes are mirrored.

Now constraint axes are shown in this case.

Other changes:

- Use 'EXEC_DEFAULT' for mirror menu items.
- Show mirror on local axis when not in edit-mode since this is useful
  in object mode too.
- Remove mirror vertex groups since this is in the vertex group menu and
  this menu isn't currently used for general symmetry operators which
  are currently in other menus.

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform_ops.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index c38c99676af..3c27cd03e1c 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -511,32 +511,16 @@ class VIEW3D_MT_mirror(Menu):
 
 layout.separator()
 
-layout.operator_context = 'INVOKE_REGION_WIN'
+layout.operator_context = 'EXEC_REGION_WIN'
 
-props = layout.operator("transform.mirror", text="X Global")
-props.constraint_axis = (True, False, False)
-props.orient_type = 'GLOBAL'
-props = layout.operator("transform.mirror", text="Y Global")
-props.constraint_axis = (False, True, False)
-props.orient_type = 'GLOBAL'
-props = layout.operator("transform.mirror", text="Z Global")
-props.constraint_axis = (False, False, True)
-props.orient_type = 'GLOBAL'
-
-if context.edit_object:
-layout.separator()
+for (space_name, space_id) in (("Global", 'GLOBAL'), ("Local", 
'LOCAL')):
+for axis_index, axis_name in enumerate("XYZ"):
+props = layout.operator("transform.mirror", 
text=f"{axis_name!s} {space_name!s}")
+props.constraint_axis[axis_index] = True
+props.orient_type = 'GLOBAL'
 
-props = layout.operator("transform.mirror", text="X Local")
-props.constraint_axis = (True, False, False)
-props.orient_type = 'LOCAL'
-props = layout.operator("transform.mirror", text="Y Local")
-props.constraint_axis = (False, True, False)
-props.orient_type = 'LOCAL'
-props = layout.operator("transform.mirror", text="Z Local")
-props.constraint_axis = (False, False, True)
-props.orient_type = 'LOCAL'
-
-layout.operator("object.vertex_group_mirror")
+if space_id == 'GLOBAL':
+layout.separator()
 
 
 class VIEW3D_MT_snap(Menu):
diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index c447d75657b..dd71084c51f 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2633,7 +2633,10 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator 
*op, const wmEvent *eve
}
 
/* Constraint init from operator */
-   if (t->flag & T_MODAL) {
+   if ((t->flag & T_MODAL) ||
+   /* For mirror operator the constraint axes are effectively the 
values. */
+   (RNA_struct_find_property(op->ptr, "values") == NULL))
+   {
if ((prop = RNA_struct_find_property(op->ptr, 
"constraint_axis")) &&
RNA_property_is_set(op->ptr, prop))
{
@@ -2644,21 +2647,14 @@ bool initTransform(bContext *C, TransInfo *t, 
wmOperator *op, const wmEvent *eve
if (constraint_axis[0] || constraint_axis[1] || 
constraint_axis[2]) {
t->con.mode |= CON_APPLY;
 
-   /* Only for interactive operation, when 
redoing, ignore these values since the numbers
-* will be constrainted already. */
-   if (t->flag & T_MODAL) {
-   if (constraint_axis[0]) {
-   t->con.mode |= CON_AXIS0;
-   }
-   if (constraint_axis[1]) {
-   t->con.mode |= CON_AXIS1;
-   }
-   if (constraint_axis[2]) {
-   t->con.mode |= CON_AXIS2;
-   }
+   if 

[Bf-blender-cvs] [dc800154b61] master: 3D View: snap cursor to world origin now resets rotation

2019-03-19 Thread Campbell Barton
Commit: dc800154b619de64d2de7dae5f81154af343ccd2
Author: Campbell Barton
Date:   Wed Mar 20 15:45:10 2019 +1100
Branches: master
https://developer.blender.org/rBdc800154b619de64d2de7dae5f81154af343ccd2

3D View: snap cursor to world origin now resets rotation

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_snap.c 
b/source/blender/editors/space_view3d/view3d_snap.c
index 755f14aea2f..862fc78649f 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -40,6 +40,7 @@
 #include "BKE_mball.h"
 #include "BKE_object.h"
 #include "BKE_report.h"
+#include "BKE_scene.h"
 #include "BKE_tracking.h"
 
 #include "DEG_depsgraph.h"
@@ -800,12 +801,15 @@ void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot)
 
 /*  */
 
-/** Snaps the 3D cursor location to the origin. */
+/** Snaps the 3D cursor location to the origin and clears cursor rotation. */
 static int snap_curs_to_center_exec(bContext *C, wmOperator *UNUSED(op))
 {
Scene *scene = CTX_data_scene(C);
+   float mat3[3][3];
+   unit_m3(mat3);
 
zero_v3(scene->cursor.location);
+   BKE_scene_cursor_mat3_to_rot(>cursor, mat3, false);
 
DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);

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


[Bf-blender-cvs] [fe7c7d2820f] master: Fix T62736: Inconsistent behavior bpy.utils.user_resource()

2019-03-19 Thread Philipp Oeser
Commit: fe7c7d2820f84b815eec5d9c322c7192f33b04b8
Author: Philipp Oeser
Date:   Wed Mar 20 15:17:32 2019 +1100
Branches: master
https://developer.blender.org/rBfe7c7d2820f84b815eec5d9c322c7192f33b04b8

Fix T62736: Inconsistent behavior bpy.utils.user_resource()

If a subfolder was specified which didn't exist, logic would fallback
to get_path_user (instead of get_path_environment).

Now always use the from the environment variable if it's set and exists.

===

M   source/blender/blenkernel/intern/appdir.c
M   source/blender/python/intern/bpy.c

===

diff --git a/source/blender/blenkernel/intern/appdir.c 
b/source/blender/blenkernel/intern/appdir.c
index bb0b9a23431..c8882be0dd0 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -244,7 +244,7 @@ bool BKE_appdir_app_is_portable_install(void)
  * \param targetpath: String to return path.
  * \param subfolder_name: optional name of subfolder within folder.
  * \param envvar: name of environment variable to check folder_name.
- * \return true if it was able to construct such a path.
+ * \return true if it was able to construct such a path and the path exists.
  */
 static bool get_path_environment(
 char *targetpath,
@@ -271,6 +271,35 @@ static bool get_path_environment(
return false;
 }
 
+/**
+ * Returns the path of a folder from environment variables
+ *
+ * \param targetpath: String to return path.
+ * \param subfolder_name: optional name of subfolder within folder.
+ * \param envvar: name of environment variable to check folder_name.
+ * \return true if it was able to construct such a path.
+ */
+static bool get_path_environment_notest(
+char *targetpath,
+size_t targetpath_len,
+const char *subfolder_name,
+const char *envvar)
+{
+   char user_path[FILE_MAX];
+
+   if (test_env_path(user_path, envvar)) {
+   if (subfolder_name) {
+   BLI_join_dirfile(targetpath, targetpath_len, user_path, 
subfolder_name);
+   return true;
+   }
+   else {
+   BLI_strncpy(targetpath, user_path, FILE_MAX);
+   return true;
+   }
+   }
+   return false;
+}
+
 /**
  * Returns the path of a folder within the user-files area.
  * \param targetpath: String to return path
@@ -447,19 +476,19 @@ const char *BKE_appdir_folder_id_user_notest(const int 
folder_id, const char *su
 
switch (folder_id) {
case BLENDER_USER_DATAFILES:
-   if (get_path_environment(path, sizeof(path), subfolder, 
"BLENDER_USER_DATAFILES")) break;
+   if (get_path_environment_notest(path, sizeof(path), 
subfolder, "BLENDER_USER_DATAFILES")) break;
get_path_user(path, sizeof(path), "datafiles", 
subfolder, ver);
break;
case BLENDER_USER_CONFIG:
-   if (get_path_environment(path, sizeof(path), subfolder, 
"BLENDER_USER_CONFIG")) break;
+   if (get_path_environment_notest(path, sizeof(path), 
subfolder, "BLENDER_USER_CONFIG")) break;
get_path_user(path, sizeof(path), "config", subfolder, 
ver);
break;
case BLENDER_USER_AUTOSAVE:
-   if (get_path_environment(path, sizeof(path), subfolder, 
"BLENDER_USER_AUTOSAVE")) break;
+   if (get_path_environment_notest(path, sizeof(path), 
subfolder, "BLENDER_USER_AUTOSAVE")) break;
get_path_user(path, sizeof(path), "autosave", 
subfolder, ver);
break;
case BLENDER_USER_SCRIPTS:
-   if (get_path_environment(path, sizeof(path), subfolder, 
"BLENDER_USER_SCRIPTS")) break;
+   if (get_path_environment_notest(path, sizeof(path), 
subfolder, "BLENDER_USER_SCRIPTS")) break;
get_path_user(path, sizeof(path), "scripts", subfolder, 
ver);
break;
default:
diff --git a/source/blender/python/intern/bpy.c 
b/source/blender/python/intern/bpy.c
index 05b471c4db7..55d226e1461 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -167,10 +167,7 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), 
PyObject *args, PyObj
}
 
/* same logic as BKE_appdir_folder_id_create(), but best leave it up to 
the script author to create */
-   path = BKE_appdir_folder_id(folder_id, subdir);
-
-   if (!path)
-   path = BKE_appdir_folder_id_user_notest(folder_id, subdir);
+   path = BKE_appdir_folder_id_user_notest(folder_id, subdir);
 
return PyC_UnicodeFromByte(path ? path : "");
 }


[Bf-blender-cvs] [4e2aea5efea] master: DRW: minor optimization for edit-mesh conversion

2019-03-19 Thread Campbell Barton
Commit: 4e2aea5efea31262ce46240baa0511e85a021332
Author: Campbell Barton
Date:   Wed Mar 20 15:05:25 2019 +1100
Branches: master
https://developer.blender.org/rB4e2aea5efea31262ce46240baa0511e85a021332

DRW: minor optimization for edit-mesh conversion

Finding visible connected elements is often a direct lookup
when they're not connected to hidden geometry.

Add inline wrappers that avoid a function call,
gives minor speedup creating GPU edit-mesh data.

===

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

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 3e1b6b6c020..4e064111245 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -84,6 +84,40 @@ enum {
DRW_MESH_WEIGHT_STATE_AUTO_NORMALIZE  = (1 << 1),
 };
 
+/* -- */
+/** \name BMesh Inline Wrappers
+ * \{ */
+
+/**
+ * Wrapper for #BM_vert_find_first_loop_visible
+ * since most of the time this can be accessed directly without a function 
call.
+ */
+BLI_INLINE BMLoop *bm_vert_find_first_loop_visible_inline(BMVert *v)
+{
+   if (v->e) {
+   BMLoop *l = v->e->l;
+   if (l && !BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
+   return l->v == v ? l : l->next;
+   }
+   return BM_vert_find_first_loop_visible(v);
+   }
+   return NULL;
+}
+
+BLI_INLINE BMLoop *bm_edge_find_first_loop_visible_inline(BMEdge *e)
+{
+   if (e->l) {
+   BMLoop *l = e->l;
+   if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
+   return l;
+   }
+   return BM_edge_find_first_loop_visible(e);
+   }
+   return NULL;
+}
+
+/** \} */
+
 /* -- */
 /** \name Mesh/BMesh Interface (direct access to basic data).
  * \{ */
@@ -3426,8 +3460,8 @@ static void mesh_create_loops_lines(
if (!BM_elem_flag_test(bm_edge, BM_ELEM_HIDDEN) 
&&
bm_edge->l != NULL)
{
-   BMLoop *bm_loop1 = 
BM_vert_find_first_loop_visible(bm_edge->v1);
-   BMLoop *bm_loop2 = 
BM_vert_find_first_loop_visible(bm_edge->v2);
+   BMLoop *bm_loop1 = 
bm_vert_find_first_loop_visible_inline(bm_edge->v1);
+   BMLoop *bm_loop2 = 
bm_vert_find_first_loop_visible_inline(bm_edge->v2);
int v1 = BM_elem_index_get(bm_loop1);
int v2 = BM_elem_index_get(bm_loop2);
if (v1 > v2) {
@@ -3669,7 +3703,7 @@ static void 
mesh_create_edit_loops_points_lines(MeshRenderData *rdata, GPUIndexB
BMEdge *eed;
BM_ITER_MESH (eed, , bm, BM_EDGES_OF_MESH) {
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
-   BMLoop *l = 
BM_edge_find_first_loop_visible(eed);
+   BMLoop *l = 
bm_edge_find_first_loop_visible_inline(eed);
if (l != NULL) {
int v1 = 
BM_elem_index_get(eed->l);
int v2 = 
BM_elem_index_get(eed->l->next);
@@ -3683,7 +3717,7 @@ static void 
mesh_create_edit_loops_points_lines(MeshRenderData *rdata, GPUIndexB
BMVert *eve;
BM_ITER_MESH (eve, , bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
-   BMLoop *l = 
BM_vert_find_first_loop_visible(eve);
+   BMLoop *l = 
bm_vert_find_first_loop_visible_inline(eve);
if (l != NULL) {
int v = BM_elem_index_get(l);

GPU_indexbuf_add_generic_vert(_vert, v);

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


[Bf-blender-cvs] [726773588cc] sculpt-mode-features: Voxel Remesher: Add remesher parameters to mesh datablock

2019-03-19 Thread Pablo Dobarro
Commit: 726773588cc15be80f9298bd7f0e4039dddea995
Author: Pablo Dobarro
Date:   Wed Mar 20 03:34:07 2019 +0100
Branches: sculpt-mode-features
https://developer.blender.org/rB726773588cc15be80f9298bd7f0e4039dddea995

Voxel Remesher: Add remesher parameters to mesh datablock

I tested several UI integrations:
-Running the remesher from an operator and adjusting the parameters with
the redo panel freezes the interface with high-res meshes. It looks
cool, but it is not that useful.
-Integrating it into a tool does not store per object remesh
configurations. It also forces the user to switch the tool when he/she is
sculpting just to recalculate the topology.

Storing the remesher options per mesh is the best option I found. Now,
the remesher is found in the properties panel under the mesh tab. The
user can assign it to the quick favorites menu or add a keyboard
shortcut.
Remesher parameters can be adjusted there. They are stored per mesh.
This way, remesher parameters of each mesh are preserved when sculpting
different objects at different levels of details. In the future, the user
will be able to choose different remeshing algorithms (triangulation,
quadriflow...) from there and assign them to the mesh. All of them will
be executed by the same remesh operator and some of them will share some
options (like smooth normals).

===

M   release/scripts/startup/bl_ui/properties_data_mesh.py
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/mesh/editmesh_add.c
M   source/blender/editors/object/object_edit.c
M   source/blender/makesdna/DNA_mesh_types.h
M   source/blender/makesrna/intern/rna_mesh.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py 
b/release/scripts/startup/bl_ui/properties_data_mesh.py
index eacf027c491..de178496c56 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -454,6 +454,22 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, Panel):
 col.operator("mesh.vertex_color_remove", icon='REMOVE', text="")
 
 
+class DATA_PT_remesh(MeshButtonsPanel, Panel):
+bl_label = "Remesh"
+bl_options = {'DEFAULT_CLOSED'}
+COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+def draw(self, context):
+layout = self.layout
+layout.use_property_split = True
+col = layout.column()
+
+mesh = context.mesh
+col.prop(mesh, "voxel_size")
+col.prop(mesh, "smooth_normals")
+col.operator("object.remesh", text="Remesh")
+
+
 class DATA_PT_customdata(MeshButtonsPanel, Panel):
 bl_label = "Geometry Data"
 bl_options = {'DEFAULT_CLOSED'}
@@ -503,6 +519,7 @@ classes = (
 DATA_PT_uv_texture,
 DATA_PT_vertex_colors,
 DATA_PT_face_maps,
+DATA_PT_remesh,
 DATA_PT_normals,
 DATA_PT_normals_auto_smooth,
 DATA_PT_texture_space,
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 47a69ff7f63..ff95e094ea4 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2927,5 +2927,11 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
part->draw_as = PART_DRAW_NOT;
}
}
+
+   if (!DNA_struct_elem_find(fd->filesdna, "Mesh", "float", 
"voxel_size")) {
+   for (Mesh *me = bmain->meshes.first; me; me = 
me->id.next) {
+   me->voxel_size = 0.1f;
+   }
+   }
}
 }
diff --git a/source/blender/editors/mesh/editmesh_add.c 
b/source/blender/editors/mesh/editmesh_add.c
index aca8fac8bf7..7cbd17c0aa7 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -27,11 +27,13 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_mesh_types.h"
 
 #include "BLT_translation.h"
 
 #include "BKE_context.h"
 #include "BKE_editmesh.h"
+#include "BKE_mesh.h"
 
 #include "RNA_define.h"
 #include "RNA_access.h"
@@ -94,6 +96,10 @@ static void make_prim_finish(bContext *C, Object *obedit, 
const MakePrimitiveDat
/* userdef */
if (exit_editmode) {
ED_object_editmode_exit(C, EM_FREEDATA);
+   //TODO: Find a better place to init this
+   Mesh *me;
+   me = obedit->data;
+   me->voxel_size = 0.1f;
}
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
 }
diff --git a/source/blender/editors/object/object_edit.c 
b/source/blender/editors/object/object_edit.c
index ba1c07c24b6..a71718431b3 100644
--- 

[Bf-blender-cvs] [47ba487e05d] master: UI: center floating popovers

2019-03-19 Thread Campbell Barton
Commit: 47ba487e05daf73018f7fd3af0a44d46228e9fd6
Author: Campbell Barton
Date:   Wed Mar 20 12:34:22 2019 +1100
Branches: master
https://developer.blender.org/rB47ba487e05daf73018f7fd3af0a44d46228e9fd6

UI: center floating popovers

Tweak placement so useful items are more likely to be nearby,
centering horizontally and align vertically to the first button.

===

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

===

diff --git a/source/blender/editors/interface/interface_region_popover.c 
b/source/blender/editors/interface/interface_region_popover.c
index 9fcf2a51652..d15eb7a3246 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -201,7 +201,11 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, 
uiPopupBlockHandle *handle, v
 
if (!handle->refresh) {
uiBut *but = NULL;
+   uiBut *but_first = NULL;
for (but = block->buttons.first; but; but = but->next) {
+   if ((but_first == NULL) && 
ui_but_is_editable(but)) {
+   but_first = but;
+   }
if (but->flag & (UI_SELECT | UI_SELECT_DRAW)) {
break;
}
@@ -209,7 +213,11 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, 
uiPopupBlockHandle *handle, v
 
if (but) {
bounds_offset[0] = -(but->rect.xmin + 0.8f * 
BLI_rctf_size_x(>rect));
-   bounds_offset[1] = -(but->rect.ymin + 0.5f * 
BLI_rctf_size_y(>rect));
+   bounds_offset[1] = -BLI_rctf_cent_y(>rect);
+   }
+   else {
+   bounds_offset[0] = -(pup->ui_size_x / 2);
+   bounds_offset[1] = but_first ? 
-BLI_rctf_cent_y(_first->rect) : (UI_UNIT_Y / 2);
}
copy_v2_v2_int(handle->prev_bounds_offset, 
bounds_offset);
}

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


[Bf-blender-cvs] [53f4fc7da9d] master: Cleanup: style

2019-03-19 Thread Campbell Barton
Commit: 53f4fc7da9d4b7acd613430bfd0f97536cc164de
Author: Campbell Barton
Date:   Wed Mar 20 10:44:13 2019 +1100
Branches: master
https://developer.blender.org/rB53f4fc7da9d4b7acd613430bfd0f97536cc164de

Cleanup: style

===

M   release/scripts/startup/bl_ui/properties_animviz.py
M   release/scripts/startup/bl_ui/properties_data_armature.py
M   release/scripts/startup/bl_ui/properties_data_light.py
M   release/scripts/startup/bl_ui/properties_freestyle.py
M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   release/scripts/startup/bl_ui/properties_object.py
M   release/scripts/startup/bl_ui/properties_paint_common.py
M   release/scripts/startup/bl_ui/space_sequencer.py
M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M   release/scripts/startup/bl_ui/space_topbar.py
M   release/scripts/startup/bl_ui/space_userpref.py
M   release/scripts/startup/bl_ui/space_view3d_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/properties_animviz.py 
b/release/scripts/startup/bl_ui/properties_animviz.py
index 54a1fb71a2b..10a3d1ddb91 100644
--- a/release/scripts/startup/bl_ui/properties_animviz.py
+++ b/release/scripts/startup/bl_ui/properties_animviz.py
@@ -48,7 +48,6 @@ class MotionPathButtonsPanel:
 else:
 row.operator("object.paths_range_update", text="", icon='TIME')
 
-
 if mps.type == 'CURRENT_FRAME':
 col = layout.column(align=True)
 col.prop(mps, "frame_before", text="Frame Range Before")
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py 
b/release/scripts/startup/bl_ui/properties_data_armature.py
index 4f639aa4bc9..2fa076c3794 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -21,6 +21,10 @@ import bpy
 from bpy.types import Panel, Menu
 from rna_prop_ui import PropertyPanel
 
+from .properties_animviz import (
+MotionPathButtonsPanel,
+MotionPathButtonsPanel_display,
+)
 
 class ArmatureButtonsPanel:
 bl_space_type = 'PROPERTIES'
@@ -257,12 +261,6 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
 col.prop(itasc, "damping_epsilon", text="Damping Epsilon", 
slider=True)
 
 
-from .properties_animviz import (
-MotionPathButtonsPanel,
-MotionPathButtonsPanel_display,
-)
-
-
 class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):
 #bl_label = "Bones Motion Paths"
 bl_options = {'DEFAULT_CLOSED'}
diff --git a/release/scripts/startup/bl_ui/properties_data_light.py 
b/release/scripts/startup/bl_ui/properties_data_light.py
index acda015f8d4..3d78b3a664d 100644
--- a/release/scripts/startup/bl_ui/properties_data_light.py
+++ b/release/scripts/startup/bl_ui/properties_data_light.py
@@ -154,7 +154,10 @@ class DATA_PT_EEVEE_shadow(DataButtonsPanel, Panel):
 def poll(cls, context):
 light = context.light
 engine = context.engine
-return (light and light.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) and 
(engine in cls.COMPAT_ENGINES)
+return (
+(light and light.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) and
+(engine in cls.COMPAT_ENGINES)
+)
 
 def draw_header(self, context):
 light = context.light
@@ -219,7 +222,10 @@ class DATA_PT_EEVEE_shadow_contact(DataButtonsPanel, 
Panel):
 def poll(cls, context):
 light = context.light
 engine = context.engine
-return (light and light.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) and 
(engine in cls.COMPAT_ENGINES)
+return (
+(light and light.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) and
+(engine in cls.COMPAT_ENGINES)
+)
 
 def draw_header(self, context):
 light = context.light
@@ -303,7 +309,10 @@ class DATA_PT_falloff_curve(DataButtonsPanel, Panel):
 light = context.light
 engine = context.engine
 
-return (light and light.type in {'POINT', 'SPOT'} and 
light.falloff_type == 'CUSTOM_CURVE') and (engine in cls.COMPAT_ENGINES)
+return (
+(light and light.type in {'POINT', 'SPOT'} and light.falloff_type 
== 'CUSTOM_CURVE') and
+(engine in cls.COMPAT_ENGINES)
+)
 
 def draw(self, context):
 light = context.light
diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py 
b/release/scripts/startup/bl_ui/properties_freestyle.py
index 19795cd4da2..a4c109b150a 100644
--- a/release/scripts/startup/bl_ui/properties_freestyle.py
+++ b/release/scripts/startup/bl_ui/properties_freestyle.py
@@ -190,7 +190,15 @@ class 
VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel
 
 row = layout.row()
 rows = 4 if lineset else 2
-row.template_list("VIEWLAYER_UL_linesets", "", freestyle, 

[Bf-blender-cvs] [310a1f728cf] master: Cleanup: unused vars

2019-03-19 Thread Campbell Barton
Commit: 310a1f728cf4ab3ca50f40c62e4ff4f4b280d62b
Author: Campbell Barton
Date:   Wed Mar 20 10:26:53 2019 +1100
Branches: master
https://developer.blender.org/rB310a1f728cf4ab3ca50f40c62e4ff4f4b280d62b

Cleanup: unused vars

===

M   release/scripts/startup/bl_operators/object.py
M   release/scripts/startup/bl_operators/wm.py
M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   release/scripts/startup/bl_ui/properties_paint_common.py
M   release/scripts/startup/bl_ui/space_image.py
M   release/scripts/startup/bl_ui/space_view3d_toolbar.py

===

diff --git a/release/scripts/startup/bl_operators/object.py 
b/release/scripts/startup/bl_operators/object.py
index 65490e5f659..22da314aea5 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -905,7 +905,6 @@ class LoadImageAsEmpty:
 
 def execute(self, context):
 scene = context.scene
-space = context.space_data
 cursor = scene.cursor.location
 
 try:
diff --git a/release/scripts/startup/bl_operators/wm.py 
b/release/scripts/startup/bl_operators/wm.py
index 9e0e090fb28..6bda41ba837 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1125,7 +1125,6 @@ class WM_OT_properties_edit(Operator):
 )
 
 data_path = self.data_path
-value = self.value
 prop = self.property
 
 prop_old = getattr(self, "_last_prop", [None])[0]
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index d08cb0ac41f..b047bbdcfec 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -622,8 +622,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 layout.separator()
 col = layout.column()
 
-flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, 
even_rows=False, align=False)
-
 col.label(text="Textures:")
 row = layout.row()
 row.prop(md, "use_mirror_u", text="Flip U")
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index 913643f6d84..0664c407ab3 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -137,8 +137,6 @@ def brush_texpaint_common(panel, context, layout, brush, 
settings, projpaint=Fal
 
 
 def brush_texpaint_common_clone(panel, context, layout, brush, settings, 
projpaint=False):
-capabilities = brush.image_paint_capabilities
-
 ob = context.active_object
 col = layout.column()
 
@@ -179,8 +177,6 @@ def brush_texpaint_common_color(panel, context, layout, 
brush, settings, projpai
 
 
 def brush_texpaint_common_gradient(panel, context, layout, brush, settings, 
projpaint=False):
-capabilities = brush.image_paint_capabilities
-
 layout.template_color_ramp(brush, "gradient", expand=True)
 
 layout.use_property_split = True
@@ -349,7 +345,6 @@ def brush_basic_sculpt_settings(layout, context, brush, *, 
compact=False):
 tool_settings = context.tool_settings
 capabilities = brush.sculpt_capabilities
 settings = tool_settings.gpencil_sculpt
-tool = settings.sculpt_tool
 
 row = layout.row(align=True)
 
diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index aa782278071..de0b6f8cc1d 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -1463,10 +1463,6 @@ class IMAGE_PT_uv_cursor(Panel):
 layout = self.layout
 
 sima = context.space_data
-ima = sima.image
-
-
-uvedit = sima.uv_editor
 
 col = layout.column()
 
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 0d660c2efb3..a358233a5d0 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -226,7 +226,6 @@ class VIEW3D_PT_tools_particlemode(Panel, View3DPaintPanel):
 def draw(self, context):
 layout = self.layout
 
-tool_settings = context.tool_settings
 settings = self.paint_settings(context)
 brush = settings.brush
 tool = settings.tool
@@ -280,7 +279,6 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
 layout.use_property_split = True
 layout.use_property_decorate = False  # No animation.
 
-tool_settings = context.tool_settings
 settings = self.paint_settings(context)
 brush = settings.brush
 
@@ -1336,7 +1334,6 @@ class VIEW3D_PT_tools_vertexpaint(Panel, 

[Bf-blender-cvs] [603a37fa89b] master: Fix T59719 Bake Indirect Lighting doesn't update env map reflection

2019-03-19 Thread Clément Foucault
Commit: 603a37fa89bd1db1dc3c717b8d4b76a3abbb759a
Author: Clément Foucault
Date:   Tue Mar 19 23:55:15 2019 +0100
Branches: master
https://developer.blender.org/rB603a37fa89bd1db1dc3c717b8d4b76a3abbb759a

Fix T59719 Bake Indirect Lighting doesn't update env map reflection

===

M   source/blender/draw/engines/eevee/eevee_engine.c
M   source/blender/draw/engines/eevee/eevee_lightprobes.c

===

diff --git a/source/blender/draw/engines/eevee/eevee_engine.c 
b/source/blender/draw/engines/eevee/eevee_engine.c
index 54c1415ca49..b1e2f12788d 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -388,7 +388,7 @@ static void eevee_id_world_update(void *vedata, World *wo)
EEVEE_WorldEngineData *wedata = EEVEE_world_data_ensure(wo);
 
if (wedata != NULL && wedata->dd.recalc != 0) {
-   if ((lcache->flag & (LIGHTCACHE_BAKED | LIGHTCACHE_BAKING)) == 
0) {
+   if ((lcache->flag & LIGHTCACHE_BAKING) == 0) {
lcache->flag |= LIGHTCACHE_UPDATE_WORLD;
}
wedata->dd.recalc = 0;
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c 
b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 4baeff7ab5e..04e2cbb37ab 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -1209,7 +1209,9 @@ void EEVEE_lightprobes_refresh(EEVEE_ViewLayerData 
*sldata, EEVEE_Data *vedata)
const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
LightCache *light_cache = vedata->stl->g_data->light_cache;
 
-   if (light_cache->flag & LIGHTCACHE_UPDATE_WORLD) {
+   if ((light_cache->flag & LIGHTCACHE_UPDATE_WORLD) &&
+   (light_cache->flag & LIGHTCACHE_BAKED) == 0)
+   {
DRWMatrixState saved_mats;
DRW_viewport_matrix_get_all(_mats);
EEVEE_lightbake_update_world_quick(sldata, vedata, scene_eval);

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


[Bf-blender-cvs] [af8fe4e94e7] sculpt-mode-features: Voxel remesher: Add support for undo from sculpt mode

2019-03-19 Thread Pablo Dobarro
Commit: af8fe4e94e79baf2830a6766781d21fe60bc06c2
Author: Pablo Dobarro
Date:   Tue Mar 19 23:07:22 2019 +0100
Branches: sculpt-mode-features
https://developer.blender.org/rBaf8fe4e94e79baf2830a6766781d21fe60bc06c2

Voxel remesher: Add support for undo from sculpt mode

Only undo for now, no redo.
This will need a lot of work and refactoring in the future (it has a lot
of bugs), but now it is safer to test new features without losing work.

===

M   source/blender/editors/object/CMakeLists.txt
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/editors/sculpt_paint/sculpt_undo.c

===

diff --git a/source/blender/editors/object/CMakeLists.txt 
b/source/blender/editors/object/CMakeLists.txt
index 3211784e126..90294bc6f67 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -33,6 +33,7 @@ set(INC
../../python
../../render/extern/include
../../windowmanager
+   ../sculpt_paint
../../../../intern/guardedalloc
../../../../intern/glew-mx
 )
diff --git a/source/blender/editors/object/object_edit.c 
b/source/blender/editors/object/object_edit.c
index 7a807206bda..ba1c07c24b6 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -113,6 +113,7 @@
 #include "WM_toolsystem.h"
 
 #include "object_intern.h"  // own include
+#include "sculpt_intern.h"
 
 #ifdef WITH_OPENVDB
#include "openvdb_capi.h"
@@ -1764,6 +1765,20 @@ static int remesh_exec(bContext *C, wmOperator *op)
}
 
if (ob->type == OB_MESH) {
+
+   if (ob->mode == OB_MODE_SCULPT) {
+   Depsgraph *depsgraph = CTX_data_depsgraph(C);
+   struct Scene *scene = CTX_data_scene(C);
+   Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
+   BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, 
ob, true, true);
+   PBVH *pbvh;
+   PBVHNode **nodes;
+   int totnode;
+   pbvh = ob->sculpt->pbvh;
+   BKE_pbvh_search_gather(pbvh, NULL, NULL, , 
);
+   sculpt_undo_push_begin("voxel remesh");
+   sculpt_undo_push_node(ob, nodes[0], SCULPT_UNDO_REMESH);
+   }
Mesh *mesh = ob->data;
BKE_mesh_runtime_looptri_recalc(mesh);
const MLoopTri *looptri = BKE_mesh_runtime_looptri_ensure(mesh);
@@ -1816,6 +1831,9 @@ static int remesh_exec(bContext *C, wmOperator *op)
if (RNA_boolean_get(op->ptr, "smooth_normals")) {
BKE_mesh_smooth_flag_set(ob, true);
}
+   if (ob->mode == OB_MODE_SCULPT) {
+   sculpt_undo_push_end();
+   }
 
BKE_mesh_batch_cache_dirty_tag(ob->data, 
BKE_MESH_BATCH_DIRTY_ALL);
DEG_relations_tag_update(bmain);
@@ -1828,7 +1846,6 @@ static int remesh_exec(bContext *C, wmOperator *op)
MEM_freeN(verttri);
MEM_freeN(rmd.out_verts);
MEM_freeN(rmd.out_faces);
-
return OPERATOR_FINISHED;
}
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h 
b/source/blender/editors/sculpt_paint/sculpt_intern.h
index bc1462cbb7e..acc5d60df20 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -28,11 +28,13 @@
 #include "DNA_listBase.h"
 #include "DNA_vec_types.h"
 #include "DNA_key_types.h"
+#include "DNA_mesh_types.h"
 
 #include "BLI_bitmap.h"
 #include "BLI_threads.h"
 
 #include "BKE_pbvh.h"
+#include "BKE_mesh.h"
 
 struct KeyBlock;
 struct Object;
@@ -83,6 +85,7 @@ typedef enum {
SCULPT_UNDO_DYNTOPO_BEGIN,
SCULPT_UNDO_DYNTOPO_END,
SCULPT_UNDO_DYNTOPO_SYMMETRIZE,
+   SCULPT_UNDO_REMESH,
 } SculptUndoType;
 
 typedef struct SculptUndoNode {
@@ -126,6 +129,17 @@ typedef struct SculptUndoNode {
/* shape keys */
char shapeName[sizeof(((KeyBlock *)0))->name];
 
+   /* remesh operations */
+   bool remesh_applied;
+   CustomData remesh_vdata;
+   CustomData remesh_edata;
+   CustomData remesh_ldata;
+   CustomData remesh_pdata;
+   int remesh_totvert;
+   int remesh_totedge;
+   int remesh_totloop;
+   int remesh_totpoly;
+
size_t undo_size;
 } SculptUndoNode;
 
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c 
b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 9c76292aaa7..b8b599a6479 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ 

[Bf-blender-cvs] [2eead486883] master: UI: Remove UI name overrides for Reveal Hidden.

2019-03-19 Thread William Reynish
Commit: 2eead48688340335dc475da30d869f19f75abd97
Author: William Reynish
Date:   Tue Mar 19 22:25:25 2019 +0100
Branches: master
https://developer.blender.org/rB2eead48688340335dc475da30d869f19f75abd97

UI: Remove UI name overrides for Reveal Hidden.

Makes the consistent operator names shine through into the UI.

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py 
b/release/scripts/startup/bl_ui/properties_mask_common.py
index d3432a95dc3..509424278b0 100644
--- a/release/scripts/startup/bl_ui/properties_mask_common.py
+++ b/release/scripts/startup/bl_ui/properties_mask_common.py
@@ -302,7 +302,7 @@ class MASK_MT_visibility(Menu):
 def draw(self, context):
 layout = self.layout
 
-layout.operator("mask.hide_view_clear", text="Show Hidden")
+layout.operator("mask.hide_view_clear")
 layout.operator("mask.hide_view_set", text="Hide Selected").unselected 
= False
 layout.operator("mask.hide_view_set", text="Hide 
Unselected").unselected = True
 
diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 00bfc48ba47..436a87c2e93 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -1385,7 +1385,7 @@ class CLIP_MT_track_visibility(Menu):
 def draw(self, context):
 layout = self.layout
 
-layout.operator("clip.hide_tracks_clear", text="Show Hidden")
+layout.operator("clip.hide_tracks_clear")
 layout.operator("clip.hide_tracks", text="Hide Selected").unselected = 
False
 layout.operator("clip.hide_tracks", text="Hide Unselected").unselected 
= True
 
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 8786d86838b..c38c99676af 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -392,7 +392,7 @@ class ShowHideMenu:
 def draw(self, context):
 layout = self.layout
 
-layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
+layout.operator("%s.reveal" % self._operator_name)
 layout.operator("%s.hide" % self._operator_name, text="Hide 
Selected").unselected = False
 layout.operator("%s.hide" % self._operator_name, text="Hide 
Unselected").unselected = True
 
@@ -2104,7 +2104,7 @@ class VIEW3D_MT_object_showhide(Menu):
 def draw(self, context):
 layout = self.layout
 
-layout.operator("object.hide_view_clear", text="Show Hidden")
+layout.operator("object.hide_view_clear")
 
 layout.separator()
 
@@ -3710,7 +3710,7 @@ class VIEW3D_MT_edit_meta_showhide(Menu):
 def draw(self, context):
 layout = self.layout
 
-layout.operator("mball.reveal_metaelems", text="Show Hidden")
+layout.operator("mball.reveal_metaelems")
 layout.operator("mball.hide_metaelems", text="Hide 
Selected").unselected = False
 layout.operator("mball.hide_metaelems", text="Hide 
Unselected").unselected = True

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


[Bf-blender-cvs] [953c8b05486] master: UI: Use 'Render Image' for image rendering in the viewport

2019-03-19 Thread William Reynish
Commit: 953c8b05486d260ed5b33473074d3cd3f40d970d
Author: William Reynish
Date:   Tue Mar 19 21:41:12 2019 +0100
Branches: master
https://developer.blender.org/rB953c8b05486d260ed5b33473074d3cd3f40d970d

UI: Use 'Render Image' for image rendering in the viewport

This is more consistent with the main Render menu, and more descriptive

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index dd0a6e5dc24..d21dc62ab06 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -225,7 +225,7 @@ class SEQUENCER_MT_view(Menu):
 
 layout.separator()
 
-layout.operator("render.opengl", text="Sequence Render", 
icon='RENDER_STILL').sequencer = True
+layout.operator("render.opengl", text="Sequence Render Image", 
icon='RENDER_STILL').sequencer = True
 props = layout.operator("render.opengl", text="Sequence Render 
Animation", icon='RENDER_ANIMATION')
 props.animation = True
 props.sequencer = True
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 5e535b7c90c..8786d86838b 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -637,7 +637,7 @@ class VIEW3D_MT_view(Menu):
 
 layout.separator()
 
-layout.operator("render.opengl", icon='RENDER_STILL')
+layout.operator("render.opengl", text="Viewport Render Image", 
icon='RENDER_STILL')
 layout.operator("render.opengl", text="Viewport Render Animation", 
icon='RENDER_ANIMATION').animation = True
 
 layout.separator()

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


[Bf-blender-cvs] [edf029d4b99] master: Fix: Inconsistent spacing in Python file after recent changes

2019-03-19 Thread William Reynish
Commit: edf029d4b993e4b34e3db90d36dc185137d71219
Author: William Reynish
Date:   Tue Mar 19 21:34:20 2019 +0100
Branches: master
https://developer.blender.org/rBedf029d4b993e4b34e3db90d36dc185137d71219

Fix: Inconsistent spacing in Python file after recent changes

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 98336519d0d..0d660c2efb3 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -392,8 +392,6 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
 brush_basic_vpaint_settings(col, context, brush)
 
 
-
-
 class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel):
 bl_context = ".paint_common"  # dot on purpose (access from topbar)
 bl_parent_id = "VIEW3D_PT_tools_brush"

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


[Bf-blender-cvs] [540f50a4da6] master: Unify "Hide Selected / Reveal Hidden" operator names

2019-03-19 Thread Dalai Felinto
Commit: 540f50a4da69c472ee343e99df83cf03cd7dd21c
Author: Dalai Felinto
Date:   Tue Mar 19 17:07:59 2019 -0300
Branches: master
https://developer.blender.org/rB540f50a4da69c472ee343e99df83cf03cd7dd21c

Unify "Hide Selected / Reveal Hidden" operator names

All edit mode related operators are now "Hide Selected / Reveal Hidden".
Before we had different variatons of them:

Hide Selection:
* MESH_OT_hide
* GPENCIL_OT_selection_opacity_toggle

Hide Selected Bones:
* ARMATURE_OT_hide

Hide:
* MBALL_OT_hide_metaelems

Hide Selected:
* CURVE_OT_hide
* PARTICLE_OT_hide
* POSE_OT_hide
* UV_OT_hide

Reveal Bones:
* ARMATURE_OT_reveal

Reveal:
* MBALL_OT_reveal_metaelems

Operators not renamed:
* Hide Curves (GRAPH_OT_hide)
* Hide (OUTLINER_OT_hide)

Note we can do a step further and mass rename them to match their UI
names. Where Reveal Hidden is Show Hidden. But for now at least they are
all unified.

===

M   source/blender/editors/armature/armature_edit.c
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/mesh/editmesh_tools.c
M   source/blender/editors/metaball/mball_edit.c

===

diff --git a/source/blender/editors/armature/armature_edit.c 
b/source/blender/editors/armature/armature_edit.c
index f3a4fef2789..e3db0ca8f2c 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -1649,7 +1649,7 @@ static int armature_hide_exec(bContext *C, wmOperator *op)
 void ARMATURE_OT_hide(wmOperatorType *ot)
 {
/* identifiers */
-   ot->name = "Hide Selected Bones";
+   ot->name = "Hide Selected";
ot->idname = "ARMATURE_OT_hide";
ot->description = "Tag selected bones to not be visible in Edit Mode";
 
@@ -1701,7 +1701,7 @@ static int armature_reveal_exec(bContext *C, wmOperator 
*op)
 void ARMATURE_OT_reveal(wmOperatorType *ot)
 {
/* identifiers */
-   ot->name = "Reveal Bones";
+   ot->name = "Reveal Hidden";
ot->idname = "ARMATURE_OT_reveal";
ot->description = "Reveal all bones hidden in Edit Mode";
 
diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index e45fedd12e4..a6b6fc2cbe7 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -563,7 +563,7 @@ static int gpencil_hideselect_toggle_exec(bContext *C, 
wmOperator *UNUSED(op))
 void GPENCIL_OT_selection_opacity_toggle(wmOperatorType *ot)
 {
/* identifiers */
-   ot->name = "Hide Selection";
+   ot->name = "Hide Selected";
ot->idname = "GPENCIL_OT_selection_opacity_toggle";
ot->description = "Hide/Unhide selected points for Grease Pencil 
strokes setting alpha factor";
 
diff --git a/source/blender/editors/mesh/editmesh_tools.c 
b/source/blender/editors/mesh/editmesh_tools.c
index 5b2cb97aff1..98700425e56 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -2021,7 +2021,7 @@ static int edbm_hide_exec(bContext *C, wmOperator *op)
 void MESH_OT_hide(wmOperatorType *ot)
 {
/* identifiers */
-   ot->name = "Hide Selection";
+   ot->name = "Hide Selected";
ot->idname = "MESH_OT_hide";
ot->description = "Hide (un)selected vertices, edges or faces";
 
diff --git a/source/blender/editors/metaball/mball_edit.c 
b/source/blender/editors/metaball/mball_edit.c
index ca88098275d..2aa9ab4c914 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -631,7 +631,7 @@ static int hide_metaelems_exec(bContext *C, wmOperator *op)
 void MBALL_OT_hide_metaelems(wmOperatorType *ot)
 {
/* identifiers */
-   ot->name = "Hide";
+   ot->name = "Hide Selected";
ot->description = "Hide (un)selected metaelement(s)";
ot->idname = "MBALL_OT_hide_metaelems";
 
@@ -674,7 +674,7 @@ static int reveal_metaelems_exec(bContext *C, wmOperator 
*op)
 void MBALL_OT_reveal_metaelems(wmOperatorType *ot)
 {
/* identifiers */
-   ot->name = "Reveal";
+   ot->name = "Reveal Hidden";
ot->description = "Reveal all hidden metaelements";
ot->idname = "MBALL_OT_reveal_metaelems";

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


[Bf-blender-cvs] [7cf1b81b3c6] master: Fix T62735: hiding curves doesnt hide in viewport

2019-03-19 Thread Dalai Felinto
Commit: 7cf1b81b3c6493c07ed9a247c9ebe7cb88e27d27
Author: Dalai Felinto
Date:   Tue Mar 19 17:04:44 2019 -0300
Branches: master
https://developer.blender.org/rB7cf1b81b3c6493c07ed9a247c9ebe7cb88e27d27

Fix T62735: hiding curves doesnt hide in viewport

Copying what we do for mesh objects.

===

M   source/blender/editors/curve/editcurve.c

===

diff --git a/source/blender/editors/curve/editcurve.c 
b/source/blender/editors/curve/editcurve.c
index fe3ac8fc947..63768493f7a 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -3013,7 +3013,7 @@ static int hide_exec(bContext *C, wmOperator *op)
}
}
 
-   DEG_id_tag_update(obedit->data, ID_RECALC_COPY_ON_WRITE | 
ID_RECALC_SELECT);
+   DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
BKE_curve_nurb_vert_active_validate(obedit->data);
}

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


[Bf-blender-cvs] [21f3c95f22d] master: Fix T62749: random mesh selection crashes.

2019-03-19 Thread Brecht Van Lommel
Commit: 21f3c95f22d458389d1857ee03312cefdfa7ead3
Author: Brecht Van Lommel
Date:   Tue Mar 19 19:57:26 2019 +0100
Branches: master
https://developer.blender.org/rB21f3c95f22d458389d1857ee03312cefdfa7ead3

Fix T62749: random mesh selection crashes.

This was an off-by-one error in the initialization of tbuf, but refactored the
code a bit more to be less obscure.

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c 
b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 18e7522ea1c..db9f2ca4d87 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -347,69 +347,72 @@ uint *ED_view3d_select_id_read(
 /* smart function to sample a rect spiralling outside, nice for backbuf 
selection */
 uint ED_view3d_select_id_read_nearest(
 struct ViewContext *UNUSED(vc), const int mval[2],
-const uint min, const uint max, uint *r_dist)
+const uint id_min, const uint id_max, uint *r_dist)
 {
-   uint index = 0;
-
-   int dirvec[4][2];
-
+   /* Create region around mouse cursor. This must be square and have an 
odd
+* width, the spiralling algorithm does not work with arbitrary 
rectangles. */
rcti rect;
BLI_rcti_init_pt_radius(, mval, *r_dist);
rect.xmax += 1;
rect.ymax += 1;
 
-   uint width, height;
-   width = height = BLI_rcti_size_x();
-
-   uint buf_len = width * height;
-   uint *buf = MEM_mallocN(buf_len * sizeof(*buf), __func__);
+   int width = BLI_rcti_size_x();
+   int height = width;
+   BLI_assert(width == height);
 
+   /* Read from selection framebuffer. */
+   uint *buf = MEM_mallocN(width * height * sizeof(*buf), __func__);
DRW_framebuffer_select_id_read(, buf);
 
-   BLI_assert(width == height); /* This algorithm doesn't work well with 
rectangles */
-
-   int rc = 0;
-
-   dirvec[0][0] = 1; dirvec[0][1] = 0;
-   dirvec[1][0] = 0; dirvec[1][1] = -height;
-   dirvec[2][0] = -1; dirvec[2][1] = 0;
-   dirvec[3][0] = 0; dirvec[3][1] = height;
+   /* Spiral, starting from center of buffer. */
+   int spiral_offset = height * (int)(width / 2) + (height / 2);
+   int spiral_direction = 0;
 
-   const uint *bufmin = buf;
-   const uint *bufmax = buf + buf_len;
-   const uint *tbuf = buf + (height * (int)(width / 2) + height / 2 - 1);
+   uint index = 0;
 
for (int nr = 1; nr <= height; nr++) {
for (int a = 0; a < 2; a++) {
for (int b = 0; b < nr; b++) {
-   if (*tbuf && *tbuf >= min && *tbuf < max) {
-   /* we got a hit */
-   int hit_co[2], center_co[2];
+   /* Find hit within the specified range. */
+   uint hit_id = buf[spiral_offset];
 
-   /* get x,y pixel coords from the offset 
*/
-   hit_co[0] = (int)(tbuf - buf) % 
(int)height;
-   hit_co[1] = (int)(tbuf - buf) / 
(int)height;
+   if (hit_id && hit_id >= id_min && hit_id < 
id_max) {
+   /* Get x/y from spiral offset. */
+   int hit_x = spiral_offset % width;
+   int hit_y = spiral_offset / width;
 
-   center_co[0] = (int)(height / 2);
-   center_co[1] = (int)(width / 2);
+   int center_x = width / 2;
+   int center_y = height / 2;
 
-   /* manhatten distance in keeping with 
other screen-based selection */
-   *r_dist = (float)(abs(hit_co[0] - 
center_co[0]) +
- abs(hit_co[1] - 
center_co[1]));
+   /* Manhatten distance in keeping with 
other screen-based selection. */
+   *r_dist = (uint)(abs(hit_x - center_x) 
+ abs(hit_y - center_y));
 
-   /* indices start at 1 here */
-   index = (*tbuf - min) + 1;
+   /* Indices start at 1 here. */
+   index = (hit_id - id_min) + 1;
goto exit;
}
 
-   tbuf += (dirvec[rc][0] + dirvec[rc][1]);
+  

[Bf-blender-cvs] [f0770b8578f] master: Fix: Make sure color panels only appear in modes where they are supported

2019-03-19 Thread William Reynish
Commit: f0770b8578f375fdfb733c6fdb8af9a0902a5019
Author: William Reynish
Date:   Tue Mar 19 19:42:17 2019 +0100
Branches: master
https://developer.blender.org/rBf0770b8578f375fdfb733c6fdb8af9a0902a5019

Fix: Make sure color panels only appear in modes where they are supported

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index a183dd19109..98336519d0d 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -405,11 +405,11 @@ class VIEW3D_PT_tools_brush_color(Panel, 
View3DPaintPanel):
 brush = settings.brush
 if context.image_paint_object:
 capabilities = brush.image_paint_capabilities
+return capabilities.has_color
 
 elif context.vertex_paint_object:
 capabilities = brush.vertex_paint_capabilities
-
-return capabilities.has_color
+return capabilities.has_color
 
 def draw(self, context):
 layout = self.layout
@@ -433,11 +433,11 @@ class VIEW3D_PT_tools_brush_swatches(Panel, 
View3DPaintPanel):
 brush = settings.brush
 if context.image_paint_object:
 capabilities = brush.image_paint_capabilities
+return capabilities.has_color
 
 elif context.vertex_paint_object:
 capabilities = brush.vertex_paint_capabilities
-
-return capabilities.has_color
+return capabilities.has_color
 
 def draw(self, context):
 layout = self.layout

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


[Bf-blender-cvs] [b525ecfcfbc] master: UI: Rename GPencil Brush 'Appearance' panel to 'Display'

2019-03-19 Thread William Reynish
Commit: b525ecfcfbc163d05e1318dab7131d0320f8d83b
Author: William Reynish
Date:   Tue Mar 19 19:32:57 2019 +0100
Branches: master
https://developer.blender.org/rBb525ecfcfbc163d05e1318dab7131d0320f8d83b

UI: Rename GPencil Brush 'Appearance' panel to 'Display'

Makes it consistent with other paint modes

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 9d2a3f9b476..a183dd19109 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1956,12 +1956,12 @@ class 
VIEW3D_PT_tools_grease_pencil_weight_paint(View3DPanel, Panel):
 # Grease Pencil Brush Appeareance (one for each mode)
 class 
VIEW3D_PT_tools_grease_pencil_paint_appearance(GreasePencilAppearancePanel, 
View3DPanel, Panel):
 bl_context = ".greasepencil_paint"
-bl_label = "Appearance"
+bl_label = "Display"
 
 
 class 
VIEW3D_PT_tools_grease_pencil_sculpt_appearance(GreasePencilAppearancePanel, 
View3DPanel, Panel):
 bl_context = ".greasepencil_sculpt"
-bl_label = "Appearance"
+bl_label = "Display"
 
 
 class 
VIEW3D_PT_tools_grease_pencil_sculpt_options(GreasePencilSculptOptionsPanel, 
View3DPanel, Panel):
@@ -1972,7 +1972,7 @@ class 
VIEW3D_PT_tools_grease_pencil_sculpt_options(GreasePencilSculptOptionsPane
 
 class 
VIEW3D_PT_tools_grease_pencil_weight_appearance(GreasePencilAppearancePanel, 
View3DPanel, Panel):
 bl_context = ".greasepencil_weight"
-bl_label = "Appearance"
+bl_label = "Display"
 
 
 class VIEW3D_PT_gpencil_brush_presets(PresetPanel, Panel):

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


[Bf-blender-cvs] [770b1188e98] master: Fix: Color Picker and Color Palette panels were appearing for non-color tools in Vertex Paint mode

2019-03-19 Thread William Reynish
Commit: 770b1188e982edf1437a7e3ec33b8d934db718a3
Author: William Reynish
Date:   Tue Mar 19 19:31:36 2019 +0100
Branches: master
https://developer.blender.org/rB770b1188e982edf1437a7e3ec33b8d934db718a3

Fix: Color Picker and Color Palette panels were appearing for non-color tools 
in Vertex Paint mode

Use correct poll method for both modes

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index aa7b37aa965..9d2a3f9b476 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -403,9 +403,13 @@ class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel):
 def poll(self, context):
 settings = self.paint_settings(context)
 brush = settings.brush
-capabilities = brush.image_paint_capabilities
+if context.image_paint_object:
+capabilities = brush.image_paint_capabilities
+
+elif context.vertex_paint_object:
+capabilities = brush.vertex_paint_capabilities
 
-return capabilities.has_color and (context.image_paint_object or 
context.vertex_paint_object)
+return capabilities.has_color
 
 def draw(self, context):
 layout = self.layout
@@ -427,9 +431,13 @@ class VIEW3D_PT_tools_brush_swatches(Panel, 
View3DPaintPanel):
 def poll(self, context):
 settings = self.paint_settings(context)
 brush = settings.brush
-capabilities = brush.image_paint_capabilities
+if context.image_paint_object:
+capabilities = brush.image_paint_capabilities
+
+elif context.vertex_paint_object:
+capabilities = brush.vertex_paint_capabilities
 
-return capabilities.has_color and (context.image_paint_object or 
context.vertex_paint_object)
+return capabilities.has_color
 
 def draw(self, context):
 layout = self.layout

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


[Bf-blender-cvs] [d555c92e3c5] blender2.7: Cleanup: fix debug warnign due to tooltip ending in dot.

2019-03-19 Thread Brecht Van Lommel
Commit: d555c92e3c57131433269ded1b679112d83390f4
Author: Brecht Van Lommel
Date:   Tue Mar 19 19:16:39 2019 +0100
Branches: blender2.7
https://developer.blender.org/rBd555c92e3c57131433269ded1b679112d83390f4

Cleanup: fix debug warnign due to tooltip ending in dot.

===

M   intern/cycles/blender/addon/operators.py

===

diff --git a/intern/cycles/blender/addon/operators.py 
b/intern/cycles/blender/addon/operators.py
index f8511dc8de4..a21b422f675 100644
--- a/intern/cycles/blender/addon/operators.py
+++ b/intern/cycles/blender/addon/operators.py
@@ -126,7 +126,7 @@ class CYCLES_OT_denoise_animation(Operator):
 
 class CYCLES_OT_merge_images(Operator):
 "Combine OpenEXR multilayer images rendered with different sample" \
-"ranges into one image with reduced noise."
+"ranges into one image with reduced noise"
 bl_idname = "cycles.merge_images"
 bl_label = "Merge Images"

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


[Bf-blender-cvs] [bdf78435714] master: UI: Make Brush Display panel consistent between Image Editor and 3D View texture painting

2019-03-19 Thread William Reynish
Commit: bdf78435714819d36dcc0b36b693c390ab5cb1db
Author: William Reynish
Date:   Tue Mar 19 19:03:51 2019 +0100
Branches: master
https://developer.blender.org/rBbdf78435714819d36dcc0b36b693c390ab5cb1db

UI: Make Brush Display panel consistent between Image Editor and 3D View 
texture painting

-Slightly simplify in both places too

===

M   release/scripts/startup/bl_ui/space_image.py
M   release/scripts/startup/bl_ui/space_view3d_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index c9684c95130..aa782278071 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -997,6 +997,9 @@ class IMAGE_PT_tools_brush_display(BrushButtonsPanel, 
Panel):
 def draw(self, context):
 layout = self.layout
 
+layout.use_property_split = True
+layout.use_property_decorate = False
+
 tool_settings = context.tool_settings.image_paint
 brush = tool_settings.brush
 tex_slot = brush.texture_slot
@@ -1004,52 +1007,98 @@ class IMAGE_PT_tools_brush_display(BrushButtonsPanel, 
Panel):
 
 col = layout.column()
 
-col.label(text="Curve:")
-
 row = col.row(align=True)
-row.prop(
-brush,
-"use_cursor_overlay",
-text="",
-toggle=True,
-icon='RESTRICT_VIEW_ON' if brush.use_cursor_overlay else 
'RESTRICT_VIEW_OFF',
-)
 
 sub = row.row(align=True)
-sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
+sub.prop(brush, "cursor_overlay_alpha", text="Curve Alpha")
 sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", 
icon='BRUSH_DATA')
+row.prop(
+brush, "use_cursor_overlay", text="", toggle=True,
+icon='HIDE_OFF' if brush.use_cursor_overlay else 'HIDE_ON',
+)
 
 col.active = brush.brush_capabilities.has_overlay
-col.label(text="Texture:")
+
 row = col.row(align=True)
-if tex_slot.map_mode != 'STENCIL':
-row.prop(
-brush,
-"use_primary_overlay",
-text="",
-toggle=True,
-icon='RESTRICT_VIEW_ON' if brush.use_primary_overlay else 
'RESTRICT_VIEW_OFF',
-)
 
 sub = row.row(align=True)
-sub.prop(brush, "texture_overlay_alpha", text="Alpha")
+sub.prop(brush, "texture_overlay_alpha", text="Texture Alpha")
 sub.prop(brush, "use_primary_overlay_override", toggle=True, text="", 
icon='BRUSH_DATA')
-
-col.label(text="Mask Texture:")
+if tex_slot.map_mode != 'STENCIL':
+row.prop(
+brush, "use_primary_overlay", text="", toggle=True,
+icon='HIDE_OFF' if brush.use_primary_overlay else 'HIDE_ON',
+)
 
 row = col.row(align=True)
+
+sub = row.row(align=True)
+sub.prop(brush, "mask_overlay_alpha", text="Mask Texture Alpha")
+sub.prop(brush, "use_secondary_overlay_override", toggle=True, 
text="", icon='BRUSH_DATA')
 if tex_slot_mask.map_mode != 'STENCIL':
 row.prop(
-brush,
-"use_secondary_overlay",
-text="",
-toggle=True,
-icon='RESTRICT_VIEW_ON' if brush.use_secondary_overlay else 
'RESTRICT_VIEW_OFF',
+brush, "use_secondary_overlay", text="", toggle=True,
+icon='HIDE_OFF' if brush.use_secondary_overlay else 'HIDE_ON',
 )
 
-sub = row.row(align=True)
-sub.prop(brush, "mask_overlay_alpha", text="Alpha")
-sub.prop(brush, "use_secondary_overlay_override", toggle=True, 
text="", icon='BRUSH_DATA')
+
+class IMAGE_PT_tools_brush_display_show_brush(BrushButtonsPanel, Panel):
+bl_context = ".paint_common_2d"  # dot on purpose (access from topbar)
+bl_label = "Show Brush"
+bl_parent_id = "IMAGE_PT_tools_brush_display"
+bl_options = {'DEFAULT_CLOSED'}
+
+def draw_header(self, context):
+settings = context.tool_settings.image_paint
+
+self.layout.prop(settings, "show_brush", text="")
+
+def draw(self, context):
+layout = self.layout
+
+layout.use_property_split = True
+layout.use_property_decorate = False
+
+settings = context.tool_settings.image_paint
+brush = settings.brush
+
+col = layout.column()
+col.active = settings.show_brush
+
+if context.sculpt_object and context.tool_settings.sculpt:
+if brush.sculpt_capabilities.has_secondary_color:
+col.prop(brush, "cursor_color_add", text="Add")
+col.prop(brush, "cursor_color_subtract", text="Subtract")
+else:
+

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

2019-03-19 Thread Brecht Van Lommel
Commit: fa59c6a3e7d72d57faadcf0795848b4c3b8381d9
Author: Brecht Van Lommel
Date:   Tue Mar 19 18:54:17 2019 +0100
Branches: master
https://developer.blender.org/rBfa59c6a3e7d72d57faadcf0795848b4c3b8381d9

Merge branch 'blender2.7'

===



===

diff --cc intern/cycles/blender/blender_session.cpp
index a06135b5362,87dc39ca676..cf856c3b3d4
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@@ -393,25 -379,12 +393,16 @@@ static void add_cryptomatte_layer(BL::R
render_add_metadata(b_rr, prefix+"manifest", manifest);
  }
  
- /* TODO(sergey): Ideally this will be an utility function in util string.h, 
but
-  * currently is relying on Blender side function, so can not do that. */
- static string make_human_readable_time(double time)
- {
-   char time_str[128];
-   BLI_timecode_string_from_time_simple(time_str, sizeof(time_str), time);
-   return time_str;
- }
- 
 -void BlenderSession::stamp_view_layer_metadata_do(const string& prefix)
 +void BlenderSession::stamp_view_layer_metadata(Scene *scene, const string& 
view_layer_name)
  {
BL::RenderResult b_rr = b_engine.get_result();
 +  string prefix = "cycles." + view_layer_name + ".";
 +
/* Configured number of samples for the view layer. */
 -  b_rr.stamp_data_add_field((prefix + "samples").c_str(),
 -to_string(session->params.samples).c_str());
 +  b_rr.stamp_data_add_field(
 +  (prefix + "samples").c_str(),
 +  to_string(session->params.samples).c_str());
 +
/* Store ranged samples information. */
if(session->tile_manager.range_num_samples != -1) {
b_rr.stamp_data_add_field(
@@@ -421,36 -394,15 +412,36 @@@
(prefix + "range_num_samples").c_str(),

to_string(session->tile_manager.range_num_samples).c_str());
}
 -}
  
 -void BlenderSession::stamp_view_layer_metadata(const string& view_layer_name)
 -{
 -  stamp_view_layer_metadata_do("cycles." + view_layer_name + ".");
 +  /* Write cryptomatte metadata. */
 +  if(scene->film->cryptomatte_passes & CRYPT_OBJECT) {
 +  add_cryptomatte_layer(b_rr, view_layer_name + ".CryptoObject",
 +
scene->object_manager->get_cryptomatte_objects(scene));
 +  }
 +  if(scene->film->cryptomatte_passes & CRYPT_MATERIAL) {
 +  add_cryptomatte_layer(b_rr, view_layer_name + ".CryptoMaterial",
 +
scene->shader_manager->get_cryptomatte_materials(scene));
 +  }
 +  if(scene->film->cryptomatte_passes & CRYPT_ASSET) {
 +  add_cryptomatte_layer(b_rr, view_layer_name + ".CryptoAsset",
 +
scene->object_manager->get_cryptomatte_assets(scene));
 +  }
 +
 +  /* Store synchronization and bare-render times. */
 +  double total_time, render_time;
 +  session->progress.get_time(total_time, render_time);
 +  b_rr.stamp_data_add_field((prefix + "total_time").c_str(),
- make_human_readable_time(total_time).c_str());
++
time_human_readable_from_seconds(total_time).c_str());
 +  b_rr.stamp_data_add_field((prefix + "render_time").c_str(),
- 
make_human_readable_time(render_time).c_str());
++
time_human_readable_from_seconds(render_time).c_str());
 +  b_rr.stamp_data_add_field((prefix + "synchronization_time").c_str(),
- make_human_readable_time(total_time - 
render_time).c_str());
++time_human_readable_from_seconds(total_time - 
render_time).c_str());
  }
  
 -void BlenderSession::render()
 +void BlenderSession::render(BL::Depsgraph& b_depsgraph_)
  {
 +  b_depsgraph = b_depsgraph_;
 +
/* set callback to write out render results */
session->write_render_tile_cb = 
function_bind(::write_render_tile, this, _1);
session->update_render_tile_cb = 
function_bind(::update_render_tile, this, _1, _2);
@@@ -1011,10 -957,9 +1002,9 @@@ void BlenderSession::update_bake_progre
  void BlenderSession::update_status_progress()
  {
string timestatus, status, substatus, kernel_status;
 -  string scene = "";
 +  string scene_status = "";
float progress;
double total_time, remaining_time = 0, render_time;
-   char time_str[128];
float mem_used = (float)session->stats.mem_used / 1024.0f / 1024.0f;
float mem_peak = (float)session->stats.mem_peak / 1024.0f / 1024.0f;
  
@@@ -1026,27 -971,29 +1016,26 @@@
remaining_time = (1.0 - (double)progress) * (render_time / 
(double)progress);
  
if(background) {
 -  scene += " | " + 

[Bf-blender-cvs] [e7f535cd4cf] master: UI: Remove redundant separator

2019-03-19 Thread William Reynish
Commit: e7f535cd4cf919b7e479d20b8a1b6714f166151d
Author: William Reynish
Date:   Tue Mar 19 18:41:33 2019 +0100
Branches: master
https://developer.blender.org/rBe7f535cd4cf919b7e479d20b8a1b6714f166151d

UI: Remove redundant separator

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index 8866d221099..c9684c95130 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -1126,9 +1126,6 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
 col.template_ID(brush, "paint_curve", new="paintcurve.new")
 col.operator("paintcurve.draw")
 
-col = layout.column()
-col.separator()
-
 row = col.row(align=True)
 if brush.use_relative_jitter:
 row.prop(brush, "jitter", slider=True)

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


[Bf-blender-cvs] [bd017dae28d] master: UI: Make Stroke panel consistent between Image Editor and 3D View texture painting

2019-03-19 Thread William Reynish
Commit: bd017dae28d733779badacb2e5263483930c96c6
Author: William Reynish
Date:   Tue Mar 19 18:39:08 2019 +0100
Branches: master
https://developer.blender.org/rBbd017dae28d733779badacb2e5263483930c96c6

UI: Make Stroke panel consistent between Image Editor and 3D View texture 
painting

This should probably become de-duplicated, but at least they look consistent now

===

M   release/scripts/startup/bl_ui/space_image.py
M   release/scripts/startup/bl_ui/space_view3d_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index 7702338a776..8866d221099 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -1100,33 +1100,29 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
 tool_settings = context.tool_settings.image_paint
 brush = tool_settings.brush
 
-col = layout.column()
+layout.use_property_split = True
+layout.use_property_decorate = False
 
-col.label(text="Stroke Method:")
+col = layout.column()
 
-col.prop(brush, "stroke_method", text="")
+col.prop(brush, "stroke_method")
 
 if brush.use_anchor:
-col.separator()
 col.prop(brush, "use_edge_to_edge", text="Edge To Edge")
 
 if brush.use_airbrush:
-col.separator()
 col.prop(brush, "rate", text="Rate", slider=True)
 
 if brush.use_space:
-col.separator()
 row = col.row(align=True)
 row.prop(brush, "spacing", text="Spacing")
 row.prop(brush, "use_pressure_spacing", toggle=True, text="")
 
 if brush.use_line or brush.use_curve:
-col.separator()
 row = col.row(align=True)
 row.prop(brush, "spacing", text="Spacing")
 
 if brush.use_curve:
-col.separator()
 col.template_ID(brush, "paint_curve", new="paintcurve.new")
 col.operator("paintcurve.draw")
 
@@ -1134,27 +1130,47 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
 col.separator()
 
 row = col.row(align=True)
-row.prop(brush, "use_relative_jitter", icon_only=True)
 if brush.use_relative_jitter:
 row.prop(brush, "jitter", slider=True)
 else:
 row.prop(brush, "jitter_absolute")
+row.prop(brush, "use_relative_jitter", icon_only=True)
 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
 
-col = layout.column()
-col.separator()
+col.prop(tool_settings, "input_samples")
+
+
+class IMAGE_PT_paint_stroke_smooth_stroke(BrushButtonsPanel, Panel):
+bl_context = ".paint_common_2d"  # dot on purpose (access from topbar)
+bl_label = "Smooth Stroke"
+bl_parent_id = "IMAGE_PT_paint_stroke"
+bl_options = {'DEFAULT_CLOSED'}
 
+@classmethod
+def poll(cls, context):
+settings = context.tool_settings.image_paint
+brush = settings.brush
 if brush.brush_capabilities.has_smooth_stroke:
-col.prop(brush, "use_smooth_stroke")
+return True
 
-sub = col.column()
-sub.active = brush.use_smooth_stroke
-sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
-sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
+def draw_header(self, context):
+settings = context.tool_settings.image_paint
+brush = settings.brush
 
-col.separator()
+self.layout.prop(brush, "use_smooth_stroke", text="")
 
-col.prop(tool_settings, "input_samples")
+def draw(self, context):
+layout = self.layout
+layout.use_property_split = True
+layout.use_property_decorate = False
+
+settings = context.tool_settings.image_paint
+brush = settings.brush
+
+col = layout.column()
+col.active = brush.use_smooth_stroke
+col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
+col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
 
 
 class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel):
@@ -1495,6 +1511,7 @@ classes = (
 IMAGE_PT_tools_brush_texture,
 IMAGE_PT_tools_mask_texture,
 IMAGE_PT_paint_stroke,
+IMAGE_PT_paint_stroke_smooth_stroke,
 IMAGE_PT_paint_curve,
 IMAGE_PT_tools_brush_display,
 IMAGE_PT_tools_imagepaint_symmetry,
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index b4bffadf489..b343825631b 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -881,9 +881,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
   

[Bf-blender-cvs] [b4a0dd1296d] master: Fix: own wrong path to image paint tool settings in recent commit

2019-03-19 Thread William Reynish
Commit: b4a0dd1296dbcdd3759f8e03575a93e08f025fc1
Author: William Reynish
Date:   Tue Mar 19 18:37:51 2019 +0100
Branches: master
https://developer.blender.org/rBb4a0dd1296dbcdd3759f8e03575a93e08f025fc1

Fix: own wrong path to image paint tool settings in recent commit

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index 2da618c66cd..7702338a776 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -920,7 +920,7 @@ class IMAGE_PT_paint_gradient(Panel, ImagePaintPanel):
 return capabilities.has_color
 
 def draw_header(self, context):
-settings = self.paint_settings(context)
+settings = context.tool_settings.image_paint
 brush = settings.brush
 self.layout.prop(brush, "use_gradient", text="")
 
@@ -944,7 +944,7 @@ class IMAGE_PT_paint_clone(Panel, ImagePaintPanel):
 
 @classmethod
 def poll(self, context):
-settings = self.paint_settings(context)
+settings = context.tool_settings.image_paint
 brush = settings.brush
 
 return brush.image_tool == 'CLONE'

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


[Bf-blender-cvs] [5b7b7101c81] blender2.7: Cycles: Implement function to format and parse human readable time

2019-03-19 Thread Sergey Sharybin
Commit: 5b7b7101c81ca104111e0df76cccf5b1c88bd3f6
Author: Sergey Sharybin
Date:   Tue Mar 19 15:19:22 2019 +0100
Branches: blender2.7
https://developer.blender.org/rB5b7b7101c81ca104111e0df76cccf5b1c88bd3f6

Cycles: Implement function to format and parse human readable time

Gives value in seconds for a string which is encoded in format HH:MM:SS.hh.

===

M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/test/CMakeLists.txt
A   intern/cycles/test/util_time_test.cpp
M   intern/cycles/util/util_time.cpp
M   intern/cycles/util/util_time.h

===

diff --git a/intern/cycles/blender/blender_session.cpp 
b/intern/cycles/blender/blender_session.cpp
index 923fdf9be4b..87dc39ca676 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -960,7 +960,6 @@ void BlenderSession::update_status_progress()
string scene = "";
float progress;
double total_time, remaining_time = 0, render_time;
-   char time_str[128];
float mem_used = (float)session->stats.mem_used / 1024.0f / 1024.0f;
float mem_peak = (float)session->stats.mem_peak / 1024.0f / 1024.0f;
 
@@ -980,13 +979,11 @@ void BlenderSession::update_status_progress()
scene += ", " + b_rview_name;
}
else {
-   BLI_timecode_string_from_time_simple(time_str, 
sizeof(time_str), total_time);
-   timestatus = "Time:" + string(time_str) + " | ";
+   timestatus = "Time:" + 
time_human_readable_from_seconds(total_time) + " | ";
}
 
if(remaining_time > 0) {
-   BLI_timecode_string_from_time_simple(time_str, 
sizeof(time_str), remaining_time);
-   timestatus += "Remaining:" + string(time_str) + " | ";
+   timestatus += "Remaining:" + 
time_human_readable_from_seconds(remaining_time) + " | ";
}
 
timestatus += string_printf("Mem:%.2fM, Peak:%.2fM", (double)mem_used, 
(double)mem_peak);
diff --git a/intern/cycles/test/CMakeLists.txt 
b/intern/cycles/test/CMakeLists.txt
index f22992ad79f..73fe590f8ae 100644
--- a/intern/cycles/test/CMakeLists.txt
+++ b/intern/cycles/test/CMakeLists.txt
@@ -101,5 +101,6 @@ set(CMAKE_EXE_LINKER_FLAGS_DEBUG 
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LIN
 CYCLES_TEST(render_graph_finalize "${ALL_CYCLES_LIBRARIES};bf_intern_numaapi")
 CYCLES_TEST(util_aligned_malloc "cycles_util")
 CYCLES_TEST(util_path 
"cycles_util;${BOOST_LIBRARIES};${OPENIMAGEIO_LIBRARIES}")
-CYCLES_TEST(util_string "cycles_util;${BOOST_LIBRARIES}")
-CYCLES_TEST(util_task "cycles_util;${BOOST_LIBRARIES};bf_intern_numaapi")
+CYCLES_TEST(util_string 
"cycles_util;${BOOST_LIBRARIES};${OPENIMAGEIO_LIBRARIES}")
+CYCLES_TEST(util_task 
"cycles_util;${BOOST_LIBRARIES};${OPENIMAGEIO_LIBRARIES};bf_intern_numaapi")
+CYCLES_TEST(util_time 
"cycles_util;${BOOST_LIBRARIES};${OPENIMAGEIO_LIBRARIES}")
diff --git a/intern/cycles/test/util_time_test.cpp 
b/intern/cycles/test/util_time_test.cpp
new file mode 100644
index 000..74f9f3b2134
--- /dev/null
+++ b/intern/cycles/test/util_time_test.cpp
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2011-2019 Blender Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "testing/testing.h"
+
+#include "util/util_time.h"
+
+CCL_NAMESPACE_BEGIN
+
+TEST(time_human_readable_to_seconds, Empty) {
+   EXPECT_EQ(time_human_readable_to_seconds(""), 0.0);
+   EXPECT_EQ(time_human_readable_from_seconds(0.0), "00:00.00");
+}
+
+TEST(time_human_readable_to_seconds, Fraction) {
+   EXPECT_NEAR(time_human_readable_to_seconds(".1"), 0.1, 1e-8f);
+   EXPECT_NEAR(time_human_readable_to_seconds(".10"), 0.1, 1e-8f);
+   EXPECT_EQ(time_human_readable_from_seconds(0.1), "00:00.10");
+}
+
+TEST(time_human_readable_to_seconds, Seconds) {
+   EXPECT_NEAR(time_human_readable_to_seconds("2.1"), 2.1, 1e-8f);
+   EXPECT_NEAR(time_human_readable_to_seconds("02.10"), 2.1, 1e-8f);
+   EXPECT_EQ(time_human_readable_from_seconds(2.1), "00:02.10");
+
+   EXPECT_NEAR(time_human_readable_to_seconds("12.1"), 12.1, 1e-8f);
+   EXPECT_NEAR(time_human_readable_to_seconds("12.10"), 12.1, 1e-8f);
+   EXPECT_EQ(time_human_readable_from_seconds(12.1), "00:12.10");
+}
+
+TEST(time_human_readable_to_seconds, MinutesSeconds) {
+   

[Bf-blender-cvs] [83de13f75aa] blender2.7: Cycles: add cycles.merge_images operator for combing EXR renders.

2019-03-19 Thread Brecht Van Lommel
Commit: 83de13f75aafca7d4e1d58ddd36cca19121aa84f
Author: Brecht Van Lommel
Date:   Tue Mar 19 14:38:57 2019 +0100
Branches: blender2.7
https://developer.blender.org/rB83de13f75aafca7d4e1d58ddd36cca19121aa84f

Cycles: add cycles.merge_images operator for combing EXR renders.

This is only available through the API, mainly intended for render farms to
combine rendered multilayer EXR Files with different samples. The images are
currently expected to have the exact same render layers and passes, just with
different samples.

Variance passes are still simply a weighted average, ideally these should be
merged more intelligently.

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

===

M   intern/cycles/blender/addon/operators.py
M   intern/cycles/blender/blender_python.cpp
M   intern/cycles/blender/blender_util.h
M   intern/cycles/render/CMakeLists.txt
A   intern/cycles/render/merge.cpp
A   intern/cycles/render/merge.h

===

diff --git a/intern/cycles/blender/addon/operators.py 
b/intern/cycles/blender/addon/operators.py
index 28657de24d4..f8511dc8de4 100644
--- a/intern/cycles/blender/addon/operators.py
+++ b/intern/cycles/blender/addon/operators.py
@@ -124,9 +124,48 @@ class CYCLES_OT_denoise_animation(Operator):
 return {'FINISHED'}
 
 
+class CYCLES_OT_merge_images(Operator):
+"Combine OpenEXR multilayer images rendered with different sample" \
+"ranges into one image with reduced noise."
+bl_idname = "cycles.merge_images"
+bl_label = "Merge Images"
+
+input_filepath1: StringProperty(
+name='Input Filepath',
+description='File path for image to merge',
+default='',
+subtype='FILE_PATH')
+
+input_filepath2: StringProperty(
+name='Input Filepath',
+description='File path for image to merge',
+default='',
+subtype='FILE_PATH')
+
+output_filepath: StringProperty(
+name='Output Filepath',
+description='File path for merged image',
+default='',
+subtype='FILE_PATH')
+
+def execute(self, context):
+in_filepaths = [self.input_filepath1, self.input_filepath2]
+out_filepath = self.output_filepath
+
+import _cycles
+try:
+_cycles.merge(input=in_filepaths, output=out_filepath)
+except Exception as e:
+self.report({'ERROR'}, str(e))
+return {'FINISHED'}
+
+return {'FINISHED'}
+
+
 classes = (
 CYCLES_OT_use_shading_nodes,
-CYCLES_OT_denoise_animation
+CYCLES_OT_denoise_animation,
+CYCLES_OT_merge_images
 )
 
 def register():
diff --git a/intern/cycles/blender/blender_python.cpp 
b/intern/cycles/blender/blender_python.cpp
index 647e7c6374b..063b0ede92b 100644
--- a/intern/cycles/blender/blender_python.cpp
+++ b/intern/cycles/blender/blender_python.cpp
@@ -23,6 +23,7 @@
 #include "blender/blender_session.h"
 
 #include "render/denoising.h"
+#include "render/merge.h"
 
 #include "util/util_debug.h"
 #include "util/util_foreach.h"
@@ -638,9 +639,8 @@ static PyObject *opencl_compile_func(PyObject * /*self*/, 
PyObject *args)
 }
 #endif
 
-static bool denoise_parse_filepaths(PyObject *pyfilepaths, vector& 
filepaths)
+static bool image_parse_filepaths(PyObject *pyfilepaths, vector& 
filepaths)
 {
-
if(PyUnicode_Check(pyfilepaths)) {
const char *filepath = PyUnicode_AsUTF8(pyfilepaths);
filepaths.push_back(filepath);
@@ -709,12 +709,12 @@ static PyObject *denoise_func(PyObject * /*self*/, 
PyObject *args, PyObject *key
/* Parse file paths list. */
vector input, output;
 
-   if(!denoise_parse_filepaths(pyinput, input)) {
+   if(!image_parse_filepaths(pyinput, input)) {
return NULL;
}
 
if(pyoutput) {
-   if(!denoise_parse_filepaths(pyoutput, output)) {
+   if(!image_parse_filepaths(pyoutput, output)) {
return NULL;
}
}
@@ -753,6 +753,42 @@ static PyObject *denoise_func(PyObject * /*self*/, 
PyObject *args, PyObject *key
Py_RETURN_NONE;
 }
 
+static PyObject *merge_func(PyObject * /*self*/, PyObject *args, PyObject 
*keywords)
+{
+   static const char *keyword_list[] = {"input", "output", NULL};
+   PyObject *pyinput, *pyoutput = NULL;
+
+   if (!PyArg_ParseTupleAndKeywords(args, keywords, "OO", 
(char**)keyword_list, , )) {
+   return NULL;
+   }
+
+   /* Parse input list. */
+   vector input;
+   if(!image_parse_filepaths(pyinput, input)) {
+   return NULL;
+   }
+
+   /* Parse output string. */
+   if(!PyUnicode_Check(pyoutput)) {
+   PyErr_SetString(PyExc_ValueError, "Output must be a string.");
+   return NULL;
+   }
+   string output = PyUnicode_AsUTF8(pyoutput);
+

[Bf-blender-cvs] [83fc8342d82] master: UI: Re-organize Brush Properties

2019-03-19 Thread William Reynish
Commit: 83fc8342d8271135d7ee0d0a380701cdfde3b20c
Author: William Reynish
Date:   Tue Mar 19 18:17:50 2019 +0100
Branches: master
https://developer.blender.org/rB83fc8342d8271135d7ee0d0a380701cdfde3b20c

UI: Re-organize Brush Properties

 - Consolidate each brush section (Color, Palette, Gradient) and make them 
distinct
 - Remove the lock icons and move these items into an Options sub-panel, 
together with other toggles
  - They now have more descriptive names
  - Use an enum for view vs scene brush unit
 - Use Property Split layout and sub-panels in line with the rest of 2.8
 - Rename Curve panel to Falloff

Reviewed by: campbellbarton, pablovazquez

Maniphest Tasks: D4529

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

===

M   release/scripts/startup/bl_ui/properties_paint_common.py
M   release/scripts/startup/bl_ui/space_image.py
M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/makesrna/intern/rna_brush.c
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index ac63948d18a..913643f6d84 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -52,18 +52,18 @@ class UnifiedPaintPanel:
 flow = parent.grid_flow(row_major=True, columns=0, even_columns=True, 
even_rows=False, align=False)
 
 col = flow.column()
-col.prop(ups, "use_unified_size", text="Size")
+col.prop(ups, "use_unified_size", text="Unified Size")
 col = flow.column()
-col.prop(ups, "use_unified_strength", text="Strength")
+col.prop(ups, "use_unified_strength", text="Unified Strength")
 if context.weight_paint_object:
 col = flow.column()
-col.prop(ups, "use_unified_weight", text="Weight")
+col.prop(ups, "use_unified_weight", text="Unified Weight")
 elif context.vertex_paint_object or context.image_paint_object:
 col = flow.column()
-col.prop(ups, "use_unified_color", text="Color")
+col.prop(ups, "use_unified_color", text="Unified Color")
 else:
 col = flow.column()
-col.prop(ups, "use_unified_color", text="Color")
+col.prop(ups, "use_unified_color", text="Unified Color")
 
 @staticmethod
 def prop_unified_size(parent, context, brush, prop_name, *, icon='NONE', 
text=None, slider=False):
@@ -114,109 +114,102 @@ def brush_texpaint_common(panel, context, layout, 
brush, settings, projpaint=Fal
 col = layout.column()
 
 if capabilities.has_color:
-if brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'}:
-if not brush.use_gradient:
-panel.prop_unified_color_picker(col, context, brush, "color", 
value_slider=True)
-
-if settings.palette:
-col.template_palette(settings, "palette", color=True)
-
-if brush.use_gradient:
-col.label(text="Gradient Colors")
-col.template_color_ramp(brush, "gradient", expand=True)
-
-if brush.image_tool == 'DRAW':
-col.label(text="Background Color")
-row = col.row(align=True)
-panel.prop_unified_color(row, context, brush, 
"secondary_color", text="")
-col.prop(brush, "gradient_stroke_mode", text="Mode")
-if brush.gradient_stroke_mode in {'SPACING_REPEAT', 
'SPACING_CLAMP'}:
-col.prop(brush, "grad_spacing")
-else:  # if brush.image_tool == 'FILL':
-col.prop(brush, "gradient_fill_mode")
-else:
-row = col.row(align=True)
-panel.prop_unified_color(row, context, brush, "color", text="")
-if brush.image_tool == 'FILL' and not projpaint:
-col.prop(brush, "fill_threshold")
-else:
-panel.prop_unified_color(row, context, brush, 
"secondary_color", text="")
-row.separator()
-row.operator("paint.brush_colors_flip", 
icon='FILE_REFRESH', text="")
-else:
+if brush.blend in {'ERASE_ALPHA', 'ADD_ALPHA'}:
 if brush.image_tool == 'FILL' and not projpaint:
 col.prop(brush, "fill_threshold")
 
 elif brush.image_tool == 'SOFTEN':
-col = layout.column(align=True)
 col.row().prop(brush, "direction", expand=True)
-col.separator()
 col.prop(brush, "sharp_threshold")
 if not projpaint:
 col.prop(brush, "blur_kernel_radius")
-col.separator()
 col.prop(brush, "blur_mode")
 elif brush.image_tool == 'MASK':
  

[Bf-blender-cvs] [c590e804667] master: Units: Use PROP_PIXEL for grad_spacing

2019-03-19 Thread William Reynish
Commit: c590e8046671e2b8f2b4d3ce9d60780e20bf4438
Author: William Reynish
Date:   Tue Mar 19 18:10:00 2019 +0100
Branches: master
https://developer.blender.org/rBc590e8046671e2b8f2b4d3ce9d60780e20bf4438

Units: Use PROP_PIXEL for grad_spacing

===

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

===

diff --git a/source/blender/makesrna/intern/rna_brush.c 
b/source/blender/makesrna/intern/rna_brush.c
index 86ac8d3bae6..c07e9523148 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1529,7 +1529,7 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Spacing", "Spacing between brush daubs 
as a percentage of brush diameter");
RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-   prop = RNA_def_property(srna, "grad_spacing", PROP_INT, PROP_NONE);
+   prop = RNA_def_property(srna, "grad_spacing", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "gradient_spacing");
RNA_def_property_range(prop, 1, 1);
RNA_def_property_ui_range(prop, 1, 1, 5, -1);

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


[Bf-blender-cvs] [2cc303700b6] master: Fix: Add poll methods for quick effects operators

2019-03-19 Thread matc
Commit: 2cc303700b65b70e731848e36dd24790b0a88166
Author: matc
Date:   Tue Mar 19 17:16:49 2019 +0100
Branches: master
https://developer.blender.org/rB2cc303700b65b70e731848e36dd24790b0a88166

Fix: Add poll methods for quick effects operators

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

===

M   release/scripts/startup/bl_operators/object_quick_effects.py

===

diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py 
b/release/scripts/startup/bl_operators/object_quick_effects.py
index 37c4af593c5..54673b24520 100644
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ b/release/scripts/startup/bl_operators/object_quick_effects.py
@@ -46,8 +46,12 @@ def object_ensure_material(obj, mat_name):
 obj.data.materials.append(mat)
 return mat
 
+class ObjectModeOperator:
+@classmethod
+def poll(cls, context):
+return context.mode == 'OBJECT'
 
-class QuickFur(Operator):
+class QuickFur(ObjectModeOperator, Operator):
 bl_idname = "object.quick_fur"
 bl_label = "Quick Fur"
 bl_options = {'REGISTER', 'UNDO'}
@@ -77,7 +81,7 @@ class QuickFur(Operator):
 def execute(self, context):
 fake_context = context.copy()
 mesh_objects = [obj for obj in context.selected_objects
-if obj.type == 'MESH' and obj.mode == 'OBJECT']
+if obj.type == 'MESH']
 
 if not mesh_objects:
 self.report({'ERROR'}, "Select at least one mesh object")
@@ -112,7 +116,7 @@ class QuickFur(Operator):
 return {'FINISHED'}
 
 
-class QuickExplode(Operator):
+class QuickExplode(ObjectModeOperator, Operator):
 bl_idname = "object.quick_explode"
 bl_label = "Quick Explode"
 bl_options = {'REGISTER', 'UNDO'}
@@ -318,7 +322,7 @@ def grid_location(x, y):
 return (x * 200, y * 150)
 
 
-class QuickSmoke(Operator):
+class QuickSmoke(ObjectModeOperator, Operator):
 bl_idname = "object.quick_smoke"
 bl_label = "Quick Smoke"
 bl_options = {'REGISTER', 'UNDO'}
@@ -422,7 +426,7 @@ class QuickSmoke(Operator):
 return {'FINISHED'}
 
 
-class QuickFluid(Operator):
+class QuickFluid(ObjectModeOperator, Operator):
 bl_idname = "object.quick_fluid"
 bl_label = "Quick Fluid"
 bl_options = {'REGISTER', 'UNDO'}

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


[Bf-blender-cvs] [3b04a867b92] master: Cleanup: correct comment

2019-03-19 Thread Campbell Barton
Commit: 3b04a867b928cba3fe167a9d563de662618d4af3
Author: Campbell Barton
Date:   Wed Mar 20 03:14:50 2019 +1100
Branches: master
https://developer.blender.org/rB3b04a867b928cba3fe167a9d563de662618d4af3

Cleanup: correct comment

===

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

===

diff --git a/source/blender/editors/mesh/editmesh_select_similar.c 
b/source/blender/editors/mesh/editmesh_select_similar.c
index 98808fc6df3..b4504626990 100644
--- a/source/blender/editors/mesh/editmesh_select_similar.c
+++ b/source/blender/editors/mesh/editmesh_select_similar.c
@@ -138,10 +138,7 @@ static bool face_data_value_set(BMFace *face, const int 
hflag, int *r_value)
 }
 
 /**
- * Note: This is not normal, but the face direction itself and always in
- * a positive quadrant (tries z, y then x).
- * Also, unlike edge_pos_direction_worldspace_get we don't normalize the 
direction.
- * In fact we scale the direction by the distance of the face center to the 
origin.
+ * World space normalized plane from a face.
  */
 static void face_to_plane(const Object *ob, BMFace *face, float r_plane[4])
 {
@@ -151,7 +148,6 @@ static void face_to_plane(const Object *ob, BMFace *face, 
float r_plane[4])
normalize_v3(normal);
mul_v3_m4v3(co, ob->obmat, BM_FACE_FIRST_LOOP(face)->v->co);
plane_from_point_normal_v3(r_plane, co, normal);
-
 }
 
 /* TODO(dfelinto): `types` that should technically be compared in world space 
but are not:

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


[Bf-blender-cvs] [7533b4416ea] functions: decision id cleanup

2019-03-19 Thread Jacques Lucke
Commit: 7533b4416eab6cdd2e3dcd2add81dbbb84d21983
Author: Jacques Lucke
Date:   Tue Mar 19 17:11:49 2019 +0100
Branches: functions
https://developer.blender.org/rB7533b4416eab6cdd2e3dcd2add81dbbb84d21983

decision id cleanup

===

M   release/scripts/startup/function_nodes/update_sockets.py

===

diff --git a/release/scripts/startup/function_nodes/update_sockets.py 
b/release/scripts/startup/function_nodes/update_sockets.py
index 725e502e820..56008d9431d 100644
--- a/release/scripts/startup/function_nodes/update_sockets.py
+++ b/release/scripts/startup/function_nodes/update_sockets.py
@@ -3,6 +3,7 @@ from . base import FunctionNode, DataSocket
 from . inferencer import Inferencer
 from collections import defaultdict
 from . sockets import type_infos, OperatorSocket, DataSocket
+from dataclasses import dataclass
 
 from . socket_decl import (
 FixedSocketDecl,
@@ -52,6 +53,15 @@ def run_socket_operators(tree):
 # Inferencing
 ###
 
+@dataclass
+class DecisionID:
+node: bpy.types.Node
+prop: object
+prop_name: str
+
+def __hash__(self):
+return id(self)
+
 def run_socket_type_inferencer(tree):
 inferencer = Inferencer()
 
@@ -66,17 +76,10 @@ def run_socket_type_inferencer(tree):
 nodes_to_rebuild = set()
 
 for decision_id, value in inferencer.get_decisions().items():
-if decision_id[0] == "COLLECTION":
-node, prop_name, index, attr_name = decision_id[1:]
-item = getattr(node, prop_name)[index]
-if getattr(item, attr_name) != value:
-setattr(item, attr_name, value)
-nodes_to_rebuild.add(node)
-else:
-node, prop_name = decision_id
-if getattr(node, prop_name) != value:
-setattr(node, prop_name, value)
-nodes_to_rebuild.add(node)
+decision_id: DecisionID
+if getattr(decision_id.prop, decision_id.prop_name) != value:
+setattr(decision_id.prop, decision_id.prop_name, value)
+nodes_to_rebuild.add(decision_id.node)
 
 for node in nodes_to_rebuild:
 node.rebuild_and_try_keep_state()
@@ -101,7 +104,7 @@ def insert_constraints__within_node(inferencer, node):
 elif isinstance(decl, VariadicListDecl):
 for i, socket in enumerate(sockets[:-1]):
 inferencer.insert_list_or_base_constraint(
-socket.to_id(node), decl.base_type, ("COLLECTION", node, 
decl.prop_name, i, "state"))
+socket.to_id(node), decl.base_type, DecisionID(node, 
getattr(node, decl.prop_name)[i], "state"))
 elif isinstance(decl, AnyVariadicDecl):
 for socket in sockets[:-1]:
 inferencer.insert_final_type(socket.to_id(node), 
socket.data_type)
@@ -109,7 +112,7 @@ def insert_constraints__within_node(inferencer, node):
 inferencer.insert_union_constraint(
 [sockets[0].to_id(node)],
 decl.allowed_types,
-(node, decl.prop_name))
+DecisionID(node, node, decl.prop_name))
 
 properties = set()
 properties.update(list_ids_per_prop.keys())
@@ -119,7 +122,7 @@ def insert_constraints__within_node(inferencer, node):
 inferencer.insert_list_constraint(
 list_ids_per_prop[prop],
 base_ids_per_prop[prop],
-(node, prop))
+DecisionID(node, node, prop))
 
 def insert_constraints__link(inferencer, link):
 if not isinstance(link.from_socket, DataSocket):

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


[Bf-blender-cvs] [57395061042] master: UI: scale cursor motion threshold by DPI

2019-03-19 Thread Campbell Barton
Commit: 57395061042fe336dae7ee33e3ae11e53d068194
Author: Campbell Barton
Date:   Wed Mar 20 02:48:11 2019 +1100
Branches: master
https://developer.blender.org/rB57395061042fe336dae7ee33e3ae11e53d068194

UI: scale cursor motion threshold by DPI

This was using hard coded values of 2-3px.

Move both drag and motion thresholds to defines.

===

M   source/blender/editors/armature/armature_select.c
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/screen/screen_ops.c
M   source/blender/editors/space_view3d/view3d_select.c
M   source/blender/windowmanager/WM_types.h
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
M   source/blender/windowmanager/intern/wm_event_system.c

===

diff --git a/source/blender/editors/armature/armature_select.c 
b/source/blender/editors/armature/armature_select.c
index 658392f77aa..8e58f14ec99 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -421,7 +421,7 @@ static EditBone *get_nearest_editbonepoint(
 
if (vc->v3d->shading.type > OB_WIRE) {
do_nearest = true;
-   if (len_manhattan_v2v2_int(vc->mval, last_mval) < 3) {
+   if (len_manhattan_v2v2_int(vc->mval, last_mval) < 
WM_EVENT_CURSOR_MOTION_THRESHOLD) {
do_nearest = false;
}
}
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index a52a9633729..50ff2c1e7ff 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8136,9 +8136,7 @@ static int ui_handle_button_event(bContext *C, const 
wmEvent *event, uiBut *but)
/* Drag on a hold button (used in the 
toolbar) now opens it immediately. */
if (data->hold_action_timer) {
if (but->flag & UI_SELECT) {
-   if ((abs(event->x - 
event->prevx)) > 2 ||
-   (abs(event->y - 
event->prevy)) > 2)
-   {
+   if 
(len_manhattan_v2v2_int(>x, >prevx) >= 
WM_EVENT_CURSOR_MOTION_THRESHOLD) {

WM_event_remove_timer(data->wm, data->window, data->hold_action_timer);

data->hold_action_timer = WM_event_add_timer(data->wm, data->window, TIMER, 
0.0f);
}
diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index bb56d127b31..b4dfcf9ab66 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -2511,8 +2511,7 @@ static int region_scale_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
}
case LEFTMOUSE:
if (event->val == KM_RELEASE) {
-
-   if (ABS(event->x - rmd->origx) < 2 && 
ABS(event->y - rmd->origy) < 2) {
+   if (len_manhattan_v2v2_int(>x, 
>origx) < WM_EVENT_CURSOR_MOTION_THRESHOLD) {
if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
region_scale_toggle_hidden(C, 
rmd);
}
diff --git a/source/blender/editors/space_view3d/view3d_select.c 
b/source/blender/editors/space_view3d/view3d_select.c
index 6a42c06e59d..d7128b7d21a 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -1410,7 +1410,7 @@ static int mixed_bones_object_selectbuffer_extended(
if (use_cycle) {
if (v3d->shading.type > OB_WIRE) {
do_nearest = true;
-   if (len_manhattan_v2v2_int(mval, last_mval) < 3) {
+   if (len_manhattan_v2v2_int(mval, last_mval) < 
WM_EVENT_CURSOR_MOTION_THRESHOLD) {
do_nearest = false;
}
}
diff --git a/source/blender/windowmanager/WM_types.h 
b/source/blender/windowmanager/WM_types.h
index 0f799448561..8ad63cb92c0 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -490,6 +490,18 @@ typedef struct wmEvent {
 
 } wmEvent;
 
+/**
+ * Values below are considered a click, above are considered a drag.
+ */
+#define 

[Bf-blender-cvs] [bd803939957] master: Fix T60684 Fourth and subsequent vertex color / UV layers displayed black

2019-03-19 Thread Clément Foucault
Commit: bd803939957555e9c22b096365238704f55f6b3e
Author: Clément Foucault
Date:   Tue Mar 19 16:25:52 2019 +0100
Branches: master
https://developer.blender.org/rBbd803939957555e9c22b096365238704f55f6b3e

Fix T60684 Fourth and subsequent vertex color / UV layers displayed black

===

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

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 08b306b0ebe..3e1b6b6c020 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -889,11 +889,13 @@ static MeshRenderData *mesh_render_data_create_ex(
 * to a safe glsl var name, but without name clash.
 * NOTE 2 : Replicate changes to code_generate_vertex_new() in 
gpu_codegen.c */
if (rdata->cd.layers.vcol_len != 0) {
+   int act_vcol = rdata->cd.layers.vcol_active;
for (int i_src = 0, i_dst = 0; i_src < 
cd_layers_src.vcol_len; i_src++, i_dst++) {
if ((cd_lused[CD_MLOOPCOL] & (1 << i_src)) == 
0) {
+   /* This is a non-used VCol slot. Skip. 
*/
i_dst--;
if (rdata->cd.layers.vcol_active >= 
i_src) {
-   rdata->cd.layers.vcol_active--;
+   act_vcol--;
}
}
else {
@@ -916,6 +918,10 @@ static MeshRenderData *mesh_render_data_create_ex(
}
}
}
+   if (rdata->cd.layers.vcol_active != -1) {
+   /* Actual active Vcol slot inside vcol layers 
used for shading. */
+   rdata->cd.layers.vcol_active = act_vcol;
+   }
}
 
/* Start Fresh */

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


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

2019-03-19 Thread Antonioya
Commit: 24bab81d086db987b088dfb5dad4ba1d863fdbc2
Author: Antonioya
Date:   Tue Mar 19 16:25:10 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB24bab81d086db987b088dfb5dad4ba1d863fdbc2

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] [899fc0331c4] master: BLI_kdtree: use 1d tree for select similar

2019-03-19 Thread Campbell Barton
Commit: 899fc0331c40bb8ca6d3673a418fe7ee90c3613a
Author: Campbell Barton
Date:   Wed Mar 20 01:56:53 2019 +1100
Branches: master
https://developer.blender.org/rB899fc0331c40bb8ca6d3673a418fe7ee90c3613a

BLI_kdtree: use 1d tree for select similar

===

M   source/blender/editors/curve/editcurve_select.c
M   source/blender/editors/include/ED_select_utils.h
M   source/blender/editors/mesh/editmesh_select_similar.c
M   source/blender/editors/metaball/mball_edit.c
M   source/blender/editors/util/select_utils.c

===

diff --git a/source/blender/editors/curve/editcurve_select.c 
b/source/blender/editors/curve/editcurve_select.c
index ba9a42a6c2b..23d55ed8eca 100644
--- a/source/blender/editors/curve/editcurve_select.c
+++ b/source/blender/editors/curve/editcurve_select.c
@@ -1362,7 +1362,8 @@ static void nurb_bpoint_direction_worldspace_get(Object 
*ob, Nurb *nu, BPoint *b
normalize_v3(r_dir);
 }
 
-static void curve_nurb_selected_type_get(Object *ob, Nurb *nu, const int type, 
KDTree_3d *r_tree)
+static void curve_nurb_selected_type_get(
+Object *ob, Nurb *nu, const int type, KDTree_1d *tree_1d, KDTree_3d 
*tree_3d)
 {
float tree_entry[3] = {0.0f, 0.0f, 0.0f};
 
@@ -1393,7 +1394,12 @@ static void curve_nurb_selected_type_get(Object *ob, 
Nurb *nu, const int type, K
break;
}
}
-   BLI_kdtree_3d_insert(r_tree, tree_index++, 
tree_entry);
+   if (tree_1d) {
+   BLI_kdtree_1d_insert(tree_1d, 
tree_index++, tree_entry);
+   }
+   else {
+   BLI_kdtree_3d_insert(tree_3d, 
tree_index++, tree_entry);
+   }
}
}
}
@@ -1423,7 +1429,12 @@ static void curve_nurb_selected_type_get(Object *ob, 
Nurb *nu, const int type, K
break;
}
}
-   BLI_kdtree_3d_insert(r_tree, tree_index++, 
tree_entry);
+   if (tree_1d) {
+   BLI_kdtree_1d_insert(tree_1d, 
tree_index++, tree_entry);
+   }
+   else {
+   BLI_kdtree_3d_insert(tree_3d, 
tree_index++, tree_entry);
+   }
}
}
}
@@ -1431,7 +1442,8 @@ static void curve_nurb_selected_type_get(Object *ob, Nurb 
*nu, const int type, K
 
 static bool curve_nurb_select_similar_type(
 Object *ob, Nurb *nu, const int type,
-const KDTree_3d *tree, const float thresh, const int compare)
+const KDTree_1d *tree_1d, const KDTree_3d *tree_3d,
+const float thresh, const int compare)
 {
const float thresh_cos = cosf(thresh * (float)M_PI_2);
bool changed = false;
@@ -1448,7 +1460,7 @@ static bool curve_nurb_select_similar_type(
case SIMCURHAND_RADIUS:
{
float radius_ref = bezt->radius;
-   if 
(ED_select_similar_compare_float_tree(tree, radius_ref, thresh, compare)) {
+   if 
(ED_select_similar_compare_float_tree(tree_1d, radius_ref, thresh, compare)) {
select = true;
}
break;
@@ -1456,7 +1468,7 @@ static bool curve_nurb_select_similar_type(
case SIMCURHAND_WEIGHT:
{
float weight_ref = bezt->weight;
-   if 
(ED_select_similar_compare_float_tree(tree, weight_ref, thresh, compare)) {
+   if 
(ED_select_similar_compare_float_tree(tree_1d, weight_ref, thresh, compare)) {
select = true;
}
break;
@@ -1466,7 +1478,7 @@ static bool curve_nurb_select_similar_type(
float dir[3];

nurb_bezt_direction_worldspace_get(ob, nu, bezt, dir);
KDTreeNearest_3d nearest;
- 

[Bf-blender-cvs] [7a937436ab1] master: BLI_kdtree: add 1d kdtree support

2019-03-19 Thread Campbell Barton
Commit: 7a937436ab14ec05542b3539a6262c7e78b3929b
Author: Campbell Barton
Date:   Wed Mar 20 01:20:46 2019 +1100
Branches: master
https://developer.blender.org/rB7a937436ab14ec05542b3539a6262c7e78b3929b

BLI_kdtree: add 1d kdtree support

Some users only use the tree to store a single value.

===

M   source/blender/blenlib/BLI_kdtree.h
M   source/blender/blenlib/CMakeLists.txt
A   source/blender/blenlib/intern/kdtree_1d.c

===

diff --git a/source/blender/blenlib/BLI_kdtree.h 
b/source/blender/blenlib/BLI_kdtree.h
index 18f3236a310..4baff208ca7 100644
--- a/source/blender/blenlib/BLI_kdtree.h
+++ b/source/blender/blenlib/BLI_kdtree.h
@@ -22,6 +22,17 @@
  * \brief A kd-tree for nearest neighbor search.
  */
 
+/* 1D version */
+#define KD_DIMS 1
+#define KDTREE_PREFIX_ID BLI_kdtree_1d
+#define KDTree KDTree_1d
+#define KDTreeNearest KDTreeNearest_1d
+#include "BLI_kdtree_impl.h"
+#undef KD_DIMS
+#undef KDTree
+#undef KDTreeNearest
+#undef KDTREE_PREFIX_ID
+
 /* 2D version */
 #define KD_DIMS 2
 #define KDTREE_PREFIX_ID BLI_kdtree_2d
diff --git a/source/blender/blenlib/CMakeLists.txt 
b/source/blender/blenlib/CMakeLists.txt
index fef24c059e7..09573d31a76 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -75,6 +75,7 @@ set(SRC
intern/hash_mm2a.c
intern/hash_mm3.c
intern/jitter_2d.c
+   intern/kdtree_1d.c
intern/kdtree_2d.c
intern/kdtree_3d.c
intern/kdtree_4d.c
diff --git a/source/blender/blenlib/intern/kdtree_1d.c 
b/source/blender/blenlib/intern/kdtree_1d.c
new file mode 100644
index 000..95d440d3644
--- /dev/null
+++ b/source/blender/blenlib/intern/kdtree_1d.c
@@ -0,0 +1,25 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup bli
+ */
+
+#define KD_DIMS 1
+#define KDTREE_PREFIX_ID BLI_kdtree_1d
+#define KDTree KDTree_1d
+#define KDTreeNearest KDTreeNearest_1d
+#  include "kdtree_impl.h"

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


[Bf-blender-cvs] [85685c7bdc6] master: Fix T62622: Animating vertex does not update viewport

2019-03-19 Thread Sergey Sharybin
Commit: 85685c7bdc6fa82edb69ea33ca7d240be28c
Author: Sergey Sharybin
Date:   Tue Mar 19 15:56:09 2019 +0100
Branches: master
https://developer.blender.org/rB85685c7bdc6fa82edb69ea33ca7d240be28c

Fix T62622: Animating vertex does not update viewport

Missing dependency graph update due to wrong relation.

===

M   source/blender/depsgraph/intern/builder/deg_builder_rna.cc

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
index eea9f7f67f2..3e9c3811fb5 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
@@ -336,8 +336,16 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(
else if (RNA_struct_is_a(ptr->type, _ImageUser)) {
if (GS(node_identifier.id->name) == ID_NT) {
node_identifier.type = NodeType::ANIMATION;
-   node_identifier.operation_code = OperationCode::IMAGE_ANIMATION;
+   node_identifier.operation_code = 
OperationCode::IMAGE_ANIMATION;
+   return node_identifier;
}
+   }
+   else if (ELEM(ptr->type, _MeshVertex,
+_MeshEdge,
+_MeshLoop,
+_MeshPolygon))
+   {
+   node_identifier.type = NodeType::GEOMETRY;
return node_identifier;
}
if (prop != NULL) {

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


[Bf-blender-cvs] [08fe29e52f1] master: Fix T62715: Grease Pencil Apply Armature Modifier Issue

2019-03-19 Thread Antonioya
Commit: 08fe29e52f161398682570eff45d8de391b73df8
Author: Antonioya
Date:   Tue Mar 19 16:03:50 2019 +0100
Branches: master
https://developer.blender.org/rB08fe29e52f161398682570eff45d8de391b73df8

Fix T62715: Grease Pencil Apply Armature Modifier Issue

@sergey wrote: "The reason it was failing is because md points to an original 
armature, which doesn't have runtime data needed for deformation. That data is 
to come from evaluated armature."

Thanks to @sergey for his help.

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
index 11e648e355d..f2e387c0374 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
@@ -119,9 +119,11 @@ static void bakeModifier(
 Main *bmain, Depsgraph *depsgraph,
 GpencilModifierData *md, Object *ob)
 {
-   ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md;
Scene *scene = DEG_get_evaluated_scene(depsgraph);
-   bGPdata *gpd = ob->data;
+   Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+   ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md;
+   GpencilModifierData *md_eval = 
BKE_gpencil_modifiers_findByName(object_eval, md->name);
+   bGPdata *gpd = (bGPdata *)ob->data;
int oldframe = (int)DEG_get_ctime(depsgraph);
 
if (mmd->object == NULL)
@@ -137,7 +139,7 @@ static void bakeModifier(
 
/* compute armature effects on this frame */
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = 
gps->next) {
-   deformStroke(md, depsgraph, ob, gpl, gps);
+   deformStroke(md_eval, depsgraph, object_eval, 
gpl, gps);
}
}
}

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


[Bf-blender-cvs] [e226460dd35] master: Workbench: World Clipping For Specular Transparent

2019-03-19 Thread Jeroen Bakker
Commit: e226460dd35b1439092888f280b00e7993d78f13
Author: Jeroen Bakker
Date:   Tue Mar 19 15:41:14 2019 +0100
Branches: master
https://developer.blender.org/rBe226460dd35b1439092888f280b00e7993d78f13

Workbench: World Clipping For Specular Transparent

When Specular Transparent materials are used the world clipping
did not work on the transparent materials. The reason was that the
accum shaders did not vary on the existance of the clipping planes

This patch will variate the accum shaders when clipping planes are
active.

Reviewed By: fclem

Maniphest Tasks: T61023

===

M   source/blender/draw/engines/workbench/workbench_deferred.c
M   source/blender/draw/engines/workbench/workbench_forward.c
M   source/blender/draw/engines/workbench/workbench_materials.c
M   source/blender/draw/engines/workbench/workbench_private.h

===

diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c 
b/source/blender/draw/engines/workbench/workbench_deferred.c
index b4175935b7a..1fe0202da5b 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -824,7 +824,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
DRW_shgroup_stencil_mask(material->shgrp, (ob->dtx & 
OB_DRAWXRAY) ? 0x00 : 0xFF);
DRW_shgroup_uniform_int(material->shgrp, "object_id", 
>object_id, 1);
workbench_material_shgroup_uniform(wpd, material->shgrp, 
material, ob, true, true, interp);
-   if (wpd->world_clip_planes) {
+   if (WORLD_CLIPPING_ENABLED(wpd)) {
const DRWContextState *draw_ctx = 
DRW_context_state_get();
RegionView3D *rv3d = draw_ctx->rv3d;

DRW_shgroup_world_clip_planes_from_rv3d(material->shgrp, rv3d);
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c 
b/source/blender/draw/engines/workbench/workbench_forward.c
index d6a11a2b1e7..bf5de40bbef 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -199,7 +199,7 @@ WORKBENCH_MaterialData 
*workbench_forward_get_or_create_material_data(
}
material->object_id = engine_object_data->object_id;
DRW_shgroup_uniform_int(material->shgrp_object_outline, 
"object_id", >object_id, 1);
-   if (wpd->world_clip_planes) {
+   if (WORLD_CLIPPING_ENABLED(wpd)) {
const DRWContextState *draw_ctx = 
DRW_context_state_get();
RegionView3D *rv3d = draw_ctx->rv3d;

DRW_shgroup_world_clip_planes_from_rv3d(material->shgrp_object_outline, rv3d);
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c 
b/source/blender/draw/engines/workbench/workbench_materials.c
index 47895f8729b..0bca8541e80 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -130,7 +130,7 @@ char 
*workbench_material_build_defines(WORKBENCH_PrivateData *wpd, bool use_text
if (is_hair) {
BLI_dynstr_appendf(ds, "#define HAIR_SHADER\n");
}
-   if (wpd->world_clip_planes != NULL) {
+   if (WORLD_CLIPPING_ENABLED(wpd)) {
BLI_dynstr_appendf(ds, "#define USE_WORLD_CLIP_PLANES\n");
}
 
@@ -192,7 +192,7 @@ int workbench_material_get_prepass_shader_index(
SET_FLAG_FROM_TEST(index, NORMAL_VIEWPORT_PASS_ENABLED(wpd), 1 << 3);
SET_FLAG_FROM_TEST(index, MATCAP_ENABLED(wpd), 1 << 4);
SET_FLAG_FROM_TEST(index, use_textures, 1 << 5);
-   SET_FLAG_FROM_TEST(index, wpd->world_clip_planes != NULL, 1 << 6);
+   SET_FLAG_FROM_TEST(index, WORLD_CLIPPING_ENABLED(wpd), 1 << 6);
BLI_assert(index < MAX_PREPASS_SHADERS);
return index;
 }
@@ -207,6 +207,7 @@ int 
workbench_material_get_accum_shader_index(WORKBENCH_PrivateData *wpd, bool u
SET_FLAG_FROM_TEST(index, is_hair, 1 << 3);
/* 1 bits SHADOWS (only facing factor) */
SET_FLAG_FROM_TEST(index, SHADOW_ENABLED(wpd), 1 << 4);
+   SET_FLAG_FROM_TEST(index, WORLD_CLIPPING_ENABLED(wpd), 1 << 5);
BLI_assert(index < MAX_ACCUM_SHADERS);
return index;
 }
@@ -281,7 +282,7 @@ void workbench_material_shgroup_uniform(
DRW_shgroup_uniform_float(grp, "materialRoughness", 
>roughness, 1);
}
 
-   if (wpd->world_clip_planes != NULL) {
+   if (WORLD_CLIPPING_ENABLED(wpd)) {
DRW_shgroup_uniform_vec4(grp, "WorldClipPlanes", 
wpd->world_clip_planes[0], 6);
DRW_shgroup_state_enable(grp, DRW_STATE_CLIP_PLANES);
}
diff --git a/source/blender/draw/engines/workbench/workbench_private.h 

[Bf-blender-cvs] [9b8eef9d9c4] master: Fix T62558: Certain IES file causes crash

2019-03-19 Thread Jacques Lucke
Commit: 9b8eef9d9c4a337bcdb9127bec63513dd0ee7e54
Author: Jacques Lucke
Date:   Tue Mar 19 15:33:28 2019 +0100
Branches: master
https://developer.blender.org/rB9b8eef9d9c4a337bcdb9127bec63513dd0ee7e54

Fix T62558: Certain IES file causes crash

Reviewers: brecht

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

===

M   intern/cycles/util/util_ies.cpp

===

diff --git a/intern/cycles/util/util_ies.cpp b/intern/cycles/util/util_ies.cpp
index e1de2e0c6e4..277045d9bc4 100644
--- a/intern/cycles/util/util_ies.cpp
+++ b/intern/cycles/util/util_ies.cpp
@@ -293,7 +293,7 @@ bool IESFile::process_type_c()
 {
if(h_angles[0] == 90.0f) {
/* Some files are stored from 90° to 270°, so we just rotate 
them to the regular 0°-180° range here. */
-   for(int i = 0; i < v_angles.size(); i++) {
+   for(int i = 0; i < h_angles.size(); i++) {
h_angles[i] -= 90.0f;
}
}

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


[Bf-blender-cvs] [1cb325fc22d] master: Cleanup: name 3D/4D trees in similar selection code

2019-03-19 Thread Campbell Barton
Commit: 1cb325fc22df207e4840bf3ecfff7891cb16f257
Author: Campbell Barton
Date:   Wed Mar 20 01:16:04 2019 +1100
Branches: master
https://developer.blender.org/rB1cb325fc22df207e4840bf3ecfff7891cb16f257

Cleanup: name 3D/4D trees in similar selection code

Do this so trees have matching & logical names.

===

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

===

diff --git a/source/blender/editors/mesh/editmesh_select_similar.c 
b/source/blender/editors/mesh/editmesh_select_similar.c
index 59c34578777..59610a10d96 100644
--- a/source/blender/editors/mesh/editmesh_select_similar.c
+++ b/source/blender/editors/mesh/editmesh_select_similar.c
@@ -183,7 +183,7 @@ static int similar_face_select_exec(bContext *C, wmOperator 
*op)
return OPERATOR_CANCELLED;
}
 
-   KDTree_3d *tree = NULL;
+   KDTree_3d *tree_3d = NULL;
KDTree_4d *tree_plane = NULL;
GSet *gset = NULL;
GSet **gset_array = NULL;
@@ -193,7 +193,7 @@ static int similar_face_select_exec(bContext *C, wmOperator 
*op)
case SIMFACE_AREA:
case SIMFACE_PERIMETER:
case SIMFACE_NORMAL:
-   tree = BLI_kdtree_3d_new(tot_faces_selected_all);
+   tree_3d = BLI_kdtree_3d_new(tot_faces_selected_all);
break;
case SIMFACE_COPLANAR:
tree_plane = BLI_kdtree_4d_new(tot_faces_selected_all);
@@ -273,14 +273,14 @@ static int similar_face_select_exec(bContext *C, 
wmOperator *op)
{
float area = 
BM_face_calc_area_with_mat3(face, ob_m3);
float dummy[3] = {area, 0.0f, 
0.0f};
-   BLI_kdtree_3d_insert(tree, 
tree_index++, dummy);
+   BLI_kdtree_3d_insert(tree_3d, 
tree_index++, dummy);
break;
}
case SIMFACE_PERIMETER:
{
float perimeter = 
BM_face_calc_perimeter_with_mat3(face, ob_m3);
float dummy[3] = {perimeter, 
0.0f, 0.0f};
-   BLI_kdtree_3d_insert(tree, 
tree_index++, dummy);
+   BLI_kdtree_3d_insert(tree_3d, 
tree_index++, dummy);
break;
}
case SIMFACE_NORMAL:
@@ -290,7 +290,7 @@ static int similar_face_select_exec(bContext *C, wmOperator 
*op)

mul_transposed_mat3_m4_v3(ob->imat, normal);
normalize_v3(normal);
 
-   BLI_kdtree_3d_insert(tree, 
tree_index++, normal);
+   BLI_kdtree_3d_insert(tree_3d, 
tree_index++, normal);
break;
}
case SIMFACE_COPLANAR:
@@ -336,8 +336,8 @@ static int similar_face_select_exec(bContext *C, wmOperator 
*op)
 
BLI_assert((type != SIMFACE_FREESTYLE) || (face_data_value != 
SIMFACE_DATA_NONE));
 
-   if (tree != NULL) {
-   BLI_kdtree_3d_balance(tree);
+   if (tree_3d != NULL) {
+   BLI_kdtree_3d_balance(tree_3d);
}
if (tree_plane != NULL) {
BLI_kdtree_4d_balance(tree_plane);
@@ -424,7 +424,7 @@ static int similar_face_select_exec(bContext *C, wmOperator 
*op)
case SIMFACE_AREA:
{
float area = 
BM_face_calc_area_with_mat3(face, ob_m3);
-   if 
(ED_select_similar_compare_float_tree(tree, area, thresh, compare)) {
+   if 
(ED_select_similar_compare_float_tree(tree_3d, area, thresh, compare)) {
select = true;
}
break;
@@ -432,7 +432,7 @@ static int similar_face_select_exec(bContext *C, wmOperator 
*op)
case SIMFACE_PERIMETER:
{
float perimeter = 
BM_face_calc_perimeter_with_mat3(face, ob_m3);
-   if 

[Bf-blender-cvs] [e7b4bbd2944] master: UV: Use BLI_kdtree_2d for 2D data

2019-03-19 Thread Campbell Barton
Commit: e7b4bbd29446ee30f22cb0c8ad5dfd54c350beaa
Author: Campbell Barton
Date:   Wed Mar 20 00:58:22 2019 +1100
Branches: master
https://developer.blender.org/rBe7b4bbd29446ee30f22cb0c8ad5dfd54c350beaa

UV: Use BLI_kdtree_2d for 2D data

===

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

===

diff --git a/source/blender/editors/uvedit/uvedit_ops.c 
b/source/blender/editors/uvedit/uvedit_ops.c
index 108481b9dae..b8c2c461f9b 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -1853,7 +1853,7 @@ static int uv_remove_doubles_to_selected(bContext *C, 
wmOperator *op)
uv_maxlen += em->bm->totloop;
}
 
-   KDTree_3d *tree = BLI_kdtree_3d_new(uv_maxlen);
+   KDTree_2d *tree = BLI_kdtree_2d_new(uv_maxlen);
 
int *duplicates = NULL;
BLI_array_declare(duplicates);
@@ -1863,7 +1863,6 @@ static int uv_remove_doubles_to_selected(bContext *C, 
wmOperator *op)
 
int mloopuv_count = 0;  /* Also used for *duplicates count. */
 
-   float uvw[3];
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
BMIter iter, liter;
BMFace *efa;
@@ -1885,8 +1884,7 @@ static int uv_remove_doubles_to_selected(bContext *C, 
wmOperator *op)
BM_ITER_ELEM(l, , efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(scene, l, 
cd_loop_uv_offset)) {
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, 
cd_loop_uv_offset);
-   copy_v3_fl3(uvw, luv->uv[0], 
luv->uv[1], 0.0f);
-   BLI_kdtree_3d_insert(tree, 
mloopuv_count, uvw);
+   BLI_kdtree_2d_insert(tree, 
mloopuv_count, luv->uv);
BLI_array_append(duplicates, -1);
BLI_array_append(mloopuv_arr, luv);
mloopuv_count++;
@@ -1897,8 +1895,8 @@ static int uv_remove_doubles_to_selected(bContext *C, 
wmOperator *op)
ob_mloopuv_max_idx[ob_index] = mloopuv_count - 1;
}
 
-   BLI_kdtree_3d_balance(tree);
-   int found_duplicates = BLI_kdtree_3d_calc_duplicates_fast(tree, 
threshold, false, duplicates);
+   BLI_kdtree_2d_balance(tree);
+   int found_duplicates = BLI_kdtree_2d_calc_duplicates_fast(tree, 
threshold, false, duplicates);
 
if (found_duplicates > 0) {
/* Calculate average uv for duplicates. */
@@ -1955,7 +1953,7 @@ static int uv_remove_doubles_to_selected(bContext *C, 
wmOperator *op)
}
}
 
-   BLI_kdtree_3d_free(tree);
+   BLI_kdtree_2d_free(tree);
BLI_array_free(mloopuv_arr);
BLI_array_free(duplicates);
MEM_freeN(changed);
@@ -1987,14 +1985,13 @@ static int uv_remove_doubles_to_unselected(bContext *C, 
wmOperator *op)
uv_maxlen += em->bm->totloop;
}
 
-   KDTree_3d *tree = BLI_kdtree_3d_new(uv_maxlen);
+   KDTree_2d *tree = BLI_kdtree_2d_new(uv_maxlen);
 
MLoopUV **mloopuv_arr = NULL;
BLI_array_declare(mloopuv_arr);
 
int mloopuv_count = 0;
 
-   float uvw[3];
/* Add visible non-selected uvs to tree */
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
BMIter iter, liter;
@@ -2017,8 +2014,7 @@ static int uv_remove_doubles_to_unselected(bContext *C, 
wmOperator *op)
BM_ITER_ELEM(l, , efa, BM_LOOPS_OF_FACE) {
if (!uvedit_uv_select_test(scene, l, 
cd_loop_uv_offset)) {
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, 
cd_loop_uv_offset);
-   copy_v3_fl3(uvw, luv->uv[0], 
luv->uv[1], 0.0f);
-   BLI_kdtree_3d_insert(tree, 
mloopuv_count, uvw);
+   BLI_kdtree_2d_insert(tree, 
mloopuv_count, luv->uv);
BLI_array_append(mloopuv_arr, luv);
mloopuv_count++;
}
@@ -2026,7 +2022,7 @@ static int uv_remove_doubles_to_unselected(bContext *C, 
wmOperator *op)
}
}
 
-   BLI_kdtree_3d_balance(tree);
+   BLI_kdtree_2d_balance(tree);
 
/* For each selected uv, find duplicate non selected uv. */
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
@@ -2051,10 +2047,8 @@ static int uv_remove_doubles_to_unselected(bContext *C, 
wmOperator *op)
BM_ITER_ELEM(l, , efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(scene, l, 
cd_loop_uv_offset)) {
MLoopUV *luv 

[Bf-blender-cvs] [d1b9b838be8] master: BLI_kdtree: add 2D kdtree support

2019-03-19 Thread Campbell Barton
Commit: d1b9b838be8a09735f52637fecdd2a8200eb9862
Author: Campbell Barton
Date:   Wed Mar 20 00:57:52 2019 +1100
Branches: master
https://developer.blender.org/rBd1b9b838be8a09735f52637fecdd2a8200eb9862

BLI_kdtree: add 2D kdtree support

Some users of the 3D versions were storing 2D data in it.

Using a 3D tree for 2D data adds a spatially redundant branch
every 3rd level, as well as some extra memory use, best avoid this.

===

M   source/blender/blenlib/BLI_kdtree.h
M   source/blender/blenlib/CMakeLists.txt
A   source/blender/blenlib/intern/kdtree_2d.c

===

diff --git a/source/blender/blenlib/BLI_kdtree.h 
b/source/blender/blenlib/BLI_kdtree.h
index af10a448423..18f3236a310 100644
--- a/source/blender/blenlib/BLI_kdtree.h
+++ b/source/blender/blenlib/BLI_kdtree.h
@@ -22,6 +22,17 @@
  * \brief A kd-tree for nearest neighbor search.
  */
 
+/* 2D version */
+#define KD_DIMS 2
+#define KDTREE_PREFIX_ID BLI_kdtree_2d
+#define KDTree KDTree_2d
+#define KDTreeNearest KDTreeNearest_2d
+#include "BLI_kdtree_impl.h"
+#undef KD_DIMS
+#undef KDTree
+#undef KDTreeNearest
+#undef KDTREE_PREFIX_ID
+
 /* 3D version */
 #define KD_DIMS 3
 #define KDTREE_PREFIX_ID BLI_kdtree_3d
diff --git a/source/blender/blenlib/CMakeLists.txt 
b/source/blender/blenlib/CMakeLists.txt
index d740fa03e70..fef24c059e7 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -75,6 +75,7 @@ set(SRC
intern/hash_mm2a.c
intern/hash_mm3.c
intern/jitter_2d.c
+   intern/kdtree_2d.c
intern/kdtree_3d.c
intern/kdtree_4d.c
intern/lasso_2d.c
diff --git a/source/blender/blenlib/BLI_kdtree.h 
b/source/blender/blenlib/intern/kdtree_2d.c
similarity index 55%
copy from source/blender/blenlib/BLI_kdtree.h
copy to source/blender/blenlib/intern/kdtree_2d.c
index af10a448423..8ad55e2d964 100644
--- a/source/blender/blenlib/BLI_kdtree.h
+++ b/source/blender/blenlib/intern/kdtree_2d.c
@@ -14,34 +14,12 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#ifndef __BLI_KDTREE_H__
-#define __BLI_KDTREE_H__
-
 /** \file
  * \ingroup bli
- * \brief A kd-tree for nearest neighbor search.
  */
 
-/* 3D version */
-#define KD_DIMS 3
-#define KDTREE_PREFIX_ID BLI_kdtree_3d
-#define KDTree KDTree_3d
-#define KDTreeNearest KDTreeNearest_3d
-#include "BLI_kdtree_impl.h"
-#undef KD_DIMS
-#undef KDTree
-#undef KDTreeNearest
-#undef KDTREE_PREFIX_ID
-
-/* 4D version */
-#define KD_DIMS 4
-#define KDTREE_PREFIX_ID BLI_kdtree_4d
-#define KDTree KDTree_4d
-#define KDTreeNearest KDTreeNearest_4d
-#include "BLI_kdtree_impl.h"
-#undef KD_DIMS
-#undef KDTree
-#undef KDTreeNearest
-#undef KDTREE_PREFIX_ID
-
-#endif  /* __BLI_KDTREE_H__ */
+#define KD_DIMS 2
+#define KDTREE_PREFIX_ID BLI_kdtree_2d
+#define KDTree KDTree_2d
+#define KDTreeNearest KDTreeNearest_2d
+#  include "kdtree_impl.h"

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


[Bf-blender-cvs] [84fe4cdcb37] master: Workbench: Support Odd Number Of AA Samples

2019-03-19 Thread Jeroen Bakker
Commit: 84fe4cdcb37c28469749d673006c8e6083bede7f
Author: Jeroen Bakker
Date:   Tue Mar 19 12:51:19 2019 +0100
Branches: master
https://developer.blender.org/rB84fe4cdcb37c28469749d673006c8e6083bede7f

Workbench: Support Odd Number Of AA Samples

Workbench render engine did not work when an odd number of AA samples
were used. A user could enter these values by disabling AA or set the
number of AA samples in the Render/Film panel to an odd number.

This commit will not perform TAA passes when AA is disabled.
For supporting the setting of 5 or 11 samples the bitmask was replaced
by an if statement as this was making the odd number not render
correctly.

As extra introduce the jitter samples of 5 and 11 so the images will
be more clean. a jitter sample of 11 used to read outside the allocated
space of the jitter samples.

Fix T60820

Reviewed By: fclem

Maniphest Tasks: T60820

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

===

M   source/blender/draw/engines/workbench/workbench_effect_taa.c
M   source/blender/draw/engines/workbench/workbench_private.h

===

diff --git a/source/blender/draw/engines/workbench/workbench_effect_taa.c 
b/source/blender/draw/engines/workbench/workbench_effect_taa.c
index d1f8c0983c6..b61cbff39a9 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_taa.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_taa.c
@@ -26,7 +26,9 @@
 
 static struct {
struct GPUShader *effect_taa_sh;
+   float jitter_5[5][2];
float jitter_8[8][2];
+   float jitter_11[11][2];
float jitter_16[16][2];
float jitter_32[32][2];
 } e_data = {NULL};
@@ -79,7 +81,9 @@ static void workbench_taa_jitter_init_order(float 
(*table)[2], int num)
 
 static void workbench_taa_jitter_init(void)
 {
+   workbench_taa_jitter_init_order(e_data.jitter_5, 5);
workbench_taa_jitter_init_order(e_data.jitter_8, 8);
+   workbench_taa_jitter_init_order(e_data.jitter_11, 11);
workbench_taa_jitter_init_order(e_data.jitter_16, 16);
workbench_taa_jitter_init_order(e_data.jitter_32, 32);
 }
@@ -212,9 +216,15 @@ void workbench_taa_draw_scene_start(WORKBENCH_Data *vedata)
num_samples = workbench_taa_calculate_num_iterations(vedata);
switch (num_samples) {
default:
+   case 5:
+   samples = e_data.jitter_5;
+   break;
case 8:
samples = e_data.jitter_8;
break;
+   case 11:
+   samples = e_data.jitter_11;
+   break;
case 16:
samples = e_data.jitter_16;
break;
@@ -225,10 +235,9 @@ void workbench_taa_draw_scene_start(WORKBENCH_Data *vedata)
 
mix_factor = 1.0f / (effect_info->jitter_index + 1);
 
-   const int bitmask = num_samples - 1;
const int jitter_index = effect_info->jitter_index;
const float *transform_offset = samples[jitter_index];
-   effect_info->jitter_index = (jitter_index + 1) & bitmask;
+   effect_info->jitter_index = (jitter_index + 1) % num_samples;
 
/* construct new matrices from transform delta */
float viewmat[4][4];
diff --git a/source/blender/draw/engines/workbench/workbench_private.h 
b/source/blender/draw/engines/workbench/workbench_private.h
index 115868bc268..eb1d9c4e860 100644
--- a/source/blender/draw/engines/workbench/workbench_private.h
+++ b/source/blender/draw/engines/workbench/workbench_private.h
@@ -62,7 +62,8 @@
 #define FXAA_ENABLED(wpd) ((!DRW_state_is_opengl_render()) && \
 (IN_RANGE(wpd->preferences->gpu_viewport_quality, 
GPU_VIEWPORT_QUALITY_FXAA, GPU_VIEWPORT_QUALITY_TAA8) || \
  ((IS_NAVIGATING(wpd) || wpd->is_playback) && 
(wpd->preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8
-#define TAA_ENABLED(wpd) (DRW_state_is_image_render() || 
(wpd->preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8 && 
!IS_NAVIGATING(wpd) && !wpd->is_playback))
+#define TAA_ENABLED(wpd) ((DRW_state_is_image_render() && 
DRW_context_state_get()->scene->r.mode & R_OSA) || \
+  (DRW_state_is_opengl_render() && 
wpd->preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8 && 
!IS_NAVIGATING(wpd) && !wpd->is_playback))
 #define SPECULAR_HIGHLIGHT_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && 
(wpd->shading.flag & V3D_SHADING_SPECULAR_HIGHLIGHT) && 
(!STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)))
 #define OBJECT_OUTLINE_ENABLED(wpd) (wpd->shading.flag & 
V3D_SHADING_OBJECT_OUTLINE)
 #define OBJECT_ID_PASS_ENABLED(wpd) (OBJECT_OUTLINE_ENABLED(wpd) || 
CURVATURE_ENABLED(wpd))

___
Bf-blender-cvs mailing list

[Bf-blender-cvs] [109cbdf2e1b] master: Cleanup: use BLI_kdtree_3d prefix

2019-03-19 Thread Campbell Barton
Commit: 109cbdf2e1b609e93270100239906a8e17c64ab5
Author: Campbell Barton
Date:   Wed Mar 20 00:46:33 2019 +1100
Branches: master
https://developer.blender.org/rB109cbdf2e1b609e93270100239906a8e17c64ab5

Cleanup: use BLI_kdtree_3d prefix

Use prefix now there isn't only the 3d version.

===

M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenkernel/BKE_particle.h
M   source/blender/blenkernel/BKE_pointcache.h
M   source/blender/blenkernel/intern/boids.c
M   source/blender/blenkernel/intern/dynamicpaint.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/particle.c
M   source/blender/blenkernel/intern/particle_distribute.c
M   source/blender/blenkernel/intern/particle_system.c
M   source/blender/blenkernel/intern/smoke.c
M   source/blender/blenlib/BLI_kdtree.h
M   source/blender/blenlib/intern/kdtree_3d.c
M   source/blender/blenlib/intern/kdtree_impl.h
M   source/blender/bmesh/operators/bmo_removedoubles.c
M   source/blender/bmesh/tools/bmesh_decimate_collapse.c
M   source/blender/editors/curve/editcurve_select.c
M   source/blender/editors/include/ED_select_utils.h
M   source/blender/editors/mesh/editmesh_select_similar.c
M   source/blender/editors/mesh/editmesh_utils.c
M   source/blender/editors/mesh/mesh_mirror.c
M   source/blender/editors/metaball/mball_edit.c
M   source/blender/editors/object/object_relations.c
M   source/blender/editors/physics/particle_edit.c
M   source/blender/editors/util/select_utils.c
M   source/blender/editors/uvedit/uvedit_ops.c
M   source/blender/makesdna/DNA_boid_types.h
M   source/blender/makesdna/DNA_particle_types.h
M   source/blender/modifiers/intern/MOD_explode.c
M   source/blender/python/mathutils/mathutils.c
M   source/blender/python/mathutils/mathutils_kdtree.c

===

diff --git a/source/blender/blenkernel/BKE_object.h 
b/source/blender/blenkernel/BKE_object.h
index 9e6366f9992..4a1470797ba 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -339,7 +339,7 @@ struct LinkNode *BKE_object_relational_superset(
 struct LinkNode *BKE_object_groups(struct Main *bmain, struct Scene *scene, 
struct Object *ob);
 void BKE_object_groups_clear(struct Main *bmain, struct Scene 
*scene, struct Object *object);
 
-struct KDTree *BKE_object_as_kdtree(struct Object *ob, int *r_tot);
+struct KDTree_3d *BKE_object_as_kdtree(struct Object *ob, int *r_tot);
 
 bool BKE_object_modifier_use_time(struct Object *ob, struct ModifierData *md);
 
diff --git a/source/blender/blenkernel/BKE_particle.h 
b/source/blender/blenkernel/BKE_particle.h
index 56f64829eb1..b2b7f9f9cb5 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -45,7 +45,7 @@ struct CustomData_MeshMasks;
 struct Depsgraph;
 struct Depsgraph;
 struct EdgeHash;
-struct KDTree;
+struct KDTree_3d;
 struct LatticeDeformData;
 struct LinkNode;
 struct MCol;
@@ -136,7 +136,7 @@ typedef struct ParticleThreadContext {
struct Material *ma;
 
/* distribution */
-   struct KDTree *tree;
+   struct KDTree_3d *tree;
 
struct ParticleSeam *seams;
int totseam;
diff --git a/source/blender/blenkernel/BKE_pointcache.h 
b/source/blender/blenkernel/BKE_pointcache.h
index 6f0145a493d..9cfc43b2e5b 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -226,7 +226,7 @@ typedef struct PTCacheUndo {
 
/* particles stuff */
struct ParticleData *particles;
-   struct KDTree *emitter_field;
+   struct KDTree_3d *emitter_field;
float *emitter_cosnos;
int psys_flag;
 
@@ -257,7 +257,7 @@ typedef struct PTCacheEdit {
struct ParticleSystem *psys_eval;
struct ParticleSystemModifierData *psmd;
struct ParticleSystemModifierData *psmd_eval;
-   struct KDTree *emitter_field;
+   struct KDTree_3d *emitter_field;
float *emitter_cosnos; /* localspace face centers and normals (average 
of its verts), from the derived mesh */
int *mirror_cache;
 
diff --git a/source/blender/blenkernel/intern/boids.c 
b/source/blender/blenkernel/intern/boids.c
index 8b71aa0fb69..c092b2c7e79 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -206,7 +206,7 @@ static int rule_avoid_collision(BoidRule *rule, 
BoidBrainData *bbd, BoidValues *
 {
const int raycast_flag = BVH_RAYCAST_DEFAULT & 
~(BVH_RAYCAST_WATERTIGHT);
BoidRuleAvoidCollision *acbr = (BoidRuleAvoidCollision*) rule;
-   KDTreeNearest *ptn = NULL;
+   KDTreeNearest_3d *ptn = NULL;
ParticleTarget *pt;
BoidParticle *bpa = pa->boid;
ColliderCache *coll;
@@ 

[Bf-blender-cvs] [e8777a72901] master: Fix T62732: Bpy/Python is letting create inputs at the node level for node groups that make blend file unsaveable.

2019-03-19 Thread Bastien Montagne
Commit: e8777a729013d04dcb854b0b9f327e9b90191747
Author: Bastien Montagne
Date:   Tue Mar 19 14:43:14 2019 +0100
Branches: master
https://developer.blender.org/rBe8777a729013d04dcb854b0b9f327e9b90191747

Fix T62732: Bpy/Python is letting create inputs at the node level for node 
groups that make blend file unsaveable.

Group nodes should not allow to add IO sockets to themselves directly,
in that case we actually want to add IO sockets to their underlying
node tree. Fairly straioght forward to support actually.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 248a1486d48..7bd3d5e9b9c 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1619,6 +1619,11 @@ static void rna_Node_name_set(PointerRNA *ptr, const 
char *value)
 
 static bNodeSocket *rna_Node_inputs_new(ID *id, bNode *node, Main *bmain, 
ReportList *reports, const char *type, const char *name, const char *identifier)
 {
+   /* Adding an input to a group node is not working, simpler to add it to 
its underlying nodetree. */
+   if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != 
NULL) {
+   return rna_NodeTree_inputs_new((bNodeTree *)node->id, bmain, 
reports, type, name);
+   }
+
bNodeTree *ntree = (bNodeTree *)id;
bNodeSocket *sock;
 
@@ -1637,6 +1642,11 @@ static bNodeSocket *rna_Node_inputs_new(ID *id, bNode 
*node, Main *bmain, Report
 
 static bNodeSocket *rna_Node_outputs_new(ID *id, bNode *node, Main *bmain, 
ReportList *reports, const char *type, const char *name, const char *identifier)
 {
+   /* Adding an output to a group node is not working, simpler to add it 
to its underlying nodetree. */
+   if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != 
NULL) {
+   return rna_NodeTree_outputs_new((bNodeTree *)node->id, bmain, 
reports, type, name);
+   }
+
bNodeTree *ntree = (bNodeTree *)id;
bNodeSocket *sock;

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


[Bf-blender-cvs] [3b9b324bf61] master: Fix T62595: Select co-planar faces fails

2019-03-19 Thread Campbell Barton
Commit: 3b9b324bf619a2c2d3cd8d25d5a0f95b7b0c476c
Author: Campbell Barton
Date:   Wed Mar 20 00:34:40 2019 +1100
Branches: master
https://developer.blender.org/rB3b9b324bf619a2c2d3cd8d25d5a0f95b7b0c476c

Fix T62595: Select co-planar faces fails

===

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

===

diff --git a/source/blender/editors/mesh/editmesh_select_similar.c 
b/source/blender/editors/mesh/editmesh_select_similar.c
index c9dea33dc78..299db63eca3 100644
--- a/source/blender/editors/mesh/editmesh_select_similar.c
+++ b/source/blender/editors/mesh/editmesh_select_similar.c
@@ -143,35 +143,15 @@ static bool face_data_value_set(BMFace *face, const int 
hflag, int *r_value)
  * Also, unlike edge_pos_direction_worldspace_get we don't normalize the 
direction.
  * In fact we scale the direction by the distance of the face center to the 
origin.
  */
-static void face_pos_direction_worldspace_scaled_get(Object *ob, BMFace *face, 
float *r_dir)
+static void face_to_plane(const Object *ob, BMFace *face, float r_plane[4])
 {
-   float distance;
-   float center[3];
+   float normal[3], co[3];
+   copy_v3_v3(normal, face->no);
+   mul_transposed_mat3_m4_v3(ob->imat, normal);
+   normalize_v3(normal);
+   mul_v3_m4v3(co, ob->obmat, BM_FACE_FIRST_LOOP(face)->v->co);
+   plane_from_point_normal_v3(r_plane, co, normal);
 
-   copy_v3_v3(r_dir, face->no);
-   normalize_v3(r_dir);
-
-   BM_face_calc_center_median(face, center);
-   mul_m4_v3(ob->obmat, center);
-
-   distance = dot_v3v3(r_dir, center);
-   mul_v3_fl(r_dir, distance);
-
-   /* Make sure we have a consistent direction regardless of the face 
orientation.
-* This spares us from storing dir and -dir in the tree. */
-   if (fabs(r_dir[2]) < FLT_EPSILON) {
-   if (fabs(r_dir[1]) < FLT_EPSILON) {
-   if (r_dir[0] < 0.0f) {
-   mul_v3_fl(r_dir, -1.0f);
-   }
-   }
-   else if (r_dir[1] < 0.0f) {
-   mul_v3_fl(r_dir, -1.0f);
-   }
-   }
-   else if (r_dir[2] < 0.0f) {
-   mul_v3_fl(r_dir, -1.0f);
-   }
 }
 
 /* TODO(dfelinto): `types` that should technically be compared in world space 
but are not:
@@ -204,6 +184,7 @@ static int similar_face_select_exec(bContext *C, wmOperator 
*op)
}
 
KDTree *tree = NULL;
+   KDTree_4d *tree_plane = NULL;
GSet *gset = NULL;
GSet **gset_array = NULL;
int face_data_value = SIMFACE_DATA_NONE;
@@ -212,9 +193,11 @@ static int similar_face_select_exec(bContext *C, 
wmOperator *op)
case SIMFACE_AREA:
case SIMFACE_PERIMETER:
case SIMFACE_NORMAL:
-   case SIMFACE_COPLANAR:
tree = BLI_kdtree_new(tot_faces_selected_all);
break;
+   case SIMFACE_COPLANAR:
+   tree_plane = BLI_kdtree_4d_new(tot_faces_selected_all);
+   break;
case SIMFACE_SIDES:
case SIMFACE_MATERIAL:
gset = BLI_gset_ptr_new("Select similar face");
@@ -312,9 +295,9 @@ static int similar_face_select_exec(bContext *C, wmOperator 
*op)
}
case SIMFACE_COPLANAR:
{
-   float dir[3];
-   
face_pos_direction_worldspace_scaled_get(ob, face, dir);
-   BLI_kdtree_insert(tree, 
tree_index++, dir);
+   float plane[4];
+   face_to_plane(ob, face, plane);
+   
BLI_kdtree_4d_insert(tree_plane, tree_index++, plane);
break;
}
case SIMFACE_SMOOTH:
@@ -356,6 +339,9 @@ static int similar_face_select_exec(bContext *C, wmOperator 
*op)
if (tree != NULL) {
BLI_kdtree_balance(tree);
}
+   if (tree_plane != NULL) {
+   BLI_kdtree_4d_balance(tree_plane);
+   }
 
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob = objects[ob_index];
@@ -470,19 +456,15 @@ static int similar_face_select_exec(bContext *C, 
wmOperator *op)
}
case SIMFACE_COPLANAR:
{
-   float diff[3];
-   

[Bf-blender-cvs] [0719d5fa0c8] master: BLI_kdtree: refactor to support different numbers of dimensions

2019-03-19 Thread Campbell Barton
Commit: 0719d5fa0c8244feb70efa330b10f103a6da2f3c
Author: Campbell Barton
Date:   Mon Mar 18 11:22:48 2019 +1100
Branches: master
https://developer.blender.org/rB0719d5fa0c8244feb70efa330b10f103a6da2f3c

BLI_kdtree: refactor to support different numbers of dimensions

This moves logic into kdtree_impl.h which is included in a source
file that defines the number of dimensions - so we can easily support
different numbers of dimensions as needed
(currently 3D and 4D are supported).

Macro use isn't so nice but avoids a lot of duplicate code.

===

M   source/blender/blenlib/BLI_kdtree.h
A   source/blender/blenlib/BLI_kdtree_impl.h
M   source/blender/blenlib/CMakeLists.txt
A   source/blender/blenlib/intern/kdtree_3d.c
A   source/blender/blenlib/intern/kdtree_4d.c
R083source/blender/blenlib/intern/BLI_kdtree.c  
source/blender/blenlib/intern/kdtree_impl.h

===

diff --git a/source/blender/blenlib/BLI_kdtree.h 
b/source/blender/blenlib/BLI_kdtree.h
index fd404fa5aab..eb0421eaec1 100644
--- a/source/blender/blenlib/BLI_kdtree.h
+++ b/source/blender/blenlib/BLI_kdtree.h
@@ -22,57 +22,22 @@
  * \brief A kd-tree for nearest neighbor search.
  */
 
-#include "BLI_compiler_attrs.h"
-
-struct KDTree;
-typedef struct KDTree KDTree;
-
-typedef struct KDTreeNearest {
-   int index;
-   float dist;
-   float co[3];
-} KDTreeNearest;
-
-KDTree *BLI_kdtree_new(unsigned int maxsize);
-void BLI_kdtree_free(KDTree *tree);
-void BLI_kdtree_balance(KDTree *tree) ATTR_NONNULL(1);
-
-void BLI_kdtree_insert(
-KDTree *tree, int index,
-const float co[3]) ATTR_NONNULL(1, 3);
-int BLI_kdtree_find_nearest(
-const KDTree *tree, const float co[3],
-KDTreeNearest *r_nearest) ATTR_NONNULL(1, 2);
-
-#define BLI_kdtree_find_nearest_n(tree, co, r_nearest, nearest_len_capacity) \
-BLI_kdtree_find_nearest_n_with_len_squared_cb(tree, co, r_nearest, 
nearest_len_capacity, NULL, NULL)
-#define BLI_kdtree_range_search(tree, co, r_nearest, range) \
-BLI_kdtree_range_search_with_len_squared_cb(tree, co, r_nearest, 
range, NULL, NULL)
-
-int BLI_kdtree_find_nearest_cb(
-const KDTree *tree, const float co[3],
-int (*filter_cb)(void *user_data, int index, const float co[3], float 
dist_sq), void *user_data,
-KDTreeNearest *r_nearest);
-void BLI_kdtree_range_search_cb(
-const KDTree *tree, const float co[3], float range,
-bool (*search_cb)(void *user_data, int index, const float co[3], float 
dist_sq), void *user_data);
-
-int BLI_kdtree_calc_duplicates_fast(
-const KDTree *tree, const float range, bool use_index_order,
-int *doubles);
-
-/* Versions of find/range search that take a squared distance callback to 
support bias. */
-int BLI_kdtree_find_nearest_n_with_len_squared_cb(
-const KDTree *tree, const float co[3],
-KDTreeNearest *r_nearest,
-const uint nearest_len_capacity,
-float (*len_sq_fn)(const float co_search[3], const float co_test[3], 
const void *user_data),
-const void *user_data) ATTR_NONNULL(1, 2, 3);
-int BLI_kdtree_range_search_with_len_squared_cb(
-const KDTree *tree, const float co[3],
-KDTreeNearest **r_nearest,
-const float range,
-float (*len_sq_fn)(const float co_search[3], const float co_test[3], 
const void *user_data),
-const void *user_data) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT;
+/* 3D version */
+#define KD_DIMS 3
+#define KDTREE_PREFIX_ID BLI_kdtree
+#include "BLI_kdtree_impl.h"
+#undef KD_DIMS
+#undef KDTREE_PREFIX_ID
+
+/* 4D version */
+#define KD_DIMS 4
+#define KDTREE_PREFIX_ID BLI_kdtree_4d
+#define KDTree KDTree_4d
+#define KDTreeNearest KDTreeNearest_4d
+#include "BLI_kdtree_impl.h"
+#undef KD_DIMS
+#undef KDTree
+#undef KDTreeNearest
+#undef KDTREE_PREFIX_ID
 
 #endif  /* __BLI_KDTREE_H__ */
diff --git a/source/blender/blenlib/BLI_kdtree_impl.h 
b/source/blender/blenlib/BLI_kdtree_impl.h
new file mode 100644
index 000..08b66c16d3e
--- /dev/null
+++ b/source/blender/blenlib/BLI_kdtree_impl.h
@@ -0,0 +1,86 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * 

[Bf-blender-cvs] [e72dc667c4d] master: Fix T61475 Particle edit does not render children if path step > 7

2019-03-19 Thread Clément Foucault
Commit: e72dc667c4d3ef0b4a4c306dd6b12cae9d37287b
Author: Clément Foucault
Date:   Tue Mar 19 14:25:32 2019 +0100
Branches: master
https://developer.blender.org/rBe72dc667c4d3ef0b4a4c306dd6b12cae9d37287b

Fix T61475 Particle edit does not render children if path step > 7

Gives 2 more bits to the segment count. Also subtract 1 because segment
count cannot be negative.

===

M   source/blender/draw/intern/draw_cache_impl_particles.c
M   source/blender/draw/modes/shaders/common_hair_lib.glsl

===

diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c 
b/source/blender/draw/intern/draw_cache_impl_particles.c
index 6790a8aa0cc..2c940f9bab8 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -793,8 +793,12 @@ static int particle_batch_cache_fill_strands_data(
continue;
}
 
+   /* XXX: We might need something more robust.
+* Adjust shader code accordingly. (see unpack_strand_data() ) 
*/
+   BLI_assert((path->segments - 1) <= 0x3FF);
+
uint *seg_data = (uint *)GPU_vertbuf_raw_step(data_step);
-   *seg_data = (curr_point & 0xFF) | (path->segments << 24);
+   *seg_data = (curr_point & 0x3F) | ((path->segments - 1) << 
22);
curr_point += path->segments + 1;
 
if (psmd != NULL) {
diff --git a/source/blender/draw/modes/shaders/common_hair_lib.glsl 
b/source/blender/draw/modes/shaders/common_hair_lib.glsl
index da86f7a7086..9cda44c8f42 100644
--- a/source/blender/draw/modes/shaders/common_hair_lib.glsl
+++ b/source/blender/draw/modes/shaders/common_hair_lib.glsl
@@ -46,8 +46,8 @@ void unpack_strand_data(uint data, out int strand_offset, out 
int strand_segment
// strand_offset = (data & 0x1FFFu);
// strand_segments = 1u << (data >> 29u); /* We only need 3 bits to 
store subdivision level. */
 #else
-   strand_offset = int(data & 0x00FFu);
-   strand_segments = int(data >> 24u);
+   strand_offset = int(data & 0x003Fu);
+   strand_segments = int(data >> 22u) + 1;
 #endif
 }

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


[Bf-blender-cvs] [58e27cca97c] master: GPencil: Include gpencil objects in BKE_object_minmax

2019-03-19 Thread Campbell Barton
Commit: 58e27cca97c4dc348949c2df8138ba08b17743fc
Author: Campbell Barton
Date:   Wed Mar 20 00:05:58 2019 +1100
Branches: master
https://developer.blender.org/rB58e27cca97c4dc348949c2df8138ba08b17743fc

GPencil: Include gpencil objects in BKE_object_minmax

Also remove redundant check for meshes.

===

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

===

diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index f7a719726b9..66b888c84f2 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2762,6 +2762,20 @@ void BKE_object_minmax(Object *ob, float min_r[3], float 
max_r[3], const bool us
changed = true;
break;
}
+   case OB_MESH:
+   {
+   bb = *BKE_mesh_boundbox_get(ob);
+   BKE_boundbox_minmax(, ob->obmat, min_r, max_r);
+   changed = true;
+   break;
+   }
+   case OB_GPENCIL:
+   {
+   bb = *BKE_gpencil_boundbox_get(ob);
+   BKE_boundbox_minmax(, ob->obmat, min_r, max_r);
+   changed = true;
+   break;
+   }
case OB_LATTICE:
{
Lattice *lt = ob->data;
@@ -2784,17 +2798,6 @@ void BKE_object_minmax(Object *ob, float min_r[3], float 
max_r[3], const bool us
changed = BKE_pose_minmax(ob, min_r, max_r, use_hidden, 
false);
break;
}
-   case OB_MESH:
-   {
-   Mesh *me = BKE_mesh_from_object(ob);
-
-   if (me) {
-   bb = *BKE_mesh_boundbox_get(ob);
-   BKE_boundbox_minmax(, ob->obmat, min_r, 
max_r);
-   changed = true;
-   }
-   break;
-   }
case OB_MBALL:
{
float ob_min[3], ob_max[3];

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


[Bf-blender-cvs] [12655c35901] greasepencil-object: GPencil: Cleanup unused code

2019-03-19 Thread Antonioya
Commit: 12655c35901e6af887db14d9cc2ff900d0a19eeb
Author: Antonioya
Date:   Tue Mar 19 13:51:40 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB12655c35901e6af887db14d9cc2ff900d0a19eeb

GPencil: Cleanup unused code

===

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

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
index 7a70fff189d..d6dcb87a1c1 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
@@ -62,18 +62,10 @@ void main()
}

if (gradient_f < 1.0) {
-   
float dist = length(centered) * 2.0;
float ex = pow(dist, (-gradient_f * 2.0f));
float alpha = clamp(1.0 - abs((1.0f - ex) / 10.0f), 0.0f, 1.0f) 
* ellip;
fragColor.a = clamp(smoothstep(fragColor.a, 0.0, alpha), 0.01, 
1.0);
-   
-   
-   // float in_rad = gradient_f / 4.0;
-   // float ex_rad = rad_squared - in_rad;
-
-   // float alpha = clamp((dist_squared - in_rad) / ex_rad, 0.0, 
1.0);
-   // fragColor.a = smoothstep(fragColor.a, 0.0, ellip);
}

if(fragColor.a < 0.0035)

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


[Bf-blender-cvs] [67143dba0d9] greasepencil-object: GPencil: Add gradient opacity parameter to topbar

2019-03-19 Thread Antonioya
Commit: 67143dba0d9774db1aa3cab3b122eec3e28d9915
Author: Antonioya
Date:   Tue Mar 19 14:07:26 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB67143dba0d9774db1aa3cab3b122eec3e28d9915

GPencil: Add gradient opacity parameter to topbar

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index ac63948d18a..6854b024d4f 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -428,6 +428,8 @@ def brush_basic_gpencil_paint_settings(layout, context, 
brush, *, compact=True):
 row = layout.row(align=True)
 row.prop(gp_settings, "pen_strength", slider=True)
 row.prop(gp_settings, "use_strength_pressure", text="", 
icon='STYLUS_PRESSURE')
+row = layout.row(align=True)
+row.prop(gp_settings, "gradient_factor", text="Opacity")
 
 
 def brush_basic_gpencil_sculpt_settings(layout, context, brush, *, 
compact=False):

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


[Bf-blender-cvs] [530d81c240d] greasepencil-object: GPencil: More changes in gradient calculation for points

2019-03-19 Thread Antonioya
Commit: 530d81c240d04aeff1390d18994671879469169e
Author: Antonioya
Date:   Tue Mar 19 13:44:24 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB530d81c240d04aeff1390d18994671879469169e

GPencil: More changes in gradient calculation for points

===

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

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
index 833329a11ce..7a70fff189d 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
@@ -62,11 +62,18 @@ void main()
}

if (gradient_f < 1.0) {
-   float in_rad = gradient_f / 4.0;
-   float ex_rad = rad_squared - in_rad;
+   
+   float dist = length(centered) * 2.0;
+   float ex = pow(dist, (-gradient_f * 2.0f));
+   float alpha = clamp(1.0 - abs((1.0f - ex) / 10.0f), 0.0f, 1.0f) 
* ellip;
+   fragColor.a = clamp(smoothstep(fragColor.a, 0.0, alpha), 0.01, 
1.0);
+   
+   
+   // float in_rad = gradient_f / 4.0;
+   // float ex_rad = rad_squared - in_rad;
 
-   float alpha = clamp((dist_squared - in_rad) / ex_rad, 0.0, 1.0);
-   fragColor.a = smoothstep(fragColor.a, 0.0, ellip);
+   // float alpha = clamp((dist_squared - in_rad) / ex_rad, 0.0, 
1.0);
+   // fragColor.a = smoothstep(fragColor.a, 0.0, ellip);
}

if(fragColor.a < 0.0035)

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


[Bf-blender-cvs] [2ba41640727] greasepencil-object: GPencil: More changes to gradient factors

2019-03-19 Thread Antonioya
Commit: 2ba4164072708d3dfc34eb8219e6d61438ad18ee
Author: Antonioya
Date:   Tue Mar 19 12:27:58 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB2ba4164072708d3dfc34eb8219e6d61438ad18ee

GPencil: More changes to gradient factors

===

M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
M   source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
M   source/blender/makesrna/intern/rna_brush.c
M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 2ca3bd4ac74..e380c645a2e 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -535,7 +535,6 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
stl->shgroups[id].gradient_f = gps->gradient_f;
copy_v2_v2(stl->shgroups[id].gradient_s, gps->gradient_s);
DRW_shgroup_uniform_float(grp, "gradient_f", 
>shgroups[id].gradient_f, 1);
-   DRW_shgroup_uniform_vec2(grp, "gradient_s", 
stl->shgroups[id].gradient_s, 1);
 
/* viewport x-ray */
stl->shgroups[id].is_xray = (ob->dt == OB_WIRE) ? 1 : 
stl->storage->is_xray;
@@ -571,7 +570,6 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
DRW_shgroup_uniform_int(grp, "caps_mode", [0], 2);
 
DRW_shgroup_uniform_float(grp, "gradient_f", 
>storage->gradient_f, 1);
-   DRW_shgroup_uniform_vec2(grp, "gradient_s", 
stl->storage->gradient_s, 1);
 
/* viewport x-ray */
DRW_shgroup_uniform_int(grp, "viewport_xray", 
>storage->is_xray, 1);
diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
index 7e222311295..833329a11ce 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
@@ -20,15 +20,25 @@ out vec4 fragColor;
 #define GPENCIL_COLOR_TEXTURE 1
 #define GPENCIL_COLOR_PATTERN 2
 
+/* Function to check the point inside ellipse */
+float checkpoint(vec2 pt, vec2 radius) 
+{ 
+float p = (pow(pt.x, 2) / pow(radius.x, 2)) + (pow(pt.y, 2) / 
pow(radius.y, 2)); 
+  
+return p; 
+} 
+
 void main()
 {
vec2 centered = mTexCoord - vec2(0.5);
float dist_squared = dot(centered, centered);
const float rad_squared = 0.25;
+   float ellip = checkpoint(centered, vec2(gradient_s / 2.0));
 
-/* Round point with jaggy edges. */
-   if ((mode != GPENCIL_MODE_BOX) && (dist_squared > rad_squared)) {
-   discard;
+   if (mode != GPENCIL_MODE_BOX) {
+   if (ellip > 1.0) {
+   discard;
+   }
}
 
vec4 tmp_color = texture2D(myTexture, mTexCoord);
@@ -50,6 +60,15 @@ void main()
/* mult both alpha factor to use strength factor with color 
alpha limit */
fragColor.a = min(text_color.a * mColor.a, mColor.a);
}
+   
+   if (gradient_f < 1.0) {
+   float in_rad = gradient_f / 4.0;
+   float ex_rad = rad_squared - in_rad;
+
+   float alpha = clamp((dist_squared - in_rad) / ex_rad, 0.0, 1.0);
+   fragColor.a = smoothstep(fragColor.a, 0.0, ellip);
+   }
+   
if(fragColor.a < 0.0035)
discard;
 }
diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
index 32d53fa9992..1825346ac68 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
@@ -2,7 +2,6 @@ uniform int color_type;
 uniform sampler2D myTexture;
 
 uniform float gradient_f;
-uniform vec2 gradient_s;
 
 in vec4 mColor;
 in vec2 mTexCoord;
@@ -21,6 +20,7 @@ out vec4 fragColor;
 
 void main()
 {
+   
vec4 tColor = vec4(mColor);
/* if uvfac[1]  == 1, then encap */
if (uvfac[1] == ENDCAP) {
@@ -58,8 +58,11 @@ void main()
}
 
/* gradient */
-   if (mTexCoord.y > gradient_f) {
-   fragColor.a = gradient_f;
+   if (gradient_f < 1.0) {
+   float d = abs(mTexCoord.y - 0.5)  * (1.1 - gradient_f);
+   float alpha = 1.0 - clamp((fragColor.a - (d * 2.0)), 0.03, 1.0);
+   fragColor.a = smoothstep(fragColor.a, 0.0, alpha);
+   
}
 
if(fragColor.a < 0.0035)
diff --git a/source/blender/makesrna/intern/rna_brush.c 

[Bf-blender-cvs] [b513f29a87f] greasepencil-object: GPencil: Change Text for Gradient parameter

2019-03-19 Thread Antonioya
Commit: b513f29a87f6dd61e9953e7199fa95a9a1d84262
Author: Antonioya
Date:   Tue Mar 19 13:49:41 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBb513f29a87f6dd61e9953e7199fa95a9a1d84262

GPencil: Change Text for Gradient parameter

===

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

===

diff --git a/source/blender/makesrna/intern/rna_brush.c 
b/source/blender/makesrna/intern/rna_brush.c
index 7798140459d..62606a1f248 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1192,7 +1192,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_range(prop, 0.001f, 1.0f);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(
-   prop, "Gradient Factor",
+   prop, "Border Opacity Factor",
"Amount of gradient along section of stroke (set to 1 for full 
solid)");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
 
diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index 13c9becf7f4..df02a5771dc 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1003,7 +1003,7 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "gradient_f");
RNA_def_property_range(prop, 0.001f, 1.0f);
RNA_def_property_float_default(prop, 1.0f);
-   RNA_def_property_ui_text(prop, "Gradient Factor",
+   RNA_def_property_ui_text(prop, "Border Opacity Factor",
"Amount of gradient along section of stroke");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");

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


[Bf-blender-cvs] [781a282caad] greasepencil-object: GPencil: Pass gradient basic data to point shader

2019-03-19 Thread Antonioya
Commit: 781a282caada36734a87ddcf43dbed09eef45f25
Author: Antonioya
Date:   Mon Mar 18 11:04:31 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB781a282caada36734a87ddcf43dbed09eef45f25

GPencil: Pass gradient basic data to point shader

===

M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
M   source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 1cb44105537..2ca3bd4ac74 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -619,7 +619,7 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
 /* create shading group for points */
 static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
 GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader 
*shader, Object *ob,
-bGPdata *gpd, bGPDlayer *gpl,
+bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps,
 MaterialGPencilStyle *gp_style, int id, bool onion,
 const float scale, const int shading_type[2])
 {
@@ -659,6 +659,11 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
DRW_shgroup_uniform_int(grp, "mode", >shgroups[id].mode, 
1);
DRW_shgroup_uniform_float(grp, "pixfactor", >pixfactor, 1);
 
+   stl->shgroups[id].gradient_f = gps->gradient_f;
+   copy_v2_v2(stl->shgroups[id].gradient_s, gps->gradient_s);
+   DRW_shgroup_uniform_float(grp, "gradient_f", 
>shgroups[id].gradient_f, 1);
+   DRW_shgroup_uniform_vec2(grp, "gradient_s", 
stl->shgroups[id].gradient_s, 1);
+
/* viewport x-ray */
stl->shgroups[id].is_xray = (ob->dt == OB_WIRE) ? 1 : 
stl->storage->is_xray;
DRW_shgroup_uniform_int(grp, "viewport_xray", (const int 
*)>shgroups[id].is_xray, 1);
@@ -692,6 +697,10 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
else {
DRW_shgroup_uniform_float(grp, "pixfactor", 
>storage->pixfactor, 1);
}
+
+   DRW_shgroup_uniform_float(grp, "gradient_f", 
>storage->gradient_f, 1);
+   DRW_shgroup_uniform_vec2(grp, "gradient_s", 
stl->storage->gradient_s, 1);
+
/* viewport x-ray */
stl->shgroups[id].is_xray = ((ob) && (ob->dt == OB_WIRE)) ? 1 : 
stl->storage->is_xray;
DRW_shgroup_uniform_int(grp, "viewport_xray", (const int 
*)>shgroups[id].is_xray, 1);
@@ -1398,7 +1407,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data, void *vedata, T
else {
stl->g_data->shgrps_drawing_stroke = 
DRW_gpencil_shgroup_point_create(
e_data, vedata, 
psl->drawing_pass, e_data->gpencil_point_sh, NULL,
-   gpd, NULL, gp_style, -1,
+   gpd, NULL, NULL, gp_style, -1,
false, 1.0f, (const int 
*)stl->storage->shade_render);
}
 
@@ -1595,7 +1604,7 @@ static void DRW_gpencil_shgroups_create(
 
shgrp = DRW_gpencil_shgroup_point_create(
e_data, vedata, stroke_pass, 
e_data->gpencil_point_sh,
-   ob, gpd, gpl, gp_style, 
stl->storage->shgroup_id, elm->onion,
+   ob, gpd, gpl, gps, gp_style, 
stl->storage->shgroup_id, elm->onion,
scale, cache_ob->shading_type);
 
DRW_shgroup_call_range_add(
diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
index a1285029e4c..7e222311295 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
@@ -2,6 +2,9 @@ uniform int color_type;
 uniform int mode;
 uniform sampler2D myTexture;
 
+uniform float gradient_f;
+uniform vec2 gradient_s;
+
 in vec4 mColor;
 in vec2 mTexCoord;
 out vec4 fragColor;
diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
index 53ff8d1709a..32d53fa9992 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
@@ -58,8 +58,9 @@ void main()

[Bf-blender-cvs] [7f6d3d8fc43] greasepencil-object: GPencil: Add default gradient values to gizmo

2019-03-19 Thread Antonioya
Commit: 7f6d3d8fc438a8025e71dda958385bd18c1ff983
Author: Antonioya
Date:   Mon Mar 18 10:56:01 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB7f6d3d8fc438a8025e71dda958385bd18c1ff983

GPencil: Add default gradient values to gizmo

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c 
b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index 09757e13297..120056ce1ba 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -437,6 +437,9 @@ static bool view3d_ruler_to_gpencil(bContext *C, 
wmGizmoGroup *gzgroup)
}
gps->flag = GP_STROKE_3DSPACE;
gps->thickness = 3;
+   gps->gradient_f = 1.0f;
+   gps->gradient_s[0] = 1.0f;
+   gps->gradient_s[1] = 1.0f;
 
BLI_addtail(>strokes, gps);
changed = true;

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


[Bf-blender-cvs] [bdbb0b0bd61] greasepencil-object: GPencil: Fix problem with gradient for Stroke and Monkey primitives

2019-03-19 Thread Antonioya
Commit: bdbb0b0bd61c5bb452aaa771eb721d8c4f7b144c
Author: Antonioya
Date:   Mon Mar 18 10:53:15 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBbdbb0b0bd61c5bb452aaa771eb721d8c4f7b144c

GPencil: Fix problem with gradient for Stroke and Monkey primitives

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 538050744d8..9ed471db21c 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -465,6 +465,10 @@ bGPDstroke *BKE_gpencil_add_stroke(bGPDframe *gpf, int 
mat_idx, int totpoints, s
bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "gp_stroke");
 
gps->thickness = thickness;
+   gps->gradient_f = 1.0f;
+   gps->gradient_s[0] = 1.0f;
+   gps->gradient_s[1] = 1.0f;
+
gps->inittime = 0;
 
/* enable recalculation flag by default */

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


[Bf-blender-cvs] [323ab6fdd74] greasepencil-object: GPencil: Set default gradient in new brushes

2019-03-19 Thread Antonioya
Commit: 323ab6fdd74ab3d71d16bdad33a805944770ba74
Author: Antonioya
Date:   Mon Mar 18 09:06:11 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB323ab6fdd74ab3d71d16bdad33a805944770ba74

GPencil: Set default gradient in new brushes

===

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

===

diff --git a/source/blender/blenkernel/intern/brush.c 
b/source/blender/blenkernel/intern/brush.c
index c959504f84f..071b73b0e51 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -304,6 +304,10 @@ void BKE_brush_gpencil_presets(bContext *C)
brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
 
+   brush->gpencil_settings->gradient_f = 1.0f;
+   brush->gpencil_settings->gradient_s[0] = 1.0f;
+   brush->gpencil_settings->gradient_s[1] = 1.0f;
+
/* Pen brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Pen");
deft = brush; /* save default brush */
@@ -336,6 +340,10 @@ void BKE_brush_gpencil_presets(bContext *C)
brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
 
+   brush->gpencil_settings->gradient_f = 1.0f;
+   brush->gpencil_settings->gradient_s[0] = 1.0f;
+   brush->gpencil_settings->gradient_s[1] = 1.0f;
+
/* Ink brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Ink");
brush->size = 60.0f;
@@ -365,6 +373,10 @@ void BKE_brush_gpencil_presets(bContext *C)
brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
 
+   brush->gpencil_settings->gradient_f = 1.0f;
+   brush->gpencil_settings->gradient_s[0] = 1.0f;
+   brush->gpencil_settings->gradient_s[1] = 1.0f;
+
/* Curve */
custom_curve = brush->gpencil_settings->curve_sensitivity;
curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f);
@@ -408,6 +420,10 @@ void BKE_brush_gpencil_presets(bContext *C)
curvemapping_initialize(custom_curve);
brush_gpencil_curvemap_reset(custom_curve->cm, 3, 
GPCURVE_PRESET_INKNOISE);
 
+   brush->gpencil_settings->gradient_f = 1.0f;
+   brush->gpencil_settings->gradient_s[0] = 1.0f;
+   brush->gpencil_settings->gradient_s[1] = 1.0f;
+
/* Block Basic brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Block");
brush->size = 150.0f;
@@ -436,6 +452,10 @@ void BKE_brush_gpencil_presets(bContext *C)
brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
 
+   brush->gpencil_settings->gradient_f = 1.0f;
+   brush->gpencil_settings->gradient_s[0] = 1.0f;
+   brush->gpencil_settings->gradient_s[1] = 1.0f;
+
/* Marker brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Marker");
brush->size = 80.0f;
@@ -472,6 +492,10 @@ void BKE_brush_gpencil_presets(bContext *C)
curvemapping_initialize(custom_curve);
brush_gpencil_curvemap_reset(custom_curve->cm, 4, 
GPCURVE_PRESET_MARKER);
 
+   brush->gpencil_settings->gradient_f = 1.0f;
+   brush->gpencil_settings->gradient_s[0] = 1.0f;
+   brush->gpencil_settings->gradient_s[1] = 1.0f;
+
/* Fill brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Fill Area");
brush->size = 1.0f;
@@ -495,6 +519,10 @@ void BKE_brush_gpencil_presets(bContext *C)
 
brush->gpencil_settings->draw_strength = 1.0f;
 
+   brush->gpencil_settings->gradient_f = 1.0f;
+   brush->gpencil_settings->gradient_s[0] = 1.0f;
+   brush->gpencil_settings->gradient_s[1] = 1.0f;
+
/* Soft Eraser brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Soft");
brush->size = 30.0f;

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


[Bf-blender-cvs] [4ca31474ef6] greasepencil-object: GPencil: Pass basic data to shaders for gradients (wip)

2019-03-19 Thread Antonioya
Commit: 4ca31474ef6a3876b651102310d673eee7f81326
Author: Antonioya
Date:   Mon Mar 18 10:50:07 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB4ca31474ef6a3876b651102310d673eee7f81326

GPencil: Pass basic data to shaders for gradients (wip)

===

M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 2710ecc5e5b..1cb44105537 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -532,6 +532,11 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
stl->shgroups[id].caps_mode[1] = gps->caps[1];
DRW_shgroup_uniform_int(grp, "caps_mode", 
>shgroups[id].caps_mode[0], 2);
 
+   stl->shgroups[id].gradient_f = gps->gradient_f;
+   copy_v2_v2(stl->shgroups[id].gradient_s, gps->gradient_s);
+   DRW_shgroup_uniform_float(grp, "gradient_f", 
>shgroups[id].gradient_f, 1);
+   DRW_shgroup_uniform_vec2(grp, "gradient_s", 
stl->shgroups[id].gradient_s, 1);
+
/* viewport x-ray */
stl->shgroups[id].is_xray = (ob->dt == OB_WIRE) ? 1 : 
stl->storage->is_xray;
DRW_shgroup_uniform_int(grp, "viewport_xray", (const int 
*)>shgroups[id].is_xray, 1);
@@ -565,6 +570,9 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
const int zero[2] = { 0, 0 };
DRW_shgroup_uniform_int(grp, "caps_mode", [0], 2);
 
+   DRW_shgroup_uniform_float(grp, "gradient_f", 
>storage->gradient_f, 1);
+   DRW_shgroup_uniform_vec2(grp, "gradient_s", 
stl->storage->gradient_s, 1);
+
/* viewport x-ray */
DRW_shgroup_uniform_int(grp, "viewport_xray", 
>storage->is_xray, 1);
DRW_shgroup_uniform_int(grp, "shading_type", (const int 
*)>storage->shade_render, 2);
@@ -1374,6 +1382,11 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data, void *vedata, T
 * i.e. tGPspoints NOT bGPDspoints
 */
short lthick = brush->size * obscale;
+
+   /* save gradient info */
+   stl->storage->gradient_f = 
brush->gpencil_settings->gradient_f;
+   copy_v2_v2(stl->storage->gradient_s, 
brush->gpencil_settings->gradient_s);
+
/* if only one point, don't need to draw buffer because 
the user has no time to see it */
if (gpd->runtime.sbuffer_size > 1) {
if ((gp_style) && (gp_style->mode == 
GP_STYLE_MODE_LINE)) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h 
b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 860dd728805..7a5546646a4 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -120,6 +120,9 @@ typedef struct GPENCIL_shgroup {
float obj_scale;
int xray_mode;
 
+   float gradient_f;
+   float gradient_s[2];
+
/* color of the wireframe */
float wire_color[4];
/* shading type and mode */
@@ -164,6 +167,9 @@ typedef struct GPENCIL_Storage {
bool simplify_fx;
bool simplify_blend;
 
+   float gradient_f;
+   float gradient_s[2];
+
/* Render Matrices and data */
float persmat[4][4], persinv[4][4];
float viewmat[4][4], viewinv[4][4];
diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
index 80fa899b13a..53ff8d1709a 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
@@ -1,6 +1,9 @@
 uniform int color_type;
 uniform sampler2D myTexture;
 
+uniform float gradient_f;
+uniform vec2 gradient_s;
+
 in vec4 mColor;
 in vec2 mTexCoord;
 in vec2 uvfac;
@@ -54,6 +57,10 @@ void main()
fragColor.a = min(text_color.a * tColor.a, tColor.a);
}
 
+   /* gradient */
+   fragColor.a = gradient_f;
+
+
if(fragColor.a < 0.0035)
discard;
 }

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


[Bf-blender-cvs] [ac1adbc3f15] greasepencil-object: GPencil: New parameter for gradient

2019-03-19 Thread Antonioya
Commit: ac1adbc3f159d43c7d849565bf0b567fb9d14383
Author: Antonioya
Date:   Mon Mar 18 09:03:29 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBac1adbc3f159d43c7d849565bf0b567fb9d14383

GPencil: New parameter for gradient

Add new fields and initialize.

===

M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/makesdna/DNA_brush_types.h
M   source/blender/makesdna/DNA_gpencil_types.h
M   source/blender/makesrna/intern/rna_brush.c
M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index a37e54d40a8..6a1c32be88e 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1545,6 +1545,8 @@ class 
VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel):
 col.prop(gp_settings, "angle", slider=True)
 col.prop(gp_settings, "angle_factor", text="Factor", slider=True)
 col.separator()
+col.prop(gp_settings, "gradient_factor", slider=True)
+col.prop(gp_settings, "gradient_shape")
 
 
 class VIEW3D_PT_tools_grease_pencil_brush_stabilizer(View3DPanel, Panel):
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 986f35008bd..be1bfea540c 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2920,5 +2920,31 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
part->draw_as = PART_DRAW_NOT;
}
}
+   /* init grease pencil brush gradients */
+   if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", 
"float", "gradient_f")) {
+   for (Brush *brush = bmain->brushes.first; brush; brush 
= brush->id.next) {
+   if (brush->gpencil_settings != NULL) {
+   BrushGpencilSettings *gp = 
brush->gpencil_settings;
+   gp->gradient_f = 1.0f;
+   gp->gradient_s[0] = 1.0f;
+   gp->gradient_s[1] = 1.0f;
+   }
+   }
+   }
+
+   /* init grease pencil stroke gradients */
+   if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "float", 
"gradient_f")) {
+   for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = 
gpd->id.next) {
+   for (bGPDlayer *gpl = gpd->layers.first; gpl; 
gpl = gpl->next) {
+   for (bGPDframe *gpf = 
gpl->frames.first; gpf; gpf = gpf->next) {
+   for (bGPDstroke *gps = 
gpf->strokes.first; gps; gps = gps->next) {
+   gps->gradient_f = 1.0f;
+   gps->gradient_s[0] = 
1.0f;
+   gps->gradient_s[1] = 
1.0f;
+   }
+   }
+   }
+   }
+   }
}
 }
diff --git a/source/blender/makesdna/DNA_brush_types.h 
b/source/blender/makesdna/DNA_brush_types.h
index 4bfbb3655af..9aa6ff8c1c8 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -111,6 +111,12 @@ typedef struct BrushGpencilSettings {
/** Internal grease pencil drawing flags. */
int flag;
 
+   /** gradient control along y for color */
+   float gradient_f;
+   /** factor xy of shape for dots gradients */
+   float gradient_s[2];
+   char _pad_2[4];
+
struct CurveMapping *curve_sensitivity;
struct CurveMapping *curve_strength;
struct CurveMapping *curve_jitter;
diff --git a/source/blender/makesdna/DNA_gpencil_types.h 
b/source/blender/makesdna/DNA_gpencil_types.h
index bd17d4e57dc..363c1dd504d 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -199,6 +199,12 @@ typedef struct bGPDstroke {
/** Caps mode for each stroke extreme */
short caps[2];
 
+   /** gradient control along y for color */
+   float gradient_f;
+   /** factor xy of shape for dots gradients */
+   float gradient_s[2];
+   char _pad_3[4];
+
/** Vertex weight data. */
struct MDeformVert *dvert;
 
diff --git 

[Bf-blender-cvs] [dda3e483036] greasepencil-object: GPencil: Copy Brusg gradient data to stroke in drawing operators.

2019-03-19 Thread Antonioya
Commit: dda3e483036458adc68dda8ab8655c426d168fb7
Author: Antonioya
Date:   Mon Mar 18 10:29:13 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBdda3e483036458adc68dda8ab8655c426d168fb7

GPencil: Copy Brusg gradient data to stroke in drawing operators.

===

M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/gpencil_fill.c
M   source/blender/editors/gpencil/gpencil_merge.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/gpencil/gpencil_primitive.c

===

diff --git a/source/blender/editors/gpencil/annotate_paint.c 
b/source/blender/editors/gpencil/annotate_paint.c
index 349deb6b53e..c61ee7be6ac 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -681,6 +681,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
/* copy appropriate settings for stroke */
gps->totpoints = totelem;
gps->thickness = gpl->thickness;
+   gps->gradient_f = 1.0f;
+   gps->gradient_s[0] = 1.0f;
+   gps->gradient_s[1] = 1.0f;
gps->flag = gpd->runtime.sbuffer_sflag;
gps->inittime = p->inittime;
 
diff --git a/source/blender/editors/gpencil/gpencil_fill.c 
b/source/blender/editors/gpencil/gpencil_fill.c
index 36202bdac0a..5a73f2e2d77 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1012,6 +1012,8 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
/* create new stroke */
bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "bGPDstroke");
gps->thickness = brush->size;
+   gps->gradient_f = brush->gpencil_settings->gradient_f;
+   copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s);
gps->inittime = 0.0f;
 
/* the polygon must be closed, so enabled cyclic */
diff --git a/source/blender/editors/gpencil/gpencil_merge.c 
b/source/blender/editors/gpencil/gpencil_merge.c
index 80b26a366fe..10bf45a9e2f 100644
--- a/source/blender/editors/gpencil/gpencil_merge.c
+++ b/source/blender/editors/gpencil/gpencil_merge.c
@@ -127,6 +127,8 @@ static bGPDstroke *gpencil_prepare_stroke(bContext *C, 
wmOperator *op, int totpo
gps->totpoints = totpoints;
gps->inittime = 0.0f;
gps->thickness = brush->size;
+   gps->gradient_f = brush->gpencil_settings->gradient_f;
+   copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s);
gps->flag |= GP_STROKE_SELECT;
gps->flag |= GP_STROKE_3DSPACE;
gps->mat_nr = ob->actcol - 1;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 40f0c0e7b84..09df45f75ca 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -938,6 +938,8 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
/* copy appropriate settings for stroke */
gps->totpoints = totelem;
gps->thickness = brush->size;
+   gps->gradient_f = brush->gpencil_settings->gradient_f;
+   copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s);
gps->flag = gpd->runtime.sbuffer_sflag;
gps->inittime = p->inittime;
 
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c 
b/source/blender/editors/gpencil/gpencil_primitive.c
index 962442824f9..fd30fc8ba68 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -338,6 +338,9 @@ static void gp_primitive_set_initdata(bContext *C, 
tGPDprimitive *tgpi)
/* create new temp stroke */
bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "Temp bGPDstroke");
gps->thickness = 2.0f;
+   gps->gradient_f = 1.0f;
+   gps->gradient_s[0] = 1.0f;
+   gps->gradient_s[1] = 1.0f;
gps->inittime = 0.0f;
 
/* enable recalculation flag by default */
@@ -1216,6 +1219,7 @@ static void gpencil_primitive_interaction_end(bContext 
*C, wmOperator *op, wmWin
bGPDstroke *gps;
 
ToolSettings *ts = tgpi->scene->toolsettings;
+   Brush *brush = tgpi->brush;
 
const int def_nr = tgpi->ob->actdef - 1;
const bool have_weight = (bool)BLI_findlink(>ob->defbase, def_nr);
@@ -1238,7 +1242,10 @@ static void gpencil_primitive_interaction_end(bContext 
*C, wmOperator *op, wmWin
/* prepare stroke to get transferred */
gps = tgpi->gpf->strokes.first;
if (gps) {
-   gps->thickness = tgpi->brush->size;
+   gps->thickness = brush->size;
+   gps->gradient_f = brush->gpencil_settings->gradient_f;
+   copy_v2_v2(gps->gradient_s, 
brush->gpencil_settings->gradient_s);
+
gps->flag |= GP_STROKE_RECALC_GEOMETRY;

[Bf-blender-cvs] [8a125e3b55d] master: Cleanup: remove unused for gpencil bounds calculation

2019-03-19 Thread Campbell Barton
Commit: 8a125e3b55de11558e12ecd5e41700c8f3b55662
Author: Campbell Barton
Date:   Tue Mar 19 23:55:04 2019 +1100
Branches: master
https://developer.blender.org/rB8a125e3b55de11558e12ecd5e41700c8f3b55662

Cleanup: remove unused for gpencil bounds calculation

===

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

===

diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index eb4101fa2f7..353ba61b70d 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -136,13 +136,13 @@ struct Material *BKE_gpencil_material_ensure(struct Main 
*bmain, struct Object *
 
 /* object boundbox */
 bool BKE_gpencil_data_minmax(
-   struct Object *ob, const struct bGPdata *gpd,
-   float r_min[3], float r_max[3]);
+const struct bGPdata *gpd,
+float r_min[3], float r_max[3]);
 bool BKE_gpencil_stroke_minmax(
-   const struct bGPDstroke *gps, const bool use_select,
-   float r_min[3], float r_max[3]);
+const struct bGPDstroke *gps, const bool use_select,
+float r_min[3], float r_max[3]);
 bool BKE_gpencil_stroke_select_check(
-   const struct bGPDstroke *gps);
+const struct bGPDstroke *gps);
 
 struct BoundBox *BKE_gpencil_boundbox_get(struct Object *ob);
 void BKE_gpencil_centroid_3d(struct bGPdata *gpd, float r_centroid[3]);
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 454e9fe5847..eb6fc9ceeeb 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1048,9 +1048,8 @@ bool BKE_gpencil_stroke_minmax(
 }
 
 /* get min/max bounds of all strokes in GP datablock */
-bool BKE_gpencil_data_minmax(Object *ob, const bGPdata *gpd, float r_min[3], 
float r_max[3])
+bool BKE_gpencil_data_minmax(const bGPdata *gpd, float r_min[3], float 
r_max[3])
 {
-   float bmat[3][3];
bool changed = false;
 
INIT_MINMAX(r_min, r_max);
@@ -1068,14 +1067,6 @@ bool BKE_gpencil_data_minmax(Object *ob, const bGPdata 
*gpd, float r_min[3], flo
}
}
 
-   if ((changed) && (ob)) {
-   copy_m3_m4(bmat, ob->obmat);
-   mul_m3_v3(bmat, r_min);
-   add_v3_v3(r_min, ob->obmat[3]);
-   mul_m3_v3(bmat, r_max);
-   add_v3_v3(r_max, ob->obmat[3]);
-   }
-
return changed;
 }
 
@@ -1097,7 +1088,7 @@ void BKE_gpencil_centroid_3d(bGPdata *gpd, float 
r_centroid[3])
 {
float min[3], max[3], tot[3];
 
-   BKE_gpencil_data_minmax(NULL, gpd, min, max);
+   BKE_gpencil_data_minmax(gpd, min, max);
 
add_v3_v3v3(tot, min, max);
mul_v3_v3fl(r_centroid, tot, 0.5f);
@@ -1118,7 +1109,7 @@ static void boundbox_gpencil(Object *ob)
bb  = ob->runtime.bb;
gpd = ob->data;
 
-   if (!BKE_gpencil_data_minmax(NULL, gpd, min, max)) {
+   if (!BKE_gpencil_data_minmax(gpd, min, max)) {
min[0] = min[1] = min[2] = -1.0f;
max[0] = max[1] = max[2] = 1.0f;
}

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


[Bf-blender-cvs] [c001a9c3b6f] master: Fix T62743: GPencil dimensions are large when no geometry exists

2019-03-19 Thread Campbell Barton
Commit: c001a9c3b6fcee5a31296441d62d99d3ee49b477
Author: Campbell Barton
Date:   Tue Mar 19 23:49:56 2019 +1100
Branches: master
https://developer.blender.org/rBc001a9c3b6fcee5a31296441d62d99d3ee49b477

Fix T62743: GPencil dimensions are large when no geometry exists

Use fallback when no data exists
matching bound-box for other kinds of geometry.

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 538050744d8..454e9fe5847 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1118,7 +1118,11 @@ static void boundbox_gpencil(Object *ob)
bb  = ob->runtime.bb;
gpd = ob->data;
 
-   BKE_gpencil_data_minmax(NULL, gpd, min, max);
+   if (!BKE_gpencil_data_minmax(NULL, gpd, min, max)) {
+   min[0] = min[1] = min[2] = -1.0f;
+   max[0] = max[1] = max[2] = 1.0f;
+   }
+
BKE_boundbox_init_from_minmax(bb, min, max);
 
bb->flag &= ~BOUNDBOX_DIRTY;

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


[Bf-blender-cvs] [0aca8b01743] master: EEVEE/LookDev: Fix Cache In Quad View

2019-03-19 Thread Jeroen Bakker
Commit: 0aca8b017436395fc3af62d6265d16fd6d531f1a
Author: Jeroen Bakker
Date:   Tue Mar 19 13:29:22 2019 +0100
Branches: master
https://developer.blender.org/rB0aca8b017436395fc3af62d6265d16fd6d531f1a

EEVEE/LookDev: Fix Cache In Quad View

When using LookDev in Quad view the cache was only updated for the first
Q-view. The evaluation data of the last cache was not stored with the
lightprobe textures. As the evaluation data was reused between the
Q-views only the lightprobe textures of the first view was updated.

With this patch the evaluated data is stored amongside the actual
lightprobe textures.

Fix T59046

Reviewed By: fclem

Maniphest Tasks: T59046

===

M   source/blender/draw/engines/eevee/eevee_lookdev.c
M   source/blender/draw/engines/eevee/eevee_private.h

===

diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c 
b/source/blender/draw/engines/eevee/eevee_lookdev.c
index 2f89476e832..b07b20386a8 100644
--- a/source/blender/draw/engines/eevee/eevee_lookdev.c
+++ b/source/blender/draw/engines/eevee/eevee_lookdev.c
@@ -41,6 +41,7 @@
 static void eevee_lookdev_lightcache_delete(EEVEE_Data *vedata)
 {
EEVEE_StorageList *stl = vedata->stl;
+   EEVEE_PrivateData *g_data = stl->g_data;
EEVEE_TextureList *txl = vedata->txl;
 
MEM_SAFE_FREE(stl->lookdev_lightcache);
@@ -48,6 +49,8 @@ static void eevee_lookdev_lightcache_delete(EEVEE_Data 
*vedata)
MEM_SAFE_FREE(stl->lookdev_cube_data);
DRW_TEXTURE_FREE_SAFE(txl->lookdev_grid_tx);
DRW_TEXTURE_FREE_SAFE(txl->lookdev_cube_tx);
+   g_data->studiolight_index = -1;
+   g_data->studiolight_rot_z = 0.0f;
 }
 
 void EEVEE_lookdev_cache_init(
@@ -57,6 +60,7 @@ void EEVEE_lookdev_cache_init(
 {
EEVEE_StorageList *stl = vedata->stl;
EEVEE_TextureList *txl = vedata->txl;
+   EEVEE_PrivateData *g_data = stl->g_data;
const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d;
if (LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d)) {
@@ -132,13 +136,12 @@ void EEVEE_lookdev_cache_init(
DRW_shgroup_uniform_texture(*grp, "image", tex);
 
/* Do we need to recalc the lightprobes? */
-   if (pinfo &&
-   ((pinfo->studiolight_index != sl->index) ||
-(pinfo->studiolight_rot_z != 
v3d->shading.studiolight_rot_z)))
+   if (g_data->studiolight_index != sl->index ||
+   g_data->studiolight_rot_z != 
v3d->shading.studiolight_rot_z)
{
stl->lookdev_lightcache->flag |= 
LIGHTCACHE_UPDATE_WORLD;
-   pinfo->studiolight_index = sl->index;
-   pinfo->studiolight_rot_z = 
v3d->shading.studiolight_rot_z;
+   g_data->studiolight_index = sl->index;
+   g_data->studiolight_rot_z = 
v3d->shading.studiolight_rot_z;
}
}
}
diff --git a/source/blender/draw/engines/eevee/eevee_private.h 
b/source/blender/draw/engines/eevee/eevee_private.h
index e0ee689f5df..c9ae245c550 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -486,8 +486,6 @@ typedef struct EEVEE_LightProbesInfo {
float visibility_blur;
float intensity_fac;
int shres;
-   int studiolight_index;
-   float studiolight_rot_z;
EEVEE_LightProbeVisTest planar_vis_tests[MAX_PLANAR];
/* UBO Storage : data used by UBO */
EEVEE_LightProbe probe_data[MAX_PROBE];
@@ -818,6 +816,11 @@ typedef struct EEVEE_PrivateData {
 
/* Color Management */
bool use_color_render_settings;
+
+   /* LookDev Settings */
+   int studiolight_index;
+   float studiolight_rot_z;
+
 } EEVEE_PrivateData; /* Transient data */
 
 /* eevee_data.c */

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


[Bf-blender-cvs] [b0c6c9f11df] master: Fix view selected ignoring all non-grease pencil objects

2019-03-19 Thread Campbell Barton
Commit: b0c6c9f11df79bfa4d49e11e2f36eb1e96f9b679
Author: Campbell Barton
Date:   Tue Mar 19 23:11:36 2019 +1100
Branches: master
https://developer.blender.org/rBb0c6c9f11df79bfa4d49e11e2f36eb1e96f9b679

Fix view selected ignoring all non-grease pencil objects

When the grease pencil was active no other objects were taken into
account. There is no need for a special case here since objects
bounding boxes are used.

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index 005e78fbc1a..c8f6ee261b5 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -2874,15 +2874,6 @@ static int viewselected_exec(bContext *C, wmOperator *op)
mul_m4_v3(ob_eval->obmat, max);
}
}
-   else if (ob_eval && (ob_eval->type == OB_GPENCIL)) {
-   ok |= BKE_gpencil_data_minmax(ob_eval, gpd, min, max);
-   /* if no strokes, use object location */
-   if ((ob_eval) && (!ok)) {
-   copy_v3_v3(min, ob_eval->obmat[3]);
-   copy_v3_v3(max, ob_eval->obmat[3]);
-   ok = true;
-   }
-   }
else if (is_face_map) {
ok = WM_gizmomap_minmax(ar->gizmo_map, true, true, min, max);
}

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


[Bf-blender-cvs] [12716e6b9fc] master: UI: Make UV Editor contextual menu more consistent with 3D View

2019-03-19 Thread William Reynish
Commit: 12716e6b9fc74bd53be39ec7aab16ca8d43f0593
Author: William Reynish
Date:   Tue Mar 19 13:14:35 2019 +0100
Branches: master
https://developer.blender.org/rB12716e6b9fc74bd53be39ec7aab16ca8d43f0593

UI: Make UV Editor contextual menu more consistent with 3D View

-Use same ordering of Add, Modify, Remove
-Add back Remove Doubles here

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index b30e5c8c642..7d8e4e7eb3e 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -448,31 +448,33 @@ class IMAGE_MT_uvs_context_menu(Menu):
 
 # UV Edit Mode
 if sima.show_uvedit:
+# Add
 layout.operator("uv.unwrap")
 layout.operator("uv.follow_active_quads")
 
 layout.separator()
 
+# Modify
 layout.operator("uv.pin").clear = False
 layout.operator("uv.pin", text="Unpin").clear = True
 
 layout.separator()
 
-layout.operator("uv.weld")
-layout.operator("uv.stitch")
-
-layout.separator()
+layout.menu("IMAGE_MT_uvs_snap")
 
-layout.operator_enum("uv.align", "axis")  # W, 2/3/4.
+layout.operator("transform.mirror", text="Mirror 
X").constraint_axis[0] = True
+layout.operator("transform.mirror", text="Mirror 
Y").constraint_axis[1] = True
 
 layout.separator()
 
-layout.operator("transform.mirror", text="Mirror 
X").constraint_axis[0] = True
-layout.operator("transform.mirror", text="Mirror 
Y").constraint_axis[1] = True
+layout.operator_enum("uv.align", "axis")  # W, 2/3/4.
 
 layout.separator()
 
-layout.menu("IMAGE_MT_uvs_snap")
+# Remove
+layout.operator("uv.remove_doubles", text="Remove Double UVs")
+layout.operator("uv.stitch")
+layout.operator("uv.weld")
 
 
 class IMAGE_MT_pivot_pie(Menu):

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


[Bf-blender-cvs] [142096a2ed0] master: UI: Make EV Editor UV menu more consistent with 3D VIew

2019-03-19 Thread William Reynish
Commit: 142096a2ed074ad72e90f45252ebd0958b04b8b3
Author: William Reynish
Date:   Tue Mar 19 13:13:32 2019 +0100
Branches: master
https://developer.blender.org/rB142096a2ed074ad72e90f45252ebd0958b04b8b3

UI: Make EV Editor UV menu more consistent with 3D VIew

-Transform, Mirror, Snap at the top
-Remove redundant Proportional Editing entry from this menu - we already have 
it in the header

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index 73c3f632812..b30e5c8c642 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -351,6 +351,10 @@ class IMAGE_MT_uvs(Menu):
 uv = sima.uv_editor
 tool_settings = context.tool_settings
 
+layout.menu("IMAGE_MT_uvs_transform")
+layout.menu("IMAGE_MT_uvs_mirror")
+layout.menu("IMAGE_MT_uvs_snap")
+
 layout.prop_menu_enum(uv, "pixel_snap_mode")
 layout.prop(uv, "lock_bounds")
 
@@ -362,15 +366,11 @@ class IMAGE_MT_uvs(Menu):
 
 layout.prop(uv, "use_live_unwrap")
 layout.operator("uv.unwrap")
-layout.operator("uv.pin", text="Unpin").clear = True
-layout.operator("uv.pin").clear = False
 
 layout.separator()
 
-layout.operator("uv.pack_islands")
-layout.operator("uv.average_islands_scale")
-layout.operator("uv.minimize_stretch")
-layout.operator("uv.stitch")
+layout.operator("uv.pin").clear = False
+layout.operator("uv.pin", text="Unpin").clear = True
 
 layout.separator()
 
@@ -380,19 +380,21 @@ class IMAGE_MT_uvs(Menu):
 
 layout.separator()
 
-layout.menu("IMAGE_MT_uvs_transform")
-layout.menu("IMAGE_MT_uvs_mirror")
-layout.menu("IMAGE_MT_uvs_snap")
-layout.menu("IMAGE_MT_uvs_weldalign")
+layout.operator("uv.pack_islands")
+layout.operator("uv.average_islands_scale")
 
 layout.separator()
 
-layout.menu("IMAGE_MT_uvs_proportional")
+layout.operator("uv.minimize_stretch")
+layout.operator("uv.stitch")
+layout.menu("IMAGE_MT_uvs_weldalign")
 
 layout.separator()
 
 layout.menu("IMAGE_MT_uvs_showhide")
 
+layout.separator()
+
 
 class IMAGE_MT_uvs_select_mode(Menu):
 bl_label = "UV Select Mode"

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


[Bf-blender-cvs] [f4b57b0190b] master: Fix T62713: Paste Normal Vectors - needed better selection handling.

2019-03-19 Thread Bastien Montagne
Commit: f4b57b0190b6212c94825c5591f851b44def3d2b
Author: Bastien Montagne
Date:   Tue Mar 19 12:23:32 2019 +0100
Branches: master
https://developer.blender.org/rBf4b57b0190b6212c94825c5591f851b44def3d2b

Fix T62713: Paste Normal Vectors - needed better selection handling.

Existing code was not really handling well cases were only edges or
faces were selected (with match select modes).

In those cases, we can assume user want to only affect loop normals of
selected faces/edges, not all lnors of all (indirectly) selected verts.

Also refactored the code a bit to move whole 'loop to edit' selection
process into its own single function.

===

M   source/blender/bmesh/intern/bmesh_mesh.c

===

diff --git a/source/blender/bmesh/intern/bmesh_mesh.c 
b/source/blender/bmesh/intern/bmesh_mesh.c
index a1f2281e6ef..c0c46a65479 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -1339,30 +1339,94 @@ static int bm_loop_normal_mark_indiv(BMesh *bm, 
BLI_bitmap *loops)
BMEditSelection *ese, *ese_prev;
int totloopsel = 0;
 
+   const bool sel_verts = (bm->selectmode & SCE_SELECT_VERTEX) != 0;
+   const bool sel_edges = (bm->selectmode & SCE_SELECT_EDGE) != 0;
+   const bool sel_faces = (bm->selectmode & SCE_SELECT_FACE) != 0;
+   const bool use_sel_face_history = sel_faces && (sel_edges || sel_verts);
+
BM_mesh_elem_index_ensure(bm, BM_LOOP);
 
BLI_assert(bm->lnor_spacearr != NULL);
BLI_assert(bm->lnor_spacearr->data_type == MLNOR_SPACEARR_BMLOOP_PTR);
 
-   /* Goes from last selected to the first selected element. */
-   for (ese = bm->selected.last; ese; ese = ese->prev) {
-   if (ese->htype == BM_FACE) {
-   ese_prev = ese;
-   /* If current face is selected, then any verts to be 
edited must have been selected before it. */
-   while ((ese_prev = ese_prev->prev)) {
-   if (ese_prev->htype == BM_VERT) {
-   bm_loop_normal_mark_indiv_do_loop(
-   BM_face_vert_share_loop((BMFace 
*)ese->ele, (BMVert *)ese_prev->ele),
-   loops, bm->lnor_spacearr, 
);
+   if (use_sel_face_history) {
+   /* Using face history allows to select a single loop from a 
single face...
+* Note that this is On² piece of code, but it is not designed 
to be used with huge selection sets,
+* rather with only a few items selected at most.*/
+   printf("using face history selection\n");
+   /* Goes from last selected to the first selected element. */
+   for (ese = bm->selected.last; ese; ese = ese->prev) {
+   if (ese->htype == BM_FACE) {
+   /* If current face is selected, then any verts 
to be edited must have been selected before it. */
+   for (ese_prev = ese->prev; ese_prev; ese_prev = 
ese_prev->prev) {
+   if (ese_prev->htype == BM_VERT) {
+   
bm_loop_normal_mark_indiv_do_loop(
+   
BM_face_vert_share_loop((BMFace *)ese->ele, (BMVert *)ese_prev->ele),
+   loops, 
bm->lnor_spacearr, );
+   }
+   else if (ese_prev->htype == BM_EDGE) {
+   BMEdge *e = (BMEdge 
*)ese_prev->ele;
+   
bm_loop_normal_mark_indiv_do_loop(
+   
BM_face_vert_share_loop((BMFace *)ese->ele, e->v1),
+   loops, 
bm->lnor_spacearr, );
+
+   
bm_loop_normal_mark_indiv_do_loop(
+   
BM_face_vert_share_loop((BMFace *)ese->ele, e->v2),
+   loops, 
bm->lnor_spacearr, );
+   }
+   }
+   }
+   }
+   }
+   else {
+   if (sel_faces) {
+   /* Only select all loops of selected faces. */
+   printf("using face selection\n");
+   BMLoop *l;
+   BMFace *f;
+   BMIter liter, fiter;
+   BM_ITER_MESH(f, , bm, BM_FACES_OF_MESH) {
+   if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+   

[Bf-blender-cvs] [d29dd5916f7] master: Minor cleanup/refactor of EditMesh custom normals copy code.

2019-03-19 Thread Bastien Montagne
Commit: d29dd5916f7d3cfb21cacb003df5796051c93301
Author: Bastien Montagne
Date:   Tue Mar 19 11:10:30 2019 +0100
Branches: master
https://developer.blender.org/rBd29dd5916f7d3cfb21cacb003df5796051c93301

Minor cleanup/refactor of EditMesh custom normals copy code.

Do not compute temp helper data when we do not need it (even though in
that case it was totally cheap to compute).

===

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

===

diff --git a/source/blender/editors/mesh/editmesh_tools.c 
b/source/blender/editors/mesh/editmesh_tools.c
index 9a58608081f..5b2cb97aff1 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -8000,16 +8000,10 @@ static int edbm_normals_tools_exec(bContext *C, 
wmOperator *op)
switch (mode) {
case EDBM_CLNOR_TOOLS_COPY:
if (bm->totfacesel != 1 && lnors_ed_arr->totloop != 1 
&& bm->totvertsel != 1) {
-   BKE_report(op->reports, RPT_ERROR, "Can only 
copy custom normal, vertex normal or face normal");
+   BKE_report(op->reports, RPT_ERROR, "Can only 
copy one custom normal, vertex normal or face normal");

BM_loop_normal_editdata_array_free(lnors_ed_arr);
return OPERATOR_CANCELLED;
}
-   bool join = true;
-   for (int i = 0; i < lnors_ed_arr->totloop; i++, 
lnor_ed++) {
-   if 
(!compare_v3v3(lnors_ed_arr->lnor_editdata->nloc, lnor_ed->nloc, 1e-4f)) {
-   join = false;
-   }
-   }
if (lnors_ed_arr->totloop == 1) {
copy_v3_v3(scene->toolsettings->normal_vector, 
lnors_ed_arr->lnor_editdata->nloc);
}
@@ -8022,8 +8016,18 @@ static int edbm_normals_tools_exec(bContext *C, 
wmOperator *op)
}
}
}
-   else if (join) {
-   copy_v3_v3(scene->toolsettings->normal_vector, 
lnors_ed_arr->lnor_editdata->nloc);
+   else {
+   /* 'Vertex' normal, i.e. common set of loop 
normals on the same vertex,
+* only if they are all the same. */
+   bool are_same_lnors = true;
+   for (int i = 0; i < lnors_ed_arr->totloop; i++, 
lnor_ed++) {
+   if 
(!compare_v3v3(lnors_ed_arr->lnor_editdata->nloc, lnor_ed->nloc, 1e-4f)) {
+   are_same_lnors = false;
+   }
+   }
+   if (are_same_lnors) {
+   
copy_v3_v3(scene->toolsettings->normal_vector, 
lnors_ed_arr->lnor_editdata->nloc);
+   }
}
break;

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


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

2019-03-19 Thread Jacques Lucke
Commit: 4c499e6d094c5fd7d972f098a72f29b378d30f27
Author: Jacques Lucke
Date:   Tue Mar 19 12:05:06 2019 +0100
Branches: functions
https://developer.blender.org/rB4c499e6d094c5fd7d972f098a72f29b378d30f27

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] [fae338bf7ce] functions: initial variadic list declaration

2019-03-19 Thread Jacques Lucke
Commit: fae338bf7ce7e9fb7f7e8abc7921095a4a861308
Author: Jacques Lucke
Date:   Tue Mar 19 12:03:47 2019 +0100
Branches: functions
https://developer.blender.org/rBfae338bf7ce7e9fb7f7e8abc7921095a4a861308

initial variadic list declaration

===

M   release/scripts/startup/function_nodes/inferencer.py
A   release/scripts/startup/function_nodes/nodes/create_list.py
M   release/scripts/startup/function_nodes/socket_decl.py
M   release/scripts/startup/function_nodes/test_inferencer.py
M   release/scripts/startup/function_nodes/update_sockets.py

===

diff --git a/release/scripts/startup/function_nodes/inferencer.py 
b/release/scripts/startup/function_nodes/inferencer.py
index 925f46dcd72..e720f1fb179 100644
--- a/release/scripts/startup/function_nodes/inferencer.py
+++ b/release/scripts/startup/function_nodes/inferencer.py
@@ -1,6 +1,7 @@
+from . sockets import type_infos
+
 class Inferencer:
-def __init__(self, type_infos):
-self.type_infos = type_infos
+def __init__(self):
 self.finalized_ids = dict()
 self.constraints = set()
 self.decisions = dict()
@@ -13,13 +14,17 @@ class Inferencer:
 self.constraints.add(constraint)
 
 def insert_list_constraint(self, list_ids, base_ids=tuple(), 
decision_id=None):
-constraint = ListConstraint(list_ids, base_ids, decision_id, 
self.type_infos)
+constraint = ListConstraint(list_ids, base_ids, decision_id)
 self.constraints.add(constraint)
 
 def insert_union_constraint(self, ids, allowed_types, decision_id=None):
 constraint = UnionConstraint(ids, decision_id, allowed_types)
 self.constraints.add(constraint)
 
+def insert_list_or_base_constraint(self, id, base_type, decision_id=None):
+constraint = ListOrBaseConstraint(id, decision_id, base_type)
+self.constraints.add(constraint)
+
 def finalize_id(self, id, data_type):
 if id in self.finalized_ids:
 if self.finalized_ids[id] != data_type:
@@ -33,6 +38,8 @@ class Inferencer:
 self.finalize_id(id, data_type)
 
 def make_decision(self, decision_id, value):
+if decision_id is None:
+return
 assert decision_id not in self.decisions
 self.decisions[decision_id] = value
 
@@ -79,8 +86,7 @@ class EqualityConstraint(Constraint):
 if id in finalized_ids:
 data_type = finalized_ids[id]
 finalize_do(self.ids, data_type)
-if self.decision_id is not None:
-make_decision(self.decision_id, data_type)
+make_decision(self.decision_id, data_type)
 return True
 return False
 
@@ -97,43 +103,61 @@ class UnionConstraint(Constraint):
 if data_type not in self.allowed_types:
 raise InferencingError()
 finalize_do(self.ids, data_type)
-if self.decision_id is not None:
-make_decision(self.decision_id, data_type)
+make_decision(self.decision_id, data_type)
 return True
 return False
 
 class ListConstraint(Constraint):
-def __init__(self, list_ids, base_ids, decision_id, type_infos):
+def __init__(self, list_ids, base_ids, decision_id):
 self.list_ids = set(list_ids)
 self.base_ids = set(base_ids)
 self.decision_id = decision_id
-self.type_infos = type_infos
 
 def try_finalize(self, finalized_ids, finalize_do, make_decision):
 for id in self.list_ids:
 if id in finalized_ids:
 list_type = finalized_ids[id]
-if not self.type_infos.is_list(list_type):
+if not type_infos.is_list(list_type):
 raise NoListTypeError()
-base_type = self.type_infos.to_base(list_type)
+base_type = type_infos.to_base(list_type)
 finalize_do(self.list_ids, list_type)
 finalize_do(self.base_ids, base_type)
-if self.decision_id is not None:
-make_decision(self.decision_id, base_type)
+make_decision(self.decision_id, base_type)
 return True
 for id in self.base_ids:
 if id in finalized_ids:
 base_type = finalized_ids[id]
-if not self.type_infos.is_base(base_type):
+if not type_infos.is_base(base_type):
 raise NoBaseTypeError()
-list_type = self.type_infos.to_list(base_type)
+list_type = type_infos.to_list(base_type)
 finalize_do(self.base_ids, base_type)
 finalize_do(self.list_ids, list_type)
-if self.decision_id is not None:
-

[Bf-blender-cvs] [a73afc7eebf] master: readfile: add off64_t typedef for __APPLE__

2019-03-19 Thread Campbell Barton
Commit: a73afc7eebfea1e60e94ae334a4dc4c3fce57467
Author: Campbell Barton
Date:   Tue Mar 19 21:59:26 2019 +1100
Branches: master
https://developer.blender.org/rBa73afc7eebfea1e60e94ae334a4dc4c3fce57467

readfile: add off64_t typedef for __APPLE__

===

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

===

diff --git a/source/blender/blenloader/intern/readfile.h 
b/source/blender/blenloader/intern/readfile.h
index a1af4bfad16..42b79a4a3f9 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -53,7 +53,7 @@ enum eFileDataFlag {
 #  pragma GCC poison off_t
 #endif
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__APPLE__)
 typedef int64_t off64_t;
 #endif

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


[Bf-blender-cvs] [882ce6812fe] functions: cleanup graph generation for combine lists and get list element

2019-03-19 Thread Jacques Lucke
Commit: 882ce6812fe4dc1487b16e6067d576c589461f56
Author: Jacques Lucke
Date:   Tue Mar 19 10:51:46 2019 +0100
Branches: functions
https://developer.blender.org/rB882ce6812fe4dc1487b16e6067d576c589461f56

cleanup graph generation for combine lists and get list element

===

M   source/blender/functions/frontends/data_flow_nodes/test_nodes.cpp
M   source/blender/functions/functions/lists.cpp
M   source/blender/functions/functions/lists.hpp
M   source/blender/functions/types/numeric.cpp

===

diff --git a/source/blender/functions/frontends/data_flow_nodes/test_nodes.cpp 
b/source/blender/functions/frontends/data_flow_nodes/test_nodes.cpp
index 4c415a5cebd..a355f3d75ca 100644
--- a/source/blender/functions/frontends/data_flow_nodes/test_nodes.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/test_nodes.cpp
@@ -82,66 +82,24 @@ namespace FN { namespace DataFlowNodes {
builder.map_sockets(node, bnode);
}
 
-   static SharedFunction _function__get_list_element(char *base_type)
-   {
-   if (STREQ(base_type, "Float")) {
-   return Functions::get_float_list_element();
-   }
-   else if (STREQ(base_type, "Vector")) {
-   return Functions::get_fvec3_list_element();
-   }
-   else if (STREQ(base_type, "Integer")) {
-   return Functions::get_int32_list_element();
-   }
-   else {
-   BLI_assert(false);
-   return *(SharedFunction *)nullptr;
-   }
-   }
-
static void insert_get_list_element_node(
Builder ,
const BuilderContext ctx,
bNode *bnode)
{
-   PointerRNA ptr;
-   ctx.get_rna(bnode, );
-   char base_type[64];
-   RNA_string_get(, "active_type", base_type);
-
-   SharedFunction  = get_function__get_list_element(base_type);
+   SharedType _type = ctx.type_from_rna(bnode, "active_type");
+   SharedFunction  = Functions::get_list_element(base_type);
Node *node = builder.insert_function(fn);
builder.map_sockets(node, bnode);
}
 
-   static SharedFunction _function__combine_lists(char *base_type)
-   {
-   if (STREQ(base_type, "Float")) {
-   return Functions::combine_float_lists();
-   }
-   else if (STREQ(base_type, "Vector")) {
-   return Functions::combine_fvec3_lists();
-   }
-   else if (STREQ(base_type, "Integer")) {
-   return Functions::combine_int32_lists();
-   }
-   else {
-   BLI_assert(false);
-   return *(SharedFunction *)nullptr;
-   }
-   }
-
static void insert_combine_lists_node(
Builder ,
const BuilderContext ctx,
bNode *bnode)
{
-   PointerRNA ptr;
-   ctx.get_rna(bnode, );
-   char base_type[64];
-   RNA_string_get(, "active_type", base_type);
-
-   SharedFunction  = get_function__combine_lists(base_type);
+   SharedType _type = ctx.type_from_rna(bnode, "active_type");
+   SharedFunction  = Functions::combine_lists(base_type);
Node *node = builder.insert_function(fn);
builder.map_sockets(node, bnode);
}
diff --git a/source/blender/functions/functions/lists.cpp 
b/source/blender/functions/functions/lists.cpp
index 170f42f36bd..4c11248bf5b 100644
--- a/source/blender/functions/functions/lists.cpp
+++ b/source/blender/functions/functions/lists.cpp
@@ -50,8 +50,6 @@ namespace FN { namespace Functions {
functions.add(base_type, fn);
}
 
-   FunctionPerType append_to_list_functions;
-
LAZY_INIT_REF_STATIC__NO_ARG(FunctionPerType, 
get_append_to_list_functions)
{
FunctionPerType functions;
@@ -108,31 +106,36 @@ namespace FN { namespace Functions {
return fn;
}
 
-   LAZY_INIT_REF__NO_ARG(SharedFunction, get_float_list_element)
+   template
+   void insert_get_element_function(
+   FunctionPerType ,
+   SharedType _type,
+   SharedType _type)
{
-   return build_get_element_function(
-   "Get Float List Element",
-   get_float_type(),
-   get_float_list_type());
+   std::string name = "Get " + base_type->name() + " List Element";
+   SharedFunction fn = build_get_element_function(name, 
base_type, list_type);
+  

[Bf-blender-cvs] [f7a9d8f4479] functions: cleanup Graph generation for Append to List node

2019-03-19 Thread Jacques Lucke
Commit: f7a9d8f4479693f16f1041bd7fc5739b83c64ed5
Author: Jacques Lucke
Date:   Tue Mar 19 10:40:10 2019 +0100
Branches: functions
https://developer.blender.org/rBf7a9d8f4479693f16f1041bd7fc5739b83c64ed5

cleanup Graph generation for Append to List node

===

M   source/blender/functions/frontends/data_flow_nodes/builder.cpp
M   source/blender/functions/frontends/data_flow_nodes/builder.hpp
M   source/blender/functions/frontends/data_flow_nodes/test_nodes.cpp
M   source/blender/functions/functions/lists.cpp
M   source/blender/functions/functions/lists.hpp

===

diff --git a/source/blender/functions/frontends/data_flow_nodes/builder.cpp 
b/source/blender/functions/frontends/data_flow_nodes/builder.cpp
index f1ec6faae33..03651d0ca31 100644
--- a/source/blender/functions/frontends/data_flow_nodes/builder.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/builder.cpp
@@ -89,14 +89,8 @@ namespace FN { namespace DataFlowNodes {
return RNA_struct_find_property(, "data_type") != NULL;
}
 
-   SharedType ::type_of_socket(bNodeSocket *bsocket) const
+   SharedType ::type_by_name(const char *data_type) const
{
-   PointerRNA ptr;
-   this->get_rna(bsocket, );
-
-   char data_type[64];
-   RNA_string_get(, "data_type", data_type);
-
if (STREQ(data_type, "Float")) {
return Types::get_float_type();
}
@@ -121,6 +115,17 @@ namespace FN { namespace DataFlowNodes {
}
}
 
+   SharedType ::type_of_socket(bNodeSocket *bsocket) const
+   {
+   PointerRNA ptr;
+   this->get_rna(bsocket, );
+
+   char data_type[64];
+   RNA_string_get(, "data_type", data_type);
+
+   return this->type_by_name(data_type);
+   }
+
void BuilderContext::get_rna(bNode *bnode, PointerRNA *ptr) const
{
RNA_pointer_create(
@@ -135,4 +140,13 @@ namespace FN { namespace DataFlowNodes {
bsocket, ptr);
}
 
+   SharedType ::type_from_rna(bNode *bnode, const char 
*prop_name) const
+   {
+   PointerRNA ptr;
+   this->get_rna(bnode, );
+   char type_name[64];
+   RNA_string_get(, prop_name, type_name);
+   return this->type_by_name(type_name);
+   }
+
 } } /* namespace FN::DataFlowNodes */
\ No newline at end of file
diff --git a/source/blender/functions/frontends/data_flow_nodes/builder.hpp 
b/source/blender/functions/frontends/data_flow_nodes/builder.hpp
index d30cc6cce12..52436e269e2 100644
--- a/source/blender/functions/frontends/data_flow_nodes/builder.hpp
+++ b/source/blender/functions/frontends/data_flow_nodes/builder.hpp
@@ -48,10 +48,12 @@ namespace FN { namespace DataFlowNodes {
ID *btree_id() const;
 
bool is_data_socket(bNodeSocket *bsocket) const;
+   SharedType _by_name(const char *data_type) const;
SharedType _of_socket(bNodeSocket *bsocket) const;
 
-   void get_rna(bNode *node, PointerRNA *ptr) const;
+   void get_rna(bNode *bnode, PointerRNA *ptr) const;
void get_rna(bNodeSocket *bsocket, PointerRNA *ptr) const;
+   SharedType _from_rna(bNode *bnode, const char *prop_name) 
const;
};
 
 } }
\ No newline at end of file
diff --git a/source/blender/functions/frontends/data_flow_nodes/test_nodes.cpp 
b/source/blender/functions/frontends/data_flow_nodes/test_nodes.cpp
index 1f151fb461e..4c415a5cebd 100644
--- a/source/blender/functions/frontends/data_flow_nodes/test_nodes.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/test_nodes.cpp
@@ -71,34 +71,13 @@ namespace FN { namespace DataFlowNodes {
builder.map_output(min_node->output(0), bnode, 0);
}
 
-   static SharedFunction _function__append(char *base_type)
-   {
-   if (STREQ(base_type, "Float")) {
-   return Functions::append_float();
-   }
-   else if (STREQ(base_type, "Vector")) {
-   return Functions::append_fvec3();
-   }
-   else if (STREQ(base_type, "Integer")) {
-   return Functions::append_int32();
-   }
-   else {
-   BLI_assert(false);
-   return *(SharedFunction *)nullptr;
-   }
-   }
-
static void insert_append_list_node(
Builder ,
const BuilderContext ctx,
bNode *bnode)
{
-   PointerRNA ptr;
-   ctx.get_rna(bnode, );
-   char base_type[64];
-   RNA_string_get(, "active_type", base_type);
-
-  

[Bf-blender-cvs] [37bb26a217f] functions: cleanup list function generation

2019-03-19 Thread Jacques Lucke
Commit: 37bb26a217fbfe17666ffb24120a3990413a991c
Author: Jacques Lucke
Date:   Tue Mar 19 11:06:38 2019 +0100
Branches: functions
https://developer.blender.org/rB37bb26a217fbfe17666ffb24120a3990413a991c

cleanup list function generation

===

M   source/blender/functions/functions/lists.cpp

===

diff --git a/source/blender/functions/functions/lists.cpp 
b/source/blender/functions/functions/lists.cpp
index 4c11248bf5b..e41358e3885 100644
--- a/source/blender/functions/functions/lists.cpp
+++ b/source/blender/functions/functions/lists.cpp
@@ -7,7 +7,6 @@
 namespace FN { namespace Functions {
 
using namespace Types;
-   using FunctionPerType = SmallMap;
 
template
class AppendToList : public TupleCallBody {
@@ -25,10 +24,10 @@ namespace FN { namespace Functions {
 
template
SharedFunction build_append_function(
-   std::string name,
SharedType _type,
SharedType _type)
{
+   std::string name = "Append " + base_type->name();
auto fn = SharedFunction::New(name, Signature({
InputParameter("List", list_type),
InputParameter("Value", base_type),
@@ -39,36 +38,6 @@ namespace FN { namespace Functions {
return fn;
}
 
-   template
-   void insert_append_to_list_function(
-   FunctionPerType ,
-   SharedType _type,
-   SharedType _type)
-   {
-   std::string name = "Append " + base_type->name();
-   SharedFunction fn = build_append_function(name, base_type, 
list_type);
-   functions.add(base_type, fn);
-   }
-
-   LAZY_INIT_REF_STATIC__NO_ARG(FunctionPerType, 
get_append_to_list_functions)
-   {
-   FunctionPerType functions;
-   insert_append_to_list_function(
-   functions, get_float_type(), get_float_list_type());
-   insert_append_to_list_function(
-   functions, get_fvec3_type(), get_fvec3_list_type());
-   insert_append_to_list_function(
-   functions, get_int32_type(), get_int32_list_type());
-   return functions;
-   }
-
-   SharedFunction _to_list(SharedType _type)
-   {
-   FunctionPerType  = get_append_to_list_functions();
-   BLI_assert(functions.contains(base_type));
-   return functions.lookup_ref(base_type);
-   }
-
 
template
class GetListElement : public TupleCallBody {
@@ -91,10 +60,10 @@ namespace FN { namespace Functions {
 
template
SharedFunction build_get_element_function(
-   std::string name,
SharedType _type,
SharedType _type)
{
+   std::string name = "Get " + base_type->name() + " List Element";
auto fn = SharedFunction::New(name, Signature({
InputParameter("List", list_type),
InputParameter("Index", get_int32_type()),
@@ -106,35 +75,6 @@ namespace FN { namespace Functions {
return fn;
}
 
-   template
-   void insert_get_element_function(
-   FunctionPerType ,
-   SharedType _type,
-   SharedType _type)
-   {
-   std::string name = "Get " + base_type->name() + " List Element";
-   SharedFunction fn = build_get_element_function(name, 
base_type, list_type);
-   functions.add(base_type, fn);
-   }
-
-   LAZY_INIT_REF_STATIC__NO_ARG(FunctionPerType, get_get_element_functions)
-   {
-   FunctionPerType functions;
-   insert_get_element_function(
-   functions, get_float_type(), get_float_list_type());
-   insert_get_element_function(
-   functions, get_fvec3_type(), get_fvec3_list_type());
-   insert_get_element_function(
-   functions, get_int32_type(), get_int32_list_type());
-   return functions;
-   }
-
-   SharedFunction _list_element(SharedType _type)
-   {
-   FunctionPerType  = get_get_element_functions();
-   BLI_assert(functions.contains(base_type));
-   return functions.lookup_ref(base_type);
-   }
 
template
class CombineLists : public TupleCallBody {
@@ -152,9 +92,10 @@ namespace FN { namespace Functions {
 
template
SharedFunction build_combine_lists_function(
-   std::string name,
+   SharedType _type,
SharedType _type)
{
+   std::string name = "Combine " + base_type->name() + " Lists";
auto fn = SharedFunction::New(name, Signature({
  

[Bf-blender-cvs] [da373c1f0d5] master: GPencil: Rename functions to annotation prefix

2019-03-19 Thread Antonioya
Commit: da373c1f0d51717625172eb4daad48310efd20f1
Author: Antonioya
Date:   Tue Mar 19 10:52:37 2019 +0100
Branches: master
https://developer.blender.org/rBda373c1f0d51717625172eb4daad48310efd20f1

GPencil: Rename functions to annotation prefix

This code was used only in annotations.

===

M   source/blender/editors/gpencil/annotate_draw.c
M   source/blender/editors/include/ED_gpencil.h
M   source/blender/editors/render/render_opengl.c

===

diff --git a/source/blender/editors/gpencil/annotate_draw.c 
b/source/blender/editors/gpencil/annotate_draw.c
index 111a24da528..8a72702505c 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -1133,7 +1133,7 @@ void ED_gpencil_draw_view3d_annotations(
gp_draw_data_all(scene, gpd, offsx, offsy, winx, winy, CFRA, dflag, 
v3d->spacetype);
 }
 
-void ED_gpencil_draw_ex(
+void ED_annotation_draw_ex(
Scene *scene, bGPdata *gpd,
int winx, int winy, const int cfra, const char spacetype)
 {
diff --git a/source/blender/editors/include/ED_gpencil.h 
b/source/blender/editors/include/ED_gpencil.h
index 12677769527..4c2ffa01bcc 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -157,7 +157,7 @@ void ED_gpencil_draw_view3d_object(
 struct View3D *v3d,
 struct ARegion *ar,
 bool only3d);
-void ED_gpencil_draw_ex(
+void ED_annotation_draw_ex(
 struct Scene *scene,
 struct bGPdata *gpd, int winx, int winy,
 const int cfra, const char spacetype);
diff --git a/source/blender/editors/render/render_opengl.c 
b/source/blender/editors/render/render_opengl.c
index 7fb9dbdf3a6..84b84f1dd52 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -325,7 +325,7 @@ static void screen_opengl_render_doit(const bContext *C, 
OGLRender *oglrender, R
GPU_matrix_translate_2f(sizex / 2, sizey / 2);
 
G.f |= G_FLAG_RENDER_VIEWPORT;
-   ED_gpencil_draw_ex(
+   ED_annotation_draw_ex(
scene, gpd, sizex, sizey, scene->r.cfra, 
SPACE_SEQ);
G.f &= ~G_FLAG_RENDER_VIEWPORT;

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


[Bf-blender-cvs] [8f790720b07] master: GPencil: Rename annotation functions

2019-03-19 Thread Antonioya
Commit: 8f790720b07d2f92f1222157be6836ff28a46902
Author: Antonioya
Date:   Tue Mar 19 11:01:27 2019 +0100
Branches: master
https://developer.blender.org/rB8f790720b07d2f92f1222157be6836ff28a46902

GPencil: Rename annotation functions

The annotation drawing functions were using gpencil prefix and it's better to 
keep all annotation code separated to avoid confusion.

===

M   source/blender/draw/intern/draw_manager.c
M   source/blender/editors/gpencil/annotate_draw.c
M   source/blender/editors/include/ED_gpencil.h
M   source/blender/editors/space_clip/clip_draw.c
M   source/blender/editors/space_image/image_draw.c
M   source/blender/editors/space_node/node_draw.c
M   source/blender/editors/space_sequencer/sequencer_draw.c

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index e517b6f8e45..45a49f2a25f 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1570,7 +1570,7 @@ void DRW_draw_render_loop_ex(
if (do_annotations) {
GPU_depth_test(false);
/* XXX: as scene->gpd is not copied for COW yet */
-   
ED_gpencil_draw_view3d_annotations(DEG_get_input_scene(depsgraph), depsgraph, 
v3d, ar, true);
+   ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), 
depsgraph, v3d, ar, true);
GPU_depth_test(true);
}
 
@@ -1609,7 +1609,7 @@ void DRW_draw_render_loop_ex(
{
GPU_depth_test(false);
/* XXX: as scene->gpd is not copied for COW yet */
-   
ED_gpencil_draw_view3d_annotations(DEG_get_input_scene(depsgraph), depsgraph, 
v3d, ar, false);
+   
ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, ar, 
false);
GPU_depth_test(true);
}
 
diff --git a/source/blender/editors/gpencil/annotate_draw.c 
b/source/blender/editors/gpencil/annotate_draw.c
index 8a72702505c..43e2b5bd3bf 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -981,7 +981,7 @@ static void gp_draw_data_all(
  *  */
 
 /* draw grease-pencil sketches to specified 2d-view that uses ibuf corrections 
*/
-void ED_gpencil_draw_2dimage(const bContext *C)
+void ED_annotation_draw_2dimage(const bContext *C)
 {
wmWindowManager *wm = CTX_wm_manager(C);
ScrArea *sa = CTX_wm_area(C);
@@ -1049,7 +1049,7 @@ void ED_gpencil_draw_2dimage(const bContext *C)
 /* draw grease-pencil sketches to specified 2d-view assuming that matrices are 
already set correctly
  * Note: this gets called twice - first time with onlyv2d=true to draw 
'canvas' strokes,
  * second time with onlyv2d=false for screen-aligned strokes */
-void ED_gpencil_draw_view2d(const bContext *C, bool onlyv2d)
+void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
 {
wmWindowManager *wm = CTX_wm_manager(C);
ScrArea *sa = CTX_wm_area(C);
@@ -1083,7 +1083,7 @@ void ED_gpencil_draw_view2d(const bContext *C, bool 
onlyv2d)
 /* draw annotations sketches to specified 3d-view assuming that matrices are 
already set correctly
  * Note: this gets called twice - first time with only3d=true to draw 
3d-strokes,
  * second time with only3d=false for screen-aligned strokes */
-void ED_gpencil_draw_view3d_annotations(
+void ED_annotation_draw_view3d(
 Scene *scene, struct Depsgraph *depsgraph,
 View3D *v3d, ARegion *ar,
 bool only3d)
diff --git a/source/blender/editors/include/ED_gpencil.h 
b/source/blender/editors/include/ED_gpencil.h
index 46aca340ea9..21bccc99b6e 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -135,8 +135,6 @@ void ED_gpencil_strokes_copybuf_free(void);
 /*  Grease-Pencil Drawing API -- */
 /* drawgpencil.c */
 
-void ED_gpencil_draw_2dimage(const struct bContext *C);
-void ED_gpencil_draw_view2d(const struct bContext *C, bool onlyv2d);
 void ED_gpencil_draw_view3d(
 struct wmWindowManager *wm,
 struct Scene *scene,
@@ -145,7 +143,10 @@ void ED_gpencil_draw_view3d(
 struct View3D *v3d,
 struct ARegion *ar,
 bool only3d);
-void ED_gpencil_draw_view3d_annotations(
+
+void ED_annotation_draw_2dimage(const struct bContext *C);
+void ED_annotation_draw_view2d(const struct bContext *C, bool onlyv2d);
+void ED_annotation_draw_view3d(
 struct Scene *scene, struct Depsgraph *depsgraph,
 struct View3D *v3d, struct ARegion *ar,
 bool only3d);
diff --git a/source/blender/editors/space_clip/clip_draw.c 
b/source/blender/editors/space_clip/clip_draw.c
index 54830c14b85..7c400f8a417 100644
--- 

[Bf-blender-cvs] [8aeb1dbb27a] master: GPencil: Cleanup unused code

2019-03-19 Thread Antonioya
Commit: 8aeb1dbb27aca735efe0df651710c8523212780d
Author: Antonioya
Date:   Tue Mar 19 10:54:27 2019 +0100
Branches: master
https://developer.blender.org/rB8aeb1dbb27aca735efe0df651710c8523212780d

GPencil: Cleanup unused code

===

M   source/blender/editors/gpencil/drawgpencil.c
M   source/blender/editors/include/ED_gpencil.h

===

diff --git a/source/blender/editors/gpencil/drawgpencil.c 
b/source/blender/editors/gpencil/drawgpencil.c
index b9b50ac207d..8d642e82208 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1691,63 +1691,3 @@ void ED_gpencil_draw_view3d(
/* draw it! */
gp_draw_data_all(view_layer, rv3d, scene, gpd, offsx, offsy, winx, 
winy, CFRA, dflag, v3d->spacetype);
 }
-
-/* draw grease-pencil sketches to specified 3d-view for gp object
- * assuming that matrices are already set correctly
- */
-void ED_gpencil_draw_view3d_object(wmWindowManager *wm, Scene *scene, 
Depsgraph *depsgraph, Object *ob, View3D *v3d, ARegion *ar, bool only3d)
-{
-   int dflag = 0;
-   RegionView3D *rv3d = ar->regiondata;
-   int offsx, offsy, winx, winy;
-
-   /* check that we have grease-pencil stuff to draw */
-   bGPdata *gpd = ob->data;
-   if (gpd == NULL) return;
-
-   /* when rendering to the offscreen buffer we don't want to
-* deal with the camera border, otherwise map the coords to the camera 
border. */
-   if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) {
-   rctf rectf;
-   ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, 
, true); /* no shift */
-
-   offsx = round_fl_to_int(rectf.xmin);
-   offsy = round_fl_to_int(rectf.ymin);
-   winx = round_fl_to_int(rectf.xmax - rectf.xmin);
-   winy = round_fl_to_int(rectf.ymax - rectf.ymin);
-   }
-   else {
-   offsx = 0;
-   offsy = 0;
-   winx = ar->winx;
-   winy = ar->winy;
-   }
-
-   /* set flags */
-   if (only3d) {
-   /* 3D strokes/3D space:
-* - only 3D space points
-* - don't status text either (as it's the wrong space)
-*/
-   dflag |= (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_NOSTATUS);
-   }
-
-   if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
-   /* don't draw status text when "only render" flag is set */
-   dflag |= GP_DRAWDATA_NOSTATUS;
-   }
-
-   if ((wm == NULL) || ED_screen_animation_playing(wm)) {
-   /* don't show onion-skins during animation playback/scrub (i.e. 
it obscures the poses)
-* OpenGL Renders (i.e. final output), or depth buffer (i.e. 
not real strokes)
-*/
-   dflag |= GP_DRAWDATA_NO_ONIONS;
-   }
-
-   /* draw it! */
-   ToolSettings *ts = scene->toolsettings;
-   Brush *brush = BKE_paint_brush(>gp_paint->paint);
-   if (brush != NULL) {
-   gp_draw_data(rv3d, brush, 1.0f, ob, gpd, offsx, offsy, winx, 
winy, CFRA, dflag);
-   }
-}
diff --git a/source/blender/editors/include/ED_gpencil.h 
b/source/blender/editors/include/ED_gpencil.h
index 4c2ffa01bcc..46aca340ea9 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -149,14 +149,6 @@ void ED_gpencil_draw_view3d_annotations(
 struct Scene *scene, struct Depsgraph *depsgraph,
 struct View3D *v3d, struct ARegion *ar,
 bool only3d);
-void ED_gpencil_draw_view3d_object(
-struct wmWindowManager *wm,
-struct Scene *scene,
-struct Depsgraph *depsgraph,
-struct Object *ob,
-struct View3D *v3d,
-struct ARegion *ar,
-bool only3d);
 void ED_annotation_draw_ex(
 struct Scene *scene,
 struct bGPdata *gpd, int winx, int winy,

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


[Bf-blender-cvs] [34d6c040037] master: Fix T62734: Crash when annotations are rendered from the VSE .view menu.

2019-03-19 Thread Antonioya
Commit: 34d6c04003775943ecf6a8015a97eb32452c7efb
Author: Antonioya
Date:   Tue Mar 19 10:48:24 2019 +0100
Branches: master
https://developer.blender.org/rB34d6c04003775943ecf6a8015a97eb32452c7efb

Fix T62734: Crash when annotations are rendered from the VSE .view menu.

The render was using the old grease pencil code and not the new annotation code 
for render.

===

M   source/blender/editors/gpencil/annotate_draw.c
M   source/blender/editors/gpencil/drawgpencil.c
M   source/blender/editors/include/ED_gpencil.h
M   source/blender/editors/render/render_opengl.c

===

diff --git a/source/blender/editors/gpencil/annotate_draw.c 
b/source/blender/editors/gpencil/annotate_draw.c
index 3d70a7f6843..111a24da528 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -1133,4 +1133,13 @@ void ED_gpencil_draw_view3d_annotations(
gp_draw_data_all(scene, gpd, offsx, offsy, winx, winy, CFRA, dflag, 
v3d->spacetype);
 }
 
+void ED_gpencil_draw_ex(
+   Scene *scene, bGPdata *gpd,
+   int winx, int winy, const int cfra, const char spacetype)
+{
+   int dflag = GP_DRAWDATA_NOSTATUS | GP_DRAWDATA_ONLYV2D;
+
+   gp_draw_data_all(scene, gpd, 0, 0, winx, winy, cfra, dflag, spacetype);
+}
+
 /* ** */
diff --git a/source/blender/editors/gpencil/drawgpencil.c 
b/source/blender/editors/gpencil/drawgpencil.c
index d25ff6b4c07..b9b50ac207d 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1751,12 +1751,3 @@ void ED_gpencil_draw_view3d_object(wmWindowManager *wm, 
Scene *scene, Depsgraph
gp_draw_data(rv3d, brush, 1.0f, ob, gpd, offsx, offsy, winx, 
winy, CFRA, dflag);
}
 }
-
-void ED_gpencil_draw_ex(
-   ViewLayer *view_layer, RegionView3D *rv3d, Scene *scene,
-   bGPdata *gpd, int winx, int winy, const int cfra, const char spacetype)
-{
-   int dflag = GP_DRAWDATA_NOSTATUS | GP_DRAWDATA_ONLYV2D;
-
-   gp_draw_data_all(view_layer, rv3d, scene, gpd, 0, 0, winx, winy, cfra, 
dflag, spacetype);
-}
diff --git a/source/blender/editors/include/ED_gpencil.h 
b/source/blender/editors/include/ED_gpencil.h
index 5d943930522..12677769527 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -158,7 +158,7 @@ void ED_gpencil_draw_view3d_object(
 struct ARegion *ar,
 bool only3d);
 void ED_gpencil_draw_ex(
-struct ViewLayer *view_layer, struct RegionView3D *rv3d, struct Scene 
*scene,
+struct Scene *scene,
 struct bGPdata *gpd, int winx, int winy,
 const int cfra, const char spacetype);
 
diff --git a/source/blender/editors/render/render_opengl.c 
b/source/blender/editors/render/render_opengl.c
index 0e0292c8d71..7fb9dbdf3a6 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -265,7 +265,6 @@ static void screen_opengl_views_setup(OGLRender *oglrender)
 static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, 
RenderResult *rr)
 {
Depsgraph *depsgraph = CTX_data_depsgraph(C);
-   ViewLayer *view_layer = CTX_data_view_layer(C);
Scene *scene = oglrender->scene;
ARegion *ar = oglrender->ar;
View3D *v3d = oglrender->v3d;
@@ -327,7 +326,7 @@ static void screen_opengl_render_doit(const bContext *C, 
OGLRender *oglrender, R
 
G.f |= G_FLAG_RENDER_VIEWPORT;
ED_gpencil_draw_ex(
-   view_layer, rv3d, scene, gpd, sizex, sizey, 
scene->r.cfra, SPACE_SEQ);
+   scene, gpd, sizex, sizey, scene->r.cfra, 
SPACE_SEQ);
G.f &= ~G_FLAG_RENDER_VIEWPORT;
 
gp_rect = MEM_mallocN(sizex * sizey * sizeof(unsigned 
char) * 4, "offscreen rect");

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


[Bf-blender-cvs] [40ecb2ded81] master: Windows: use int64_t instead of off_t

2019-03-19 Thread Campbell Barton
Commit: 40ecb2ded81ba7265c426f6680faf3417ff22aeb
Author: Campbell Barton
Date:   Tue Mar 19 20:28:05 2019 +1100
Branches: master
https://developer.blender.org/rB40ecb2ded81ba7265c426f6680faf3417ff22aeb

Windows: use int64_t instead of off_t

Avoids 2gb file size limit.

===

M   source/blender/blenkernel/intern/bpath.c
M   source/blender/imbuf/intern/jp2.c

===

diff --git a/source/blender/blenkernel/intern/bpath.c 
b/source/blender/blenkernel/intern/bpath.c
index e85cb700bce..3d91283e1cc 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -211,7 +211,7 @@ static bool missing_files_find__recursive(
 char *filename_new,
 const char *dirname,
 const char *filename,
-off_t *r_filesize,
+int64_t *r_filesize,
 int *r_recur_depth)
 {
/* file searching stuff */
@@ -219,7 +219,7 @@ static bool missing_files_find__recursive(
struct dirent *de;
BLI_stat_t status;
char path[FILE_MAX];
-   off_t size;
+   int64_t size;
bool found = false;
 
dir = opendir(dirname);
@@ -275,7 +275,7 @@ static bool missing_files_find__visit_cb(void *userdata, 
char *path_dst, const c
BPathFind_Data *data = (BPathFind_Data *)userdata;
char filename_new[FILE_MAX];
 
-   off_t filesize = -1;
+   int64_t filesize = -1;
int recur_depth = 0;
bool found;
 
diff --git a/source/blender/imbuf/intern/jp2.c 
b/source/blender/imbuf/intern/jp2.c
index c3690bcf643..aaeb4e4c2ad 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -138,7 +138,7 @@ static void info_callback(const char *msg, void 
*client_data)
 struct BufInfo {
const unsigned char *buf;
const unsigned char *cur;
-   off_t len;
+   OPJ_OFF_T len;
 };
 
 static void opj_read_from_buffer_free(void *UNUSED(p_user_data))

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


[Bf-blender-cvs] [7ba82f3f0a8] master: Fix T62707: opening blend files over 2gb on win32 fails

2019-03-19 Thread Campbell Barton
Commit: 7ba82f3f0a848aedcc0f3b3f73a429f740792dbe
Author: Campbell Barton
Date:   Tue Mar 19 20:04:23 2019 +1100
Branches: master
https://developer.blender.org/rB7ba82f3f0a848aedcc0f3b3f73a429f740792dbe

Fix T62707: opening blend files over 2gb on win32 fails

Regression in 358e07f447e9ed7 for ms-windows since off_t is an int32_t
even on 64bit systems causing files over 2gb not to load.

Poison off_t so this doesn't happen again.

===

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

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 93ef7fe5b73..b8131c8abbb 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -264,7 +264,7 @@ typedef struct BHeadN {
struct BHeadN *next, *prev;
 #ifdef USE_BHEAD_READ_ON_DEMAND
/** Use to read the data from the file directly into memory as needed. 
*/
-   off_t file_offset;
+   off64_t file_offset;
/** When set, the remainder of this allocation is the data, otherwise 
it needs to be read. */
bool has_data;
 #endif
@@ -838,7 +838,7 @@ static BHeadN *get_bhead(FileData *fd)
new_bhead->file_offset = 
fd->file_offset;
new_bhead->has_data = false;
new_bhead->bhead = bhead;
-   off_t seek_new = fd->seek(fd, 
bhead.len, SEEK_CUR);
+   off64_t seek_new = fd->seek(fd, 
bhead.len, SEEK_CUR);
if (seek_new == -1) {
fd->is_eof = true;
MEM_freeN(new_bhead);
@@ -946,7 +946,7 @@ static bool blo_bhead_read_data(FileData *fd, BHead 
*thisblock, void *buf)
bool success = true;
BHeadN *new_bhead = BHEADN_FROM_BHEAD(thisblock);
BLI_assert(new_bhead->has_data == false && new_bhead->file_offset != 0);
-   off_t offset_backup = fd->file_offset;
+   off64_t offset_backup = fd->file_offset;
if (UNLIKELY(fd->seek(fd, new_bhead->file_offset, SEEK_SET) == -1)) {
success = false;
}
@@ -1136,7 +1136,7 @@ static int fd_read_data_from_file(FileData *filedata, 
void *buffer, uint size)
return (readsize);
 }
 
-static off_t fd_seek_data_from_file(FileData *filedata, off_t offset, int 
whence)
+static off64_t fd_seek_data_from_file(FileData *filedata, off64_t offset, int 
whence)
 {
filedata->file_offset = lseek(filedata->filedes, offset, whence);
return filedata->file_offset;
diff --git a/source/blender/blenloader/intern/readfile.h 
b/source/blender/blenloader/intern/readfile.h
index 9e970b9ae5d..a1af4bfad16 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -48,10 +48,17 @@ enum eFileDataFlag {
FD_FLAGS_NOT_MY_LIBMAP = 1 << 5,
 };
 
+/* Disallow since it's 32bit on ms-windows. */
+#ifdef __GNUC__
+#  pragma GCC poison off_t
+#endif
 
+#if defined(_MSC_VER)
+typedef int64_t off64_t;
+#endif
 
 typedef int (FileDataReadFn)(struct FileData *filedata, void *buffer, unsigned 
int size);
-typedef off_t (FileDataSeekFn)(struct FileData *filedata, off_t offset, int 
whence);
+typedef off64_t (FileDataSeekFn)(struct FileData *filedata, off64_t offset, 
int whence);
 
 typedef struct FileData {
/** Linked list of BHeadN's. */
@@ -59,7 +66,7 @@ typedef struct FileData {
enum eFileDataFlag flags;
bool is_eof;
int buffersize;
-   off_t file_offset;
+   int64_t file_offset;
 
FileDataReadFn *read;
FileDataSeekFn *seek;

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


[Bf-blender-cvs] [4db7842a72c] master: BLI_math: use fallback for compatible quaternion calculation

2019-03-19 Thread Campbell Barton
Commit: 4db7842a72cc2f9cdca31c08d45c703ad8519dc0
Author: Campbell Barton
Date:   Tue Mar 19 17:39:14 2019 +1100
Branches: master
https://developer.blender.org/rB4db7842a72cc2f9cdca31c08d45c703ad8519dc0

BLI_math: use fallback for compatible quaternion calculation

Copy the new value when the compatible quaternion isn't usable.

===

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

===

diff --git a/source/blender/blenlib/intern/math_rotation.c 
b/source/blender/blenlib/intern/math_rotation.c
index d52c8f54096..5f6bbcce3b3 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -207,14 +207,20 @@ void pow_qt_fl_normalized(float q[4], const float fac)
  */
 void quat_to_compatible_quat(float q[4], const float a[4], const float old[4])
 {
+   const float eps = 1e-4f;
BLI_ASSERT_UNIT_QUAT(a);
-   float delta[4];
float old_unit[4];
-   normalize_qt_qt(old_unit, old);
-   rotation_between_quats_to_quat(delta, old_unit, a);
-   mul_qt_qtqt(q, old, delta);
-   if ((q[0] < 0.0f) != (old[0] < 0.0f)) {
-   negate_v4(q);
+   /* Skips `!finite_v4(old)` case too. */
+   if (normalize_qt_qt(old_unit, old) > eps) {
+   float delta[4];
+   rotation_between_quats_to_quat(delta, old_unit, a);
+   mul_qt_qtqt(q, old, delta);
+   if ((q[0] < 0.0f) != (old[0] < 0.0f)) {
+   negate_v4(q);
+   }
+   }
+   else {
+   copy_qt_qt(q, a);
}
 }

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


[Bf-blender-cvs] [e2ec045cc99] master: BLI_math: add utility to calculate compatible quaternions

2019-03-19 Thread Campbell Barton
Commit: e2ec045cc995bb8767a5f88e8830aa1062921011
Author: Campbell Barton
Date:   Tue Mar 19 16:50:18 2019 +1100
Branches: master
https://developer.blender.org/rBe2ec045cc995bb8767a5f88e8830aa1062921011

BLI_math: add utility to calculate compatible quaternions

===

M   source/blender/blenlib/BLI_math_rotation.h
M   source/blender/blenlib/intern/math_rotation.c

===

diff --git a/source/blender/blenlib/BLI_math_rotation.h 
b/source/blender/blenlib/BLI_math_rotation.h
index 5246d7ad1a9..60adcf8c762 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -77,6 +77,8 @@ void add_qt_qtqt(float q[4], const float a[4], const float 
b[4], const float t);
 void quat_to_mat3(float mat[3][3], const float q[4]);
 void quat_to_mat4(float mat[4][4], const float q[4]);
 
+void quat_to_compatible_quat(float q[4], const float a[4], const float old[4]);
+
 void mat3_normalized_to_quat(float q[4], const float mat[3][3]);
 void mat4_normalized_to_quat(float q[4], const float mat[4][4]);
 void mat3_to_quat(float q[4], const float mat[3][3]);
diff --git a/source/blender/blenlib/intern/math_rotation.c 
b/source/blender/blenlib/intern/math_rotation.c
index a348edaece8..d52c8f54096 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -201,6 +201,23 @@ void pow_qt_fl_normalized(float q[4], const float fac)
normalize_v3_length(q + 1, si);
 }
 
+/**
+ * Apply the rotation of \a a to \a q keeping the values compatible with \a 
old.
+ * Avoid axis flipping for animated f-curves for eg.
+ */
+void quat_to_compatible_quat(float q[4], const float a[4], const float old[4])
+{
+   BLI_ASSERT_UNIT_QUAT(a);
+   float delta[4];
+   float old_unit[4];
+   normalize_qt_qt(old_unit, old);
+   rotation_between_quats_to_quat(delta, old_unit, a);
+   mul_qt_qtqt(q, old, delta);
+   if ((q[0] < 0.0f) != (old[0] < 0.0f)) {
+   negate_v4(q);
+   }
+}
+
 /* skip error check, currently only needed by mat3_to_quat_is_ok */
 static void quat_to_mat3_no_error(float m[3][3], const float q[4])
 {

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


[Bf-blender-cvs] [40e85a603c9] master: Fix pose slide interpolation

2019-03-19 Thread Campbell Barton
Commit: 40e85a603c982b96fef51212deb086f6ddb73407
Author: Campbell Barton
Date:   Tue Mar 19 17:17:34 2019 +1100
Branches: master
https://developer.blender.org/rB40e85a603c982b96fef51212deb086f6ddb73407

Fix pose slide interpolation

- Quaternions weren't normalized before interpolating
  causing incorrect results & assert.

- Make the newly calculated quaternion compatible with the previous
  to avoid axis-flipping & setting values with large changes compared
  to existing key-frames.

===

M   source/blender/editors/armature/pose_slide.c

===

diff --git a/source/blender/editors/armature/pose_slide.c 
b/source/blender/editors/armature/pose_slide.c
index 1545576e208..8b0bfadcbe7 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -558,54 +558,67 @@ static void pose_slide_apply_quat(tPoseSlideOp *pso, 
tPChanFCurveLink *pfl)
 
/* only if all channels exist, proceed */
if (fcu_w && fcu_x && fcu_y && fcu_z) {
-   float quat_prev[4], quat_next[4];
+   float quat_prev[4], quat_prev_orig[4];
+   float quat_next[4], quat_next_orig[4];
+   float quat_curr[4], quat_curr_orig[4];
+   float quat_final[4];
+
+   copy_qt_qt(quat_curr_orig, pchan->quat);
 
/* get 2 quats */
-   quat_prev[0] = evaluate_fcurve(fcu_w, prevFrameF);
-   quat_prev[1] = evaluate_fcurve(fcu_x, prevFrameF);
-   quat_prev[2] = evaluate_fcurve(fcu_y, prevFrameF);
-   quat_prev[3] = evaluate_fcurve(fcu_z, prevFrameF);
+   quat_prev_orig[0] = evaluate_fcurve(fcu_w, prevFrameF);
+   quat_prev_orig[1] = evaluate_fcurve(fcu_x, prevFrameF);
+   quat_prev_orig[2] = evaluate_fcurve(fcu_y, prevFrameF);
+   quat_prev_orig[3] = evaluate_fcurve(fcu_z, prevFrameF);
+
+   quat_next_orig[0] = evaluate_fcurve(fcu_w, nextFrameF);
+   quat_next_orig[1] = evaluate_fcurve(fcu_x, nextFrameF);
+   quat_next_orig[2] = evaluate_fcurve(fcu_y, nextFrameF);
+   quat_next_orig[3] = evaluate_fcurve(fcu_z, nextFrameF);
 
-   quat_next[0] = evaluate_fcurve(fcu_w, nextFrameF);
-   quat_next[1] = evaluate_fcurve(fcu_x, nextFrameF);
-   quat_next[2] = evaluate_fcurve(fcu_y, nextFrameF);
-   quat_next[3] = evaluate_fcurve(fcu_z, nextFrameF);
+   normalize_qt_qt(quat_prev, quat_prev_orig);
+   normalize_qt_qt(quat_next, quat_next_orig);
+   normalize_qt_qt(quat_curr, quat_curr_orig);
 
/* perform blending */
if (pso->mode == POSESLIDE_BREAKDOWN) {
/* just perform the interpol between quat_prev and 
quat_next using pso->percentage as a guide */
-   interp_qt_qtqt(pchan->quat, quat_prev, quat_next, 
pso->percentage);
+   interp_qt_qtqt(quat_final, quat_prev, quat_next, 
pso->percentage);
}
else if (pso->mode == POSESLIDE_PUSH) {
-   float quat_diff[4], quat_orig[4];
+   float quat_diff[4];
 
/* calculate the delta transform from the previous to 
the current */
/* TODO: investigate ways to favour one transform more? 
*/
-   sub_qt_qtqt(quat_diff, pchan->quat, quat_prev);
-
-   /* make a copy of the original rotation */
-   copy_qt_qt(quat_orig, pchan->quat);
+   sub_qt_qtqt(quat_diff, quat_curr, quat_prev);
 
/* increase the original by the delta transform, by an 
amount determined by percentage */
-   add_qt_qtqt(pchan->quat, quat_orig, quat_diff, 
pso->percentage);
+   add_qt_qtqt(quat_final, quat_curr, quat_diff, 
pso->percentage);
+
+   normalize_qt(quat_final);
}
else {
-   float quat_interp[4], quat_orig[4];
+   BLI_assert(pso->mode == POSESLIDE_RELAX);
+   float quat_interp[4], quat_final_prev[4];
/* TODO: maybe a sensitivity ctrl on top of this is 
needed */
int iters = (int)ceil(10.0f * pso->percentage);
 
+   copy_qt_qt(quat_final, quat_curr);
+
/* perform this blending several times until a 
satisfactory result is reached */
while (iters-- > 0) {
/* calculate the interpolation between the 
endpoints */
interp_qt_qtqt(quat_interp, quat_prev, 
quat_next, (cframe - pso->prevFrame) / (pso->nextFrame - pso->prevFrame));
 
-