[Bf-blender-cvs] [c3d46694e21] blender2.8: Gizmo: add spin-tool rotate on view axis

2018-09-23 Thread Campbell Barton
Commit: c3d46694e21dacb32a5654a363bca86cba90e74f
Author: Campbell Barton
Date:   Mon Sep 24 10:09:48 2018 +1000
Branches: blender2.8
https://developer.blender.org/rBc3d46694e21dacb32a5654a363bca86cba90e74f

Gizmo: add spin-tool rotate on view axis

This also acts to catch stray click events so missing a gizmo
doesn't move the cursor or execute another spin action.

===

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

===

diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c 
b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
index 14f79e21a1f..658ca86d734 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
@@ -371,11 +371,14 @@ typedef struct GizmoGroupData_SpinRedo {
/* Spin angle */
struct wmGizmo *angle_z;
 
-   /* Translate XY constrained. */
+   /* Translate XY constrained ('orient_mat'). */
struct wmGizmo *translate_xy[2];
-   /* For grabbing the gizmo and moving freely. */
+   /* Rotate XY constrained ('orient_mat'). */
struct wmGizmo *rotate_xy[2];
 
+   /* Rotate on view axis. */
+   struct wmGizmo *rotate_view;
+
struct {
float plane_co[3];
float plane_no[3];
@@ -448,6 +451,7 @@ static void 
gizmo_mesh_spin_redo_update_from_op(GizmoGroupData_SpinRedo *ggd)
WM_gizmo_set_matrix_location(ggd->translate_xy[i], plane_co);
}
WM_gizmo_set_matrix_location(ggd->angle_z, plane_co);
+   WM_gizmo_set_matrix_location(ggd->rotate_view, plane_co);
/* translate_c location comes from the property. */
 
for (int i = 0; i < 2; i++) {
@@ -699,6 +703,21 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, 
wmGizmoGroup *gzgroup)
const wmGizmoType *gzt_move = WM_gizmotype_find("GIZMO_GT_move_3d", 
true);
const wmGizmoType *gzt_dial = WM_gizmotype_find("GIZMO_GT_dial_3d", 
true);
 
+   /* Rotate View Axis (rotate_view) */
+   {
+   wmGizmo *gz = WM_gizmo_new_ptr(gzt_dial, gzgroup, NULL);
+   UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, gz->color);
+   zero_v4(gz->color);
+   copy_v3_fl(gz->color_hi, 1.0f);
+   gz->color_hi[3] = 0.1f;
+   WM_gizmo_set_flag(gz, WM_GIZMO_DRAW_VALUE, true);
+   RNA_enum_set(gz->ptr, "draw_options",
+ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR |
+ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y |
+ED_GIZMO_DIAL_DRAW_FLAG_FILL);
+   ggd->rotate_view = gz;
+   }
+
/* Translate Center (translate_c) */
{
wmGizmo *gz = WM_gizmo_new_ptr(gzt_move, gzgroup, NULL);
@@ -741,7 +760,6 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, 
wmGizmoGroup *gzgroup)
UI_GetThemeColor3fv(TH_AXIS_X + i, gz->color);
gz->color[3] = 0.6f;
WM_gizmo_set_flag(gz, WM_GIZMO_DRAW_VALUE, true);
-   WM_gizmo_set_scale(gz, 1.0f);
WM_gizmo_set_line_width(gz, 3.0f);
/* show the axis instead of mouse cursor */
RNA_enum_set(gz->ptr, "draw_options",
@@ -790,6 +808,15 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, 
wmGizmoGroup *gzgroup)
.user_data = NULL,
});
 
+   WM_gizmo_target_property_def_func(
+   ggd->rotate_view, "offset",
+   &(const struct wmGizmoPropertyFnParams) {
+   .value_get_fn = gizmo_spin_prop_axis_angle_get,
+   .value_set_fn = gizmo_spin_prop_axis_angle_set,
+   .range_get_fn = NULL,
+   .user_data = NULL,
+   });
+
for (int i = 0; i < 2; i++) {
WM_gizmo_target_property_def_func(
ggd->rotate_xy[i], "offset",
@@ -846,6 +873,16 @@ static void gizmo_mesh_spin_redo_draw_prepare(
 
RegionView3D *rv3d = ED_view3d_context_rv3d(ggd->data.context);
WM_gizmo_set_matrix_rotation_from_z_axis(ggd->translate_c, 
rv3d->viewinv[2]);
+   {
+   float view_up[3];
+   project_plane_normalized_v3_v3v3(view_up, 
ggd->data.orient_mat[2], rv3d->viewinv[2]);
+   if (normalize_v3(view_up) != 0.0f) {
+   
WM_gizmo_set_matrix_rotation_from_yz_axis(ggd->rotate_view, view_up, 
rv3d->viewinv[2]);
+   }
+   else {
+   
WM_gizmo_set_matrix_rotation_from_z_axis(ggd->rotate_view, rv3d->viewinv[2]);
+   }
+   }
 }
 
 void MESH_GGT_spin_redo(struct wmGizmoGroupType *gzgt)


[Bf-blender-cvs] [2abbe1d125f] blender2.8: Cleanup: skip translation to calculate length

2018-09-23 Thread Campbell Barton
Commit: 2abbe1d125f75ba6beb90ea8b3024107da4f1a1e
Author: Campbell Barton
Date:   Mon Sep 24 08:30:15 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB2abbe1d125f75ba6beb90ea8b3024107da4f1a1e

Cleanup: skip translation to calculate length

===

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 b589b88a69e..aa917f0d529 100644
--- a/source/blender/editors/mesh/editmesh_select_similar.c
+++ b/source/blender/editors/mesh/editmesh_select_similar.c
@@ -252,11 +252,9 @@ static void edge_pos_direction_worldspace_get(Object *ob, 
BMEdge *edge, float *r
 static float edge_length_squared_worldspace_get(Object *ob, BMEdge *edge)
 {
float v1[3], v2[3];
-   copy_v3_v3(v1, edge->v1->co);
-   copy_v3_v3(v2, edge->v2->co);
 
-   mul_m4_v3(ob->obmat, v1);
-   mul_m4_v3(ob->obmat, v2);
+   mul_v3_mat3_m4v3(v1, ob->obmat, edge->v1->co);
+   mul_v3_mat3_m4v3(v2, ob->obmat, edge->v2->co);
 
return len_squared_v3v3(v1, v2);
 }

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


[Bf-blender-cvs] [0e65c4839c4] blender2.8: Cleanup: style

2018-09-23 Thread Campbell Barton
Commit: 0e65c4839c407c4c117a75e9e9376b5b02ed68b5
Author: Campbell Barton
Date:   Mon Sep 24 08:25:51 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB0e65c4839c407c4c117a75e9e9376b5b02ed68b5

Cleanup: style

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenkernel/intern/multires_reshape.c
M   source/blender/blenkernel/intern/subdiv_ccg_mask.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/mesh/editmesh_select_similar.c
M   source/blender/editors/transform/transform_snap_object.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 35e0ecea67e..5e03c521af3 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -225,7 +225,7 @@ class VIEW3D_HT_header(Header):
 icon=or_icon,
 )
 
-if object_mode in ('GPENCIL_PAINT', 'GPENCIL_SCULPT'):
+if object_mode in {'GPENCIL_PAINT', 'GPENCIL_SCULPT'}:
 lock = tool_settings.gpencil_sculpt.lockaxis
 gp_lock = \
 
tool_settings.gpencil_sculpt.bl_rna.properties['lockaxis'].enum_items[lock]
diff --git a/source/blender/blenkernel/intern/multires_reshape.c 
b/source/blender/blenkernel/intern/multires_reshape.c
index 35dbc7f7b9b..617352840da 100644
--- a/source/blender/blenkernel/intern/multires_reshape.c
+++ b/source/blender/blenkernel/intern/multires_reshape.c
@@ -227,7 +227,7 @@ static void multires_reshape_vertex_copy_to_next(
 const MPoly *coarse_poly,
 const int current_corner,
 const MDisps *current_displacement_grid,
-   const GridPaintMask *current_mask_grid,
+const GridPaintMask *current_mask_grid,
 const int current_grid_x, const int current_grid_y)
 {
const int grid_size = ctx->grid_size;
@@ -474,7 +474,7 @@ static void multires_reshape_propagate_prepare_from_mmd(
 }
 
 static void multires_reshape_propagate_corner_data(
-MultiresPropagateCornerData* corner,
+MultiresPropagateCornerData *corner,
 const MDisps *old_displacement_grid,
 const MDisps *new_displacement_grid,
 const GridPaintMask *grid_paint_mask,
@@ -505,7 +505,7 @@ static void multires_reshape_propagate_all_corners_data(
 MultiresPropagateCornerData corners[4],
 const MDisps *old_displacement_grid,
 const MDisps *new_displacement_grid,
-   const GridPaintMask *grid_paint_mask,
+const GridPaintMask *grid_paint_mask,
 const int grid_size,
 const int grid_skip,
 const int reshape_x, const int reshape_y)
@@ -636,7 +636,8 @@ static void multires_reshape_propagate_grid(
}
 }
 
-static void multires_reshape_propagate(MultiresPropagateData *data) {
+static void multires_reshape_propagate(MultiresPropagateData *data)
+{
if (data->old_displacement_grids == NULL) {
return;
}
@@ -660,7 +661,8 @@ static void 
multires_reshape_propagate(MultiresPropagateData *data) {
}
 }
 
-static void multires_reshape_propagate_free(MultiresPropagateData *data) {
+static void multires_reshape_propagate_free(MultiresPropagateData *data)
+{
if (data->old_displacement_grids != NULL) {
const int num_grids = data->num_grids;
MDisps *old_mdisps = data->old_displacement_grids;
diff --git a/source/blender/blenkernel/intern/subdiv_ccg_mask.c 
b/source/blender/blenkernel/intern/subdiv_ccg_mask.c
index 3805e0b4bdc..f3a63bb0e9e 100644
--- a/source/blender/blenkernel/intern/subdiv_ccg_mask.c
+++ b/source/blender/blenkernel/intern/subdiv_ccg_mask.c
@@ -233,8 +233,8 @@ bool BKE_subdiv_ccg_mask_init_from_paint(
return false;
}
/* Allocate all required memory. */
-   mask_evaluator->user_data =MEM_callocN(sizeof(GridPaintMaskData),
-  "mask from grid data");
+   mask_evaluator->user_data = MEM_callocN(sizeof(GridPaintMaskData),
+   "mask from grid data");
displacement_init_data(mask_evaluator, mesh);
displacement_init_functions(mask_evaluator);
return true;
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 011e2641089..2e261ee2e03 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -831,7 +831,7 @@ void do_versions_after_linking_280(Main *bmain)
 
newptr[3][1] = 
bezt->radius;
 
-   oldptr += 3*4;
+   oldptr += 3 * 4;
   

[Bf-blender-cvs] [f3e455a0f89] hair_object: Follicle selection flag and "select all" operator.

2018-09-23 Thread Lukas Tönne
Commit: f3e455a0f89df914b95e5ee43b3c7cfd9b37a755
Author: Lukas Tönne
Date:   Sun Sep 23 14:04:20 2018 +0100
Branches: hair_object
https://developer.blender.org/rBf3e455a0f89df914b95e5ee43b3c7cfd9b37a755

Follicle selection flag and "select all" operator.

===

M   source/blender/draw/intern/draw_cache_impl_hair.c
M   source/blender/editors/hair/CMakeLists.txt
A   source/blender/editors/hair/edithair_select.c
M   source/blender/editors/hair/hair_intern.h
M   source/blender/editors/hair/hair_ops.c
M   source/blender/makesdna/DNA_hair_types.h

===

diff --git a/source/blender/draw/intern/draw_cache_impl_hair.c 
b/source/blender/draw/intern/draw_cache_impl_hair.c
index 2673cc354f5..97c2b7b3f2a 100644
--- a/source/blender/draw/intern/draw_cache_impl_hair.c
+++ b/source/blender/draw/intern/draw_cache_impl_hair.c
@@ -768,7 +768,7 @@ static void hair_batch_cache_ensure_edit_follicle_pos(
if (format.attr_len == 0) {
/* initialize vertex format */
pos_id = GPU_vertformat_attr_add(, "pos", GPU_COMP_F32, 
3, GPU_FETCH_FLOAT);
-   data_id = GPU_vertformat_attr_add(, "data", GPU_COMP_U8, 
1, GPU_FETCH_INT);
+   data_id = GPU_vertformat_attr_add(, "data", 
GPU_COMP_U32, 1, GPU_FETCH_INT);
}
 
cache->edit_follicle_pos = GPU_vertbuf_create_with_format();
@@ -783,8 +783,7 @@ static void hair_batch_cache_ensure_edit_follicle_pos(
 
GPU_vertbuf_attr_set(cache->edit_follicle_pos, pos_id, 
point_index, loc);
 
-   unsigned char flag = 0;
-   GPU_vertbuf_attr_set(cache->edit_follicle_pos, data_id, 
point_index, );
+   GPU_vertbuf_attr_set(cache->edit_follicle_pos, data_id, 
point_index, >flag);
}
 }
 
diff --git a/source/blender/editors/hair/CMakeLists.txt 
b/source/blender/editors/hair/CMakeLists.txt
index 1477f1fb221..4f74c24734c 100644
--- a/source/blender/editors/hair/CMakeLists.txt
+++ b/source/blender/editors/hair/CMakeLists.txt
@@ -36,6 +36,7 @@ set(INC_SYS
 set(SRC
hair_ops.c
edithair.c
+   edithair_select.c
edithair_test.c
 
hair_intern.h
diff --git a/source/blender/editors/hair/edithair_select.c 
b/source/blender/editors/hair/edithair_select.c
new file mode 100644
index 000..c9d30caaf58
--- /dev/null
+++ b/source/blender/editors/hair/edithair_select.c
@@ -0,0 +1,168 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * 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.
+ *
+ * The Original Code is Copyright (C) Blender Foundation
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Lukas Toenne
+ *
+ * * END GPL LICENSE BLOCK *
+ */
+
+/** \file blender/editors/hair/edithair_test.c
+ *  \ingroup edhair
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+
+#include "DNA_hair_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "BKE_context.h"
+#include "BKE_hair.h"
+#include "BKE_hair_iterators.h"
+#include "BKE_mesh_sample.h"
+
+#include "DEG_depsgraph.h"
+
+#include "ED_hair.h"
+#include "ED_screen.h"
+#include "ED_view3d.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "UI_resources.h"
+
+#include "BLT_translation.h"
+
+#include "hair_intern.h"  /* own include */
+
+/ de select all operator /
+
+static bool hair_has_selected_follicles(EditHair *edit)
+{
+   const HairFollicle *follicle;
+   HairIterator iter;
+   BKE_HAIR_ITER_FOLLICLES(follicle, , edit->pattern) {
+   if (follicle->flag & HAIR_FOLLICLE_SELECT) {
+   return true;
+   }
+   }
+   return false;
+}
+
+static void hair_follicle_select_action_apply(HairFollicle *follicle, int 
action)
+{
+   switch (action) {
+   case SEL_SELECT:
+   if (!(follicle->flag & HAIR_FOLLICLE_SELECT)) {
+   follicle->flag |= HAIR_FOLLICLE_SELECT;
+   }
+   break;
+   case 

[Bf-blender-cvs] [a2715716ba1] hair_object: Remove deprecated texture cache from HairSystem.

2018-09-23 Thread Lukas Tönne
Commit: a2715716ba1c247fe5aafdb471c34230c8f61ff8
Author: Lukas Tönne
Date:   Sun Sep 23 12:58:55 2018 +0100
Branches: hair_object
https://developer.blender.org/rBa2715716ba1c247fe5aafdb471c34230c8f61ff8

Remove deprecated texture cache from HairSystem.

===

M   source/blender/blenkernel/intern/hair.c
M   source/blender/blenkernel/intern/hair_draw.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/makesdna/DNA_hair_types.h

===

diff --git a/source/blender/blenkernel/intern/hair.c 
b/source/blender/blenkernel/intern/hair.c
index 2cc646bd6df..bb4cea70b2f 100644
--- a/source/blender/blenkernel/intern/hair.c
+++ b/source/blender/blenkernel/intern/hair.c
@@ -166,7 +166,6 @@ void BKE_hair_copy_data(Main *UNUSED(bmain), HairSystem 
*hsys_dst, const HairSys
}
 
hsys_dst->draw_batch_cache = NULL;
-   hsys_dst->draw_texture_cache = NULL;
 }
 
 HairSystem *BKE_hair_copy(Main *bmain, const HairSystem *hsys)
diff --git a/source/blender/blenkernel/intern/hair_draw.c 
b/source/blender/blenkernel/intern/hair_draw.c
index 12a02c3399e..b62ce6888b1 100644
--- a/source/blender/blenkernel/intern/hair_draw.c
+++ b/source/blender/blenkernel/intern/hair_draw.c
@@ -84,7 +84,7 @@ void BKE_hair_batch_cache_dirty(HairSystem* hsys, int mode)
 
 void BKE_hair_batch_cache_free(HairSystem* hsys)
 {
-   if (hsys->draw_batch_cache || hsys->draw_texture_cache) {
+   if (hsys->draw_batch_cache) {
BKE_hair_batch_cache_free_cb(hsys);
}
 }
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index e584cf0e470..00384e507ef 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8410,7 +8410,6 @@ static void direct_link_hair(FileData *fd, HairSystem* 
hsys)
hsys->bb = NULL;
hsys->edithair = NULL;
hsys->draw_batch_cache = NULL;
-   hsys->draw_texture_cache = NULL;
 }
 
 /* ** GENERAL & MAIN  */
diff --git a/source/blender/makesdna/DNA_hair_types.h 
b/source/blender/makesdna/DNA_hair_types.h
index 547b256ed55..096d532ca31 100644
--- a/source/blender/makesdna/DNA_hair_types.h
+++ b/source/blender/makesdna/DNA_hair_types.h
@@ -118,8 +118,6 @@ typedef struct HairSystem {
 
/* Data buffers for drawing */
void *draw_batch_cache;
-   /* Texture buffer for drawing */
-   void *draw_texture_cache;
 } HairSystem;
 
 typedef enum eHairSystemFlag

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


[Bf-blender-cvs] [6df397bcb24] hair_object: Tag the object data block instead of the object to ensure correct updates after selection.

2018-09-23 Thread Lukas Tönne
Commit: 6df397bcb243182639fec8628aae7fd1ce588da1
Author: Lukas Tönne
Date:   Sun Sep 23 14:13:47 2018 +0100
Branches: hair_object
https://developer.blender.org/rB6df397bcb243182639fec8628aae7fd1ce588da1

Tag the object data block instead of the object to ensure correct updates after 
selection.

===

M   source/blender/editors/hair/edithair_select.c
M   source/blender/editors/hair/edithair_test.c

===

diff --git a/source/blender/editors/hair/edithair_select.c 
b/source/blender/editors/hair/edithair_select.c
index c9d30caaf58..b2f903dbbad 100644
--- a/source/blender/editors/hair/edithair_select.c
+++ b/source/blender/editors/hair/edithair_select.c
@@ -144,8 +144,8 @@ static int hair_select_all_exec(bContext *C, wmOperator *op)
}
 
BKE_hair_batch_cache_dirty(hsys, BKE_HAIR_BATCH_DIRTY_SELECT);
-   DEG_id_tag_update(>id, DEG_TAG_SELECT_UPDATE);
-   WM_event_add_notifier(C, NC_OBJECT|ND_DATA|NA_SELECTED, obedit);
+   DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
+   WM_event_add_notifier(C, NC_GEOM|ND_SELECT|NA_SELECTED, obedit);
 
return OPERATOR_FINISHED;
 }
diff --git a/source/blender/editors/hair/edithair_test.c 
b/source/blender/editors/hair/edithair_test.c
index a19499f1bc7..6975d99f922 100644
--- a/source/blender/editors/hair/edithair_test.c
+++ b/source/blender/editors/hair/edithair_test.c
@@ -42,6 +42,8 @@
 #include "BKE_hair.h"
 #include "BKE_mesh_sample.h"
 
+#include "DEG_depsgraph.h"
+
 #include "ED_hair.h"
 #include "ED_screen.h"
 #include "ED_view3d.h"
@@ -123,6 +125,8 @@ static int add_test_hair_exec(bContext *C, wmOperator *op)
//  hsys->flag |= HAIR_SYSTEM_UPDATE_FOLLICLE_BINDING;
 
BKE_hair_batch_cache_dirty(hsys, BKE_HAIR_BATCH_DIRTY_ALL);
+   DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
+   WM_event_add_notifier(C, NC_GEOM|ND_DRAW, obedit);
 
return OPERATOR_FINISHED;
 }

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


[Bf-blender-cvs] [09072775437] hair_object: Hair selection mode enum for specifying what part of hair data tools should work on.

2018-09-23 Thread Lukas Tönne
Commit: 090727754373a824f2c26c66dae21aafb4a80c15
Author: Lukas Tönne
Date:   Sun Sep 23 10:35:14 2018 +0100
Branches: hair_object
https://developer.blender.org/rB090727754373a824f2c26c66dae21aafb4a80c15

Hair selection mode enum for specifying what part of hair data tools should 
work on.

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_sculpt_paint.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index d4ba7b44563..792471983b4 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -63,6 +63,7 @@ class VIEW3D_HT_header(Header):
 # Hair edit
 if object_mode == 'EDIT' and obj.type == 'HAIR':
 row = layout.row()
+row.prop(tool_settings.hair_edit_settings, "select_mode", 
text="")
 row.prop(tool_settings.hair_edit_settings, 
"follicle_draw_mode", text="")
 
 # Occlude geometry
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index c136056649f..76bb8ca61f9 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -875,6 +875,12 @@ typedef struct ParticleEditSettings {
 //typedef enum HairEditFlags {
 //} HairEditFlags;
 
+typedef enum HairEditSelectMode {
+   HAIR_SELECT_FOLLICLES,
+   HAIR_SELECT_VERTICES,
+   HAIR_SELECT_TIPS,
+} HairEditSelectMode;
+
 typedef enum HairEditFollicleDrawMode {
HAIR_FOLLICLE_DRAW_NONE,
HAIR_FOLLICLE_DRAW_POINT,
@@ -885,8 +891,8 @@ typedef enum HairEditFollicleDrawMode {
 /* Hair Edit Mode Settings */
 typedef struct HairEditSettings {
int flag;
+   short select_mode;
short follicle_draw_mode;
-   short pad;
 } HairEditSettings;
 
 /* --- */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c 
b/source/blender/makesrna/intern/rna_sculpt_paint.c
index cbc5d09a024..976827a7a70 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1121,6 +1121,13 @@ static void rna_def_hair_edit_settings(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
 
+   static const EnumPropertyItem select_mode_items[] = {
+   {HAIR_SELECT_FOLLICLES, "FOLLICLES", ICON_NONE, "Follicles", 
"Select hair follicles"},
+   {HAIR_SELECT_VERTICES, "VERTICES", ICON_NONE, "Vertices", "Select 
hair curve vertices"},
+   {HAIR_SELECT_TIPS, "TIPS", ICON_NONE, "Tips", "Select only last 
vertices of hair curves"},
+   {0, NULL, 0, NULL, NULL}
+   };
+
static const EnumPropertyItem follicle_draw_mode_items[] = {
{HAIR_FOLLICLE_DRAW_NONE, "NONE", ICON_NONE, "None", "Don't draw 
hair follicles"},
{HAIR_FOLLICLE_DRAW_POINT, "POINT", ICON_NONE, "Point", "Draw point 
on follicle location"},
@@ -1133,6 +1140,14 @@ static void rna_def_hair_edit_settings(BlenderRNA *brna)
RNA_def_struct_path_func(srna, "rna_HairEditSettings_path");
RNA_def_struct_ui_text(srna, "Hair Edit", "Properties of hair editing 
mode");
 
+   prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
+   RNA_def_property_enum_sdna(prop, NULL, "select_mode");
+   RNA_def_property_enum_items(prop, select_mode_items);
+   RNA_def_property_ui_text(prop, "Selection Mode", "Mode of selecting 
editable hair points");
+   RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+   RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, 
"rna_HairEditSettings_update");
+
prop = RNA_def_property(srna, "follicle_draw_mode", PROP_ENUM, 
PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "follicle_draw_mode");
RNA_def_property_enum_items(prop, follicle_draw_mode_items);

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


[Bf-blender-cvs] [e18c5b70532] hair_object: Fix submodules.

2018-09-23 Thread Lukas Tönne
Commit: e18c5b70532e6eedb5095c2b8e77d9e6ee74e46b
Author: Lukas Tönne
Date:   Sun Sep 23 09:32:14 2018 +0100
Branches: hair_object
https://developer.blender.org/rBe18c5b70532e6eedb5095c2b8e77d9e6ee74e46b

Fix submodules.

===

M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   source/tools

===

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 59495b4b590..d3349b42856 16
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 59495b4b59077aa1cc68fffbdae1463af980f08e
+Subproject commit d3349b42856d00c278f72f2a5909a6c96b9cdb5e
diff --git a/release/scripts/addons b/release/scripts/addons
index 371960484a3..d5ad293372d 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 371960484a38fc64e0a2635170a41a0d8ab2f6bd
+Subproject commit d5ad293372d3a66ea52ec9d307104e3cd62d3cb6
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 47470215783..fecc0db5600 16
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 474702157831f1a58bb50f5240ab8b1b02b6ba37
+Subproject commit fecc0db5600405a0c14c70120ae279222861ef80
diff --git a/source/tools b/source/tools
index 87f7038ee8c..11656ebaf7f 16
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit 87f7038ee8c4b46a5e73a1a9065e2a9b7367f594
+Subproject commit 11656ebaf7f912cdb1b5eb39c5d0a3b5d492c1aa

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


[Bf-blender-cvs] [1180b90e13c] hair_object: Fix const-ness of hair primitive pointers for screen vertex callbacks.

2018-09-23 Thread Lukas Tönne
Commit: 1180b90e13cf51cd5856965a8dcdaa5947288ccb
Author: Lukas Tönne
Date:   Sun Sep 16 11:34:01 2018 +0100
Branches: hair_object
https://developer.blender.org/rB1180b90e13cf51cd5856965a8dcdaa5947288ccb

Fix const-ness of hair primitive pointers for screen vertex callbacks.

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_iterators.c 
b/source/blender/editors/space_view3d/view3d_iterators.c
index 61f5a22bc27..3724b7e332c 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -426,9 +426,9 @@ void hair_foreachScreenVert(
}
 
if (edit->pattern) {
-   const HairFollicle *follicle;
-   const HairFiberCurve *curve;
-   const HairFiberVertex *vert;
+   HairFollicle *follicle;
+   HairFiberCurve *curve;
+   HairFiberVertex *vert;
HairIterator fiter;
HairIterator viter;
BKE_HAIR_ITER_FOLLICLE_CURVES(follicle, curve, , 
edit->pattern, >curve_data) {

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


[Bf-blender-cvs] [6a81f686eb1] hair_object: Draw function for hair follicles.

2018-09-23 Thread Lukas Tönne
Commit: 6a81f686eb110eb513fc3d2a74ed3c3bfe8c4449
Author: Lukas Tönne
Date:   Sun Sep 23 09:31:10 2018 +0100
Branches: hair_object
https://developer.blender.org/rB6a81f686eb110eb513fc3d2a74ed3c3bfe8c4449

Draw function for hair follicles.

===

M   source/blender/draw/intern/draw_cache.c
M   source/blender/draw/intern/draw_cache.h
M   source/blender/draw/intern/draw_cache_impl.h
M   source/blender/draw/intern/draw_cache_impl_hair.c
M   source/blender/draw/modes/edit_hair_mode.c
M   source/blender/editors/hair/edithair_test.c

===

diff --git a/source/blender/draw/intern/draw_cache.c 
b/source/blender/draw/intern/draw_cache.c
index c39ec47101a..2d831c6e6d7 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -3370,19 +3370,19 @@ GPUBatch *DRW_cache_particles_get_prim(int type)
 
 /** \name Hair */
 
-GPUBatch *DRW_cache_hair_get_fibers(struct Object *ob, struct HairSystem 
*hsys, const struct HairExportCache *hair_export)
+GPUBatch *DRW_cache_hair_get_edit_follicle_points(struct Object *ob, struct 
HairSystem *hsys)
 {
-   return DRW_hair_batch_cache_get_fibers(ob, hsys, hair_export);
+   return DRW_hair_batch_cache_get_edit_follicle_points(ob, hsys);
 }
 
-GPUBatch *DRW_cache_hair_get_follicle_points(struct Object *ob, struct 
HairSystem *hsys)
+GPUBatch *DRW_cache_hair_get_edit_follicle_normals(struct Object *ob, struct 
HairSystem *hsys)
 {
-   return DRW_hair_batch_cache_get_follicle_points(ob, hsys);
+   return DRW_hair_batch_cache_get_edit_follicle_normals(ob, hsys);
 }
 
-GPUBatch *DRW_cache_hair_get_verts(struct Object *ob, struct HairSystem *hsys)
+GPUBatch *DRW_cache_hair_get_edit_follicle_axes(struct Object *ob, struct 
HairSystem *hsys)
 {
-   return DRW_hair_batch_cache_get_verts(ob, hsys);
+   return DRW_hair_batch_cache_get_edit_follicle_axes(ob, hsys);
 }
 
 GPUBatch *DRW_cache_hair_get_edit_strands(struct Object *ob, struct HairSystem 
*hsys)
diff --git a/source/blender/draw/intern/draw_cache.h 
b/source/blender/draw/intern/draw_cache.h
index d57fd2528a5..510f4bb5fb1 100644
--- a/source/blender/draw/intern/draw_cache.h
+++ b/source/blender/draw/intern/draw_cache.h
@@ -196,9 +196,9 @@ struct GPUBatch *DRW_cache_particles_get_edit_tip_points(
 struct GPUBatch *DRW_cache_particles_get_prim(int type);
 
 /* Hair */
-struct GPUBatch *DRW_cache_hair_get_fibers(struct Object *ob, struct 
HairSystem *hsys, const struct HairExportCache *hair_export);
-struct GPUBatch *DRW_cache_hair_get_follicle_points(struct Object *ob, struct 
HairSystem *hsys);
-struct GPUBatch *DRW_cache_hair_get_verts(struct Object *ob, struct HairSystem 
*hsys);
+struct GPUBatch *DRW_cache_hair_get_edit_follicle_points(struct Object *ob, 
struct HairSystem *hsys);
+struct GPUBatch *DRW_cache_hair_get_edit_follicle_normals(struct Object *ob, 
struct HairSystem *hsys);
+struct GPUBatch *DRW_cache_hair_get_edit_follicle_axes(struct Object *ob, 
struct HairSystem *hsys);
 struct GPUBatch *DRW_cache_hair_get_edit_strands(struct Object *ob, struct 
HairSystem *hsys);
 
 /* Metaball */
diff --git a/source/blender/draw/intern/draw_cache_impl.h 
b/source/blender/draw/intern/draw_cache_impl.h
index b0f01244f52..035d06b7ebd 100644
--- a/source/blender/draw/intern/draw_cache_impl.h
+++ b/source/blender/draw/intern/draw_cache_impl.h
@@ -152,9 +152,9 @@ struct GPUBatch 
*DRW_particles_batch_cache_get_edit_tip_points(
 struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit 
*edit);
 
 /* Hair */
-struct GPUBatch *DRW_hair_batch_cache_get_fibers(struct Object *ob, struct 
HairSystem *hsys, const struct HairExportCache *hair_export);
-struct GPUBatch *DRW_hair_batch_cache_get_follicle_points(struct Object *ob, 
struct HairSystem *hsys);
-struct GPUBatch *DRW_hair_batch_cache_get_verts(struct Object *ob, struct 
HairSystem *hsys);
+struct GPUBatch *DRW_hair_batch_cache_get_edit_follicle_points(struct Object 
*ob, struct HairSystem *hsys);
+struct GPUBatch *DRW_hair_batch_cache_get_edit_follicle_normals(struct Object 
*ob, struct HairSystem *hsys);
+struct GPUBatch *DRW_hair_batch_cache_get_edit_follicle_axes(struct Object 
*ob, struct HairSystem *hsys);
 struct GPUBatch *DRW_hair_batch_cache_get_edit_strands(struct Object *ob, 
struct HairSystem *hsys);
 
 #endif /* __DRAW_CACHE_IMPL_H__ */
diff --git a/source/blender/draw/intern/draw_cache_impl_hair.c 
b/source/blender/draw/intern/draw_cache_impl_hair.c
index 5718f14106c..2673cc354f5 100644
--- a/source/blender/draw/intern/draw_cache_impl_hair.c
+++ b/source/blender/draw/intern/draw_cache_impl_hair.c
@@ -67,6 +67,10 @@ typedef struct HairBatchCache {
/* Control points when in edit mode. */
ParticleHairCache edit_hair;
 
+   GPUVertBuf *edit_follicle_pos;
+   GPUBatch *edit_follicle_points;
+   int edit_follicle_point_len;

[Bf-blender-cvs] [babdb5a3605] hair_object: Draw mode for hair follicles in edit mode.

2018-09-23 Thread Lukas Tönne
Commit: babdb5a3605fd6e04421ae8812719ef49fb35653
Author: Lukas Tönne
Date:   Sun Sep 16 12:57:31 2018 +0100
Branches: hair_object
https://developer.blender.org/rBbabdb5a3605fd6e04421ae8812719ef49fb35653

Draw mode for hair follicles in edit mode.

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_sculpt_paint.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 2064c9870dc..d4ba7b44563 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -57,12 +57,13 @@ class VIEW3D_HT_header(Header):
 # object_mode = obj.mode
 
 # Particle edit
-if object_mode == 'EDIT' and obj.type == 'HAIR':
-row = layout.row()
-row.prop(tool_settings.hair_edit_settings, "mode", text="", 
expand=True)
-elif object_mode == 'PARTICLE_EDIT':
+if object_mode == 'PARTICLE_EDIT':
 row = layout.row()
 row.prop(tool_settings.particle_edit, "select_mode", text="", 
expand=True)
+# Hair edit
+if object_mode == 'EDIT' and obj.type == 'HAIR':
+row = layout.row()
+row.prop(tool_settings.hair_edit_settings, 
"follicle_draw_mode", text="")
 
 # Occlude geometry
 if (
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index 1a1f2c8c18a..c136056649f 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -872,10 +872,21 @@ typedef struct ParticleEditSettings {
 /* --- */
 /* Hair Edit */
 
+//typedef enum HairEditFlags {
+//} HairEditFlags;
+
+typedef enum HairEditFollicleDrawMode {
+   HAIR_FOLLICLE_DRAW_NONE,
+   HAIR_FOLLICLE_DRAW_POINT,
+   HAIR_FOLLICLE_DRAW_NORMAL,
+   HAIR_FOLLICLE_DRAW_AXES,
+} HairEditFollicleDrawMode;
+
 /* Hair Edit Mode Settings */
 typedef struct HairEditSettings {
-   int pad;
-   int pad2;
+   int flag;
+   short follicle_draw_mode;
+   short pad;
 } HairEditSettings;
 
 /* --- */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c 
b/source/blender/makesrna/intern/rna_sculpt_paint.c
index d9ffe08c1c4..cbc5d09a024 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1121,9 +1121,25 @@ static void rna_def_hair_edit_settings(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
 
+   static const EnumPropertyItem follicle_draw_mode_items[] = {
+   {HAIR_FOLLICLE_DRAW_NONE, "NONE", ICON_NONE, "None", "Don't draw 
hair follicles"},
+   {HAIR_FOLLICLE_DRAW_POINT, "POINT", ICON_NONE, "Point", "Draw point 
on follicle location"},
+   {HAIR_FOLLICLE_DRAW_NORMAL, "NORMAL", ICON_NONE, "Normal", "Draw 
surface normal at follicle location"},
+   {HAIR_FOLLICLE_DRAW_AXES, "AXES", ICON_NONE, "Axes", "Draw local 
coordinate system at follicle location"},
+   {0, NULL, 0, NULL, NULL}
+   };
+
srna = RNA_def_struct(brna, "HairEditSettings", NULL);
RNA_def_struct_path_func(srna, "rna_HairEditSettings_path");
RNA_def_struct_ui_text(srna, "Hair Edit", "Properties of hair editing 
mode");
+
+   prop = RNA_def_property(srna, "follicle_draw_mode", PROP_ENUM, 
PROP_NONE);
+   RNA_def_property_enum_sdna(prop, NULL, "follicle_draw_mode");
+   RNA_def_property_enum_items(prop, follicle_draw_mode_items);
+   RNA_def_property_ui_text(prop, "Follicle Draw Mode", "Mode of drawing 
hair follicles");
+   RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+   RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, 
"rna_HairEditSettings_update");
 }
 
 static void rna_def_gpencil_sculpt(BlenderRNA *brna)

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