[Bf-blender-cvs] [9abc2dfa493] master: Fix T56491: Undo crash while preview jobs run
Commit: 9abc2dfa4933266b7f385b75c65527d512441363 Author: Campbell Barton Date: Fri Aug 24 12:36:19 2018 +1000 Branches: master https://developer.blender.org/rB9abc2dfa4933266b7f385b75c65527d512441363 Fix T56491: Undo crash while preview jobs run While the crash is in 2.8, it's possible undo operates on data which isn't only owned by the current scene (any object for eg). Thanks to @mont29 for suggesting the fix. === M source/blender/editors/undo/ed_undo.c === diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index a13fa4af4e2..621c5d73d5a 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -111,9 +111,7 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) /* undo during jobs are running can easily lead to freeing data using by jobs, * or they can just lead to freezing job in some other cases */ - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY)) { - return OPERATOR_CANCELLED; - } + WM_jobs_kill_all(wm); /* TODO(campbell): undo_system: use undo system */ /* grease pencil can be can be used in plenty of spaces, so check it first */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f029aefe3e0] blender2.8: Merge branch 'master' into blender2.8
Commit: f029aefe3e051d213292cf0d9be20d5438ca618f Author: Campbell Barton Date: Fri Aug 24 12:39:36 2018 +1000 Branches: blender2.8 https://developer.blender.org/rBf029aefe3e051d213292cf0d9be20d5438ca618f Merge branch 'master' into blender2.8 === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6a5bc88abfb] blender2.8: Merge branch 'master' into blender2.8
Commit: 6a5bc88abfbbf4330ba0f1c4ea0b0366c42af3e1 Author: Campbell Barton Date: Fri Aug 24 12:17:33 2018 +1000 Branches: blender2.8 https://developer.blender.org/rB6a5bc88abfbbf4330ba0f1c4ea0b0366c42af3e1 Merge branch 'master' into blender2.8 === === diff --cc source/blender/editors/interface/interface_layout.c index a9703736916,edd568e4fea..70bcc8e7c4e --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@@ -745,10 -676,10 +745,11 @@@ static uiBut *ui_item_with_label uiBut *but = NULL; PropertyType type; PropertySubType subtype; - int labelw; + int prop_but_width = w_hint; + const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0); - sub = uiLayoutRow(layout, layout->align); + /* Always align item with label since text is already given enough space not to overlap. */ + sub = uiLayoutRow(layout, true); UI_block_layout_set_current(block, sub); if (name[0]) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b2d32d7fa4b] master: UI: always align item w/ label
Commit: b2d32d7fa4b371561b18c68d0d7012850f8c Author: Campbell Barton Date: Fri Aug 24 12:13:28 2018 +1000 Branches: master https://developer.blender.org/rBb2d32d7fa4b371561b18c68d0d7012850f8c UI: always align item w/ label === M source/blender/editors/interface/interface_layout.c === diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 140fdbe355b..edd568e4fea 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -678,7 +678,8 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n PropertySubType subtype; int labelw; - sub = uiLayoutRow(layout, layout->align); + /* Always align item with label since text is already given enough space not to overlap. */ + sub = uiLayoutRow(layout, true); UI_block_layout_set_current(block, sub); if (name[0]) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7fa42b3e519] blender2.8: Fix T56511: UILayout.prop_search misaligned
Commit: 7fa42b3e519173c29a2ae250cea15f35e32521c2 Author: Campbell Barton Date: Fri Aug 24 12:09:56 2018 +1000 Branches: blender2.8 https://developer.blender.org/rB7fa42b3e519173c29a2ae250cea15f35e32521c2 Fix T56511: UILayout.prop_search misaligned Add padding when used with property decorations. === M release/scripts/startup/bl_ui/properties_physics_common.py M source/blender/editors/interface/interface_layout.c === diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index 83bfab5581d..9653d98d428 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -239,11 +239,11 @@ def effector_weights_ui(self, context, weights, weight_type): layout = self.layout layout.use_property_split = True -layout.prop(weights, "group") - # NOTE: TODO temporarly used until the animate properties are properly skipped. layout.use_property_decorate = False # No animation (remove this later on). +layout.prop(weights, "group") + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True) col = flow.column() diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index ec35325416a..a9703736916 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -809,6 +809,11 @@ static uiBut *ui_item_with_label( x, y, prop_but_width, h); } + /* Only for alignment. */ + if ((layout->item.flag & UI_ITEM_PROP_DECORATE) != 0) { + uiItemL(sub, NULL, ICON_BLANK1); + } + UI_block_layout_set_current(block, layout); return but; } @@ -1509,6 +1514,8 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index #ifdef UI_PROP_DECORATE struct { bool use_prop_decorate; + /* For button types that handle own decorations (or add own padding for alignment). */ + bool use_prop_decorate_done; int len; uiLayout *layout; uiBut *but; @@ -1728,6 +1735,11 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index if (layout->redalert) UI_but_flag_enable(but, UI_BUT_REDALERT); + +#ifdef UI_PROP_DECORATE + /* ui_item_with_label handles this. */ + ui_decorate.use_prop_decorate_done = true; +#endif } /* single button */ else { @@ -1749,7 +1761,10 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index } #ifdef UI_PROP_DECORATE - if (ui_decorate.use_prop_decorate) { + if (ui_decorate.use_prop_decorate_done) { + /* pass */ + } + else if (ui_decorate.use_prop_decorate) { const bool is_anim = RNA_property_animateable(ptr, prop); uiBut *but_decorate = ui_decorate.but ? ui_decorate.but->next : block->buttons.first; uiLayout *layout_col = uiLayoutColumn(ui_decorate.layout, false); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [bae8ab3188b] blender2.8: UI: remove hack to align search properties
Commit: bae8ab3188b33635f90f840fccdc6517a3dae22b Author: Campbell Barton Date: Fri Aug 24 10:51:53 2018 +1000 Branches: blender2.8 https://developer.blender.org/rBbae8ab3188b33635f90f840fccdc6517a3dae22b UI: remove hack to align search properties === M release/scripts/startup/bl_ui/properties_physics_cloth.py M release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py M release/scripts/startup/bl_ui/properties_physics_smoke.py M release/scripts/startup/bl_ui/properties_physics_softbody.py M release/scripts/startup/bl_ui/properties_texture.py === diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index 86ded4f9d01..d65be4e578a 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -95,11 +95,9 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel): key = ob.data.shape_keys if key: -# Note: TODO prop_search doesn't align on the right. row = col.row(align=True) row.active = not cloth.use_dynamic_mesh row.prop_search(cloth, "rest_shape_key", key, "key_blocks", text="Rest Shape Key") -row.label(text="", icon='BLANK1') class PHYSICS_PT_cloth_pinning(PhysicButtonsPanel, Panel): @@ -129,10 +127,7 @@ class PHYSICS_PT_cloth_pinning(PhysicButtonsPanel, Panel): col = flow.column() -# Note: TODO prop_search doesn't align on the right. -row = col.row(align=True) -row.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="Mass Group") -row.label(text="", icon='BLANK1') +col.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="Mass Group") col = flow.column() col.prop(cloth, "pin_stiffness", text="Stiffness") @@ -221,10 +216,7 @@ class PHYSICS_PT_cloth_self_collision(PhysicButtonsPanel, Panel): col.prop(cloth, "self_distance_min", slider=True, text="Distance") col = flow.column() -# Note: TODO prop_search doesn't align on the right. -row = col.row(align=True) -row.prop_search(cloth, "vertex_group_self_collisions", ob, "vertex_groups", text="Vertex Group") -row.label(text="", icon='BLANK1') +col.prop_search(cloth, "vertex_group_self_collisions", ob, "vertex_groups", text="Vertex Group") class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, Panel): @@ -252,24 +244,19 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, Panel): flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True) col = flow.column() -# Note: TODO prop_search doesn't align on the right. -row = col.row(align=True) -row.prop_search( +col.prop_search( cloth, "vertex_group_structural_stiffness", ob, "vertex_groups", text="Structural Group" ) -row.label(text="", icon='BLANK1') col.prop(cloth, "structural_stiffness_max", text="Max") col.separator() col = flow.column() -row = col.row(align=True) -row.prop_search( +col.prop_search( cloth, "vertex_group_bending", ob, "vertex_groups", text="Bending Group" ) -row.label(text="", icon='BLANK1') col.prop(cloth, "bending_stiffness_max", text="Max") @@ -302,10 +289,7 @@ class PHYSICS_PT_cloth_sewing(PhysicButtonsPanel, Panel): col.separator() col = col.column() -# Note: TODO prop_search doesn't align on the right. -row = col.row(align=True) -row.prop_search(cloth, "vertex_group_shrink", ob, "vertex_groups", text="Shrinking Group") -row.label(text="", icon='BLANK1') +col.prop_search(cloth, "vertex_group_shrink", ob, "vertex_groups", text="Shrinking Group") col = flow.column(align=True) col.prop(cloth, "shrink_min", text="Min") diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index 9d52232e10c..424ad6ce5e1 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -397,10 +397,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel): col = flow.column() -# Note: TODO prop_search doesn't align on the right. -row = col.row(align=True) -row.prop_search(surface, "uv_layer", ob.data, "uv_layers", text="UV Map") -row.label(text="", icon='BLANK1') +col.prop_search(surface, "uv_layer", ob.data, "uv_layers", text="UV Map") col = flow.c
[Bf-blender-cvs] [5bd731b6730] blender2.8: Merge branch 'master' into blender2.8
Commit: 5bd731b6730b6dc31dad7c3e8ccf0555b7bed3f1 Author: Campbell Barton Date: Fri Aug 24 11:54:12 2018 +1000 Branches: blender2.8 https://developer.blender.org/rB5bd731b6730b6dc31dad7c3e8ccf0555b7bed3f1 Merge branch 'master' into blender2.8 === === diff --cc source/blender/editors/interface/interface_layout.c index f3f08b10257,140fdbe355b..ec35325416a --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@@ -2017,34 -1828,16 +2037,17 @@@ void uiItemPointerR_prop StructRNA *icontype; int w, h; char namestr[UI_MAX_NAME_STR]; + const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0); - /* validate arguments */ - prop = RNA_struct_find_property(ptr, propname); - - if (!prop) { - RNA_warning("property not found: %s.%s", - RNA_struct_identifier(ptr->type), propname); - return; - } - type = RNA_property_type(prop); if (!ELEM(type, PROP_POINTER, PROP_STRING, PROP_ENUM)) { - RNA_warning("Property %s must be a pointer, string or enum", propname); - return; - } - - searchprop = RNA_struct_find_property(searchptr, searchpropname); - - - if (!searchprop) { - RNA_warning("search collection property not found: %s.%s", - RNA_struct_identifier(searchptr->type), searchpropname); + RNA_warning("Property %s.%s must be a pointer, string or enum", + RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return; } - else if (RNA_property_type(searchprop) != PROP_COLLECTION) { + if (RNA_property_type(searchprop) != PROP_COLLECTION) { RNA_warning("search collection property is not a collection type: %s.%s", - RNA_struct_identifier(searchptr->type), searchpropname); + RNA_struct_identifier(searchptr->type), RNA_property_identifier(searchprop)); return; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7ec1a56a419] master: RNA: avoid redundant property lookups in UI API
Commit: 7ec1a56a41953eac23e252fad9a3bf1605471abc Author: Campbell Barton Date: Fri Aug 24 11:44:28 2018 +1000 Branches: master https://developer.blender.org/rB7ec1a56a41953eac23e252fad9a3bf1605471abc RNA: avoid redundant property lookups in UI API === M source/blender/editors/include/UI_interface.h M source/blender/editors/interface/interface_layout.c M source/blender/makesrna/intern/rna_ui_api.c M source/blenderplayer/bad_level_call_stubs/stubs.c === diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index f2aad249df3..a38f82bc5fc 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1051,8 +1051,10 @@ void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int void uiItemFullR(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, const char *name, int icon); void uiItemEnumR_prop(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, PropertyRNA *prop, int value); void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, const char *propname, int value); +void uiItemEnumR_string_prop(uiLayout *layout, struct PointerRNA *ptr, PropertyRNA *prop, const char *value, const char *name, int icon); void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, const char *name, int icon); void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname); +void uiItemPointerR_prop(uiLayout *layout, struct PointerRNA *ptr, PropertyRNA *prop, struct PointerRNA *searchptr, PropertyRNA *searchprop, const char *name, int icon); void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, const char *name, int icon); void uiItemsFullEnumO( uiLayout *layout, const char *opname, const char *propname, diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 5fc2dd09203..140fdbe355b 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1545,22 +1545,26 @@ void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, value, 0, name, icon); } -void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, const char *name, int icon) + +void uiItemEnumR_string_prop( +uiLayout *layout, struct PointerRNA *ptr, PropertyRNA *prop, +const char *value, const char *name, int icon) { - PropertyRNA *prop = RNA_struct_find_property(ptr, propname); const EnumPropertyItem *item; int ivalue, a; bool free; - if (!prop || RNA_property_type(prop) != PROP_ENUM) { + if (UNLIKELY(RNA_property_type(prop) != PROP_ENUM)) { + const char *propname = RNA_property_identifier(prop); ui_item_disabled(layout, propname); - RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); + RNA_warning("not an enum property: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } RNA_property_enum_items(layout->root->block->evil_C, ptr, prop, &item, NULL, &free); if (!RNA_enum_value_from_id(item, value, &ivalue)) { + const char *propname = RNA_property_identifier(prop); if (free) { MEM_freeN((void *)item); } @@ -1584,6 +1588,19 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr } } +void uiItemEnumR_string( +uiLayout *layout, struct PointerRNA *ptr, const char *propname, +const char *value, const char *name, int icon) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname); + if (UNLIKELY(prop == NULL)) { + ui_item_disabled(layout, propname); + RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); + return; + } + uiItemEnumR_string_prop(layout, ptr, prop, value, name, icon); +} + void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname) { PropertyRNA *prop; @@ -1799,9 +1816,12 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN } } -void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, const char *name, int icon) +void uiItemPointerR_prop( +uiL
[Bf-blender-cvs] [0cf12dfc14f] blender2.8: Cleanup: indentation, style
Commit: 0cf12dfc14f8312d9fe9db1d512dfb55104f6ac6 Author: Campbell Barton Date: Fri Aug 24 10:26:59 2018 +1000 Branches: blender2.8 https://developer.blender.org/rB0cf12dfc14f8312d9fe9db1d512dfb55104f6ac6 Cleanup: indentation, style === M source/blender/blenkernel/intern/colortools.c M source/blender/blenkernel/intern/multires_reshape.c M source/blender/blenkernel/intern/subdiv_foreach.c M source/blender/blenkernel/intern/subdiv_mesh.c M source/blender/blenkernel/intern/tracking_stabilize.c M source/blender/blenkernel/intern/tracking_util.c M source/blender/compositor/nodes/COM_RenderLayersNode.cpp M source/blender/depsgraph/intern/builder/deg_builder.cc M source/blender/draw/intern/draw_cache.c M source/blender/editors/armature/pose_edit.c M source/blender/python/mathutils/mathutils_noise.c === diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index ddf11d148cb..c934adc8762 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -962,15 +962,15 @@ static void curvemapping_evaluateRGBF_filmlike(const CurveMapping *cumap, float * \param black Use instead of cumap->black * \param bwmul Use instead of cumap->bwmul */ -void curvemapping_evaluate_premulRGBF_ex(const CurveMapping *cumap, float vecout[3], const float vecin[3], - const float black[3], const float bwmul[3]) +void curvemapping_evaluate_premulRGBF_ex( +const CurveMapping *cumap, float vecout[3], const float vecin[3], +const float black[3], const float bwmul[3]) { const float r = (vecin[0] - black[0]) * bwmul[0]; const float g = (vecin[1] - black[1]) * bwmul[1]; const float b = (vecin[2] - black[2]) * bwmul[2]; - switch (cumap->tone) - { + switch (cumap->tone) { default: case CURVE_TONE_STANDARD: { diff --git a/source/blender/blenkernel/intern/multires_reshape.c b/source/blender/blenkernel/intern/multires_reshape.c index a5235d00c1a..3fdd5de94f1 100644 --- a/source/blender/blenkernel/intern/multires_reshape.c +++ b/source/blender/blenkernel/intern/multires_reshape.c @@ -363,12 +363,13 @@ static Subdiv *multires_subdiv_for_reshape(struct Depsgraph *depsgraph, return subdiv; } -static bool multires_reshape_from_vertcos(struct Depsgraph *depsgraph, - Object *object, - const MultiresModifierData *mmd, - const float (*deformed_verts)[3], - const int num_deformed_verts, - const bool use_render_params) +static bool multires_reshape_from_vertcos( +struct Depsgraph *depsgraph, +Object *object, +const MultiresModifierData *mmd, +const float (*deformed_verts)[3], +const int num_deformed_verts, +const bool use_render_params) { Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); Mesh *coarse_mesh = object->data; @@ -476,7 +477,8 @@ bool multiresModifier_reshapeFromDeformModifier( Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); /* Perform sanity checks and early output. */ if (multires_get_level( - scene_eval, object, &highest_mmd, false, true) == 0) { + scene_eval, object, &highest_mmd, false, true) == 0) + { return false; } /* Create mesh for the multires, ignoring any further modifiers (leading diff --git a/source/blender/blenkernel/intern/subdiv_foreach.c b/source/blender/blenkernel/intern/subdiv_foreach.c index 0f02df82cd5..d77bbe8a15d 100644 --- a/source/blender/blenkernel/intern/subdiv_foreach.c +++ b/source/blender/blenkernel/intern/subdiv_foreach.c @@ -746,15 +746,14 @@ static void subdiv_foreach_inner_vertices_special( const int coarse_poly_index = coarse_poly - coarse_mesh->mpoly; int ptex_face_index = ctx->face_ptex_offset[coarse_poly_index]; const int start_vertex_index = ctx->subdiv_vertex_offset[coarse_poly_index]; - int subdiv_vertex_index = - ctx->vertices_inner_offset + start_vertex_index; + int subdiv_vertex_index = ctx->vertices_inner_offset + start_vertex_index; ctx->foreach_context->vertex_inner( - ctx->foreach_context, + ctx->foreach_context, tls, - ptex_face_index, - 1.0f, 1.0f, - coarse_poly_index, 0, - subdiv_vertex_index); + ptex_face_index, + 1.0f, 1.0f, +
[Bf-blender-cvs] [1c63a3a1004] blender2.8: UI: re-arrange some items in context menu
Commit: 1c63a3a100414f504b25571fd0b8fd29af42922c Author: Pablo Vazquez Date: Fri Aug 24 01:37:55 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB1c63a3a100414f504b25571fd0b8fd29af42922c UI: re-arrange some items in context menu * Move Add to Quick Favorites before Assign Shortcut, as it is more often that we add items to favorites, than changing shortcuts. * Move Header menu last. In some cases the Online Manual for that item would appear after the header menu. * No icon for "Remove from Quick Favorites", matches Remove Shortcut === M source/blender/editors/interface/interface_context_menu.c === diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 281c2fb7104..253de3d3d5a 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -639,6 +639,33 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) } } + /* Favorites Menu */ + if (ui_but_is_user_menu_compatible(C, but)) { + uiBlock *block = uiLayoutGetBlock(layout); + const int w = uiLayoutGetWidth(layout); + uiBut *but2; + + but2 = uiDefIconTextBut( + block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Quick Favorites"), + 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, + "Add to a user defined context menu (stored in the user preferences)"); + UI_but_func_set(but2, popup_user_menu_add_or_replace_func, but, NULL); + + bUserMenu *um = ED_screen_user_menu_find(C); + if (um) { + bUserMenuItem *umi = ui_but_user_menu_find(C, but, um); + if (umi != NULL) { + but2 = uiDefIconTextBut( + block, UI_BTYPE_BUT, 0, ICON_BLANK1, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Quick Favorites"), + 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + UI_but_func_set(but2, popup_user_menu_remove_func, um, umi); + } + } + uiItemS(layout); + } + /* Operator buttons */ if (but->optype) { uiBlock *block = uiLayoutGetBlock(layout); @@ -694,42 +721,6 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) uiItemS(layout); } - /* Favorites Menu */ - if (ui_but_is_user_menu_compatible(C, but)) { - uiBlock *block = uiLayoutGetBlock(layout); - const int w = uiLayoutGetWidth(layout); - uiBut *but2; - - but2 = uiDefIconTextBut( - block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Quick Favorites"), - 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, - "Add to a user defined context menu (stored in the user preferences)"); - UI_but_func_set(but2, popup_user_menu_add_or_replace_func, but, NULL); - - bUserMenu *um = ED_screen_user_menu_find(C); - if (um) { - bUserMenuItem *umi = ui_but_user_menu_find(C, but, um); - if (umi != NULL) { - but2 = uiDefIconTextBut( - block, UI_BTYPE_BUT, 0, ICON_CANCEL, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Quick Favorites"), - 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - UI_but_func_set(but2, popup_user_menu_remove_func, um, umi); - } - } - uiItemS(layout); - } - - /* Show header tools for header buttons. */ - if (ui_block_is_popup_any(but->block) == false) { - ARegion *ar = CTX_wm_region(C); - if (ar && (ar->regiontype == RGN_TYPE_HEADER)) { - uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL); - uiItemS(layout); - } - } - { /* Docs */ char buf[512]; @@ -773,6 +764,14 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) uiItemFullO(layout, "UI_OT_edittranslation_init", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL); } + /* Show header tools for header buttons. */ + if (ui_bl
[Bf-blender-cvs] [db5bacb9882] temp-select-axis: MESH_OT_select_axis: Different approach to world fix, use planes
Commit: db5bacb988268e2dcd312b4537904bc4ef493622 Author: Dalai Felinto Date: Thu Aug 23 19:39:20 2018 -0300 Branches: temp-select-axis https://developer.blender.org/rBdb5bacb988268e2dcd312b4537904bc4ef493622 MESH_OT_select_axis: Different approach to world fix, use planes This is supposed to be faster than multiplying each vertex by the object matrix. That said it is not working at the moment. === M source/blender/editors/mesh/editmesh_select.c === diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 80fac887ac3..2ffbe49a538 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -4351,6 +4351,14 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) BMVert *v_act = BM_mesh_active_vert_get(bm); const int axis = RNA_enum_get(op->ptr, "axis"); const int mode = RNA_enum_get(op->ptr, "mode"); + const float normal_lookup[6][3] = { + { 1.0f, 0.0f, 0.0f}, /* +X */ + { 0.0f, 1.0f, 0.0f}, /* +Y */ + { 0.0f, 0.0f, 1.0f}, /* +Z */ + {-1.0f, 0.0f, 0.0f}, /* -X */ + { 0.0f,-1.0f, 0.0f}, /* -Y */ + { 0.0f, 0.0f,-1.0f}, /* -Z */ + }; if (v_act == NULL) { BKE_report(op->reports, RPT_WARNING, "This operator requires an active vertex (last selected)"); @@ -4360,37 +4368,51 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) BMVert *v; BMIter iter; const float limit = RNA_float_get(op->ptr, "threshold"); + const float limit_squared = limit * limit; - float value; - float vertex_world[3]; + float plane_normal[3]; + float plane_coord[3]; + float plane[4]; - mul_v3_m4v3(vertex_world, obedit->obmat, v_act->co); - value = vertex_world[axis]; + mul_v3_m4v3(plane_coord, obedit->obmat, v_act->co); if (mode == SELECT_AXIS_NEGATIVE) { - value -= limit; + plane_coord[axis] -= limit; + copy_v3_v3(plane_normal, normal_lookup[axis + 3]); } else if (mode == SELECT_AXIS_POSITIVE) { - value += limit; + plane_coord[axis] += limit; + copy_v3_v3(plane_normal, normal_lookup[axis]); + } + else { + copy_v3_v3(plane_normal, normal_lookup[axis]); } + /* Convert plane to object space. */ + float imat[4][4]; + + invert_m4_m4(imat, obedit->obmat); + mul_m4_v3(imat, plane_coord); + mul_transposed_mat3_m4_v3(obedit->obmat, plane_normal); + + plane_from_point_normal_v3(plane, plane_coord, plane_normal); + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN)) { - float v_iter_world[3]; - mul_v3_m4v3(v_iter_world, obedit->obmat, v->co); + float dist = dist_signed_squared_to_plane_v3(v->co, plane); switch (mode) { case SELECT_AXIS_ALIGNED: - if (fabsf(v_iter_world[axis] - value) < limit) { + if (fabsf(dist) < limit_squared) { BM_vert_select_set(bm, v, true); } break; case SELECT_AXIS_NEGATIVE: - if (v_iter_world[axis] > value) { + if (dist <= 0.0f) { BM_vert_select_set(bm, v, true); } break; case SELECT_AXIS_POSITIVE: - if (v_iter_world[axis] < value) { + if (dist >= 0.0f) { BM_vert_select_set(bm, v, true); } break; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [880fb78a591] temp-select-axis: MESH_OT_select_axis: Make it work with world axis, not local ones
Commit: 880fb78a591b91080ccf0e096087797a1d0109c2 Author: Dalai Felinto Date: Thu Aug 23 18:23:51 2018 -0300 Branches: temp-select-axis https://developer.blender.org/rB880fb78a591b91080ccf0e096087797a1d0109c2 MESH_OT_select_axis: Make it work with world axis, not local ones === M source/blender/editors/mesh/editmesh_select.c === diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index fdf6ac5685f..80fac887ac3 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -4360,7 +4360,12 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) BMVert *v; BMIter iter; const float limit = RNA_float_get(op->ptr, "threshold"); - float value = v_act->co[axis]; + + float value; + float vertex_world[3]; + + mul_v3_m4v3(vertex_world, obedit->obmat, v_act->co); + value = vertex_world[axis]; if (mode == SELECT_AXIS_NEGATIVE) { value -= limit; @@ -4371,18 +4376,23 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN)) { + float v_iter_world[3]; + mul_v3_m4v3(v_iter_world, obedit->obmat, v->co); switch (mode) { case SELECT_AXIS_ALIGNED: - if (fabsf(v->co[axis] - value) < limit) + if (fabsf(v_iter_world[axis] - value) < limit) { BM_vert_select_set(bm, v, true); + } break; case SELECT_AXIS_NEGATIVE: - if (v->co[axis] > value) + if (v_iter_world[axis] > value) { BM_vert_select_set(bm, v, true); + } break; case SELECT_AXIS_POSITIVE: - if (v->co[axis] < value) + if (v_iter_world[axis] < value) { BM_vert_select_set(bm, v, true); + } break; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [67e60688a56] temp-select-axis: MESH_OT_select_axis: cleanup (use enum instead of hardcoded values)
Commit: 67e60688a569cd2a6649ef96611f0a6504274140 Author: Dalai Felinto Date: Thu Aug 23 18:12:53 2018 -0300 Branches: temp-select-axis https://developer.blender.org/rB67e60688a569cd2a6649ef96611f0a6504274140 MESH_OT_select_axis: cleanup (use enum instead of hardcoded values) === M source/blender/editors/mesh/editmesh_select.c === diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index bbdb0a904a9..fdf6ac5685f 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -4330,6 +4330,18 @@ void MESH_OT_select_ungrouped(wmOperatorType *ot) /** \name Select Axis Operator * \{ */ +enum { + SELECT_AXIS_POSITIVE = 0, + SELECT_AXIS_NEGATIVE = 1, + SELECT_AXIS_ALIGNED = 2, +}; + +enum { + SELECT_AXIS_X = 0, + SELECT_AXIS_Y = 1, + SELECT_AXIS_Z = 2, +}; + /* BMESH_TODO - some way to select on an arbitrary axis */ static int edbm_select_axis_exec(bContext *C, wmOperator *op) { @@ -4338,7 +4350,7 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) BMesh *bm = em->bm; BMVert *v_act = BM_mesh_active_vert_get(bm); const int axis = RNA_enum_get(op->ptr, "axis"); - const int mode = RNA_enum_get(op->ptr, "mode"); /* -1 == aligned, 0 == neg, 1 == pos */ + const int mode = RNA_enum_get(op->ptr, "mode"); if (v_act == NULL) { BKE_report(op->reports, RPT_WARNING, "This operator requires an active vertex (last selected)"); @@ -4350,23 +4362,25 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) const float limit = RNA_float_get(op->ptr, "threshold"); float value = v_act->co[axis]; - if (mode == 0) + if (mode == SELECT_AXIS_NEGATIVE) { value -= limit; - else if (mode == 1) + } + else if (mode == SELECT_AXIS_POSITIVE) { value += limit; + } BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN)) { switch (mode) { - case -1: /* aligned */ + case SELECT_AXIS_ALIGNED: if (fabsf(v->co[axis] - value) < limit) BM_vert_select_set(bm, v, true); break; - case 0: /* neg */ + case SELECT_AXIS_NEGATIVE: if (v->co[axis] > value) BM_vert_select_set(bm, v, true); break; - case 1: /* pos */ + case SELECT_AXIS_POSITIVE: if (v->co[axis] < value) BM_vert_select_set(bm, v, true); break; @@ -4384,16 +4398,16 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) void MESH_OT_select_axis(wmOperatorType *ot) { static const EnumPropertyItem axis_mode_items[] = { - {0, "POSITIVE", 0, "Positive Axis", ""}, - {1, "NEGATIVE", 0, "Negative Axis", ""}, - {-1, "ALIGNED", 0, "Aligned Axis", ""}, + {SELECT_AXIS_POSITIVE, "POSITIVE", 0, "Positive Axis", ""}, + {SELECT_AXIS_NEGATIVE, "NEGATIVE", 0, "Negative Axis", ""}, + {SELECT_AXIS_ALIGNED, "ALIGNED", 0, "Aligned Axis", ""}, {0, NULL, 0, NULL, NULL} }; static const EnumPropertyItem axis_items_xyz[] = { - {0, "X_AXIS", 0, "X Axis", ""}, - {1, "Y_AXIS", 0, "Y Axis", ""}, - {2, "Z_AXIS", 0, "Z Axis", ""}, + {SELECT_AXIS_X, "X_AXIS", 0, "X Axis", ""}, + {SELECT_AXIS_Y, "Y_AXIS", 0, "Y Axis", ""}, + {SELECT_AXIS_Z, "Z_AXIS", 0, "Z Axis", ""}, {0, NULL, 0, NULL, NULL} }; @@ -4410,8 +4424,8 @@ void MESH_OT_select_axis(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "mode", axis_mode_items, 0, "Axis Mode", "Axis side to use when selecting"); - RNA_def_enum(ot->srna, "axis", axis_items_xyz, 0, "Axis", "Select the axis to compare each vertex on"); + RNA_def_enum(ot->srna, "mode", axis_mode_items, SELECT_AXIS_NEGATIVE, "Axis Mode", "Axis side to use when s
[Bf-blender-cvs] [61e194757bc] fluid-mantaflow: improved cache directory handling
Commit: 61e194757bc5afb8a9ab52703f981144db8a2349 Author: Sebastián Barschkis Date: Fri Aug 24 00:25:27 2018 +0200 Branches: fluid-mantaflow https://developer.blender.org/rB61e194757bc5afb8a9ab52703f981144db8a2349 improved cache directory handling === M intern/mantaflow/intern/FLUID.cpp M source/blender/blenkernel/intern/smoke.c M source/blender/editors/physics/physics_fluid.c === diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp index ada723cc893..7c67df19d0c 100644 --- a/intern/mantaflow/intern/FLUID.cpp +++ b/intern/mantaflow/intern/FLUID.cpp @@ -896,6 +896,7 @@ int FLUID::updateFlipStructures(SmokeModifierData *smd, int framenr) std::cout << "FLUID::updateFlipStructures()" << std::endl; if (!mUsingLiquid) return 0; + if (BLI_path_is_rel(smd->domain->cache_directory)) return 0; std::ostringstream ss; char cacheDir[FILE_MAX], targetFile[FILE_MAX]; @@ -932,6 +933,7 @@ int FLUID::updateMeshStructures(SmokeModifierData *smd, int framenr) std::cout << "FLUID::updateMeshStructures()" << std::endl; if (!mUsingMesh) return 0; + if (BLI_path_is_rel(smd->domain->cache_directory)) return 0; std::ostringstream ss; char cacheDir[FILE_MAX], targetFile[FILE_MAX]; @@ -969,6 +971,7 @@ int FLUID::updateParticleStructures(SmokeModifierData *smd, int framenr) std::cout << "FLUID::updateParticleStructures()" << std::endl; if (!mUsingDrops && !mUsingBubbles && !mUsingFloats && !mUsingTracers) return 0; + if (BLI_path_is_rel(smd->domain->cache_directory)) return 0; std::ostringstream ss; char cacheDir[FILE_MAX], targetFile[FILE_MAX]; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index f840ec5e2e3..e8b830a11f4 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -549,7 +549,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd) smd->domain->particle_tracer_amount = 0.5f; smd->domain->particle_tracer_life = 250.0f; smd->domain->particle_tracer_max = 2; - smd->domain->particle_type = 0; + smd->domain->particle_type = FLUID_DOMAIN_PARTICLE_FLIP; smd->domain->particle_scale = 1; /* fluid guiding options */ @@ -798,6 +798,7 @@ void smokeModifier_copy(const struct SmokeModifierData *smd, struct SmokeModifie tsmd->domain->cache_data_format = smd->domain->cache_data_format; tsmd->domain->cache_particle_format = smd->domain->cache_particle_format; tsmd->domain->cache_noise_format = smd->domain->cache_noise_format; + BLI_strncpy(tsmd->domain->cache_directory, smd->domain->cache_directory, sizeof(tsmd->domain->cache_directory)); /* viewport display options */ tsmd->domain->viewport_display_mode = smd->domain->viewport_display_mode; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 70d381694c9..635a9315cee 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -1178,6 +1178,51 @@ static bool fluid_manta_initjob(bContext *C, FluidMantaflowJob *job, wmOperator return true; } + +static bool fluid_manta_initpaths(FluidMantaflowJob *job, ReportList *reports) +{ + SmokeDomainSettings *sds = job->smd->domain; + char tmpDir[FILE_MAX]; + tmpDir[0] = '\0'; + + const char *relbase = modifier_path_relbase(job->bmain, job->ob); + + /* We do not accept empty paths, they can end in random places silently, see T51176. */ + if (sds->cache_directory[0] == '\0') { + modifier_path_init(sds->cache_directory, sizeof(sds->cache_directory), FLUID_DOMAIN_DIR_DEFAULT); + BKE_reportf(reports, RPT_WARNING, "Fluid Mantaflow: Empty cache path, reset to default '%s'", sds->cache_directory); + } + + BLI_strncpy(tmpDir, sds->cache_directory, FILE_MAXDIR); + BLI_path_abs(tmpDir, relbase); + + /* Ensure whole path exists */ + const bool dir_exists = BLI_dir_create_recursive(tmpDir); + + /* We change path to some presumably valid default value, but do not allow bake process to continue, +* this gives user chance to set manually another path. */ + if (!dir_exists) { + modifier_path_init(sds->cache_directory, sizeof(sds->cache_directory), FLUID_DOMAIN_DIR_DEFAULT); + + BKE_reportf(reports, RPT_ERROR, "Fluid Mantaflow: Could not create cache directory '%s', reset to default '%s'", +
[Bf-blender-cvs] [7b648f2b4c1] fluid-mantaflow: secondary particle naming update
Commit: 7b648f2b4c17c5183580a713085985b2275f5954 Author: Sebastián Barschkis Date: Fri Aug 24 00:24:01 2018 +0200 Branches: fluid-mantaflow https://developer.blender.org/rB7b648f2b4c17c5183580a713085985b2275f5954 secondary particle naming update === M intern/mantaflow/intern/FLUID.cpp M source/blender/blenkernel/intern/particle_system.c M source/blender/blenkernel/intern/smoke.c M source/blender/makesdna/DNA_smoke_types.h M source/blender/makesrna/intern/rna_smoke.c === diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp index 33671341d4c..ada723cc893 100644 --- a/intern/mantaflow/intern/FLUID.cpp +++ b/intern/mantaflow/intern/FLUID.cpp @@ -70,9 +70,9 @@ FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID) mUsingGuiding = smd->domain->flags & FLUID_DOMAIN_USE_GUIDING; mUsingLiquid = smd->domain->type == FLUID_DOMAIN_TYPE_LIQUID; mUsingSmoke= smd->domain->type == FLUID_DOMAIN_TYPE_GAS; - mUsingDrops= smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_DROP; + mUsingDrops= smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY; mUsingBubbles = smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE; - mUsingFloats = smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FLOAT; + mUsingFloats = smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FOAM; mUsingTracers = smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_TRACER; // Simulation constants @@ -788,14 +788,14 @@ std::string FLUID::getRealValue(const std::string& varName, SmokeModifierData * else if (varName == "FLUID_DOMAIN_SIZE") ss << smd->domain->domain_size; else if (varName == "SNDPARTICLE_TYPES") { - if (smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_DROP) { + if (smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) { ss << "PtypeSpray"; } if (smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE) { if (!ss.str().empty()) ss << "|"; ss << "PtypeBubble"; } - if (smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FLOAT) { + if (smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FOAM) { if (!ss.str().empty()) ss << "|"; ss << "PtypeFoam"; } @@ -806,8 +806,8 @@ std::string FLUID::getRealValue(const std::string& varName, SmokeModifierData * if (ss.str().empty()) ss << "0"; } else if (varName == "USING_SNDPARTS") { - tmpVar = (FLUID_DOMAIN_PARTICLE_DROP | FLUID_DOMAIN_PARTICLE_BUBBLE | - FLUID_DOMAIN_PARTICLE_FLOAT | FLUID_DOMAIN_PARTICLE_TRACER); + tmpVar = (FLUID_DOMAIN_PARTICLE_SPRAY | FLUID_DOMAIN_PARTICLE_BUBBLE | + FLUID_DOMAIN_PARTICLE_FOAM | FLUID_DOMAIN_PARTICLE_TRACER); ss << (((smd->domain->particle_type & tmpVar)) ? "True" : "False"); } else if (varName == "GUIDING_ALPHA") ss << smd->domain->guiding_alpha; @@ -1496,9 +1496,9 @@ void FLUID::exportLiquidScript(SmokeModifierData *smd) BLI_path_make_safe(cacheDirScript); bool mesh = smd->domain->flags & FLUID_DOMAIN_USE_MESH; - bool drops= smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_DROP; + bool drops= smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY; bool bubble = smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE; - bool floater = smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FLOAT; + bool floater = smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FOAM; bool tracer = smd->domain->particle_type & FLUID_DOMAIN_PARTICLE_TRACER; bool obstacle = smd->domain->active_fields & FLUID_DOMAIN_ACTIVE_OBSTACLE; bool guiding = smd->domain->active_fields & FLUID_DOMAIN_ACTIVE_GUIDING; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index e0535fd4916..269dda13b2b 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3848,9 +3848,9 @@ static void particles_manta_step( // Sanity check: parts also enabled in fluid domain? if ((part->type == PART_MANTA_FLIP && (sds->particle_type & FLUID_DOMAIN_PARTICLE_FLIP)==0) || - (part->type == PART_MANTA_SPRAY && (sds->particle_type & FLUID_DOMAIN_PARTICLE_DROP)==0) || + (part->type == PART_MANTA_SPRAY && (sds->particle_type & FLUID_DOMAIN_PART
[Bf-blender-cvs] [cf64a83edc2] blender2.8: UI: Fix area border thickness over top and bottom bar with glScissors
Commit: cf64a83edc2621aaeafed417f22081ef7b81ad1b Author: Clément Foucault Date: Thu Aug 23 23:02:38 2018 +0200 Branches: blender2.8 https://developer.blender.org/rBcf64a83edc2621aaeafed417f22081ef7b81ad1b UI: Fix area border thickness over top and bottom bar with glScissors === M source/blender/editors/screen/screen_draw.c === diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 60fe1dfa483..5371fcfd6d4 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -221,8 +221,8 @@ static void draw_join_shape(ScrArea *sa, char dir, unsigned int pos) static void do_vert_pair(GPUVertBuf *vbo, uint pos, uint *vidx, int corner, int i) { float inter[2], exter[2]; - inter[0] = cosf((corner * 2.0f * M_PI / 4.0f) + (i * M_PI_2 / (CORNER_RESOLUTION - 1.0f))); - inter[1] = sinf((corner * 2.0f * M_PI / 4.0f) + (i * M_PI_2 / (CORNER_RESOLUTION - 1.0f))); + inter[0] = cosf(corner * M_PI_2 + (i * M_PI_2 / (CORNER_RESOLUTION - 1.0f))); + inter[1] = sinf(corner * M_PI_2 + (i * M_PI_2 / (CORNER_RESOLUTION - 1.0f))); /* Snap point to edge */ float div = 1.0f / max_ff(fabsf(inter[0]), fabsf(inter[1])); @@ -377,6 +377,20 @@ void ED_screen_draw_edges(wmWindow *win) ScrArea *sa; + rcti scissor_rect; + BLI_rcti_init_minmax(&scissor_rect); + for (sa = screen->areabase.first; sa; sa = sa->next) { + BLI_rcti_do_minmax_v(&scissor_rect, (int[2]){sa->v1->vec.x, sa->v1->vec.y}); + BLI_rcti_do_minmax_v(&scissor_rect, (int[2]){sa->v3->vec.x, sa->v3->vec.y}); + } + + GPU_scissor(scissor_rect.xmin, + scissor_rect.ymin, + BLI_rcti_size_x(&scissor_rect) + 1, + BLI_rcti_size_y(&scissor_rect) + 1); + + glEnable(GL_SCISSOR_TEST); + UI_GetThemeColor4fv(TH_EDITOR_OUTLINE, col); col[3] = 1.0f / 8.0f; corner_scale = U.pixelsize * 8.0f; @@ -406,6 +420,8 @@ void ED_screen_draw_edges(wmWindow *win) drawscredge_area(sa, winsize_x, winsize_y, edge_thickness); } + glDisable(GL_SCISSOR_TEST); + screen->do_draw = false; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [19fe267823b] blender2.8: Hide Grease Pencil ornaments if overlay setting is disabled
Commit: 19fe267823b8a0324318729dbc44afd37dc09bcf Author: Pablo Vazquez Date: Thu Aug 23 22:47:53 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB19fe267823b8a0324318729dbc44afd37dc09bcf Hide Grease Pencil ornaments if overlay setting is disabled === M source/blender/draw/modes/object_mode.c === diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index c8f14892646..e00e6dbdd0a 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -2754,6 +2754,9 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) DRW_shgroup_empty(sgl, ob, view_layer); break; case OB_GPENCIL: + if (hide_object_extra) { + break; + } DRW_shgroup_gpencil(sgl, ob, view_layer); break; case OB_SPEAKER: ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [bd7e14f48c0] blender2.8: Cleanup: remove unused code
Commit: bd7e14f48c05263eb8228d1221184d20fbdeb669 Author: Clément Foucault Date: Thu Aug 23 22:34:25 2018 +0200 Branches: blender2.8 https://developer.blender.org/rBbd7e14f48c05263eb8228d1221184d20fbdeb669 Cleanup: remove unused code === M source/blender/editors/screen/screen_draw.c === diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 928ed05f1de..60fe1dfa483 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -295,140 +295,8 @@ static GPUBatch *batch_screen_edges_get(int *corner_len) return screen_edges_batch; } -static void drawscredge_corner_geometry( -int sizex, int sizey, -int corner_x, int corner_y, -int center_x, int center_y, -double angle_offset, -const float *color) -{ - const int radius = ABS(corner_x - center_x); - const int line_thickness = U.pixelsize; - - if (corner_x < center_x) { - if (corner_x > 0.0f) { - /* Left (internal) edge. */ - corner_x += line_thickness; - center_x += line_thickness; - } - } - else { - /* Right (internal) edge. */ - if (corner_x < sizex - 1) { - corner_x += 1 - line_thickness; - center_x += 1 - line_thickness; - } - else { - /* Corner case, extreme right edge. */ - corner_x += 1; - center_x += 1; - } - } - - if (corner_y < center_y) { - if (corner_y > 0.0f) { - /* Bottom (internal) edge. */ - corner_y += line_thickness; - center_y += line_thickness; - } - } - else { - /* Top (internal) edge. */ - if (corner_y < sizey) { - corner_y += 1 - line_thickness; - center_y += 1 - line_thickness; - } - } - - float tri_array[CORNER_RESOLUTION + 1][2]; - - tri_array[0][0] = corner_x; - tri_array[0][1] = corner_y; - - for (int i = 0; i < CORNER_RESOLUTION; i++) { - double angle = angle_offset + (M_PI_2 * ((float)i / (CORNER_RESOLUTION - 1))); - float x = center_x + (radius * cos(angle)); - float y = center_y + (radius * sin(angle)); - tri_array[i + 1][0] = x; - tri_array[i + 1][1] = y; - } - - UI_draw_anti_fan(tri_array, CORNER_RESOLUTION + 1, color); -} - #undef CORNER_RESOLUTION -static void drawscredge_corner(ScrArea *sa, int sizex, int sizey) -{ - int size = 10 * U.pixelsize; - float color[4] = {0}; - UI_GetThemeColor4fv(TH_EDITOR_OUTLINE, color); - - /* Bottom-Left. */ - drawscredge_corner_geometry(sizex, sizey, - sa->v1->vec.x, - sa->v1->vec.y, - sa->v1->vec.x + size, - sa->v1->vec.y + size, - M_PI_2 * 2.0f, - color); - - /* Top-Left. */ - drawscredge_corner_geometry(sizex, sizey, - sa->v2->vec.x, - sa->v2->vec.y, - sa->v2->vec.x + size, - sa->v2->vec.y - size, - M_PI_2, - color); - - /* Top-Right. */ - drawscredge_corner_geometry(sizex, sizey, - sa->v3->vec.x, - sa->v3->vec.y, - sa->v3->vec.x - size, - sa->v3->vec.y - size, - 0.0f, - color); - - /* Bottom-Right. */ - drawscredge_corner_geometry(sizex, sizey, - sa->v4->vec.x, - sa->v4->vec.y, - sa->v4->vec.x - size, - sa->v4->vec.y + size, - M_PI_2 * 3.0f, - color); - - /* Wrap up the corners with a nice embossing. */ - rcti rect = sa->totrct; - - uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - - immUniformColor4fv(color); - immBeginAtMost(GPU_PRIM_LINES, 8); - - /* Right. */ - immVertex2f(
[Bf-blender-cvs] [34b3d6e2f88] blender2.8: UI: Optimize the area border drawing
Commit: 34b3d6e2f88c275032cfec5aacd036cb65d20dc3 Author: Clément Foucault Date: Thu Aug 23 22:29:29 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB34b3d6e2f88c275032cfec5aacd036cb65d20dc3 UI: Optimize the area border drawing It is was not really a bottleneck but it was triggering my OCD when 1/3rd of the drawcalls in a normal scene were basically only caused by this. === M source/blender/editors/screen/screen_draw.c M source/blender/gpu/CMakeLists.txt M source/blender/gpu/GPU_shader.h M source/blender/gpu/intern/gpu_shader.c A source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl === diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 10d72d74b22..928ed05f1de 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -24,12 +24,14 @@ #include "ED_screen.h" +#include "GPU_batch_presets.h" #include "GPU_framebuffer.h" #include "GPU_immediate.h" #include "GPU_matrix.h" #include "GPU_state.h" #include "BLI_math.h" +#include "BLI_rect.h" #include "WM_api.h" #include "WM_types.h" @@ -214,7 +216,85 @@ static void draw_join_shape(ScrArea *sa, char dir, unsigned int pos) } } -#define CORNER_RESOLUTION 10 +#define CORNER_RESOLUTION 9 + +static void do_vert_pair(GPUVertBuf *vbo, uint pos, uint *vidx, int corner, int i) +{ + float inter[2], exter[2]; + inter[0] = cosf((corner * 2.0f * M_PI / 4.0f) + (i * M_PI_2 / (CORNER_RESOLUTION - 1.0f))); + inter[1] = sinf((corner * 2.0f * M_PI / 4.0f) + (i * M_PI_2 / (CORNER_RESOLUTION - 1.0f))); + + /* Snap point to edge */ + float div = 1.0f / max_ff(fabsf(inter[0]), fabsf(inter[1])); + mul_v2_v2fl(exter, inter, div); + exter[0] = roundf(exter[0]); + exter[1] = roundf(exter[1]); + + if (i == 0 || i == (CORNER_RESOLUTION - 1)) { + copy_v2_v2(inter, exter); + } + + /* Line width is 20% of the entire corner size. */ + const float line_width = 0.2f; + mul_v2_fl(inter, 1.0f - line_width); + mul_v2_fl(exter, 1.0f + line_width); + + switch (corner) { + case 0: + add_v2_v2(inter, (float[2]){-1.0f, -1.0f}); + add_v2_v2(exter, (float[2]){-1.0f, -1.0f}); + break; + case 1: + add_v2_v2(inter, (float[2]){1.0f, -1.0f}); + add_v2_v2(exter, (float[2]){1.0f, -1.0f}); + break; + case 2: + add_v2_v2(inter, (float[2]){1.0f, 1.0f}); + add_v2_v2(exter, (float[2]){1.0f, 1.0f}); + break; + case 3: + add_v2_v2(inter, (float[2]){-1.0f, 1.0f}); + add_v2_v2(exter, (float[2]){-1.0f, 1.0f}); + break; + } + + GPU_vertbuf_attr_set(vbo, pos, (*vidx)++, inter); + GPU_vertbuf_attr_set(vbo, pos, (*vidx)++, exter); +} + +static GPUBatch *batch_screen_edges_get(int *corner_len) +{ + static GPUBatch *screen_edges_batch = NULL; + + if (screen_edges_batch == NULL) { + GPUVertFormat format = {0}; + uint pos = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + + GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format); + GPU_vertbuf_data_alloc(vbo, CORNER_RESOLUTION * 2 * 4 * 8 + 2); + + uint vidx = 0; + /* Note jitter is applied in the shader. */ + for (int jit = 0; jit < 8; ++jit) { + for (int corner = 0; corner < 4; ++corner) { + for (int c = 0; c < CORNER_RESOLUTION; ++c) { + do_vert_pair(vbo, pos, &vidx, corner, c); + } + } + } + /* close the loop */ + do_vert_pair(vbo, pos, &vidx, 0, 0); + + screen_edges_batch = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, NULL, GPU_BATCH_OWNS_VBO); + gpu_batch_presets_register(screen_edges_batch); + } + + if (corner_len) { + *corner_len = CORNER_RESOLUTION * 2; + } + return screen_edges_batch; +} + static void drawscredge_corner_geometry( int sizex, int sizey, int corner_x, int corner_y, @@ -373,59 +453,47 @@ static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir), unsigned int immRectf(pos, sa->v1->vec.x, sa->v1->vec.y, sa->v3->vec.x, sa->v3->vec.y); } -static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, short x2, short y2, unsigned int pos) +static void drawscredge_are
[Bf-blender-cvs] [fb7fc3be194] blender2.8: Wireframe: Add support for sculpt mode
Commit: fb7fc3be194ba324b84eaa1c538bf3f8b74c726e Author: Clément Foucault Date: Thu Aug 23 18:05:50 2018 +0200 Branches: blender2.8 https://developer.blender.org/rBfb7fc3be194ba324b84eaa1c538bf3f8b74c726e Wireframe: Add support for sculpt mode Now wireframe does update in sculpt mode using the sculpt mesh VBOs. The only thing that does not work is simplified wireframe (the wireframe slider) when the mesh is shaded flat. In this case all edges are shown. === M source/blender/draw/modes/overlay_mode.c M source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl === diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c index 3bf765a9695..2e16ba5e847 100644 --- a/source/blender/draw/modes/overlay_mode.c +++ b/source/blender/draw/modes/overlay_mode.c @@ -54,6 +54,8 @@ typedef struct OVERLAY_Data { typedef struct OVERLAY_PrivateData { DRWShadingGroup *face_orientation_shgrp; + DRWShadingGroup *sculpt_wires_full; + DRWShadingGroup *sculpt_wires; View3DOverlay overlay; float wire_step_param[2]; bool ghost_stencil_test; @@ -67,6 +69,8 @@ static struct { /* Wireframe shader */ struct GPUShader *face_wireframe_sh; struct GPUShader *face_wireframe_pretty_sh; + struct GPUShader *face_wireframe_sculpt_sh; + struct GPUShader *face_wireframe_sculpt_pretty_sh; } e_data = {NULL}; /* Shaders */ @@ -115,6 +119,21 @@ static void overlay_engine_init(void *vedata) use_geom ? "#define USE_GEOM_SHADER\n" "#define LIGHT_EDGES\n" : "#define LIGHT_EDGES\n"); + + e_data.face_wireframe_sculpt_sh = DRW_shader_create( + datatoc_overlay_face_wireframe_vert_glsl, + datatoc_overlay_face_wireframe_geom_glsl, + datatoc_overlay_face_wireframe_frag_glsl, + "#define USE_SCULPT\n" + "#define USE_GEOM_SHADER\n"); + + e_data.face_wireframe_sculpt_pretty_sh = DRW_shader_create( + datatoc_overlay_face_wireframe_vert_glsl, + datatoc_overlay_face_wireframe_geom_glsl, + datatoc_overlay_face_wireframe_frag_glsl, + "#define USE_SCULPT\n" + "#define USE_GEOM_SHADER\n" + "#define LIGHT_EDGES\n"); } } @@ -147,13 +166,25 @@ static void overlay_cache_init(void *vedata) { /* Wireframe */ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND; + psl->face_wireframe_full_pass = DRW_pass_create("All Face Wires", state); + + stl->g_data->sculpt_wires_full = DRW_shgroup_create(e_data.face_wireframe_sculpt_sh, psl->face_wireframe_full_pass); + DRW_shgroup_uniform_vec2(stl->g_data->sculpt_wires_full, "viewportSize", DRW_viewport_size_get(), 1); + DRWShadingGroup *shgrp = DRW_shgroup_create(e_data.face_wireframe_sh, psl->face_wireframe_full_pass); DRW_shgroup_uniform_vec2(shgrp, "viewportSize", DRW_viewport_size_get(), 1); psl->face_wireframe_pass = DRW_pass_create("Face Wires", state); + + stl->g_data->sculpt_wires = DRW_shgroup_create(e_data.face_wireframe_sculpt_pretty_sh, psl->face_wireframe_pass); + DRW_shgroup_uniform_vec2(stl->g_data->sculpt_wires, "viewportSize", DRW_viewport_size_get(), 1); + DRW_shgroup_uniform_vec2(stl->g_data->sculpt_wires, "wireStepParam", stl->g_data->wire_step_param, 1); + shgrp = DRW_shgroup_create(e_data.face_wireframe_pretty_sh, psl->face_wireframe_pass); DRW_shgroup_uniform_vec2(shgrp, "viewportSize", DRW_viewport_size_get(), 1); + DRW_shgroup_uniform_vec2(shgrp, "wireStepParam", stl->g_data->wire_step_param, 1); + /** * The wireframe threshold ranges from 0.0 to 1.0 * When 1.0 we show all the edges, when 0.5 we show as many as 2.7. @@ -166,8 +197,6 @@ static void overlay_cache_init(void *vedata) const float range = 0.00125f; stl->g_data->wire_step_param[1] = (1.0f - factor) + stl->g_data->overlay.wireframe_threshold * factor; stl->g_data->wire_step_param[0] = stl->g_data->wire_step_param[1] + range; - - DRW_shgroup_uniform_vec2(shgrp, "wireStepParam", stl->g_data->wire_step_param, 1); } } @@ -198,26 +227,37 @@ static void overlay_cache_populate(void *vedata, Object *ob) { /* Don't do that in edit mode. */ if ((ob != draw_ctx->object_edit) && !BKE_object_is_
[Bf-blender-cvs] [13ac92d057e] blender2.8: Fix T55507: Crash due to GPencil brush icon management, when there is no active object.
Commit: 13ac92d057e5c916d170d000554ec000a3c30358 Author: Bastien Montagne Date: Thu Aug 23 21:56:11 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB13ac92d057e5c916d170d000554ec000a3c30358 Fix T55507: Crash due to GPencil brush icon management, when there is no active object. === M source/blender/editors/interface/interface_icons.c === diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 4f77b797ec0..8816d6acec8 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1636,7 +1636,7 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id) } /* reset the icon */ - if (ob->mode & OB_MODE_GPENCIL_PAINT) { + if (ob != NULL && ob->mode & OB_MODE_GPENCIL_PAINT) { switch (br->gpencil_settings->icon_id) { case GP_BRUSH_ICON_PENCIL: br->id.icon_id = ICON_GPBRUSH_PENCIL; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4cde92303f3] blender2.8: Fix T56455: [2.8] Crash when projecting skinwrap curve/path.
Commit: 4cde92303f3db9286b38d65d835db3e358b595f4 Author: Bastien Montagne Date: Thu Aug 23 21:49:14 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB4cde92303f3db9286b38d65d835db3e358b595f4 Fix T56455: [2.8] Crash when projecting skinwrap curve/path. Shrinkwrap is not only a Mesh modifier... === M source/blender/modifiers/intern/MOD_shrinkwrap.c === diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index 5497673a52d..c54fbcf7f87 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -108,11 +108,11 @@ static void deformVerts( struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph); Mesh *mesh_src = mesh; - if (mesh_src == NULL) { + if (mesh_src == NULL && ctx->object->type == OB_MESH) { mesh_src = ctx->object->data; } - BLI_assert(mesh_src->totvert == numVerts); + BLI_assert(mesh_src == NULL || mesh_src->totvert == numVerts); shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, scene, ctx->object, mesh_src, vertexCos, numVerts); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8ec74106f83] blender2.8: Fix single column UI: grey out B-Bone properties when not a B-Bone.
Commit: 8ec74106f83f02d170facb75868783ccae5a222f Author: Alexander Gavrilov Date: Thu Aug 23 22:37:30 2018 +0300 Branches: blender2.8 https://developer.blender.org/rB8ec74106f83f02d170facb75868783ccae5a222f Fix single column UI: grey out B-Bone properties when not a B-Bone. There was a mistake when the UI was converted to the new layout style. === M release/scripts/startup/bl_ui/properties_data_bone.py === diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py index 6d364ee6539..3fc0c66b0b4 100644 --- a/release/scripts/startup/bl_ui/properties_data_bone.py +++ b/release/scripts/startup/bl_ui/properties_data_bone.py @@ -145,38 +145,38 @@ class BONE_PT_curved(BoneButtonsPanel, Panel): layout.prop(bone, "bbone_segments", text="Segments") -col = layout.column() -col.active = bone.bbone_segments > 1 +topcol = layout.column() +topcol.active = bone.bbone_segments > 1 -col = layout.column(align=True) +col = topcol.column(align=True) col.prop(bbone, "bbone_curveinx", text="Curve In X") col.prop(bbone, "bbone_curveiny", text="In Y") -col = layout.column(align=True) +col = topcol.column(align=True) col.prop(bbone, "bbone_curveoutx", text="Curve Out X") col.prop(bbone, "bbone_curveouty", text="Out Y") -col = layout.column(align=True) +col = topcol.column(align=True) col.prop(bbone, "bbone_rollin", text="Roll In") col.prop(bbone, "bbone_rollout", text="Out") col.prop(bone, "use_endroll_as_inroll") -col = layout.column(align=True) +col = topcol.column(align=True) col.prop(bbone, "bbone_scalein", text="Scale In") col.prop(bbone, "bbone_scaleout", text="Out") -col = layout.column(align=True) +col = topcol.column(align=True) col.prop(bbone, "bbone_easein", text="Ease In") col.prop(bbone, "bbone_easeout", text="Out") if pchan: -layout.separator() +topcol.separator() -col = layout.column() +col = topcol.column() col.use_property_split = False col.prop(pchan, "use_bbone_custom_handles") -col = layout.column(align=True) +col = topcol.column(align=True) col.active = pchan.use_bbone_custom_handles col.use_property_split = True ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a6b65c75cd2] blender2.8: Fix T56360: metaball viewport checkbox crash.
Commit: a6b65c75cd2d08afb0bc9543e0528ac583b720a3 Author: Bastien Montagne Date: Thu Aug 23 21:26:44 2018 +0200 Branches: blender2.8 https://developer.blender.org/rBa6b65c75cd2d08afb0bc9543e0528ac583b720a3 Fix T56360: metaball viewport checkbox crash. Do same as for other geometry types to compute bbox, instead of blindly returning NULL `ob->bb`... === M source/blender/blenkernel/BKE_mball.h M source/blender/blenkernel/intern/mball.c M source/blender/blenkernel/intern/object.c === diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index e6874cd064b..2eee5f72c0f 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -32,6 +32,7 @@ * \since March 2001 * \author nzc */ +struct BoundBox; struct Depsgraph; struct Main; struct MetaBall; @@ -54,6 +55,7 @@ bool BKE_mball_is_basis(struct Object *ob); struct Object *BKE_mball_basis_find(struct Scene *scene, struct Object *ob); void BKE_mball_texspace_calc(struct Object *ob); +struct BoundBox *BKE_mball_boundbox_get(struct Object *ob); float *BKE_mball_make_orco(struct Object *ob, struct ListBase *dispbase); void BKE_mball_properties_copy(struct Scene *scene, struct Object *active_object); diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index bc2d7ed79d5..5e4f5614370 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -238,6 +238,23 @@ void BKE_mball_texspace_calc(Object *ob) bb->flag &= ~BOUNDBOX_DIRTY; } +/** Return or compute bbox for given metaball object. */ +BoundBox *BKE_mball_boundbox_get(Object *ob) +{ + BLI_assert(ob->type == OB_MBALL); + + if (ob->bb != NULL && (ob->bb->flag & BOUNDBOX_DIRTY) == 0) { + return ob->bb; + } + + /* This should always only be called with evaluated objects, but currently RNA is a problem here... */ + if (ob->runtime.curve_cache != NULL) { + BKE_mball_texspace_calc(ob); + } + + return ob->bb; +} + float *BKE_mball_make_orco(Object *ob, ListBase *dispbase) { BoundBox *bb; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index b4060d6e60a..aa5c006482a 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2442,7 +2442,7 @@ BoundBox *BKE_object_boundbox_get(Object *ob) bb = BKE_curve_boundbox_get(ob); } else if (ob->type == OB_MBALL) { - bb = ob->bb; + bb = BKE_mball_boundbox_get(ob); } else if (ob->type == OB_LATTICE) { bb = BKE_lattice_boundbox_get(ob); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [34ebf6f82c4] blender2.8: Workspaces: move delete to right click menu, instead of X on tab.
Commit: 34ebf6f82c4a375feb3c5260597042ff41adc7b5 Author: Brecht Van Lommel Date: Thu Aug 23 19:58:54 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB34ebf6f82c4a375feb3c5260597042ff41adc7b5 Workspaces: move delete to right click menu, instead of X on tab. These are not intended to be closed as often as e.g. browser tabs, they are intended to be more persistent and accidental closing should be avoided. === M release/scripts/startup/bl_ui/space_topbar.py M source/blender/editors/include/UI_interface.h M source/blender/editors/interface/interface.c M source/blender/editors/interface/interface_context_menu.c M source/blender/editors/interface/interface_handlers.c M source/blender/editors/interface/interface_intern.h M source/blender/editors/interface/interface_templates.c M source/blender/editors/screen/workspace_edit.c M source/blender/makesrna/intern/rna_ui_api.c === diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 881d3db8a4c..8bf8e40d74e 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -47,8 +47,8 @@ class TOPBAR_HT_upper_bar(Header): if not screen.show_fullscreen: layout.template_ID_tabs( window, "workspace", -new="workspace.workspace_add_menu", -unlink="workspace.workspace_delete", +new="workspace.add_menu", +menu="TOPBAR_MT_workspace_menu", ) else: layout.operator( @@ -622,11 +622,23 @@ class TOPBAR_MT_window_specials(Menu): layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES') +class TOPBAR_MT_workspace_menu(Menu): +bl_label = "Workspace" + +def draw(self, context): +layout = self.layout + +layout.operator("workspace.duplicate", text="Duplicate") +if len(bpy.data.workspaces) > 1: +layout.operator("workspace.delete", text="Delete") + + classes = ( TOPBAR_HT_upper_bar, TOPBAR_HT_lower_bar, TOPBAR_MT_file_specials, TOPBAR_MT_window_specials, +TOPBAR_MT_workspace_menu, INFO_MT_editor_menus, INFO_MT_file, INFO_MT_file_import, diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 5cc3e369439..c88470bd323 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1033,7 +1033,7 @@ void uiTemplateIDPreview( void uiTemplateIDTabs( uiLayout *layout, struct bContext *C, PointerRNA *ptr, const char *propname, -const char *newop, const char *openop, const char *unlinkop, +const char *newop, const char *openop, const char *menu, int filter); void uiTemplateAnyID( uiLayout *layout, struct PointerRNA *ptr, const char *propname, @@ -1221,6 +1221,7 @@ void UI_context_active_but_prop_get_filebrowser( void UI_context_active_but_prop_get_templateID( struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop); +struct ID *UI_context_active_but_get_tab_ID(struct bContext *C); uiBut *UI_region_active_but_get(struct ARegion *ar); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 37c56d454bb..edb0928c57e 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2075,7 +2075,7 @@ static bool ui_but_icon_extra_is_visible_text_clear(const uiBut *but) static bool ui_but_icon_extra_is_visible_search_unlink(const uiBut *but) { - BLI_assert(ELEM(but->type, UI_BTYPE_SEARCH_MENU, UI_BTYPE_TAB)); + BLI_assert(ELEM(but->type, UI_BTYPE_SEARCH_MENU)); return ((but->editstr == NULL) && (but->drawstr[0] != '\0') && (but->flag & UI_BUT_VALUE_CLEAR)); @@ -2118,11 +2118,6 @@ uiButExtraIconType ui_but_icon_extra_get(uiBut *but) return UI_BUT_ICONEXTRA_EYEDROPPER; } break; - case UI_BTYPE_TAB: - if (ui_but_icon_extra_is_visible_search_unlink(but)) { - return UI_BUT_ICONEXTRA_CLEAR; - } - break; default: break; } @@ -3095,7 +3090,6 @@ void ui_but_update_ex(uiBut *but, const bool validate) case UI_BTYPE_TEXT: case UI_BTYPE_SEARCH_MENU: - case UI_BTYPE_TAB: if (!but->editstr) { char str[UI_MAX_DRAW_STR]; diff --git a/source/blender/editors/int
[Bf-blender-cvs] [1de3ae7e427] blender2.8: UI: rename Grease Pencil panels in toolbar to Annotation.
Commit: 1de3ae7e427eace696b760fe6fa298157ee7c544 Author: Brecht Van Lommel Date: Wed Aug 22 16:59:04 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB1de3ae7e427eace696b760fe6fa298157ee7c544 UI: rename Grease Pencil panels in toolbar to Annotation. To match the panels in the N key sidebar. === M release/scripts/startup/bl_ui/properties_data_gpencil.py M release/scripts/startup/bl_ui/properties_grease_pencil_common.py M release/scripts/startup/bl_ui/space_clip.py M release/scripts/startup/bl_ui/space_image.py M release/scripts/startup/bl_ui/space_node.py 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/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py index be35d2ba86c..a63a8e10c08 100644 --- a/release/scripts/startup/bl_ui/properties_data_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py @@ -21,7 +21,6 @@ import bpy from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel from .properties_grease_pencil_common import ( -GreasePencilDataPanel, GreasePencilOnionPanel, ) diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index 7101b855c58..8aa57476ddc 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -76,11 +76,11 @@ def gpencil_active_brush_settings_simple(context, layout): # XXX: To be replaced with active tools -class GreasePencilDrawingToolsPanel: +class AnnotationDrawingToolsPanel: # subclass must set # bl_space_type = 'IMAGE_EDITOR' -bl_label = "Grease Pencil" -bl_category = "Grease Pencil" +bl_label = "Annotation" +bl_category = "Annotation" bl_region_type = 'TOOLS' @classmethod @@ -649,7 +649,7 @@ class GPENCIL_UL_annotation_layer(UIList): layout.label(text="", icon_value=icon) -class GreasePencilDataPanel: +class AnnotationDataPanel: bl_label = "Annotations" bl_region_type = 'UI' bl_options = {'DEFAULT_CLOSED'} diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 1564204c613..c40013b2610 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -23,8 +23,8 @@ from bpy.types import Panel, Header, Menu, UIList from bpy.app.translations import pgettext_iface as iface_ from bl_operators.presets import PresetMenu from .properties_grease_pencil_common import ( -GreasePencilDrawingToolsPanel, -GreasePencilDataPanel, +AnnotationDrawingToolsPanel, +AnnotationDataPanel, ) @@ -1140,7 +1140,7 @@ class CLIP_PT_tools_scenesetup(Panel): # Grease Pencil properties -class CLIP_PT_grease_pencil(GreasePencilDataPanel, CLIP_PT_clip_view_panel, Panel): +class CLIP_PT_grease_pencil(AnnotationDataPanel, CLIP_PT_clip_view_panel, Panel): bl_space_type = 'CLIP_EDITOR' bl_region_type = 'UI' bl_options = {'DEFAULT_CLOSED'} @@ -1150,7 +1150,7 @@ class CLIP_PT_grease_pencil(GreasePencilDataPanel, CLIP_PT_clip_view_panel, Pane # Grease Pencil drawing tools -class CLIP_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel): +class CLIP_PT_tools_grease_pencil_draw(AnnotationDrawingToolsPanel, Panel): bl_space_type = 'CLIP_EDITOR' bl_region_type = 'TOOLS' diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 06615ebb2c3..24673af319e 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -33,8 +33,8 @@ from .properties_paint_common import ( brush_mask_texture_settings, ) from .properties_grease_pencil_common import ( -GreasePencilDrawingToolsPanel, -GreasePencilDataPanel, +AnnotationDrawingToolsPanel, +AnnotationDataPanel, ) from bpy.app.translations import pgettext_iface as iface_ @@ -1436,7 +1436,7 @@ class IMAGE_PT_scope_sample(ImageScopesPanel, Panel): # Grease Pencil properties -class IMAGE_PT_grease_pencil(GreasePencilDataPanel, Panel): +class IMAGE_PT_grease_pencil(AnnotationDataPanel, Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'UI' @@ -1445,7 +1445,7 @@ class IMAGE_PT_grease_pencil(GreasePencilDataPanel, Panel): # Grease Pencil drawing tools. -class IMAGE_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel): +class IMAGE_PT_tools_grease_pencil_draw(AnnotationDrawingToolsPanel, Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'TOOLS' diff --git a/release/scripts/startup/bl_ui/space_node.py b/r
[Bf-blender-cvs] [7fa77cd31d9] blender2.8: Multi-Objects: MESH_OT_loop_select
Commit: 7fa77cd31d925f4c70448e00e4c34d65b6a89f14 Author: Dalai Felinto Date: Thu Aug 23 12:49:56 2018 -0300 Branches: blender2.8 https://developer.blender.org/rB7fa77cd31d925f4c70448e00e4c34d65b6a89f14 Multi-Objects: MESH_OT_loop_select === M source/blender/editors/mesh/editmesh_select.c === diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index a035ba5ab33..bbdb0a904a9 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -1729,21 +1729,32 @@ static void mouse_mesh_loop_edge(BMEditMesh *em, BMEdge *eed, bool select, bool static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, bool ring) { + Base *basact = NULL; + BMVert *eve = NULL; + BMEdge *eed = NULL; + BMFace *efa = NULL; + ViewContext vc; BMEditMesh *em; - BMEdge *eed; bool select = true; bool select_clear = false; bool select_cycle = true; - float dist = ED_view3d_select_dist_px() * 0.f; float mvalf[2]; em_setup_viewcontext(C, &vc); mvalf[0] = (float)(vc.mval[0] = mval[0]); mvalf[1] = (float)(vc.mval[1] = mval[1]); - em = vc.em; - eed = EDBM_edge_find_nearest_ex(&vc, &dist, NULL, true, true, NULL); + BMEditMesh *em_original = vc.em; + const short selectmode = em_original->selectmode; + em_original->selectmode = SCE_SELECT_EDGE; + + if (EDBM_unified_findnearest(&vc, &basact, &eve, &eed, &efa)) { + ED_view3d_viewcontext_init_object(&vc, basact->object); + em = vc.em; + } + em_original->selectmode = selectmode; + if (eed == NULL) { return false; } @@ -1814,9 +1825,10 @@ static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool de } else if (em->selectmode & SCE_SELECT_FACE) { /* Select the face of eed which is the nearest of mouse. */ - BMFace *f, *efa = NULL; + BMFace *f; BMIter iterf; float best_dist = FLT_MAX; + efa = NULL; /* We can't be sure this has already been set... */ ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4d28cfc7077] blender2.8: UI: Subpanels to Cycles Samples for Branched Path Tracing
Commit: 4d28cfc707739f7a42fe1c234ba1832fe8a27666 Author: William Reynish Date: Thu Aug 23 17:29:05 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB4d28cfc707739f7a42fe1c234ba1832fe8a27666 UI: Subpanels to Cycles Samples for Branched Path Tracing === M intern/cycles/blender/addon/ui.py === diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 737f7416486..0ad3a8ba5ac 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -150,7 +150,6 @@ class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel): def draw(self, context): layout = self.layout -layout.use_property_split = False scene = context.scene cscene = scene.cycles @@ -165,31 +164,70 @@ class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel): col.prop(cscene, "preview_samples", text="Viewport") col.separator() col.prop(cscene, "use_square_samples") # Duplicate below. + + +class CYCLES_RENDER_PT_sampling_aa_samples(CyclesButtonsPanel, Panel): +bl_label = "AA Samples" +bl_parent_id = "CYCLES_RENDER_PT_sampling" + +@classmethod +def poll(self, context): +scene = context.scene +cscene = scene.cycles +if cscene.progressive == 'PATH' or use_branched_path(context) is False: +return False else: +return True -col = layout.column(align=True) -col.label(text="AA Samples") -col.prop(cscene, "aa_samples", text="Render") -col.prop(cscene, "preview_aa_samples", text="Preview") +def draw(self, context): +layout = self.layout +layout.use_property_split = True -col = layout.column(align=True) -col.label(text="Samples") -col.prop(cscene, "diffuse_samples", text="Diffuse") -col.prop(cscene, "glossy_samples", text="Glossy") -col.prop(cscene, "transmission_samples", text="Transmission") -col.prop(cscene, "ao_samples", text="AO") - -sub = col.row(align=True) -sub.active = use_sample_all_lights(context) -sub.prop(cscene, "mesh_light_samples", text="Mesh Light") -col.prop(cscene, "subsurface_samples", text="Subsurface") -col.prop(cscene, "volume_samples", text="Volume") -col.separator() -col.prop(cscene, "use_square_samples") # Duplicate above. +scene = context.scene +cscene = scene.cycles -col = layout.column(align=True) -col.prop(cscene, "sample_all_lights_direct") -col.prop(cscene, "sample_all_lights_indirect") +col = layout.column(align=True) +col.prop(cscene, "aa_samples", text="Render") +col.prop(cscene, "preview_aa_samples", text="Preview") + + +class CYCLES_RENDER_PT_sampling_samples(CyclesButtonsPanel, Panel): +bl_label = "Samples" +bl_parent_id = "CYCLES_RENDER_PT_sampling" + +@classmethod +def poll(self, context): +scene = context.scene +cscene = scene.cycles +if cscene.progressive == 'PATH' or use_branched_path(context) is False: +return False +else: +return True + +def draw(self, context): +layout = self.layout +layout.use_property_split = True + +scene = context.scene +cscene = scene.cycles + +col = layout.column(align=True) +col.prop(cscene, "diffuse_samples", text="Diffuse") +col.prop(cscene, "glossy_samples", text="Glossy") +col.prop(cscene, "transmission_samples", text="Transmission") +col.prop(cscene, "ao_samples", text="AO") + +sub = col.row(align=True) +sub.active = use_sample_all_lights(context) +sub.prop(cscene, "mesh_light_samples", text="Mesh Light") +col.prop(cscene, "subsurface_samples", text="Subsurface") +col.prop(cscene, "volume_samples", text="Volume") +col.separator() +col.prop(cscene, "use_square_samples") # Duplicate above. + +col = layout.column(align=True) +col.prop(cscene, "sample_all_lights_direct") +col.prop(cscene, "sample_all_lights_indirect") row = layout.row(align=True) row.prop(cscene, "seed") @@ -1810,6 +1848,8 @@ classes = ( CYCLES_MT_sampling_presets, CYCLES_MT_integrator_presets, CYCLES_RENDER_PT_sampling, +CYCLES_RENDER_PT_sampling_aa_samples, +CYCLES_RENDER_PT_sampling_samples, CYCLES_RENDER_PT_sampling_light, CYCLES_RENDER_PT_geometry, CYCLES_RENDER_PT_geometry_subdivision, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c11997ccfcb] blender2.8: UI: Physics panel minor adjustments
Commit: c11997ccfcbf76bac8509d967d74cc608a5d15f8 Author: William Reynish Date: Thu Aug 23 17:21:55 2018 +0200 Branches: blender2.8 https://developer.blender.org/rBc11997ccfcbf76bac8509d967d74cc608a5d15f8 UI: Physics panel minor adjustments Flow panel had a wrong name when the checkmark was used in the header, fixed alignment in softbody panel & fixed wrong active state for Cloth Pin. === M release/scripts/startup/bl_ui/properties_physics_cloth.py M release/scripts/startup/bl_ui/properties_physics_fluid.py M release/scripts/startup/bl_ui/properties_physics_softbody.py === diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index 0a7318864a3..86ded4f9d01 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -112,7 +112,7 @@ class PHYSICS_PT_cloth_pinning(PhysicButtonsPanel, Panel): md = context.cloth cloth = md.settings -self.layout.active = cloth_panel_enabled(md) and cloth.use_pin_cloth +self.layout.active = cloth_panel_enabled(md) self.layout.prop(cloth, "use_pin_cloth", text="") def draw(self, context): diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index 451b17b72b7..23fc39f0f54 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -86,23 +86,91 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel): col.prop(fluid, "type") -class PHYSICS_PT_fluid_settings(PhysicButtonsPanel, Panel): -bl_label = "Settings" +class PHYSICS_PT_fluid_flow(PhysicButtonsPanel, Panel): +bl_label = "Flow" bl_parent_id = "PHYSICS_PT_fluid" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): +md = context.fluid +fluid = md.settings + if not PhysicButtonsPanel.poll_fluid_settings(context): return False - -return (context.engine in cls.COMPAT_ENGINES) +return fluid.type in {'INFLOW', 'OUTFLOW', 'CONTROL'} and (context.engine in cls.COMPAT_ENGINES) def draw_header(self, context): md = context.fluid fluid = md.settings -if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID', 'OBSTACLE'}: -self.layout.prop(fluid, "use", text="") + +self.layout.prop(fluid, "use", text="") + +def draw(self, context): +layout = self.layout +layout.use_property_split = True + +md = context.fluid +fluid = md.settings + +flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True) + +flow.active = fluid.use + +if fluid.type == 'INFLOW': +col = flow.column() +col.prop(fluid, "volume_initialization", text="Volume Initialization") +col.prop(fluid, "use_animated_mesh") + +row = col.row() +row.active = not fluid.use_animated_mesh +row.prop(fluid, "use_local_coords") + +col = flow.column() +col.prop(fluid, "inflow_velocity", text="Inflow Velocity") + +elif fluid.type == 'OUTFLOW': +col = flow.column() +col.prop(fluid, "volume_initialization", text="Volume Initialization") + +col = flow.column() +col.prop(fluid, "use_animated_mesh") + +elif fluid.type == 'CONTROL': +col = flow.column() +col.prop(fluid, "quality", slider=True) +col.prop(fluid, "use_reverse_frames") + +col = flow.column() +col.prop(fluid, "start_time", text="Time Start") +col.prop(fluid, "end_time", text="End") + +col.separator() + +col = flow.column() +col.prop(fluid, "attraction_strength", text="Attraction Strength") +col.prop(fluid, "attraction_radius", text="Radius") + +col.separator() + +col = flow.column(align=True) +col.prop(fluid, "velocity_strength", text="Velocity Strength") +col.prop(fluid, "velocity_radius", text="Radius") + + +class PHYSICS_PT_fluid_settings(PhysicButtonsPanel, Panel): +bl_label = "Settings" +bl_parent_id = "PHYSICS_PT_fluid" +COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + +@classmethod +def poll(cls, context): +md = context.fluid +fluid = md.settings + +if not PhysicButtonsPanel.poll_fluid_settings(context): +return False +return fluid.type in {'DOMAIN', 'FLUID', 'OBSTACLE', 'PARTICLE'} and (context.engine in cls.COMPAT_ENGINES) def draw(self, context
[Bf-blender-cvs] [23c03bf0cc4] blender2.8: UI: Dark XYZ characters in the navigation gizmo
Commit: 23c03bf0cc4fa85e4b5316b47beb3f8e7be2faa7 Author: Pablo Vazquez Date: Thu Aug 23 17:15:44 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB23c03bf0cc4fa85e4b5316b47beb3f8e7be2faa7 UI: Dark XYZ characters in the navigation gizmo Much easier to read against the usually brighter axes colors. === M source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c === diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c index b68ed61e06c..4b1fe375084 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -295,7 +295,7 @@ static void axis_geom_draw(const wmGizmo *gz, const float color[4], const bool U GPU_line_width(1.0f); float m3[3][3]; copy_m3_m4(m3, gz->matrix_offset); - immUniformColor4fv(is_highlight ? axis_black : axis_highlight); + immUniformColor4fv(axis_black); draw_xyz_wire(pos_id, m3, v_final, 1.0, axis); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f79e734ff37] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Commit: f79e734ff374491ca1286ed3c00c189c9a732e69 Author: Antonioya Date: Thu Aug 23 16:15:23 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBf79e734ff374491ca1286ed3c00c189c9a732e69 Merge branch 'blender2.8' 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] [f97d61c4bd2] blender2.8: Depsgraph: Bring back visibility checks based on collection restrict flags
Commit: f97d61c4bd2a9ab3c1dd0ae4902778bc9703a716 Author: Sergey Sharybin Date: Thu Aug 23 16:17:06 2018 +0200 Branches: blender2.8 https://developer.blender.org/rBf97d61c4bd2a9ab3c1dd0ae4902778bc9703a716 Depsgraph: Bring back visibility checks based on collection restrict flags The title says it all actually, the idea is to speedup the following case: - Visible duplicator of a restricted collection (reported as T56512), One of the questionable change is that none of the view layer bases is ignored now. This ensures corresponding objects will have copy-on-write component evaluated, making it possible to access those pointers. The evaluation of those objects is skipped. Reviewers: brecht Differential Revision: https://developer.blender.org/D3641 === M source/blender/depsgraph/intern/builder/deg_builder.cc M source/blender/depsgraph/intern/builder/deg_builder_nodes.cc M source/blender/depsgraph/intern/builder/deg_builder_nodes.h M source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc M source/blender/depsgraph/intern/builder/deg_builder_relations.cc M source/blender/depsgraph/intern/builder/deg_builder_relations.h M source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc M source/blender/depsgraph/intern/depsgraph_types.h M source/blender/depsgraph/intern/eval/deg_eval.cc M source/blender/depsgraph/intern/nodes/deg_node_id.cc M source/blender/depsgraph/intern/nodes/deg_node_id.h === diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc index 8f5925a5ce3..0549ec76f3c 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder.cc @@ -34,6 +34,8 @@ #include "DNA_object_types.h" #include "DNA_ID.h" +#include "BLI_stack.h" + extern "C" { #include "BKE_animsys.h" } @@ -43,6 +45,8 @@ extern "C" { #include "intern/eval/deg_eval_copy_on_write.h" #include "intern/nodes/deg_node.h" #include "intern/nodes/deg_node_id.h" +#include "intern/nodes/deg_node_component.h" +#include "intern/nodes/deg_node_operation.h" #include "util/deg_util_foreach.h" @@ -50,8 +54,61 @@ extern "C" { namespace DEG { +namespace { + +void deg_graph_build_flush_layers(Depsgraph *graph) +{ + BLI_Stack *stack = BLI_stack_new(sizeof(OperationDepsNode*), +"DEG flush layers stack"); + foreach (OperationDepsNode *op_node, graph->operations) { + op_node->done = 0; + op_node->num_links_pending = 0; + foreach (DepsRelation *rel, op_node->outlinks) { + if ((rel->from->type == DEG_NODE_TYPE_OPERATION) && + (rel->flag & DEPSREL_FLAG_CYCLIC) == 0) + { + ++op_node->num_links_pending; + } + } + if (op_node->num_links_pending == 0) { + BLI_stack_push(stack, &op_node); + op_node->done = 1; + } + } + while (!BLI_stack_is_empty(stack)) { + OperationDepsNode *op_node; + BLI_stack_pop(stack, &op_node); + /* Flush layers to parents. */ + foreach (DepsRelation *rel, op_node->inlinks) { + if (rel->from->type == DEG_NODE_TYPE_OPERATION) { + OperationDepsNode *op_from = (OperationDepsNode *)rel->from; + op_from->owner->owner->is_visible |= + op_node->owner->owner->is_visible; + } + } + /* Schedule parent nodes. */ + foreach (DepsRelation *rel, op_node->inlinks) { + if (rel->from->type == DEG_NODE_TYPE_OPERATION) { + OperationDepsNode *op_from = (OperationDepsNode *)rel->from; + if ((rel->flag & DEPSREL_FLAG_CYCLIC) == 0) { + BLI_assert(op_from->num_links_pending > 0); + --op_from->num_links_pending; + } + if (op_from->num_links_pending == 0 && op_from->done == 0) { + BLI_stack_push(stack, &op_from); + op_from->done = 1; + } + } + } + } + BLI_stack_free(stack); +} + +} // namespace + void deg_graph_build_finalize(Main *bmain, Depsgraph *graph) { + deg_graph_build_flush_layers(graph); /* Re-tag IDs for update if it was tagged before the relations
[Bf-blender-cvs] [a9ecfc96534] blender2.8: Fix T56347: Driven values not supported in node groups.
Commit: a9ecfc965349241b858b1b23d0a3d9b987600b5d Author: Bastien Montagne Date: Thu Aug 23 15:19:08 2018 +0200 Branches: blender2.8 https://developer.blender.org/rBa9ecfc965349241b858b1b23d0a3d9b987600b5d Fix T56347: Driven values not supported in node groups. Need to rebuild dependency graph when we add or remove nodes from a tree... === M source/blender/editors/space_node/node_group.c === diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index a3294211ff9..4012cfdaebc 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -50,6 +50,8 @@ #include "BKE_main.h" #include "BKE_report.h" +#include "DEG_depsgraph_build.h" + #include "ED_node.h" /* own include */ #include "ED_screen.h" #include "ED_render.h" @@ -961,6 +963,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op) snode_notify(C, snode); snode_dag_update(C, snode); + DEG_relations_tag_update(bmain); /* We broke relations in node tree, need to rebuild them in the grahes. */ 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] [613523d5f5f] blender2.8: Rename: *_batch_cache_dirty > *_batch_cache_dirty_tag
Commit: 613523d5f5f501c899364ff6de16b426d6f19741 Author: Dalai Felinto Date: Thu Aug 23 10:14:29 2018 -0300 Branches: blender2.8 https://developer.blender.org/rB613523d5f5f501c899364ff6de16b426d6f19741 Rename: *_batch_cache_dirty > *_batch_cache_dirty_tag === M source/blender/blenkernel/BKE_curve.h M source/blender/blenkernel/BKE_gpencil.h M source/blender/blenkernel/BKE_lattice.h M source/blender/blenkernel/BKE_mball.h M source/blender/blenkernel/BKE_mesh.h M source/blender/blenkernel/BKE_object.h M source/blender/blenkernel/BKE_particle.h M source/blender/blenkernel/intern/curve.c M source/blender/blenkernel/intern/deform.c M source/blender/blenkernel/intern/gpencil.c M source/blender/blenkernel/intern/lattice.c M source/blender/blenkernel/intern/mball.c M source/blender/blenkernel/intern/mesh_runtime.c M source/blender/blenkernel/intern/object_deform.c M source/blender/blenkernel/intern/object_update.c M source/blender/blenkernel/intern/paint.c M source/blender/blenkernel/intern/particle.c M source/blender/blenkernel/intern/particle_system.c M source/blender/draw/engines/gpencil/gpencil_cache_utils.c M source/blender/draw/intern/draw_cache_impl.h M source/blender/draw/intern/draw_cache_impl_curve.c M source/blender/draw/intern/draw_cache_impl_lattice.c M source/blender/draw/intern/draw_cache_impl_mesh.c M source/blender/draw/intern/draw_cache_impl_metaball.c M source/blender/draw/intern/draw_cache_impl_particles.c M source/blender/draw/intern/draw_manager.c M source/blender/draw/modes/paint_weight_mode.c M source/blender/editors/curve/editfont.c M source/blender/editors/gpencil/gpencil_old.c M source/blender/editors/mesh/editface.c M source/blender/editors/mesh/editmesh_polybuild.c M source/blender/editors/object/object_edit.c M source/blender/editors/object/object_transform.c M source/blender/editors/physics/particle_edit.c M source/blender/editors/sculpt_paint/paint_vertex.c M source/blender/editors/sculpt_paint/sculpt.c M source/blender/makesrna/intern/rna_curve_api.c M source/blender/makesrna/intern/rna_lattice_api.c M source/blender/makesrna/intern/rna_mesh.c M source/blender/makesrna/intern/rna_mesh_api.c M source/blender/makesrna/intern/rna_meta_api.c M source/blender/makesrna/intern/rna_sculpt_paint.c === diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index a3440097688..ff2b1a78a6f 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -231,7 +231,7 @@ enum { BKE_CURVE_BATCH_DIRTY_ALL = 0, BKE_CURVE_BATCH_DIRTY_SELECT, }; -void BKE_curve_batch_cache_dirty(struct Curve *cu, int mode); +void BKE_curve_batch_cache_dirty_tag(struct Curve *cu, int mode); void BKE_curve_batch_cache_free(struct Curve *cu); /* curve_decimate.c */ diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index b7bef9bbf4e..19535f23cf2 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -68,7 +68,7 @@ bool BKE_gpencil_free_frame_runtime_data(struct bGPDframe *derived_gpf); void BKE_gpencil_free_derived_frames(struct bGPdata *gpd); void BKE_gpencil_free(struct bGPdata *gpd, bool free_all); -void BKE_gpencil_batch_cache_dirty(struct bGPdata *gpd); +void BKE_gpencil_batch_cache_dirty_tag(struct bGPdata *gpd); void BKE_gpencil_batch_cache_free(struct bGPdata *gpd); void BKE_gpencil_stroke_sync_selection(struct bGPDstroke *gps); diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index 67e6a32edfd..e98839e3dbc 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -111,7 +111,7 @@ enum { BKE_LATTICE_BATCH_DIRTY_ALL = 0, BKE_LATTICE_BATCH_DIRTY_SELECT, }; -void BKE_lattice_batch_cache_dirty(struct Lattice *lt, int mode); +void BKE_lattice_batch_cache_dirty_tag(struct Lattice *lt, int mode); void BKE_lattice_batch_cache_free(struct Lattice *lt); #endif /* __BKE_LATTICE_H__ */ diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index 74ef9d9dbc0..e6874cd064b 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -81,7 +81,7 @@ struct Depsgraph; enum { BKE_MBALL_BATCH_DIRTY_ALL = 0, }; -void BKE_mball_batch_cache_dirty(struct MetaBall *mb, int mode); +void BKE_mball_batch_cache_dirty_tag(struct MetaBall *mb, int mode); void BKE_mball_batch_cache_free(struct MetaBall *mb); #endif diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blend
[Bf-blender-cvs] [25c918196ce] blender2.8: Fix T56500: Origin to geometry crashes on armature
Commit: 25c918196ce66eff4417d7d2e1d3da8c11d96735 Author: Dalai Felinto Date: Wed Aug 22 17:02:37 2018 -0300 Branches: blender2.8 https://developer.blender.org/rB25c918196ce66eff4417d7d2e1d3da8c11d96735 Fix T56500: Origin to geometry crashes on armature Reviewers: sergey https://developer.blender.org/D3639 === M source/blender/blenkernel/BKE_object.h M source/blender/blenkernel/intern/object_update.c M source/blender/editors/object/object_transform.c === diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 7d795c25a04..90df5a5441a 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -308,6 +308,8 @@ struct MovieClip *BKE_object_movieclip_get(struct Scene *scene, struct Object *o void BKE_object_runtime_reset(struct Object *object); +void BKE_object_batch_cache_dirty(struct Object *ob); + /* this function returns a superset of the scenes selection based on relationships */ typedef enum eObRelationTypes { diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 3641df26496..52e3d4a0803 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -302,14 +302,8 @@ void BKE_object_eval_uber_transform(Depsgraph *depsgraph, Object *object) BKE_object_eval_proxy_copy(depsgraph, object); } -void BKE_object_eval_uber_data(Depsgraph *depsgraph, - Scene *scene, - Object *ob) +void BKE_object_batch_cache_dirty(Object *ob) { - DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); - BLI_assert(ob->type != OB_ARMATURE); - BKE_object_handle_data_update(depsgraph, scene, ob); - switch (ob->type) { case OB_MESH: BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL); @@ -331,6 +325,16 @@ void BKE_object_eval_uber_data(Depsgraph *depsgraph, } } +void BKE_object_eval_uber_data(Depsgraph *depsgraph, + Scene *scene, + Object *ob) +{ + DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); + BLI_assert(ob->type != OB_ARMATURE); + BKE_object_handle_data_update(depsgraph, scene, ob); + BKE_object_batch_cache_dirty(ob); +} + void BKE_object_eval_cloth(Depsgraph *depsgraph, Scene *scene, Object *object) diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 96b540251b4..fb54c9ec2c2 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1216,7 +1216,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) for (tob = bmain->object.first; tob; tob = tob->id.next) { if (tob->data && (((ID *)tob->data)->tag & LIB_TAG_DOIT)) { - BKE_mesh_batch_cache_dirty(tob->data, BKE_MESH_BATCH_DIRTY_ALL); + BKE_object_batch_cache_dirty(tob); DEG_id_tag_update(&tob->id, OB_RECALC_OB | OB_RECALC_DATA); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2dafc39d566] blender2.8: Icons: new icons for sculpt border hide/mask
Commit: 2dafc39d566aa5c65b148cadf1129305ac1ceabc Author: William Reynish Date: Thu Aug 23 22:46:04 2018 +1000 Branches: blender2.8 https://developer.blender.org/rB2dafc39d566aa5c65b148cadf1129305ac1ceabc Icons: new icons for sculpt border hide/mask === M release/datafiles/icons/brush.particle.add.dat M release/datafiles/icons/brush.particle.comb.dat M release/datafiles/icons/brush.particle.cut.dat M release/datafiles/icons/brush.particle.length.dat M release/datafiles/icons/brush.particle.puff.dat M release/datafiles/icons/brush.particle.smooth.dat M release/datafiles/icons/brush.particle.weight.dat M release/datafiles/icons/brush.sculpt.mask.dat A release/datafiles/icons/ops.sculpt.border_hide.dat A release/datafiles/icons/ops.sculpt.border_mask.dat M release/scripts/startup/bl_ui/space_toolsystem_toolbar.py M source/blender/editors/datafiles/CMakeLists.txt === diff --git a/release/datafiles/icons/brush.particle.add.dat b/release/datafiles/icons/brush.particle.add.dat index e78bf251371..ee785ef7dc6 100644 Binary files a/release/datafiles/icons/brush.particle.add.dat and b/release/datafiles/icons/brush.particle.add.dat differ diff --git a/release/datafiles/icons/brush.particle.comb.dat b/release/datafiles/icons/brush.particle.comb.dat index 5ece6bf754d..39fd44debdc 100644 Binary files a/release/datafiles/icons/brush.particle.comb.dat and b/release/datafiles/icons/brush.particle.comb.dat differ diff --git a/release/datafiles/icons/brush.particle.cut.dat b/release/datafiles/icons/brush.particle.cut.dat index 79306d5d7e9..3a62a9c1900 100644 Binary files a/release/datafiles/icons/brush.particle.cut.dat and b/release/datafiles/icons/brush.particle.cut.dat differ diff --git a/release/datafiles/icons/brush.particle.length.dat b/release/datafiles/icons/brush.particle.length.dat index 4c9da271316..169b8ba6239 100644 Binary files a/release/datafiles/icons/brush.particle.length.dat and b/release/datafiles/icons/brush.particle.length.dat differ diff --git a/release/datafiles/icons/brush.particle.puff.dat b/release/datafiles/icons/brush.particle.puff.dat index 9e6523558ae..e9d626123b1 100644 Binary files a/release/datafiles/icons/brush.particle.puff.dat and b/release/datafiles/icons/brush.particle.puff.dat differ diff --git a/release/datafiles/icons/brush.particle.smooth.dat b/release/datafiles/icons/brush.particle.smooth.dat index a3cbe3cf657..5424bd53ac9 100644 Binary files a/release/datafiles/icons/brush.particle.smooth.dat and b/release/datafiles/icons/brush.particle.smooth.dat differ diff --git a/release/datafiles/icons/brush.particle.weight.dat b/release/datafiles/icons/brush.particle.weight.dat index 309ee157a19..75d78e63625 100644 Binary files a/release/datafiles/icons/brush.particle.weight.dat and b/release/datafiles/icons/brush.particle.weight.dat differ diff --git a/release/datafiles/icons/brush.sculpt.mask.dat b/release/datafiles/icons/brush.sculpt.mask.dat index 3a2819168d3..7a14f45e468 100644 Binary files a/release/datafiles/icons/brush.sculpt.mask.dat and b/release/datafiles/icons/brush.sculpt.mask.dat differ diff --git a/release/datafiles/icons/brush.sculpt.mask.dat b/release/datafiles/icons/ops.sculpt.border_hide.dat similarity index 76% copy from release/datafiles/icons/brush.sculpt.mask.dat copy to release/datafiles/icons/ops.sculpt.border_hide.dat index 3a2819168d3..ca2f5b8405a 100644 Binary files a/release/datafiles/icons/brush.sculpt.mask.dat and b/release/datafiles/icons/ops.sculpt.border_hide.dat differ diff --git a/release/datafiles/icons/brush.sculpt.mask.dat b/release/datafiles/icons/ops.sculpt.border_mask.dat similarity index 100% copy from release/datafiles/icons/brush.sculpt.mask.dat copy to release/datafiles/icons/ops.sculpt.border_mask.dat diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 8f7fec387ff..af65ca35c52 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -939,7 +939,7 @@ class _defs_sculpt: def hide_border(): return dict( text="Border Hide", -icon="none", +icon="ops.sculpt.border_hide", widget=None, keymap=( ("paint.hide_show", dict(action='HIDE'), dict(type='EVT_TWEAK_A', value='ANY')), @@ -952,7 +952,7 @@ class _defs_sculpt: def mask_border(): return dict( text="Border Mask", -icon="none", +icon="ops.sculpt.border_mask", widget=None, keymap=( ("view3d.select_border", dict(mode='ADD'), dict(type='EVT_TWEAK_A', value='ANY')), diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/ble
[Bf-blender-cvs] [09895cae484] blender2.8: Merge branch 'master' into blender2.8
Commit: 09895cae4846181783793953bc300013dd59817b Author: Bastien Montagne Date: Thu Aug 23 14:56:42 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB09895cae4846181783793953bc300013dd59817b Merge branch 'master' into blender2.8 === === diff --cc source/blender/blenkernel/intern/lattice.c index 04830eb1081,582743acff4..ca555a46da5 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@@ -623,9 -624,9 +623,9 @@@ static bool calc_curve_deform(Object *p if (is_neg_axis) { index = axis - 3; if (cu->flag & CU_STRETCH) - fac = (-co[index] - cd->dmax[index]) / (cd->dmax[index] - cd->dmin[index]); + fac = -(co[index] - cd->dmax[index]) / (cd->dmax[index] - cd->dmin[index]); else - fac = -(co[index] - cd->dmax[index]) / (par->curve_cache->path->totdist); + fac = -(co[index] - cd->dmax[index]) / (par->runtime.curve_cache->path->totdist); } else { index = axis; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c5206e5d2f8] master: Fix T56506: Different behaviour of Bounds Clamp with positive and negative axis.
Commit: c5206e5d2f880adf9cff8ed295be5ec160d18e0d Author: Bastien Montagne Date: Thu Aug 23 14:55:40 2018 +0200 Branches: master https://developer.blender.org/rBc5206e5d2f880adf9cff8ed295be5ec160d18e0d Fix T56506: Different behaviour of Bounds Clamp with positive and negative axis. Small typo on minus sign position... ;) === M source/blender/blenkernel/intern/lattice.c === diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index b02396e5296..582743acff4 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -624,7 +624,7 @@ static bool calc_curve_deform(Scene *scene, Object *par, float co[3], if (is_neg_axis) { index = axis - 3; if (cu->flag & CU_STRETCH) - fac = (-co[index] - cd->dmax[index]) / (cd->dmax[index] - cd->dmin[index]); + fac = -(co[index] - cd->dmax[index]) / (cd->dmax[index] - cd->dmin[index]); else fac = -(co[index] - cd->dmax[index]) / (par->curve_cache->path->totdist); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f894db794fc] blender2.8: 3D Grid: Fix grid not showing in camera view
Commit: f894db794fcad2ca5be782b963f6ef32dd933f34 Author: Clément Foucault Date: Thu Aug 23 13:56:25 2018 +0200 Branches: blender2.8 https://developer.blender.org/rBf894db794fcad2ca5be782b963f6ef32dd933f34 3D Grid: Fix grid not showing in camera view === M source/blender/draw/modes/object_mode.c === diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 3ae0bec77b2..c8f14892646 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -634,7 +634,7 @@ static void OBJECT_engine_init(void *vedata) float dist; if (rv3d->persp == RV3D_CAMOB && v3d->camera) { Object *camera_object = DEG_get_evaluated_object(draw_ctx->depsgraph, v3d->camera); - dist = ((Camera *)camera_object)->clipend; + dist = ((Camera *)(camera_object->data))->clipend; } else { dist = v3d->far; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [745123024d1] blender2.8: 3D Grid: Fix axes color blending
Commit: 745123024d1c6ece6c4033d9ba6a5607ed4b08b7 Author: Clément Foucault Date: Thu Aug 23 13:35:41 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB745123024d1c6ece6c4033d9ba6a5607ed4b08b7 3D Grid: Fix axes color blending === M source/blender/draw/modes/shaders/object_grid_frag.glsl === diff --git a/source/blender/draw/modes/shaders/object_grid_frag.glsl b/source/blender/draw/modes/shaders/object_grid_frag.glsl index 06369e80c8d..aa2b45b5b50 100644 --- a/source/blender/draw/modes/shaders/object_grid_frag.glsl +++ b/source/blender/draw/modes/shaders/object_grid_frag.glsl @@ -199,13 +199,16 @@ void main() vec3 axes = get_axes(axes_dist, axes_fwidth, 0.1); if ((gridFlag & AXIS_X) != 0) { - FragColor = mix(FragColor, colorGridAxisX, axes.x); + FragColor.a = max(FragColor.a, axes.x); + FragColor.rgb = (axes.x < 1e-8) ? FragColor.rgb : colorGridAxisX.rgb; } if ((gridFlag & AXIS_Y) != 0) { - FragColor = mix(FragColor, colorGridAxisY, axes.y); + FragColor.a = max(FragColor.a, axes.y); + FragColor.rgb = (axes.y < 1e-8) ? FragColor.rgb : colorGridAxisY.rgb; } if ((gridFlag & AXIS_Z) != 0) { - FragColor = mix(FragColor, colorGridAxisZ, axes.z); + FragColor.a = max(FragColor.a, axes.z); + FragColor.rgb = (axes.z < 1e-8) ? FragColor.rgb : colorGridAxisZ.rgb; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [55f122264c7] blender2.8: 3D Grid: Fix grid passing through objects too much
Commit: 55f122264c7faeedb4cdb1b3d1038ac3af28f6f2 Author: Clément Foucault Date: Thu Aug 23 13:35:10 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB55f122264c7faeedb4cdb1b3d1038ac3af28f6f2 3D Grid: Fix grid passing through objects too much For this we need to add a bias depending on the viewing angle. But increasing the hardness of the test make float precision issues in the mesh transformation more prominent (actual geometry is far below the surface). So to solve this issue we use a more subdivided grid mesh 8x8 quads instead of 1 triangle. === M source/blender/draw/intern/draw_cache.c M source/blender/draw/intern/draw_cache.h M source/blender/draw/modes/object_mode.c M source/blender/draw/modes/shaders/object_grid_frag.glsl === diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 412ad72207e..03c3e1ff16e 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -53,6 +53,7 @@ static struct DRWShapeCache { GPUBatch *drw_fullscreen_quad; GPUBatch *drw_fullscreen_quad_texcoord; GPUBatch *drw_quad; + GPUBatch *drw_grid; GPUBatch *drw_sphere; GPUBatch *drw_screenspace_circle; GPUBatch *drw_plain_axes; @@ -322,6 +323,48 @@ GPUBatch *DRW_cache_quad_get(void) return SHC.drw_quad; } +/* Grid */ +GPUBatch *DRW_cache_grid_get(void) +{ + if (!SHC.drw_grid) { + /* Position Only 2D format */ + static GPUVertFormat format = { 0 }; + static struct { uint pos; } attr_id; + if (format.attr_len == 0) { + attr_id.pos = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + } + + GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format); + GPU_vertbuf_data_alloc(vbo, 8 * 8 * 2 * 3); + + uint v_idx = 0; + for (int i = 0; i < 8; ++i) { + for (int j = 0; j < 8; ++j) { + float pos0[2] = {(float)i / 8.0f, (float)j / 8.0f}; + float pos1[2] = {(float)(i+1) / 8.0f, (float)j / 8.0f}; + float pos2[2] = {(float)i / 8.0f, (float)(j+1) / 8.0f}; + float pos3[2] = {(float)(i+1) / 8.0f, (float)(j+1) / 8.0f}; + + madd_v2_v2v2fl(pos0, (float[2]){-1.0f, -1.0f}, pos0, 2.0f); + madd_v2_v2v2fl(pos1, (float[2]){-1.0f, -1.0f}, pos1, 2.0f); + madd_v2_v2v2fl(pos2, (float[2]){-1.0f, -1.0f}, pos2, 2.0f); + madd_v2_v2v2fl(pos3, (float[2]){-1.0f, -1.0f}, pos3, 2.0f); + + GPU_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, pos0); + GPU_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, pos1); + GPU_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, pos2); + + GPU_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, pos2); + GPU_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, pos1); + GPU_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, pos3); + } + } + + SHC.drw_grid = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, NULL, GPU_BATCH_OWNS_VBO); + } + return SHC.drw_grid; +} + /* Sphere */ GPUBatch *DRW_cache_sphere_get(void) { diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h index eb75c685ec0..08c93010700 100644 --- a/source/blender/draw/intern/draw_cache.h +++ b/source/blender/draw/intern/draw_cache.h @@ -39,6 +39,7 @@ void DRW_shape_cache_reset(void); struct GPUBatch *DRW_cache_cursor_get(bool crosshair_lines); /* Common Shapes */ +struct GPUBatch *DRW_cache_grid_get(void); struct GPUBatch *DRW_cache_fullscreen_quad_get(void); struct GPUBatch *DRW_cache_quad_get(void); struct GPUBatch *DRW_cache_cube_get(void); diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 934b9ada99f..3ae0bec77b2 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -1042,7 +1042,7 @@ static void OBJECT_cache_init(void *vedata) DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND; psl->grid = DRW_pass_create("Infinite Grid Pass", state); - struct GPUBatch *quad = DRW_cache_fullscreen_quad_get(); + struct GPUBatch *geom = DRW_cache_grid_get(); static float mat[4][4]; unit_m4(mat); @@ -1058,7 +1058,7 @@ static void OBJECT_cache_init(void *vedata) DRW_
[Bf-blender-cvs] [7f8014f9184] blender2.8: Revert "Icons: avoid error with colors out of 0-255 range"
Commit: 7f8014f918422d2968b0b14ec5440aae89599fea Author: Campbell Barton Date: Thu Aug 23 21:36:51 2018 +1000 Branches: blender2.8 https://developer.blender.org/rB7f8014f918422d2968b0b14ec5440aae89599fea Revert "Icons: avoid error with colors out of 0-255 range" This reverts commit 6e7da7616b6b02d2827f306ea4e55510a79b79de. === M release/datafiles/blender_icons_geom.py === diff --git a/release/datafiles/blender_icons_geom.py b/release/datafiles/blender_icons_geom.py index b9f7c05ac31..f3af7f997c1 100644 --- a/release/datafiles/blender_icons_geom.py +++ b/release/datafiles/blender_icons_geom.py @@ -162,7 +162,7 @@ def mesh_data_lists_from_mesh(me, material_colors): ), # RGBA color. tuple(( -[min(max(int(c * b * 255), 0), 255) for c, b in zip(cn.color, base_color)] +[int(c * b * 255) for c, b in zip(cn.color, base_color)] for cn in (c0, c1, c2) )), )) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0cbbcac23e4] blender2.8: Icons: clamp material color from 0..1
Commit: 0cbbcac23e47a686519b89c9cac7b2df2e4a4458 Author: Campbell Barton Date: Thu Aug 23 21:40:30 2018 +1000 Branches: blender2.8 https://developer.blender.org/rB0cbbcac23e47a686519b89c9cac7b2df2e4a4458 Icons: clamp material color from 0..1 Warn about out of range colors too. === M release/datafiles/blender_icons_geom.py === diff --git a/release/datafiles/blender_icons_geom.py b/release/datafiles/blender_icons_geom.py index f3af7f997c1..644d0756234 100644 --- a/release/datafiles/blender_icons_geom.py +++ b/release/datafiles/blender_icons_geom.py @@ -93,6 +93,9 @@ def object_material_colors(ob): for node in node_tree.nodes if node.type == 'RGB' ), color_default) +if min(color) < 0.0 or max(color) > 1.0: +print(f"Material: {material.name!r} has color out of 0..1 range {color!r}") +color = tuple(max(min(c, 1.0), 0.0) for c in color) material_colors.append(color) return material_colors ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8e58b88ea43] soc-2018-npr: Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
Commit: 8e58b88ea432cca8548fc85b0390a2a688e4c120 Author: Nick Wu Date: Thu Aug 23 18:55:32 2018 +0800 Branches: soc-2018-npr https://developer.blender.org/rB8e58b88ea432cca8548fc85b0390a2a688e4c120 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr # Conflicts: # release/scripts/addons # release/scripts/addons_contrib # source/tools === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4b763f4cb2e] soc-2018-npr: Fixing perpective flag
Commit: 4b763f4cb2e7a80d0bbaf3bb26f717ef39a72882 Author: Nick Wu Date: Thu Aug 23 18:53:37 2018 +0800 Branches: soc-2018-npr https://developer.blender.org/rB4b763f4cb2e7a80d0bbaf3bb26f717ef39a72882 Fixing perpective flag === M source/blender/draw/engines/lanpr/lanpr_dpix.c === diff --git a/source/blender/draw/engines/lanpr/lanpr_dpix.c b/source/blender/draw/engines/lanpr/lanpr_dpix.c index 634d59ad8f3..19930cc8c95 100644 --- a/source/blender/draw/engines/lanpr/lanpr_dpix.c +++ b/source/blender/draw/engines/lanpr/lanpr_dpix.c @@ -347,6 +347,7 @@ void lanpr_dpix_draw_scene(LANPR_TextureList *txl, LANPR_FramebufferList *fbl, L float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; float clear_depth = 1.0f; uint clear_stencil = 0xFF; + int is_persp=1; if (!lanpr->active_layer) return; /* return early in case we don't have line layers. DPIX only use the first layer. */ @@ -360,15 +361,19 @@ void lanpr_dpix_draw_scene(LANPR_TextureList *txl, LANPR_FramebufferList *fbl, L if (v3d) { RegionView3D *rv3d = draw_ctx->rv3d; camera = (rv3d && rv3d->persp == RV3D_CAMOB) ? v3d->camera : NULL; + is_persp = rv3d->is_persp; } if (!camera) { camera = scene->camera; + if(!v3d)is_persp = ((Camera *)camera->data)->type == CAM_PERSP ? 1 : 0; } if (is_render && !camera) return; + //XXX: should implement view angle functions for ortho camera. + pd->dpix_viewport[2] = texw; pd->dpix_viewport[3] = texh; - pd->dpix_is_perspective = 1; + pd->dpix_is_perspective = is_persp; pd->dpix_sample_step = 1; pd->dpix_buffer_width = TNS_DPIX_TEXTURE_SIZE; pd->dpix_depth_offset = 0.0001; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c2231bc4c96] temp-fracture-modifier-2.8: fixes and polishing recently implemented features
Commit: c2231bc4c96f16d8ce9a9c8054616ad05f8fe54e Author: Martin Felke Date: Thu Aug 23 12:42:45 2018 +0200 Branches: temp-fracture-modifier-2.8 https://developer.blender.org/rBc2231bc4c96f16d8ce9a9c8054616ad05f8fe54e fixes and polishing recently implemented features === M source/blender/blenkernel/BKE_fracture.h M source/blender/blenkernel/BKE_fracture_util.h M source/blender/blenkernel/intern/fracture.c M source/blender/blenkernel/intern/fracture_automerge.c M source/blender/blenkernel/intern/fracture_external.c M source/blender/blenkernel/intern/fracture_prefractured.c M source/blender/blenkernel/intern/fracture_util.c M source/blender/blenkernel/intern/pointcache.c M source/blender/makesrna/intern/rna_rigidbody.c === diff --git a/source/blender/blenkernel/BKE_fracture.h b/source/blender/blenkernel/BKE_fracture.h index 74e8bc04506..eec805c63c0 100644 --- a/source/blender/blenkernel/BKE_fracture.h +++ b/source/blender/blenkernel/BKE_fracture.h @@ -34,6 +34,7 @@ #include "BLI_sys_types.h" #include "BKE_scene.h" +#include "BKE_customdata.h" struct Mesh; @@ -71,6 +72,15 @@ typedef struct FracPointCloud { } FracPointCloud; +static const CustomDataMask CD_MASK_ISLAND = + CD_MASK_MDEFORMVERT | + CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR | CD_MASK_MDISPS | + CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | + CD_MASK_RECAST | CD_MASK_PAINT_MASK | + CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN | CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE | + CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_FACEMAP; + + void BKE_fracture_autohide_refresh(struct FractureModifierData* fmd, struct Object *ob, struct Mesh *me_assembled); void BKE_fracture_automerge_refresh(struct FractureModifierData* fmd, struct Mesh *me_assembled); @@ -109,8 +119,6 @@ void BKE_fracture_mesh_island_remove_all(struct FractureModifierData *fmd, struc void BKE_fracture_mesh_constraint_remove(struct FractureModifierData *fmd, struct RigidBodyShardCon* con, struct Scene *scene); void BKE_fracture_constraints_free(struct FractureModifierData *fmd, struct Scene *scene); -int BKE_fracture_update_visual_mesh(struct FractureModifierData *fmd, struct Object *ob, bool do_custom_data); - struct RigidBodyShardCon *BKE_fracture_mesh_constraint_create(struct Scene *scene, struct FractureModifierData *fmd, struct MeshIsland *mi1, struct MeshIsland *mi2, short con_type); @@ -135,10 +143,6 @@ void BKE_fracture_mesh_island_free(struct MeshIsland *mi, struct Scene* scene); short BKE_fracture_collect_materials(struct Main* bmain, struct Object* o, struct Object* ob, int matstart, struct GHash** mat_index_map); -struct Mesh *BKE_fracture_prefractured_do(struct FractureModifierData *fmd, struct Object *ob, struct Mesh *dm, - struct Mesh *orig_dm, char names [][66], int count, struct Scene* scene, - struct Depsgraph *depsgraph); - struct Mesh* BKE_fracture_mesh_copy(struct Mesh* source, struct Object* ob); struct BMesh* BKE_fracture_mesh_to_bmesh(struct Mesh* me); struct Mesh* BKE_fracture_bmesh_to_mesh(struct BMesh* bm); @@ -165,5 +169,9 @@ void BKE_fracture_meshislands_pack(struct FractureModifierData *fmd, struct Obje void BKE_fracture_postprocess_meshisland(struct FractureModifierData *fmd, struct Object* ob, struct MeshIsland*mi, struct Mesh** temp_meshs, int count, struct Main* bmain, struct Scene* scene, int frame); +void BKE_fracture_meshisland_normals_fix(struct FractureModifierData *fmd, struct MeshIsland* mi, struct Mesh* orig_me); + +void BKE_fracture_copy_customdata(struct CustomData* src, struct CustomData* dst, CustomDataMask mask, int src_ofs, int dst_ofs, + int copyelem, int totelem); #endif /* BKE_FRACTURE_H */ diff --git a/source/blender/blenkernel/BKE_fracture_util.h b/source/blender/blenkernel/BKE_fracture_util.h index 123f7834651..672af68da86 100644 --- a/source/blender/blenkernel/BKE_fracture_util.h +++ b/source/blender/blenkernel/BKE_fracture_util.h @@ -40,6 +40,7 @@ typedef struct BisectContext { bool clear_outer; bool use_fill; bool do_fast_bisect; + bool use_smooth_inner; char uv_layer[64]; float normal[3]; diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c index a444f32e023..b67adaf9fe4 100644 --- a/source/blender/blenkernel/intern/fracture.c +++ b/source/blender/blenkernel/intern/fracture.c @@ -96,7 +96,7 @@ static void parse_cell_polys(cell c, MPoly *mpoly, int totpoly); static void p
[Bf-blender-cvs] [73f90b25055] blender2.8: Fix annotate tool in the 3D view
Commit: 73f90b250551566c576588ed4fae88d6ad9d1162 Author: Campbell Barton Date: Thu Aug 23 20:25:25 2018 +1000 Branches: blender2.8 https://developer.blender.org/rB73f90b250551566c576588ed4fae88d6ad9d1162 Fix annotate tool in the 3D view We can't share tools between space-types since they contain keymaps that store the space type. === M release/scripts/startup/bl_ui/space_toolsystem_toolbar.py === diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index f8992094c43..8f7fec387ff 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -196,92 +196,98 @@ class _defs_view3d_generic: ), ) +def _defs_annotate_factory(): -class _defs_annotate: -@staticmethod -def draw_settings_common(context, layout, tool): -ts = context.tool_settings - -space_type = tool.space_type -if space_type == 'VIEW_3D': -layout.separator() - -row = layout.row(align=True) -row.prop(ts, "annotation_stroke_placement_view3d", text="Placement") -if ts.gpencil_stroke_placement_view3d == 'CURSOR': -row.prop(ts.gpencil_sculpt, "lockaxis") -elif ts.gpencil_stroke_placement_view3d in {'SURFACE', 'STROKE'}: -row.prop(ts, "use_gpencil_stroke_endpoints") - -@ToolDef.from_fn -def scribble(): -def draw_settings(context, layout, tool): -_defs_annotate.draw_settings_common(context, layout, tool) - -return dict( -text="Annotate", -icon="ops.gpencil.draw", -cursor='PAINT_BRUSH', -keymap=( -("gpencil.annotate", - dict(mode='DRAW', wait_for_input=False), - dict(type='EVT_TWEAK_A', value='ANY')), -), -draw_settings=draw_settings, -) +class _defs_annotate: +@staticmethod +def draw_settings_common(context, layout, tool): +ts = context.tool_settings -@ToolDef.from_fn -def line(): -def draw_settings(context, layout, tool): -_defs_annotate.draw_settings_common(context, layout, tool) +space_type = tool.space_type +if space_type == 'VIEW_3D': +layout.separator() -return dict( -text="Draw Line", -icon="ops.gpencil.draw.line", -cursor='CROSSHAIR', -keymap=( -("gpencil.annotate", - dict(mode='DRAW_STRAIGHT', wait_for_input=False), - dict(type='EVT_TWEAK_A', value='ANY')), -), -draw_settings=draw_settings, -) +row = layout.row(align=True) +row.prop(ts, "annotation_stroke_placement_view3d", text="Placement") +if ts.gpencil_stroke_placement_view3d == 'CURSOR': +row.prop(ts.gpencil_sculpt, "lockaxis") +elif ts.gpencil_stroke_placement_view3d in {'SURFACE', 'STROKE'}: +row.prop(ts, "use_gpencil_stroke_endpoints") + +@ToolDef.from_fn +def scribble(): +def draw_settings(context, layout, tool): +_defs_annotate.draw_settings_common(context, layout, tool) + +return dict( +text="Annotate", +icon="ops.gpencil.draw", +cursor='PAINT_BRUSH', +keymap=( +("gpencil.annotate", + dict(mode='DRAW', wait_for_input=False), + dict(type='EVT_TWEAK_A', value='ANY')), +), +draw_settings=draw_settings, +) -@ToolDef.from_fn -def poly(): -def draw_settings(context, layout, tool): -_defs_annotate.draw_settings_common(context, layout, tool) +@ToolDef.from_fn +def line(): +def draw_settings(context, layout, tool): +_defs_annotate.draw_settings_common(context, layout, tool) + +return dict( +text="Draw Line", +icon="ops.gpencil.draw.line", +cursor='CROSSHAIR', +keymap=( +("gpencil.annotate", + dict(mode='DRAW_STRAIGHT', wait_for_input=False), + dict(type='EVT_TWEAK_A', value='ANY')), +), +draw_settings=draw_settings, +) -return dict( -text="Draw Polygon", -icon="ops.gpencil.draw.poly", -cursor='CROSSHAIR', -keymap=( -("gpencil.annotate", - dict(mode='DRAW_POLY', wait_for_input=False), -
[Bf-blender-cvs] [32f3ecf7011] blender2.8: Cleanup: use staticmethod when class isn't used
Commit: 32f3ecf70112e53ab4ff2770663976ad4e25cea6 Author: Campbell Barton Date: Thu Aug 23 20:16:50 2018 +1000 Branches: blender2.8 https://developer.blender.org/rB32f3ecf70112e53ab4ff2770663976ad4e25cea6 Cleanup: use staticmethod when class isn't used === M release/scripts/startup/bl_ui/space_toolsystem_toolbar.py === diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 35353474fad..f8992094c43 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -198,8 +198,8 @@ class _defs_view3d_generic: class _defs_annotate: -@classmethod -def draw_settings_common(cls, context, layout, tool): +@staticmethod +def draw_settings_common(context, layout, tool): ts = context.tool_settings space_type = tool.space_type @@ -1110,8 +1110,8 @@ class _defs_uv_select: class _defs_gpencil_paint: -@classmethod -def draw_color_selector(cls, context, layout): +@staticmethod +def draw_color_selector(context, layout): brush = context.active_gpencil_brush gp_settings = brush.gpencil_settings ts = context.tool_settings @@ -1122,8 +1122,8 @@ class _defs_gpencil_paint: else: row.template_greasepencil_color(gp_settings, "material", rows=3, cols=8, scale=0.8) -@classmethod -def draw_settings_common(cls, context, layout, tool): +@staticmethod +def draw_settings_common(context, layout, tool): ob = context.active_object if ob and ob.mode == 'GPENCIL_PAINT': brush = context.active_gpencil_brush @@ -1232,8 +1232,8 @@ class _defs_gpencil_edit: class _defs_gpencil_sculpt: -@classmethod -def draw_settings_common(cls, context, layout, tool): +@staticmethod +def draw_settings_common(context, layout, tool): ob = context.active_object if ob and ob.mode == 'GPENCIL_SCULPT': ts = context.tool_settings @@ -1403,8 +1403,8 @@ class _defs_gpencil_sculpt: class _defs_gpencil_weight: -@classmethod -def draw_settings_common(cls, context, layout, tool): +@staticmethod +def draw_settings_common(context, layout, tool): ob = context.active_object if ob and ob.mode == 'GPENCIL_WEIGHT': settings = context.tool_settings.gpencil_sculpt ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [48f7fe4829d] blender2.8: UI: rename "Ruler" to "Measure"
Commit: 48f7fe4829dc6e528ac0b2a9888b62c13fced4e5 Author: Campbell Barton Date: Thu Aug 23 16:50:43 2018 +1000 Branches: blender2.8 https://developer.blender.org/rB48f7fe4829dc6e528ac0b2a9888b62c13fced4e5 UI: rename "Ruler" to "Measure" === M release/scripts/startup/bl_ui/space_toolsystem_toolbar.py === diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 7607bdd35e5..35353474fad 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -188,7 +188,7 @@ class _defs_view3d_generic: @ToolDef.from_fn def ruler(): return dict( -text="Ruler", +text="Measure", icon="ops.view3d.ruler", widget="VIEW3D_GGT_ruler", keymap=( ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a619ad3f303] blender2.8: Add Torus: default generate UV's to true
Commit: a619ad3f3036858c488d4a288b4c9ae4a8064317 Author: Campbell Barton Date: Thu Aug 23 16:49:42 2018 +1000 Branches: blender2.8 https://developer.blender.org/rBa619ad3f3036858c488d4a288b4c9ae4a8064317 Add Torus: default generate UV's to true === M release/scripts/startup/bl_operators/add_mesh_torus.py === diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py index 68f49acc186..6bd470091c3 100644 --- a/release/scripts/startup/bl_operators/add_mesh_torus.py +++ b/release/scripts/startup/bl_operators/add_mesh_torus.py @@ -191,7 +191,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper): generate_uvs: BoolProperty( name="Generate UVs", description="Generate a default UV map", -default=False, +default=True, ) def draw(self, context): ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4de7c0c3105] blender2.8: Compositor: Film-like curve
Commit: 4de7c0c3105a80d244dd9f2078c310331873a16b Author: Jeroen Bakker Date: Thu Aug 23 10:25:54 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB4de7c0c3105a80d244dd9f2078c310331873a16b Compositor: Film-like curve Film-like curves for the RGB Curve node (Compositor) and Curve Modifier (Sequencer) Film-like curves originated from Adobe. "It’s an RGB curve where the tone curve is applied on the largest and smallest value, and then the middle value is adapted to keep a constant hue as defined by RGB-HSL/HSV. In terms of look and saturation increase it’s very similar to a pure RGB curve, more so than a HSL-L curve or HSV-V curve, but some color shift problems are avoided." Other tools like Natron, Krita and RawTherapee have implemented this curve tone. Reviewers: brecht, campbellbarton Reviewed By: brecht Tags: #compositing, #video_sequencer Differential Revision: https://developer.blender.org/D3638 === M release/scripts/startup/bl_ui/space_sequencer.py M source/blender/blenkernel/intern/colortools.c M source/blender/editors/include/UI_interface.h M source/blender/editors/interface/interface_templates.c M source/blender/editors/space_node/drawnode.c M source/blender/makesdna/DNA_color_types.h M source/blender/makesrna/intern/rna_color.c M source/blender/makesrna/intern/rna_ui_api.c === diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 84ae59772b6..dd90968bca3 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -1248,7 +1248,7 @@ class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel): box.prop(mod, "color_multiply") draw_color_balance(box, mod.color_balance) elif mod.type == 'CURVES': -box.template_curve_mapping(mod, "curve_mapping", type='COLOR') +box.template_curve_mapping(mod, "curve_mapping", type='COLOR', show_tone=True) elif mod.type == 'HUE_CORRECT': box.template_curve_mapping(mod, "curve_mapping", type='HUE') elif mod.type == 'BRIGHT_CONTRAST': diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index d18572a57f6..ddf11d148cb 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -938,6 +938,21 @@ void curvemapping_evaluateRGBF(const CurveMapping *cumap, float vecout[3], const vecout[2] = curvemap_evaluateF(&cumap->cm[2], curvemap_evaluateF(&cumap->cm[3], vecin[2])); } +static void curvemapping_evaluateRGBF_filmlike(const CurveMapping *cumap, float vecout[3], const float vecin[3], + const int channel_offset[3]) +{ + const float v0in = vecin[channel_offset[0]]; + const float v1in = vecin[channel_offset[1]]; + const float v2in = vecin[channel_offset[2]]; + + const float v0 = curvemap_evaluateF(&cumap->cm[channel_offset[0]], v0in); + const float v2 = curvemap_evaluateF(&cumap->cm[channel_offset[2]], v2in); + const float v1 = v2 + ((v0 - v2) * (v1in - v2in) / (v0in - v2in)); + + vecout[channel_offset[0]] = v0; + vecout[channel_offset[1]] = v1; + vecout[channel_offset[2]] = v2; +} /** same as #curvemapping_evaluate_premulRGBF * but black/bwmul are passed as args for the compositor * where they can change per pixel. @@ -950,17 +965,70 @@ void curvemapping_evaluateRGBF(const CurveMapping *cumap, float vecout[3], const void curvemapping_evaluate_premulRGBF_ex(const CurveMapping *cumap, float vecout[3], const float vecin[3], const float black[3], const float bwmul[3]) { - vecout[0] = curvemap_evaluateF(&cumap->cm[0], (vecin[0] - black[0]) * bwmul[0]); - vecout[1] = curvemap_evaluateF(&cumap->cm[1], (vecin[1] - black[1]) * bwmul[1]); - vecout[2] = curvemap_evaluateF(&cumap->cm[2], (vecin[2] - black[2]) * bwmul[2]); + const float r = (vecin[0] - black[0]) * bwmul[0]; + const float g = (vecin[1] - black[1]) * bwmul[1]; + const float b = (vecin[2] - black[2]) * bwmul[2]; + + switch (cumap->tone) + { + default: + case CURVE_TONE_STANDARD: + { + vecout[0] = curvemap_evaluateF(&cumap->cm[0], r); + vecout[1] = curvemap_evaluateF(&cumap->cm[1], g); + vecout[2] = curvemap_evaluateF(&cumap->cm[2], b); + break; + } + case CURVE_TONE_FILMLIKE: + { + if (r >= g) { + if (g > b) {
[Bf-blender-cvs] [b4f9b25107f] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Commit: b4f9b25107fca015f2e14e64ad94d6c0274aaed2 Author: Antonioya Date: Thu Aug 23 10:18:19 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBb4f9b25107fca015f2e14e64ad94d6c0274aaed2 Merge branch 'blender2.8' into greasepencil-object === === diff --cc source/blender/blenkernel/intern/gpencil_modifier.c index 57444f90425,3b0c86a1832..752147ae8a9 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@@ -409,13 -407,10 +409,12 @@@ void BKE_gpencil_stroke_modifiers(Depsg /* some modifiers could require a recalc of fill triangulation data */ if (gpd->flag & GP_DATA_STROKE_FORCE_RECALC) { if (ELEM(md->type, - eGpencilModifierType_Hook, - eGpencilModifierType_Lattice, - eGpencilModifierType_Offset)) - { + eGpencilModifierType_Armature, + eGpencilModifierType_Hook, + eGpencilModifierType_Lattice, + eGpencilModifierType_Noise, - eGpencilModifierType_Offset, - eGpencilModifierType_Smooth)) { ++ eGpencilModifierType_Offset)) { + gps->flag |= GP_STROKE_RECALC_CACHES; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5262e21c6c6] greasepencil-object: Cleanup style
Commit: 5262e21c6c6e7ca069ebea9be609f1da2ce4bbff Author: Antonioya Date: Wed Aug 22 10:29:43 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB5262e21c6c6e7ca069ebea9be609f1da2ce4bbff Cleanup style === M source/blender/editors/gpencil/gpencil_armature.c M source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c === diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c index 9b8b35cdaa1..b8a5c81d9ca 100644 --- a/source/blender/editors/gpencil/gpencil_armature.c +++ b/source/blender/editors/gpencil/gpencil_armature.c @@ -85,8 +85,9 @@ enum { #define DEFAULT_RATIO 0.10f #define DEFAULT_DECAY 0.8f -static int gpencil_bone_looper(Object *ob, Bone *bone, void *data, - int(*bone_func)(Object *, Bone *, void *)) +static int gpencil_bone_looper( + Object *ob, Bone *bone, void *data, + int(*bone_func)(Object *, Bone *, void *)) { /* We want to apply the function bone_func to every bone * in an armature -- feed bone_looper the first bone and @@ -142,17 +143,21 @@ static int bone_skinnable_cb(Object *UNUSED(ob), Bone *bone, void *datap) if (!(bone->flag & BONE_HIDDEN_P)) { if (!(bone->flag & BONE_NO_DEFORM)) { - if (data->heat && data->armob->pose && BKE_pose_channel_find_name(data->armob->pose, bone->name)) + if (data->heat && data->armob->pose && + BKE_pose_channel_find_name(data->armob->pose, bone->name)) + { segments = bone->segments; - else + } + else { segments = 1; + } if (data->list != NULL) { hbone = (Bone ***)&data->list; for (a = 0; a < segments; a++) { **hbone = bone; - ++*hbone; + *hbone++; } } return segments; @@ -208,12 +213,15 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap) if (!(bone->flag & BONE_HIDDEN_P)) { if (!(bone->flag & BONE_NO_DEFORM)) { - if (data->heat && data->armob->pose && BKE_pose_channel_find_name(data->armob->pose, bone->name)) + if (data->heat && data->armob->pose && + BKE_pose_channel_find_name(data->armob->pose, bone->name)) + { segments = bone->segments; - else + } + else { segments = 1; + } - //if (((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED))) { if (arm->layer & bone->layer) { if (!(defgroup = defgroup_find_name(ob, bone->name))) { defgroup = BKE_object_defgroup_add_name(ob, bone->name); @@ -229,7 +237,7 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap) for (a = 0; a < segments; a++) { **hgroup = defgroup; - ++*hgroup; + *hgroup++; } } return segments; @@ -253,9 +261,10 @@ static float get_weight(float dist, float decay_rad, float dif_rad) } /* This functions implements the automatic computation of vertex group weights */ -static void gpencil_add_verts_to_dgroups(const bContext *C, - ReportList *reports, Depsgraph *depsgraph, Scene *scene, - Object *ob, Object *ob_arm, const float ratio, const float decay) +static void gpencil_add_verts_to_dgroups( + const bContext *C, ReportList *reports, + Depsgraph *depsgraph, Scene *scene, + Object *ob, Object *ob_arm, const float ratio, const float decay) { bArmature *arm = ob_arm->data; Bone **bonelist, *bone; @@ -313,7 +322,9 @@ static void gpencil_add_verts_to_dgroups(const bContext *C, segments = 1; bbone = NULL; - if ((ob_arm->pose) && (pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name))) { + if ((ob_ar
[Bf-blender-cvs] [462c69d2889] greasepencil-object: Rename function and fix wrong pointer increment
Commit: 462c69d28890271e7799e4589e57e02918a9c84b Author: Antonioya Date: Wed Aug 22 22:59:52 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB462c69d28890271e7799e4589e57e02918a9c84b Rename function and fix wrong pointer increment The change done in previous cleanup broken the function. === M source/blender/editors/gpencil/gpencil_armature.c === diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c index b8a5c81d9ca..dfe36a65d68 100644 --- a/source/blender/editors/gpencil/gpencil_armature.c +++ b/source/blender/editors/gpencil/gpencil_armature.c @@ -113,7 +113,7 @@ static int gpencil_bone_looper( return count; } -static int bone_skinnable_cb(Object *UNUSED(ob), Bone *bone, void *datap) +static int gpencil_bone_skinnable_cb(Object *UNUSED(ob), Bone *bone, void *datap) { /* Bones that are deforming * are regarded to be "skinnable" and are eligible for @@ -157,7 +157,7 @@ static int bone_skinnable_cb(Object *UNUSED(ob), Bone *bone, void *datap) for (a = 0; a < segments; a++) { **hbone = bone; - *hbone++; + ++*hbone; } } return segments; @@ -237,7 +237,7 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap) for (a = 0; a < segments; a++) { **hgroup = defgroup; - *hgroup++; + ++*hgroup; } } return segments; @@ -287,7 +287,7 @@ static void gpencil_add_verts_to_dgroups( looper_data.list = NULL; /* count the number of skinnable bones */ - numbones = gpencil_bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb); + numbones = gpencil_bone_looper(ob, arm->bonebase.first, &looper_data, gpencil_bone_skinnable_cb); if (numbones == 0) return; @@ -296,7 +296,7 @@ static void gpencil_add_verts_to_dgroups( * and fill it with all of the skinnable bones */ bonelist = MEM_callocN(numbones * sizeof(Bone *), "bonelist"); looper_data.list = bonelist; - gpencil_bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb); + gpencil_bone_looper(ob, arm->bonebase.first, &looper_data, gpencil_bone_skinnable_cb); /* create an array of pointers to the deform groups that * correspond to the skinnable bones (creating them ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [39344493e36] greasepencil-object: Add Force Fill Data parameter
Commit: 39344493e36548d3ffb58033117ad0e9332856ff Author: Antonioya Date: Tue Aug 21 19:33:39 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB39344493e36548d3ffb58033117ad0e9332856ff Add Force Fill Data parameter Add a general parameter to force the recalc of the triangulation data because some modifiers could change the geometry and the filling triangles would not be right. Now, the parameter is visible in UI panel because this option reduces FPS, but maybe in the future we can keep always ON and remove the parameter. === M release/scripts/startup/bl_ui/properties_data_gpencil.py M release/scripts/startup/bl_ui/properties_data_modifier.py M source/blender/blenkernel/intern/gpencil_modifier.c M source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c M source/blender/makesdna/DNA_gpencil_modifier_types.h M source/blender/makesdna/DNA_gpencil_types.h M source/blender/makesrna/intern/rna_gpencil.c M source/blender/makesrna/intern/rna_gpencil_modifier.c === diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py index effa527e6db..169b521a2eb 100644 --- a/release/scripts/startup/bl_ui/properties_data_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py @@ -367,6 +367,8 @@ class DATA_PT_gpencil_display(DataButtonsPanel, Panel): layout.prop(gpd, "edit_line_color", text="Edit Line Color") layout.prop(ob, "empty_draw_size", text="Marker Size") +layout.prop(gpd, "force_fill_recalc", text="Force Fill Update") + col = layout.column(align=True) col.prop(gpd, "show_constant_thickness") sub = col.column() diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index db03d7ce3ba..37552f00116 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -2040,7 +2040,6 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel): col = layout.column() col.label(text="Object:") col.prop(md, "object", text="") -col.prop(md, "force_recalc", text="Force Fill Update") classes = ( diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index 74d0852fbbc..974a77fdc45 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -394,6 +394,7 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph, Object *ob, bGPDlayer *g GpencilModifierData *md; bGPdata *gpd = ob->data; const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd); + bool recalc_fill = false; for (md = ob->greasepencil_modifiers.first; md; md = md->next) { if (GPENCIL_MODIFIER_ACTIVE(md, is_render)) { @@ -405,6 +406,20 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph, Object *ob, bGPDlayer *g if (mti && mti->deformStroke) { mti->deformStroke(md, depsgraph, ob, gpl, gps); + + /* some modifiers could require a recalc of fill triangulation data */ + if (gpd->flag & GP_DATA_STROKE_FORCE_RECALC) { + if (ELEM(md->type, + eGpencilModifierType_Armature, + eGpencilModifierType_Hook, + eGpencilModifierType_Lattice, + eGpencilModifierType_Noise, + eGpencilModifierType_Offset, + eGpencilModifierType_Smooth)) { + + gps->flag |= GP_STROKE_RECALC_CACHES; + } + } } } } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c index af75cdb2afe..f7c80afad67 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c @@ -355,11 +355,6 @@ static void gpencil_armature_deform_verts(ArmatureGpencilModifierData *mmd, Obje } MEM_freeN(pdef_info_array); - - /* set recalc */ - if (mmd->flag & GP_ARMATURE_RECALC_FILL) { - gps->flag |= GP_STROKE_RECALC_CACHES; - } } /* deform stroke */ diff --git a/sour
[Bf-blender-cvs] [b91deea4dcd] greasepencil-object: Change calculation of automatic weights
Commit: b91deea4dcdb3e0f689805dd4215ad29f1f1d781 Author: Antonioya Date: Tue Aug 21 13:16:15 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBb91deea4dcdb3e0f689805dd4215ad29f1f1d781 Change calculation of automatic weights There were several mistakes and now is using standard routines. === M source/blender/editors/gpencil/gpencil_armature.c === diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c index 7cb6e9dd6f0..9b8b35cdaa1 100644 --- a/source/blender/editors/gpencil/gpencil_armature.c +++ b/source/blender/editors/gpencil/gpencil_armature.c @@ -82,52 +82,8 @@ enum { GP_ARMATURE_AUTO = 1 }; -#define DEFAULT_RATIO 0.15f -#define DEFAULT_DECAY 0.25f - -/* test if a point is inside cylinder - * Return: -1.0 if point is outside the cylinder - * o distance squared from cylinder axis if point is inside. - */ -static float test_point_in_cylynder(float pt1[3], float pt2[3], - float lengthsq, float radius_sq, bGPDspoint *pt) -{ - float dx[3];/* vector from line segment point 1 to point 2 */ - float pdx[3]; /* vector pd from point 1 to test point */ - float dot, dsq; - - sub_v3_v3v3(dx, pt2, pt1); - sub_v3_v3v3(pdx, &pt->x, pt1); - - /* Dot the d and pd vectors to see if point lies behind the */ - dot = dot_v3v3(pdx, dx); - - /* If dot is less than zero the point is behind the pt1 cap. -* If greater than the cylinder axis line segment length squared -* then the point is outside the other end cap at pt2. -*/ - if (dot < 0.0f || dot > lengthsq) - { - return(-1.0f); - } - else - { - /* Point lies within the parallel caps, so find, -* distance squared from point to line */ - - /* distance squared to the cylinder axis */ - dsq = (pdx[0] * pdx[0] + pdx[1] * pdx[1] + pdx[2] * pdx[2]) - dot * dot / lengthsq; - - if (dsq > radius_sq) - { - return(-1.0f); - } - else - { - return(dsq);// return distance squared to axis - } - } -} +#define DEFAULT_RATIO 0.10f +#define DEFAULT_DECAY 0.8f static int gpencil_bone_looper(Object *ob, Bone *bone, void *data, int(*bone_func)(Object *, Bone *, void *)) @@ -311,7 +267,7 @@ static void gpencil_add_verts_to_dgroups(const bContext *C, Mat4 bbone_array[MAX_BBONE_SUBDIV], *bbone = NULL; float(*root)[3], (*tip)[3], (*verts)[3]; - float *lensqr, *radsqr; + float *radsqr; int *selected; float weight; int numbones, i, j, segments = 0; @@ -346,7 +302,6 @@ static void gpencil_add_verts_to_dgroups(const bContext *C, root = MEM_callocN(numbones * sizeof(float) * 3, "root"); tip = MEM_callocN(numbones * sizeof(float) * 3, "tip"); selected = MEM_callocN(numbones * sizeof(int), "selected"); - lensqr = MEM_callocN(numbones * sizeof(float), "lensqr"); radsqr = MEM_callocN(numbones * sizeof(float), "radsqr"); for (j = 0; j < numbones; j++) { @@ -389,11 +344,8 @@ static void gpencil_add_verts_to_dgroups(const bContext *C, selected[j] = 1; - /* calculate len of bone squared */ - lensqr[j] = len_squared_v3v3(root[j], tip[j]); - /* calculate radius squared */ - radsqr[j] = lensqr[j] * ratio; + radsqr[j] = len_squared_v3v3(root[j], tip[j]) * ratio; } /* loop all strokes */ @@ -437,18 +389,16 @@ static void gpencil_add_verts_to_dgroups(const bContext *C, for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { MDeformVert *dvert = &gps->dvert[i]; - float dist = test_point_in_cylynder(root[j], tip[j], - lensqr[j], radsqr[j], - pt); - if (dist < 0) { + float dist = dist_squared_to_line_segment_v3(verts[i], root[j], tip[j]); + if (dist > radsqr[j]) { /* if not in cylinder, check if inside sphere of extremes */ weight = 0.0f; -
[Bf-blender-cvs] [ee212fd2040] greasepencil-object: UI: Change text of force recalc
Commit: ee212fd20408a31a168696132fd515df1682afe8 Author: Antonioya Date: Tue Aug 21 18:41:04 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBee212fd20408a31a168696132fd515df1682afe8 UI: Change text of force recalc === M release/scripts/startup/bl_ui/properties_data_modifier.py === diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index b7d1ec344f3..db03d7ce3ba 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -2040,7 +2040,7 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel): col = layout.column() col.label(text="Object:") col.prop(md, "object", text="") -col.prop(md, "force_recalc") +col.prop(md, "force_recalc", text="Force Fill Update") classes = ( ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [948e1de3259] greasepencil-object: Rename parent layer when change bone name
Commit: 948e1de32593eb2b0888e30854e8f870878ee15f Author: Antonioya Date: Mon Aug 20 22:34:14 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB948e1de32593eb2b0888e30854e8f870878ee15f Rename parent layer when change bone name === M source/blender/editors/armature/armature_naming.c === diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index 3ea20e6fde3..4c5313257dc 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -34,6 +34,7 @@ #include "DNA_armature_types.h" #include "DNA_constraint_types.h" #include "DNA_object_types.h" +#include "DNA_gpencil_types.h" #include "DNA_gpencil_modifier_types.h" #include "BLI_blenlib.h" @@ -270,6 +271,15 @@ void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep, /* fix grease pencil modifiers and vertex groups */ if (ob->type == OB_GPENCIL) { + + bGPdata *gpd = (bGPdata *)ob->data; + for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { + if ((gpl->parent != NULL) && (gpl->parent->data == arm)) { + if (STREQ(gpl->parsubstr, oldname)) + BLI_strncpy(gpl->parsubstr, newname, MAXBONENAME); + } + } + GpencilModifierData *gp_md = BKE_gpencil_modifiers_findByType(ob, eGpencilModifierType_Armature); if (gp_md) { ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)gp_md; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7fc1d6cf961] greasepencil-object: Cleanup: Unused variable
Commit: 7fc1d6cf96187c209346d5d2faa1f2f6a8db56fa Author: Antonioya Date: Tue Aug 21 20:02:25 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB7fc1d6cf96187c209346d5d2faa1f2f6a8db56fa Cleanup: Unused variable === M source/blender/blenkernel/intern/gpencil_modifier.c === diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index 974a77fdc45..57444f90425 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -394,7 +394,6 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph, Object *ob, bGPDlayer *g GpencilModifierData *md; bGPdata *gpd = ob->data; const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd); - bool recalc_fill = false; for (md = ob->greasepencil_modifiers.first; md; md = md->next) { if (GPENCIL_MODIFIER_ACTIVE(md, is_render)) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [62f67b8bef1] greasepencil-object: Implement Parent with Empty and Automatic weights
Commit: 62f67b8bef11f62d95d989629b97f5a6f4fe1fda Author: Antonioya Date: Tue Aug 21 11:25:11 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB62f67b8bef11f62d95d989629b97f5a6f4fe1fda Implement Parent with Empty and Automatic weights This is an alternative way of define weights. === M source/blender/editors/gpencil/gpencil_armature.c M source/blender/editors/include/ED_gpencil.h M source/blender/editors/object/object_relations.c === diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c index d7b00d86812..7cb6e9dd6f0 100644 --- a/source/blender/editors/gpencil/gpencil_armature.c +++ b/source/blender/editors/gpencil/gpencil_armature.c @@ -51,6 +51,7 @@ #include "DNA_meshdata_types.h" #include "DNA_scene_types.h" +#include "BKE_main.h" #include "BKE_action.h" #include "BKE_armature.h" #include "BKE_context.h" @@ -68,6 +69,7 @@ #include "RNA_enum_types.h" #include "ED_gpencil.h" +#include "ED_object.h" #include "ED_mesh.h" #include "DEG_depsgraph.h" @@ -80,6 +82,9 @@ enum { GP_ARMATURE_AUTO = 1 }; +#define DEFAULT_RATIO 0.15f +#define DEFAULT_DECAY 0.25f + /* test if a point is inside cylinder * Return: -1.0 if point is outside the cylinder * o distance squared from cylinder axis if point is inside. @@ -292,7 +297,7 @@ static float get_weight(float dist, float decay_rad, float dif_rad) } /* This functions implements the automatic computation of vertex group weights */ -static void gpencil_add_verts_to_dgroups(bContext *C, +static void gpencil_add_verts_to_dgroups(const bContext *C, ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, Object *ob_arm, const float ratio, const float decay) { @@ -392,8 +397,7 @@ static void gpencil_add_verts_to_dgroups(bContext *C, } /* loop all strokes */ - CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers) - { + for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { bGPDframe *init_gpf = gpl->actframe; bGPDspoint *pt = NULL; @@ -434,8 +438,8 @@ static void gpencil_add_verts_to_dgroups(bContext *C, for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { MDeformVert *dvert = &gps->dvert[i]; float dist = test_point_in_cylynder(root[j], tip[j], - lensqr[j], radsqr[j], - pt); + lensqr[j], radsqr[j], + pt); if (dist < 0) { /* if not in cylinder, check if inside sphere of extremes */ weight = 0.0f; @@ -470,7 +474,6 @@ static void gpencil_add_verts_to_dgroups(bContext *C, } } } - CTX_DATA_END; /* free the memory allocated */ MEM_SAFE_FREE(bonelist); @@ -482,7 +485,7 @@ static void gpencil_add_verts_to_dgroups(bContext *C, MEM_SAFE_FREE(selected); } -static void gpencil_object_vgroup_calc_from_armature(bContext *C, +static void gpencil_object_vgroup_calc_from_armature(const bContext *C, ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, Object *ob_arm, const int mode, const float ratio, const float decay) { @@ -515,6 +518,46 @@ static void gpencil_object_vgroup_calc_from_armature(bContext *C, } } +bool ED_gpencil_add_armature_weights(const bContext *C, ReportList *reports, + Object *ob, Object *ob_arm, int mode) +{ + Main *bmain = CTX_data_main(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); + Scene *scene = CTX_data_scene(C); + + /* if no armature modifier, add a new one */ + GpencilModifierData *md = BKE_gpencil_modifiers_findByType(ob, eGpencilModifierType_Armature); + if (md == NULL) { + md = ED_object_gpencil_modifier_add(reports, bmain, scene, + ob, "Armature", eGpencilModifierType_Armature); + if (md == NULL) { + BKE_report(reports, RPT_ERROR, + "Unable to add a new Armature modifier to object"); + return f
[Bf-blender-cvs] [f92e13a4ebe] greasepencil-object: Enable Fade geometry in Pose mode
Commit: f92e13a4ebe651685dc01c24edd78b71c31633e8 Author: Antonioya Date: Mon Aug 20 23:18:09 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBf92e13a4ebe651685dc01c24edd78b71c31633e8 Enable Fade geometry in Pose mode Now the grease pencil geometry is fade when the alpha value is enabled. === M source/blender/draw/engines/gpencil/gpencil_draw_utils.c M source/blender/makesrna/intern/rna_space.c === diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c index 16412dda3f8..0d304da24f5 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@ -553,14 +553,14 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create( static void gpencil_add_fill_shgroup( GpencilBatchCache *cache, DRWShadingGroup *fillgrp, Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps, -const float tintcolor[4], const bool onion, const bool custonion) + float opacity, const float tintcolor[4], const bool onion, const bool custonion) { MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1); if (gps->totpoints >= 3) { float tfill[4]; /* set color using material, tint color and opacity */ interp_v3_v3v3(tfill, gps->runtime.tmp_fill_rgba, tintcolor, tintcolor[3]); - tfill[3] = gps->runtime.tmp_fill_rgba[3] * gpl->opacity; + tfill[3] = gps->runtime.tmp_fill_rgba[3] * opacity; if ((tfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (gp_style->fill_style > 0)) { const float *color; if (!onion) { @@ -866,7 +866,7 @@ static void gpencil_draw_strokes( if ((fillgrp) && (!stl->storage->simplify_fill)) { gpencil_add_fill_shgroup( cache, fillgrp, ob, gpl, derived_gpf, gps, - tintcolor, false, custonion); + opacity, tintcolor, false, custonion); } /* stroke */ if (strokegrp) { @@ -1218,6 +1218,7 @@ void DRW_gpencil_populate_datablock( const bool main_onion = v3d != NULL ? (v3d->gp_flag & V3D_GP_SHOW_ONION_SKIN) : true; const bool do_onion = (bool)((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0) && main_onion; const bool overlay = v3d != NULL ? (bool)((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) : true; + float opacity; /* check if playing animation */ bool playing = stl->storage->is_playing; @@ -1241,6 +1242,16 @@ void DRW_gpencil_populate_datablock( if (gpf == NULL) continue; + /* if pose mode, maybe the overlay to fade geometry is enabled */ + if ((draw_ctx->obact) && (draw_ctx->object_mode == OB_MODE_POSE) && + (v3d->overlay.flag & V3D_OVERLAY_BONE_SELECT)) + { + opacity = gpl->opacity * v3d->overlay.bone_select_alpha; + } + else { + opacity = gpl->opacity; + } + /* create GHash if need */ if (gpl->runtime.derived_data == NULL) { gpl->runtime.derived_data = (GHash *)BLI_ghash_str_new(gpl->info); @@ -1307,7 +1318,7 @@ void DRW_gpencil_populate_datablock( gpencil_draw_strokes( cache, e_data, vedata, ts, ob, gpd, gpl, gpf, derived_gpf, - gpl->opacity, gpl->tintcolor, false, cache_ob); + opacity, gpl->tintcolor, false, cache_ob); } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d7563f13dc2..990399235d9 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2746,7 +2746,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_BONE_SELECT); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Bone Selection", "Show the Bone Selection Overlay"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update"); prop = RNA_def_property(srna, "bone_select_alpha", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "overlay.bone_select_alpha"); @@ -2754,7 +2754,7 @@ static void rna_def_space_vi
[Bf-blender-cvs] [7088c211a50] greasepencil-object: Rename bone if Armature modifier
Commit: 7088c211a50a16760763452227d439e86fb8bcd9 Author: Antonioya Date: Mon Aug 20 17:28:11 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB7088c211a50a16760763452227d439e86fb8bcd9 Rename bone if Armature modifier === M source/blender/editors/armature/armature_naming.c === diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index 350dee07a2c..3ea20e6fde3 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -34,6 +34,7 @@ #include "DNA_armature_types.h" #include "DNA_constraint_types.h" #include "DNA_object_types.h" +#include "DNA_gpencil_modifier_types.h" #include "BLI_blenlib.h" #include "BLI_ghash.h" @@ -51,6 +52,7 @@ #include "BKE_global.h" #include "BKE_main.h" #include "BKE_modifier.h" +#include "BKE_gpencil_modifier.h" #include "DEG_depsgraph.h" @@ -265,6 +267,37 @@ void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep, break; } } + + /* fix grease pencil modifiers and vertex groups */ + if (ob->type == OB_GPENCIL) { + GpencilModifierData *gp_md = BKE_gpencil_modifiers_findByType(ob, eGpencilModifierType_Armature); + if (gp_md) { + ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)gp_md; + if (mmd->object && mmd->object->data == arm) { + bDeformGroup *dg = defgroup_find_name(ob, oldname); + if (dg) { + BLI_strncpy(dg->name, newname, MAXBONENAME); + } + } + } + + for (gp_md = ob->greasepencil_modifiers.first; gp_md; gp_md = gp_md->next) { + switch (gp_md->type) { + case eGpencilModifierType_Hook: + { + HookGpencilModifierData *hgp_md = (HookGpencilModifierData *)gp_md; + if (hgp_md->object && (hgp_md->object->data == arm)) { + if (STREQ(hgp_md->subtarget, oldname)) + BLI_strncpy(hgp_md->subtarget, newname, MAXBONENAME); + } + break; + } + default: + break; + } + } + } + DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE); } /* Fix all animdata that may refer to this bone - we can't just do the ones attached to objects, since ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8ddbcd67f4f] greasepencil-object: Add weights to subdivide points
Commit: 8ddbcd67f4fecd14ce0e5f25913b24bc936de0d4 Author: Antonioya Date: Mon Aug 20 13:57:08 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB8ddbcd67f4fecd14ce0e5f25913b24bc936de0d4 Add weights to subdivide points === M source/blender/blenloader/intern/readfile.c M source/blender/editors/gpencil/gpencil_edit.c === diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index a990e9213c3..ba56852e016 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6594,8 +6594,10 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd) gps->points = newdataadr(fd, gps->points); /* relink weight data */ - gps->dvert = newdataadr(fd, gps->dvert); - direct_link_dverts(fd, gps->totpoints, gps->dvert); + if (gps->dvert) { + gps->dvert = newdataadr(fd, gps->dvert); + direct_link_dverts(fd, gps->totpoints, gps->dvert); + } /* the triangulation is not saved, so need to be recalculated */ gps->triangles = NULL; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index f7c08239647..beef2cf7c94 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -2878,6 +2878,8 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDspoint *temp_points; + MDeformVert *temp_dverts; + const int cuts = RNA_int_get(op->ptr, "number_cuts"); int totnewpoints, oldtotpoints; @@ -2899,20 +2901,25 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) } /* duplicate points in a temp area */ temp_points = MEM_dupallocN(gps->points); + if (gps->dvert == NULL) { + gps->dvert = MEM_callocN(sizeof(MDeformVert) * gps->totpoints, "gp_stroke_weights"); + } + temp_dverts = MEM_dupallocN(gps->dvert); + oldtotpoints = gps->totpoints; /* resize the points arrys */ gps->totpoints += totnewpoints; gps->points = MEM_recallocN(gps->points, sizeof(*gps->points) * gps->totpoints); - if (gps->dvert != NULL) { - gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * gps->totpoints); - } + gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * gps->totpoints); + gps->flag |= GP_STROKE_RECALC_CACHES; /* loop and interpolate */ i2 = 0; for (int i = 0; i < oldtotpoints; i++) { bGPDspoint *pt = &temp_points[i]; + MDeformVert *dvert = &temp_dverts[i]; bGPDspoint *pt_final = &gps->points[i2]; MDeformVert *dvert_final = &gps->dvert[i2]; @@ -2924,8 +2931,8 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) pt_final->time = pt->time; pt_final->flag = pt->flag; - dvert_final->totweight = 0; - dvert_final->dw = NULL; + dvert_final->totweight = dvert->totweight; + dvert_final->dw = dvert->dw; i2++; /* if next point is selected add a half way point */ @@ -2945,9 +2952,8 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) pt_final->time = interpf(pt->time, next->time, 0.5f); pt_final->flag |= GP_SPOINT_SELECT; - dvert_final->totweight = 0; - dvert_final->dw = NULL; - +
[Bf-blender-cvs] [b425c0a302d] greasepencil-object: Add weight data when drawing
Commit: b425c0a302dbc949c63cd35532f1fbb8bb4e08ee Author: Antonioya Date: Mon Aug 20 16:59:01 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBb425c0a302dbc949c63cd35532f1fbb8bb4e08ee Add weight data when drawing === M release/scripts/startup/bl_ui/space_topbar.py M source/blender/editors/gpencil/gpencil_fill.c M source/blender/editors/gpencil/gpencil_paint.c M source/blender/editors/gpencil/gpencil_primitive.c M source/blender/makesdna/DNA_scene_types.h M source/blender/makesrna/intern/rna_scene.c === diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 881d3db8a4c..5c8c195c39a 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -172,6 +172,7 @@ class TOPBAR_HT_lower_bar(Header): if context.tool_settings.gpencil_stroke_placement_view3d in ('ORIGIN', 'CURSOR'): layout.prop(context.tool_settings.gpencil_sculpt, "lockaxis", text='') layout.prop(context.tool_settings, "use_gpencil_draw_onback", text="", icon='ORTHO') +layout.prop(context.tool_settings, "add_gpencil_weight_data", text="", icon='WPAINT_HLT') layout.prop(context.tool_settings, "use_gpencil_additive_drawing", text="", icon='FREEZE') elif mode == 'GPENCIL_SCULPT': diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index c6df07ae83e..9a15284abae 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -865,6 +865,10 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf) pt = gps->points; dvert = gps->dvert; point2D = (tGPspoint *)tgpf->sbuffer; + + const int def_nr = tgpf->ob->actdef - 1; + const bool is_weight = (bool)BLI_findlink(&tgpf->ob->defbase, def_nr); + for (int i = 0; i < tgpf->sbuffer_size && point2D; i++, point2D++, pt++, dvert++) { /* convert screen-coordinates to 3D coordinates */ gp_stroke_convertcoords_tpoint( @@ -877,8 +881,13 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf) pt->strength = 1.0f;; pt->time = 0.0f; - dvert->totweight = 0; - dvert->dw = NULL; + if ((ts->gpencil_flags & GP_TOOL_FLAG_CREATE_WEIGHTS) && (is_weight)) { + BKE_gpencil_vgroup_add_point_weight(dvert, def_nr, ts->vgroup_weight); + } + else { + dvert->totweight = 0; + dvert->dw = NULL; + } } /* smooth stroke */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index d4371926eb4..5481ae85f7c 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -554,6 +554,8 @@ static short gp_stroke_addpoint( RegionView3D *rv3d = p->ar->regiondata; View3D *v3d = p->sa->spacedata.first; MaterialGPencilStyle *gp_style = p->material->gp_style; + const int def_nr = obact->actdef - 1; + const bool is_weight = (bool)BLI_findlink(&obact->defbase, def_nr); /* check painting mode */ if (p->paintmode == GP_PAINTMODE_DRAW_STRAIGHT) { @@ -786,8 +788,13 @@ static short gp_stroke_addpoint( pts->uv_fac = pt->uv_fac; pts->uv_rot = pt->uv_rot; - dvert->totweight = 0; - dvert->dw = NULL; + if ((ts->gpencil_flags & GP_TOOL_FLAG_CREATE_WEIGHTS) && (is_weight)) { + BKE_gpencil_vgroup_add_point_weight(dvert, def_nr, ts->vgroup_weight); + } + else { + dvert->totweight = 0; + dvert->dw = NULL; + } /* force fill recalc */ gps->flag |= GP_STROKE_RECALC_CACHES; @@ -897,6 +904,8 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) ToolSettings *ts = p->scene->toolsettings; Depsgraph *depsgraph = p->depsgraph; Object *obact = (Object *)p->ownerPtr.data; + const int def_nr = obact->actdef - 1; + const bool is_weight = (bool)BLI_findlink(&obact->defbase, def_nr); int i, totelem; /* since strokes are so fine, when using their depth we need a margin otherwise they might get missed */ @@ -973,8 +982,13 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f); pt->time = ptc->time; -
[Bf-blender-cvs] [fbc2a8a6041] greasepencil-object: Interpolate weights when subdivide
Commit: fbc2a8a6041218f139949dcdbf64a8827157b0f6 Author: Antonioya Date: Mon Aug 20 15:59:17 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBfbc2a8a6041218f139949dcdbf64a8827157b0f6 Interpolate weights when subdivide === M source/blender/editors/gpencil/gpencil_edit.c M source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c === diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index beef2cf7c94..87d85d9ae6c 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -2945,6 +2945,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) } /* Interpolate all values */ bGPDspoint *next = &temp_points[i + 1]; + MDeformVert *dvert_next = &temp_dverts[i + 1]; interp_v3_v3v3(&pt_final->x, &pt->x, &next->x, 0.5f); pt_final->pressure = interpf(pt->pressure, next->pressure, 0.5f); pt_final->strength = interpf(pt->strength, next->strength, 0.5f); @@ -2954,6 +2955,17 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) dvert_final->totweight = dvert->totweight; dvert_final->dw = MEM_dupallocN(dvert->dw); + + /* interpolate weight values */ + for (int d = 0; d < dvert->totweight; d++) { + MDeformWeight *dw_a = &dvert->dw[d]; + if (dvert_next->totweight > d) { + MDeformWeight *dw_b = &dvert_next->dw[d]; + MDeformWeight *dw_final = &dvert_final->dw[d]; + dw_final->weight= interpf(dw_a->weight,dw_b->weight, 0.5f); + } + } + i2++; } } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c index 8f22633e982..d5a372a8ba5 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c @@ -124,6 +124,8 @@ static void deformStroke( MDeformVert *dvert = &temp_dverts[i]; bGPDspoint *next = &temp_points[i + 1]; + MDeformVert *dvert_next = &temp_dverts[i + 1]; + bGPDspoint *pt_final = &gps->points[i2]; MDeformVert *dvert_final = &gps->dvert[i2]; @@ -136,6 +138,17 @@ static void deformStroke( dvert_final->totweight = dvert->totweight; dvert_final->dw = MEM_dupallocN(dvert->dw); + + /* interpolate weight values */ + for (int d = 0; d < dvert->totweight; d++) { + MDeformWeight *dw_a = &dvert->dw[d]; + if (dvert_next->totweight > d) { + MDeformWeight *dw_b = &dvert_next->dw[d]; + MDeformWeight *dw_final = &dvert_final->dw[d]; + dw_final->weight = interpf(dw_a->weight, dw_b->weight, 0.5f); + } + } + i2 += 2; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ec58cb0429d] greasepencil-object: Manage weights in simplify operator and modifier
Commit: ec58cb0429df8dfd5ed9aaa32280df5b600b1a69 Author: Antonioya Date: Mon Aug 20 14:12:21 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBec58cb0429df8dfd5ed9aaa32280df5b600b1a69 Manage weights in simplify operator and modifier === M source/blender/blenkernel/intern/gpencil_modifier.c === diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index d1c455f64e1..1527ef85781 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -308,6 +308,7 @@ void BKE_gpencil_simplify_fixed(bGPDstroke *gps) if ((i == 0) || (i == gps->totpoints - 1) || ((i % 2) > 0.0)) { memcpy(pt, pt_src, sizeof(bGPDspoint)); memcpy(dvert, dvert_src, sizeof(MDeformVert)); + memcpy(dvert->dw, dvert_src->dw, sizeof(MDeformWeight)); j++; } else { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [cdad9b4960e] greasepencil-object: Keep weight when simplify with RDP
Commit: cdad9b4960e527ce5f7c3c84f58fdd5aa3f314ad Author: Antonioya Date: Mon Aug 20 16:03:57 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBcdad9b4960e527ce5f7c3c84f58fdd5aa3f314ad Keep weight when simplify with RDP === M source/blender/blenkernel/intern/gpencil_modifier.c === diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index 1527ef85781..74d0852fbbc 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -237,6 +237,7 @@ static void gpencil_rdp_stroke(bGPDstroke *gps, vec2f *points2d, float epsilon) if ((marked[i]) || (i == 0) || (i == totpoints - 1)) { memcpy(pt, pt_src, sizeof(bGPDspoint)); memcpy(dvert, dvert_src, sizeof(MDeformVert)); + memcpy(dvert->dw, dvert_src->dw, sizeof(MDeformWeight)); j++; } else { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9d3cea5e542] greasepencil-object: Improvements in automatic weight calculation
Commit: 9d3cea5e542334fe123de00879837098afff37f0 Author: Antonioya Date: Mon Aug 20 11:22:25 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB9d3cea5e542334fe123de00879837098afff37f0 Improvements in automatic weight calculation === M release/scripts/startup/bl_ui/space_view3d.py M source/blender/editors/gpencil/gpencil_armature.c === diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 2edd1815c08..261129ed55c 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -3539,6 +3539,15 @@ class VIEW3D_MT_edit_armature_delete(Menu): # ** Grease Pencil Stroke menus ** +class VIEW3D_MT_gpencil_autoweights(Menu): +bl_label = "Generate Weights" + +def draw(self, context): +layout = self.layout +layout.operator("gpencil.generate_weights", text="With Empty Groups").mode = 'NAME' +layout.operator("gpencil.generate_weights", text="With Automatic Weights").mode = 'AUTO' + + class VIEW3D_MT_gpencil_simplify(Menu): bl_label = "Simplify" @@ -3686,6 +3695,9 @@ class VIEW3D_MT_weight_gpencil(Menu): layout.operator("gpencil.vertex_group_invert", text="Invert") layout.operator("gpencil.vertex_group_smooth", text="Smooth") +layout.separator() +layout.menu("VIEW3D_MT_gpencil_autoweights") + class VIEW3D_MT_gpencil_animation(Menu): bl_label = "Animation" @@ -4967,7 +4979,6 @@ class VIEW3D_MT_gpencil_sculpt_specials(Menu): def draw(self, context): layout = self.layout -is_3d_view = context.space_data.type == 'VIEW_3D' layout.operator_context = 'INVOKE_REGION_WIN' layout.menu("VIEW3D_MT_assign_material") @@ -4982,6 +4993,9 @@ class VIEW3D_MT_gpencil_sculpt_specials(Menu): layout.operator("gpencil.stroke_simplify_fixed", text="Simplify") layout.operator("gpencil.stroke_simplify", text="Simplify Adaptative") +if context.mode == 'GPENCIL_WEIGHT': +layout.separator() +layout.menu("VIEW3D_MT_gpencil_autoweights") classes = ( VIEW3D_HT_header, @@ -5126,6 +5140,7 @@ classes = ( VIEW3D_PT_object_type_visibility, VIEW3D_PT_grease_pencil, VIEW3D_PT_gpencil_multi_frame, +VIEW3D_MT_gpencil_autoweights, VIEW3D_MT_gpencil_edit_specials, VIEW3D_MT_gpencil_sculpt_specials, VIEW3D_PT_quad_view, diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c index 0f0b176dbb3..d7b00d86812 100644 --- a/source/blender/editors/gpencil/gpencil_armature.c +++ b/source/blender/editors/gpencil/gpencil_armature.c @@ -71,6 +71,7 @@ #include "ED_mesh.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "gpencil_intern.h" @@ -276,9 +277,24 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap) return 0; } +/* get weight value depending of distance and decay value */ +static float get_weight(float dist, float decay_rad, float dif_rad) +{ + float weight = 1.0f; + if (dist < decay_rad) { + weight = 1.0f; + } + else { + weight = interpf(0.0f, 0.9f, (dist - decay_rad) / dif_rad); + } + + return weight; +} + /* This functions implements the automatic computation of vertex group weights */ static void gpencil_add_verts_to_dgroups(bContext *C, - ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, Object *ob_arm) + ReportList *reports, Depsgraph *depsgraph, Scene *scene, + Object *ob, Object *ob_arm, const float ratio, const float decay) { bArmature *arm = ob_arm->data; Bone **bonelist, *bone; @@ -372,7 +388,7 @@ static void gpencil_add_verts_to_dgroups(bContext *C, lensqr[j] = len_squared_v3v3(root[j], tip[j]); /* calculate radius squared */ - radsqr[j] = lensqr[j] / 6.0f; + radsqr[j] = lensqr[j] * ratio; } /* loop all strokes */ @@ -412,6 +428,9 @@ static void gpencil_add_verts_to_dgroups(bContext *C, continue; } + float decay_rad = radsqr[j] - (radsqr[j] * decay); + float dif_rad = radsqr[j] - decay_rad; + for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { MDeformVert *dvert = &gps->dvert[i]; float dist = test_point_in_cylynder(root[j], tip[j], @@ -420,21 +439,20 @@ stat
[Bf-blender-cvs] [c91aaf5891e] greasepencil-object: More changes to subdivide modifier
Commit: c91aaf5891e319e16669ac812d665ae64736f6bc Author: Antonioya Date: Mon Aug 20 14:06:04 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBc91aaf5891e319e16669ac812d665ae64736f6bc More changes to subdivide modifier === M source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c === diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c index dba3e028904..8f22633e982 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c @@ -70,6 +70,7 @@ static void deformStroke( { SubdivGpencilModifierData *mmd = (SubdivGpencilModifierData *)md; bGPDspoint *temp_points; + MDeformVert *temp_dverts; int totnewpoints, oldtotpoints; int i2; @@ -85,6 +86,10 @@ static void deformStroke( totnewpoints = gps->totpoints - 1; /* duplicate points in a temp area */ temp_points = MEM_dupallocN(gps->points); + if (gps->dvert == NULL) { + gps->dvert = MEM_callocN(sizeof(MDeformVert) * gps->totpoints, "gp_stroke_weights"); + } + temp_dverts = MEM_dupallocN(gps->dvert); oldtotpoints = gps->totpoints; /* resize the points arrys */ @@ -99,7 +104,7 @@ static void deformStroke( bGPDspoint *pt = &temp_points[i]; bGPDspoint *pt_final = &gps->points[i2]; - MDeformVert *dvert = &gps->dvert[i]; + MDeformVert *dvert = &temp_dverts[i]; MDeformVert *dvert_final = &gps->dvert[i2]; copy_v3_v3(&pt_final->x, &pt->x); @@ -116,6 +121,8 @@ static void deformStroke( i2 = 1; for (int i = 0; i < oldtotpoints - 1; i++) { bGPDspoint *pt = &temp_points[i]; + MDeformVert *dvert = &temp_dverts[i]; + bGPDspoint *next = &temp_points[i + 1]; bGPDspoint *pt_final = &gps->points[i2]; MDeformVert *dvert_final = &gps->dvert[i2]; @@ -127,12 +134,13 @@ static void deformStroke( CLAMP(pt_final->strength, GPENCIL_STRENGTH_MIN, 1.0f); pt_final->time = interpf(pt->time, next->time, 0.5f); - dvert_final->totweight = 0; - dvert_final->dw = NULL; + dvert_final->totweight = dvert->totweight; + dvert_final->dw = MEM_dupallocN(dvert->dw); i2 += 2; } MEM_SAFE_FREE(temp_points); + MEM_SAFE_FREE(temp_dverts); /* move points to smooth stroke (not simple flag )*/ if ((mmd->flag & GP_SUBDIV_SIMPLE) == 0) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9d937032b9c] greasepencil-object: Code cleanup: remove unused code
Commit: 9d937032b9c3a6e62015c70b3538acefdeae8e5b Author: Antonioya Date: Sat Aug 18 19:22:17 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB9d937032b9c3a6e62015c70b3538acefdeae8e5b Code cleanup: remove unused code === 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 753249458a8..edf98a8c921 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c @@ -71,11 +71,10 @@ typedef struct bPoseChanDeform { DualQuat *b_bone_dual_quats; } bPoseChanDeform; -typedef struct ArmatureBBoneDefmatsData { +typedef struct GpArmatureBBoneDefmatsData { bPoseChanDeform *pdef_info_array; DualQuat *dualquats; - bool use_quaternion; -} ArmatureBBoneDefmatsData; +} GpArmatureBBoneDefmatsData; static void initData(GpencilModifierData *md) { @@ -215,7 +214,7 @@ static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f return contrib; } -static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info, const bool use_quaternion) +static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info) { Bone *bone = pchan->bone; Mat4 b_bone[MAX_BBONE_SUBDIV], b_bone_rest[MAX_BBONE_SUBDIV]; @@ -226,15 +225,10 @@ static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info b_bone_spline_setup(pchan, 0, b_bone); b_bone_spline_setup(pchan, 1, b_bone_rest); - /* allocate b_bone matrices and dual quats */ + /* allocate b_bone matrices */ b_bone_mats = MEM_mallocN((1 + bone->segments) * sizeof(Mat4), "BBone defmats"); pdef_info->b_bone_mats = b_bone_mats; - if (use_quaternion) { - b_bone_dual_quats = MEM_mallocN((bone->segments) * sizeof(DualQuat), "BBone dqs"); - pdef_info->b_bone_dual_quats = b_bone_dual_quats; - } - /* first matrix is the inverse arm_mat, to bring points in local bone space * for finding out which segment it belongs to */ invert_m4_m4(b_bone_mats[0].mat, bone->arm_mat); @@ -251,34 +245,25 @@ static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info invert_m4_m4(tmat, b_bone_rest[a].mat); mul_m4_series(b_bone_mats[a + 1].mat, pchan->chan_mat, bone->arm_mat, b_bone[a].mat, tmat, b_bone_mats[0].mat); - if (use_quaternion) - mat4_to_dquat(&b_bone_dual_quats[a], bone->arm_mat, b_bone_mats[a + 1].mat); } } static void gpencil_armature_bbone_defmats_cb(void *userdata, Link *iter, int index) { - ArmatureBBoneDefmatsData *data = userdata; + GpArmatureBBoneDefmatsData *data = userdata; bPoseChannel *pchan = (bPoseChannel *)iter; if (!(pchan->bone->flag & BONE_NO_DEFORM)) { bPoseChanDeform *pdef_info = &data->pdef_info_array[index]; - const bool use_quaternion = data->use_quaternion; if (pchan->bone->segments > 1) { - pchan_b_bone_defmats(pchan, pdef_info, use_quaternion); + pchan_b_bone_defmats(pchan, pdef_info); } - if (use_quaternion) { - pdef_info->dual_quat = &data->dualquats[index]; - mat4_to_dquat(pdef_info->dual_quat, pchan->bone->arm_mat, pchan->chan_mat); - } } } -static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstroke *gps, float(*vertexCos)[3], - float(*defMats)[3][3], int numVerts, int deformflag, - float(*prevCos)[3], const char *defgrp_name) +static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstroke *gps) { bPoseChanDeform *pdef_info_array; bPoseChanDeform *pdef_info = NULL; @@ -289,12 +274,8 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr bDeformGroup *dg; DualQuat *dualquats = NULL; float obinv[4][4], premat[4][4], postmat[4][4]; - const bool use_envelope = (deformflag & ARM_DEF_ENVELOPE) != 0; - const bool use_quaternion = (deformflag & ARM_DEF_QUATERNION) != 0; - const bool invert_vgroup = (deformflag & ARM_DEF_INVERT_VGROUP) != 0; int defbase_tot = 0; /* safety for vertexgroup index overflow */ int i, target_totvert = 0; /* safety for vertexgroup overflow */ - int armature_def_nr; // revisar int totchan; /* in editmode, or not an armature */ @@ -315,22 +296,14 @@ static void gpencil_armature_deform_verts(Object *armOb, O
[Bf-blender-cvs] [d634916624c] greasepencil-object: Cleanup code and comments
Commit: d634916624c5b74fe26861c2643ca052734e2f95 Author: Antonioya Date: Sat Aug 18 22:47:27 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBd634916624c5b74fe26861c2643ca052734e2f95 Cleanup code and comments === 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 36deaddf3ad..28203ed557b 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c @@ -219,7 +219,6 @@ static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info Bone *bone = pchan->bone; Mat4 b_bone[MAX_BBONE_SUBDIV], b_bone_rest[MAX_BBONE_SUBDIV]; Mat4 *b_bone_mats; - DualQuat *b_bone_dual_quats = NULL; int a; b_bone_spline_setup(pchan, 0, b_bone); @@ -334,6 +333,7 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr } BLI_ghash_free(idx_hash, NULL, NULL); + /* deform points of stroke */ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { MDeformVert *dvert = &gps->dvert[i]; DualQuat *dq = NULL; @@ -381,9 +381,11 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr /* always, check above code */ mul_m4_v3(postmat, co); + /* copy back new location to point */ copy_v3_v3(&pt->x, co); } + /* free memory */ if (defnrToPC) MEM_freeN(defnrToPC); if (defnrToPCIndex) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b5301a185c5] greasepencil-object: Limit Armature modifier to only one instance
Commit: b5301a185c515fee1ec3c49fb421bc93d4ce5adb Author: Antonioya Date: Sat Aug 18 22:32:00 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBb5301a185c515fee1ec3c49fb421bc93d4ce5adb Limit Armature modifier to only one instance === 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 a00991b3b47..36deaddf3ad 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c @@ -477,7 +477,7 @@ GpencilModifierTypeInfo modifierType_Gpencil_Armature = { /* structName */"ArmatureGpencilModifierData", /* structSize */sizeof(ArmatureGpencilModifierData), /* type */ eGpencilModifierTypeType_Gpencil, - /* flags */ 0, + /* flags */ eGpencilModifierTypeFlag_Single, /* copyData */ copyData, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [dfdf4514a52] greasepencil-object: New operator to generate automatic weights
Commit: dfdf4514a52b7dad740b75c380bbd4ed6ac05fd7 Author: Antonioya Date: Sun Aug 19 17:22:35 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBdfdf4514a52b7dad740b75c380bbd4ed6ac05fd7 New operator to generate automatic weights === M source/blender/editors/gpencil/gpencil_armature.c M source/blender/editors/gpencil/gpencil_data.c === diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c index 0ee25c58603..0f0b176dbb3 100644 --- a/source/blender/editors/gpencil/gpencil_armature.c +++ b/source/blender/editors/gpencil/gpencil_armature.c @@ -48,6 +48,7 @@ #include "DNA_armature_types.h" #include "DNA_gpencil_types.h" +#include "DNA_meshdata_types.h" #include "DNA_scene_types.h" #include "BKE_action.h" @@ -78,6 +79,50 @@ enum { GP_ARMATURE_AUTO = 1 }; +/* test if a point is inside cylinder + * Return: -1.0 if point is outside the cylinder + * o distance squared from cylinder axis if point is inside. + */ +static float test_point_in_cylynder(float pt1[3], float pt2[3], + float lengthsq, float radius_sq, bGPDspoint *pt) +{ + float dx[3];/* vector from line segment point 1 to point 2 */ + float pdx[3]; /* vector pd from point 1 to test point */ + float dot, dsq; + + sub_v3_v3v3(dx, pt2, pt1); + sub_v3_v3v3(pdx, &pt->x, pt1); + + /* Dot the d and pd vectors to see if point lies behind the */ + dot = dot_v3v3(pdx, dx); + + /* If dot is less than zero the point is behind the pt1 cap. +* If greater than the cylinder axis line segment length squared +* then the point is outside the other end cap at pt2. +*/ + if (dot < 0.0f || dot > lengthsq) + { + return(-1.0f); + } + else + { + /* Point lies within the parallel caps, so find, +* distance squared from point to line */ + + /* distance squared to the cylinder axis */ + dsq = (pdx[0] * pdx[0] + pdx[1] * pdx[1] + pdx[2] * pdx[2]) - dot * dot / lengthsq; + + if (dsq > radius_sq) + { + return(-1.0f); + } + else + { + return(dsq);// return distance squared to axis + } + } +} + static int gpencil_bone_looper(Object *ob, Bone *bone, void *data, int(*bone_func)(Object *, Bone *, void *)) { @@ -196,17 +241,18 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap) */ bDeformGroup ***hgroup, *defgroup = NULL; int a, segments; - struct { Object *armob; void *list; int heat; bool is_weight_paint; } *data = datap; + struct { Object *armob; void *list; int heat; } *data = datap; bArmature *arm = data->armob->data; - if (!data->is_weight_paint || !(bone->flag & BONE_HIDDEN_P)) { + if (!(bone->flag & BONE_HIDDEN_P)) { if (!(bone->flag & BONE_NO_DEFORM)) { if (data->heat && data->armob->pose && BKE_pose_channel_find_name(data->armob->pose, bone->name)) segments = bone->segments; else segments = 1; - if (!data->is_weight_paint || ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED))) { + //if (((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED))) { + if (arm->layer & bone->layer) { if (!(defgroup = defgroup_find_name(ob, bone->name))) { defgroup = BKE_object_defgroup_add_name(ob, bone->name); } @@ -230,36 +276,28 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap) return 0; } -static void add_verts_to_dgroups( - ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, Object *par, - int heat, const bool mirror) +/* This functions implements the automatic computation of vertex group weights */ +static void gpencil_add_verts_to_dgroups(bContext *C, + ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, Object *ob_arm) { - /* This functions implements the automatic computation of vertex group -* weights, either through envelopes or using a heat equilibrium. -* -* This function can be called both when parenting a mesh to an armature, -* or in weightpaint + posemode. In the latter case selection is taken -* into account and vertex weights can be mirrored. -* -* The mesh vertex positions used are either the
[Bf-blender-cvs] [ad5dc176a7f] greasepencil-object: New parameter to force Fill cache recalc
Commit: ad5dc176a7f7c8de26fd422d392618aec747d326 Author: Antonioya Date: Sun Aug 19 20:50:32 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBad5dc176a7f7c8de26fd422d392618aec747d326 New parameter to force Fill cache recalc This is needed for extreme deformations === M release/scripts/startup/bl_ui/properties_data_modifier.py M source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c M source/blender/makesdna/DNA_gpencil_modifier_types.h M source/blender/makesrna/intern/rna_gpencil_modifier.c === diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 37552f00116..b7d1ec344f3 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -2040,6 +2040,7 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel): col = layout.column() col.label(text="Object:") col.prop(md, "object", text="") +col.prop(md, "force_recalc") classes = ( diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c index 89c93eb894e..af75cdb2afe 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c @@ -215,8 +215,9 @@ static void gpencil_armature_bbone_defmats_cb(void *userdata, Link *iter, int in } } -static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstroke *gps) +static void gpencil_armature_deform_verts(ArmatureGpencilModifierData *mmd, Object *target, bGPDstroke *gps) { + Object *armOb = mmd->object; bGPDspoint *pt = NULL; bPoseChanDeform *pdef_info_array; bPoseChanDeform *pdef_info = NULL; @@ -354,6 +355,11 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr } MEM_freeN(pdef_info_array); + + /* set recalc */ + if (mmd->flag & GP_ARMATURE_RECALC_FILL) { + gps->flag |= GP_STROKE_RECALC_CACHES; + } } /* deform stroke */ @@ -366,7 +372,7 @@ static void deformStroke( return; } - gpencil_armature_deform_verts(mmd->object, ob, gps); + gpencil_armature_deform_verts(mmd, ob, gps); } static void bakeModifier( diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h index 6e723346402..b7ef2dcd89d 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_types.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h @@ -417,6 +417,10 @@ typedef struct ArmatureGpencilModifierData { char pad[4]; } ArmatureGpencilModifierData; +typedef enum eArmatureGpencil_Flag { + GP_ARMATURE_RECALC_FILL = (1 << 0), +} eArmatureGpencil_Flag; + #define MOD_MESHSEQ_READ_ALL \ (MOD_MESHSEQ_READ_VERT | MOD_MESHSEQ_READ_POLY | MOD_MESHSEQ_READ_UV | MOD_MESHSEQ_READ_COLOR) diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index b95493e0c45..383eb06c72e 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -1281,6 +1281,12 @@ static void rna_def_modifier_gpencilarmature(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, NULL, "rna_ArmatureGpencilModifier_object_set", NULL, "rna_Armature_object_poll"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); + + prop = RNA_def_property(srna, "force_recalc", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARMATURE_RECALC_FILL); + RNA_def_property_ui_text(prop, "Force Recalc", + "Force to recalc fill geometry for extreme deformations (slower FPS)"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); } void RNA_def_greasepencil_modifier(BlenderRNA *brna) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [643afc347b6] greasepencil-object: WIP: Operator to create vertex groups
Commit: 643afc347b691d8f0802e981f84f5b886890c3d1 Author: Antonioya Date: Sun Aug 19 13:04:21 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB643afc347b691d8f0802e981f84f5b886890c3d1 WIP: Operator to create vertex groups Only works with the Empty mode. === M source/blender/editors/gpencil/CMakeLists.txt A source/blender/editors/gpencil/gpencil_armature.c M source/blender/editors/gpencil/gpencil_intern.h M source/blender/editors/gpencil/gpencil_ops.c M source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c === diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt index 114e55c5704..cea2e5d4269 100644 --- a/source/blender/editors/gpencil/CMakeLists.txt +++ b/source/blender/editors/gpencil/CMakeLists.txt @@ -58,6 +58,7 @@ set(SRC gpencil_undo.c gpencil_utils.c gpencil_old.c + gpencil_armature.c gpencil_intern.h ) diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c new file mode 100644 index 000..0ee25c58603 --- /dev/null +++ b/source/blender/editors/gpencil/gpencil_armature.c @@ -0,0 +1,481 @@ +/* + * * 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) 2018, Blender Foundation + * This is a new part of Blender + * + * Contributor(s): Antonio Vazquez + * + * * END GPL LICENSE BLOCK * + * + * Operators for dealing with armatures and GP datablocks + */ + +/** \file blender/editors/gpencil/gpencil_armature.c + * \ingroup edgpencil + */ + + +#include +#include +#include +#include +#include + +#include "MEM_guardedalloc.h" + +#include "BLI_blenlib.h" +#include "BLI_utildefines.h" +#include "BLI_ghash.h" +#include "BLI_math.h" +#include "BLI_string_utils.h" + +#include "BLT_translation.h" + +#include "DNA_armature_types.h" +#include "DNA_gpencil_types.h" +#include "DNA_scene_types.h" + +#include "BKE_action.h" +#include "BKE_armature.h" +#include "BKE_context.h" +#include "BKE_deform.h" +#include "BKE_gpencil.h" +#include "BKE_gpencil_modifier.h" +#include "BKE_object_deform.h" +#include "BKE_report.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "ED_gpencil.h" +#include "ED_mesh.h" + +#include "DEG_depsgraph.h" + +#include "gpencil_intern.h" + +enum { + GP_ARMATURE_NAME = 0, + GP_ARMATURE_AUTO = 1 +}; + +static int gpencil_bone_looper(Object *ob, Bone *bone, void *data, + int(*bone_func)(Object *, Bone *, void *)) +{ + /* We want to apply the function bone_func to every bone +* in an armature -- feed bone_looper the first bone and +* a pointer to the bone_func and watch it go!. The int count +* can be useful for counting bones with a certain property +* (e.g. skinnable) +*/ + int count = 0; + + if (bone) { + /* only do bone_func if the bone is non null */ + count += bone_func(ob, bone, data); + + /* try to execute bone_func for the first child */ + count += gpencil_bone_looper(ob, bone->childbase.first, data, bone_func); + + /* try to execute bone_func for the next bone at this +* depth of the recursion. +*/ + count += gpencil_bone_looper(ob, bone->next, data, bone_func); + } + + return count; +} + +static int bone_skinnable_cb(Object *UNUSED(ob), Bone *bone, void *datap) +{ + /* Bones that are deforming +* are regarded to be "skinnable" and are eligible for +* auto-skinning. +* +* This function performs 2 functions: +* +* a) It returns 1 if the bone is skinnable. +* If we loop over all bones with this +* function, we can count the number of +* skinnable bones. +* b) If the pointer data is non null, +* it is treated like a handle to a +* bone pointer -- the bone pointer +
[Bf-blender-cvs] [89e8ccaacfd] greasepencil-object: Cleanup unused function
Commit: 89e8ccaacfdc0a7b53d3281af5bc54816e78ea13 Author: Antonioya Date: Sun Aug 19 11:41:14 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB89e8ccaacfdc0a7b53d3281af5bc54816e78ea13 Cleanup unused function === 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 28203ed557b..51e57c87b25 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c @@ -167,53 +167,6 @@ static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f (*contrib) += weight; } -static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float vec[3], DualQuat *dq, - float mat[3][3], const float co[3]) -{ - Bone *bone = pchan->bone; - float fac, contrib = 0.0; - float cop[3], bbonemat[3][3]; - DualQuat bbonedq; - - if (bone == NULL) - return 0.0f; - - copy_v3_v3(cop, co); - - fac = distfactor_to_bone(cop, bone->arm_head, bone->arm_tail, bone->rad_head, bone->rad_tail, bone->dist); - - if (fac > 0.0f) { - fac *= bone->weight; - contrib = fac; - if (contrib > 0.0f) { - if (vec) { - if (bone->segments > 1) - /* applies on cop and bbonemat */ - b_bone_deform(pdef_info, bone, cop, NULL, (mat) ? bbonemat : NULL); - else - mul_m4_v3(pchan->chan_mat, cop); - - /* Make this a delta from the base position */ - sub_v3_v3(cop, co); - madd_v3_v3fl(vec, cop, fac); - - if (mat) - pchan_deform_mat_add(pchan, fac, bbonemat, mat); - } - else { - if (bone->segments > 1) { - b_bone_deform(pdef_info, bone, cop, &bbonedq, NULL); - add_weighted_dq_dq(dq, &bbonedq, fac); - } - else - add_weighted_dq_dq(dq, pdef_info->dual_quat, fac); - } - } - } - - return contrib; -} - static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info) { Bone *bone = pchan->bone; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e9e1e8f6dc9] greasepencil-object: More cleanup
Commit: e9e1e8f6dc94650650ae8df587af9967c5bc4351 Author: Antonioya Date: Sat Aug 18 20:17:26 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBe9e1e8f6dc94650650ae8df587af9967c5bc4351 More cleanup === 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 edf98a8c921..a00991b3b47 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c @@ -265,6 +265,7 @@ static void gpencil_armature_bbone_defmats_cb(void *userdata, Link *iter, int in static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstroke *gps) { + bGPDspoint *pt = NULL; bPoseChanDeform *pdef_info_array; bPoseChanDeform *pdef_info = NULL; bArmature *arm = armOb->data; @@ -293,7 +294,7 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr mul_m4_m4m4(postmat, obinv, armOb->obmat); invert_m4_m4(premat, postmat); - /* initialize B_bone matrices and dual quaternions */ + /* initialize B_bone matrices */ totchan = BLI_listbase_count(&armOb->pose->chanbase); pdef_info_array = MEM_callocN(sizeof(bPoseChanDeform) * totchan, "bPoseChanDeform"); @@ -301,6 +302,7 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr GpArmatureBBoneDefmatsData data = { .pdef_info_array = pdef_info_array,.dualquats = dualquats }; + BLI_task_parallel_listbase(&armOb->pose->chanbase, &data, gpencil_armature_bbone_defmats_cb, totchan > 512); @@ -332,10 +334,10 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr } BLI_ghash_free(idx_hash, NULL, NULL); - for (i = 0; i < gps->totpoints; i++) { - MDeformVert *dvert; + for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { + MDeformVert *dvert = &gps->dvert[i]; DualQuat *dq = NULL; - float *co; + float co[3]; float sumvec[3]; float *vec = NULL, (*smat)[3] = NULL; float contrib = 0.0f; @@ -344,7 +346,7 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr vec = sumvec; /* get the coord we work on */ - //co = prevCos[i]; GPXX + copy_v3_v3(co, &pt->x); /* Apply the object's matrix */ mul_m4_v3(premat, co); @@ -379,6 +381,7 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr /* always, check above code */ mul_m4_v3(postmat, co); + copy_v3_v3(&pt->x, co); } if (defnrToPC) @@ -401,30 +404,14 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr /* deform stroke */ static void deformStroke( GpencilModifierData *md, Depsgraph *UNUSED(depsgraph), -Object *ob, bGPDlayer *gpl, bGPDstroke *gps) +Object *ob, bGPDlayer *UNUSED(gpl), bGPDstroke *gps) { ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md; if (!mmd->object) { return; } - //int vindex = defgroup_name_index(ob, mmd->vgname); - //float weight = 1.0f; - - //bPoseChannel *pchan = BKE_pose_channel_find_name(mmd->object->pose, mmd->subtarget); - //float dmat[4][4]; - - /* loop points and apply deform */ - for (int i = 0; i < gps->totpoints; i++) { - bGPDspoint *pt = &gps->points[i]; - MDeformVert *dvert = &gps->dvert[i]; - - //weight = get_modifier_point_weight(dvert, 0, vindex); - //if (weight < 0) { - // continue; - //} - // gp_armature_co_apply(&tData, weight, pt); - } + gpencil_armature_deform_verts(mmd->object, ob, gps); } static void bakeModifier( ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [96d9b20aa20] greasepencil-object: Put in place all pieces for Armature modifier
Commit: 96d9b20aa20fd8d94ee1119932506ce07f190195 Author: Antonioya Date: Sat Aug 18 17:36:54 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB96d9b20aa20fd8d94ee1119932506ce07f190195 Put in place all pieces for Armature modifier The modifier doesn't do anything yet. === M release/datafiles/locale M release/scripts/addons_contrib M release/scripts/startup/bl_ui/properties_data_modifier.py M source/blender/editors/space_outliner/outliner_draw.c M source/blender/gpencil_modifiers/CMakeLists.txt M source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h M source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c A source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c M source/blender/makesdna/DNA_gpencil_modifier_types.h M source/blender/makesrna/RNA_access.h M source/blender/makesrna/intern/rna_gpencil_modifier.c === diff --git a/release/datafiles/locale b/release/datafiles/locale index c93ed11a47b..d3349b42856 16 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@ -1 +1 @@ -Subproject commit c93ed11a47b3016cf59711ec16de2e2e94c30e99 +Subproject commit d3349b42856d00c278f72f2a5909a6c96b9cdb5e diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib index 47470215783..15b25a42783 16 --- a/release/scripts/addons_contrib +++ b/release/scripts/addons_contrib @@ -1 +1 @@ -Subproject commit 474702157831f1a58bb50f5240ab8b1b02b6ba37 +Subproject commit 15b25a42783d1e516b5298d70b582fae2559ae17 diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 45af80c0a62..37552f00116 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -2036,6 +2036,11 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel): row.prop(md, "pass_index", text="Pass") row.prop(md, "invert_pass", text="", icon="ARROW_LEFTRIGHT") +def GP_ARMATURE(self, layout, ob, md): +col = layout.column() +col.label(text="Object:") +col.prop(md, "object", text="") + classes = ( DATA_PT_modifiers, diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 211c9e1a392..187021e403e 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1094,6 +1094,9 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te) case eGpencilModifierType_Offset: data.icon = ICON_MOD_DISPLACE; break; + case eGpencilModifierType_Armature: + data.icon = ICON_MOD_ARMATURE; + break; /* Default */ default: diff --git a/source/blender/gpencil_modifiers/CMakeLists.txt b/source/blender/gpencil_modifiers/CMakeLists.txt index 5ad91d4e01b..44689a1d091 100644 --- a/source/blender/gpencil_modifiers/CMakeLists.txt +++ b/source/blender/gpencil_modifiers/CMakeLists.txt @@ -43,6 +43,7 @@ set(SRC intern/MOD_gpencil_util.h intern/MOD_gpencil_util.c + intern/MOD_gpencilarmature.c intern/MOD_gpencilnoise.c intern/MOD_gpencilsubdiv.c intern/MOD_gpencilsimplify.c diff --git a/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h b/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h index 73386601d10..968f7e73544 100644 --- a/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h +++ b/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h @@ -44,6 +44,7 @@ extern GpencilModifierTypeInfo modifierType_Gpencil_Mirror; extern GpencilModifierTypeInfo modifierType_Gpencil_Smooth; extern GpencilModifierTypeInfo modifierType_Gpencil_Hook; extern GpencilModifierTypeInfo modifierType_Gpencil_Offset; +extern GpencilModifierTypeInfo modifierType_Gpencil_Armature; /* MOD_gpencil_util.c */ void gpencil_modifier_type_init(GpencilModifierTypeInfo *types[]); diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c index 151218c06e4..742eae66e1d 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c @@ -76,6 +76,7 @@ void gpencil_modifier_type_init(GpencilModifierTypeInfo *types[]) INIT_GP_TYPE(Smoo
[Bf-blender-cvs] [e4082db5778] greasepencil-object: Put text to review
Commit: e4082db5778ebae53eccac89f8d747be03f8a0a8 Author: Antonioya Date: Sat Aug 18 18:43:03 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBe4082db5778ebae53eccac89f8d747be03f8a0a8 Put text to review === 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 275dcdba20f..753249458a8 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c @@ -294,7 +294,7 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr const bool invert_vgroup = (deformflag & ARM_DEF_INVERT_VGROUP) != 0; int defbase_tot = 0; /* safety for vertexgroup index overflow */ int i, target_totvert = 0; /* safety for vertexgroup overflow */ - int armature_def_nr; + int armature_def_nr; // revisar int totchan; /* in editmode, or not an armature */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c3ba8910a14] greasepencil-object: WIP: Add basic functions to deform
Commit: c3ba8910a142f7ee03a488e42f31b4408be300fb Author: Antonioya Date: Sat Aug 18 18:08:22 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBc3ba8910a142f7ee03a488e42f31b4408be300fb WIP: Add basic functions to deform === 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 5b28aaf6ef4..275dcdba20f 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c @@ -30,6 +30,7 @@ #include +#include "DNA_armature_types.h" #include "DNA_meshdata_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" @@ -38,9 +39,12 @@ #include "DNA_modifier_types.h" #include "BLI_math.h" +#include "BLI_listbase.h" +#include "BLI_task.h" #include "BLI_utildefines.h" #include "BKE_action.h" +#include "BKE_armature.h" #include "BKE_context.h" #include "BKE_colortools.h" #include "BKE_deform.h" @@ -61,6 +65,18 @@ #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" +typedef struct bPoseChanDeform { + Mat4 *b_bone_mats; + DualQuat *dual_quat; + DualQuat *b_bone_dual_quats; +} bPoseChanDeform; + +typedef struct ArmatureBBoneDefmatsData { + bPoseChanDeform *pdef_info_array; + DualQuat *dualquats; + bool use_quaternion; +} ArmatureBBoneDefmatsData; + static void initData(GpencilModifierData *md) { ArmatureGpencilModifierData *gpmd = (ArmatureGpencilModifierData *)md; @@ -72,6 +88,428 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target) BKE_gpencil_modifier_copyData_generic(md, target); } +static void b_bone_deform(bPoseChanDeform *pdef_info, Bone *bone, float co[3], DualQuat *dq, float defmat[3][3]) +{ + Mat4 *b_bone = pdef_info->b_bone_mats; + float(*mat)[4] = b_bone[0].mat; + float segment, y; + int a; + + /* need to transform co back to bonespace, only need y */ + y = mat[0][1] * co[0] + mat[1][1] * co[1] + mat[2][1] * co[2] + mat[3][1]; + + /* now calculate which of the b_bones are deforming this */ + segment = bone->length / ((float)bone->segments); + a = (int)(y / segment); + + /* note; by clamping it extends deform at endpoints, goes best with +* straight joints in restpos. */ + CLAMP(a, 0, bone->segments - 1); + + if (dq) { + copy_dq_dq(dq, &(pdef_info->b_bone_dual_quats)[a]); + } + else { + mul_m4_v3(b_bone[a + 1].mat, co); + + if (defmat) { + copy_m3_m4(defmat, b_bone[a + 1].mat); + } + } +} + +static void pchan_deform_mat_add(bPoseChannel *pchan, float weight, float bbonemat[3][3], float mat[3][3]) +{ + float wmat[3][3]; + + if (pchan->bone->segments > 1) + copy_m3_m3(wmat, bbonemat); + else + copy_m3_m4(wmat, pchan->chan_mat); + + mul_m3_fl(wmat, weight); + add_m3_m3m3(mat, mat, wmat); +} + +static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float weight, float vec[3], DualQuat *dq, + float mat[3][3], const float co[3], float *contrib) +{ + float cop[3], bbonemat[3][3]; + DualQuat bbonedq; + + if (!weight) + return; + + copy_v3_v3(cop, co); + + if (vec) { + if (pchan->bone->segments > 1) + /* applies on cop and bbonemat */ + b_bone_deform(pdef_info, pchan->bone, cop, NULL, (mat) ? bbonemat : NULL); + else + mul_m4_v3(pchan->chan_mat, cop); + + vec[0] += (cop[0] - co[0]) * weight; + vec[1] += (cop[1] - co[1]) * weight; + vec[2] += (cop[2] - co[2]) * weight; + + if (mat) + pchan_deform_mat_add(pchan, weight, bbonemat, mat); + } + else { + if (pchan->bone->segments > 1) { + b_bone_deform(pdef_info, pchan->bone, cop, &bbonedq, NULL); + add_weighted_dq_dq(dq, &bbonedq, weight); + } + else + add_weighted_dq_dq(dq, pdef_info->dual_quat, weight); + } + + (*contrib) += weight; +} + +static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float vec[3], DualQuat *dq, + float mat[3][3], const float co[3]) +{ + Bone *bone = pchan->bone; + float fac, contrib = 0.0; + float cop[3], bbonemat[3][3]; + DualQuat bbonedq; + + if (bone == NULL) + return 0.0f; + + copy_v3_v3(cop, co); + + fac = distfactor_to_bon
[Bf-blender-cvs] [31a11358290] greasepencil-object: Merge branch 'blender2.8' into greasepencil-experimental
Commit: 31a11358290b677b851ce9d02ab78b37e02f2dcb Author: Antonioya Date: Sat Aug 18 17:37:26 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB31a11358290b677b851ce9d02ab78b37e02f2dcb Merge branch 'blender2.8' into greasepencil-experimental === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs