[Bf-blender-cvs] [cc5bdf02932] master: Cleanup: rename DEPRECATED to UNUSED
Commit: cc5bdf02932438e61b8fb41280d4754549a093b4 Author: Campbell Barton Date: Sun Mar 17 10:28:08 2019 +1100 Branches: master https://developer.blender.org/rBcc5bdf02932438e61b8fb41280d4754549a093b4 Cleanup: rename DEPRECATED to UNUSED While the flags have been deprecated they're currently unused. Rename for clarity. === M source/blender/blenloader/intern/versioning_270.c M source/blender/blenloader/intern/versioning_280.c M source/blender/blenloader/intern/versioning_userdef.c M source/blender/makesdna/DNA_anim_types.h M source/blender/makesdna/DNA_armature_types.h M source/blender/makesdna/DNA_brush_types.h M source/blender/makesdna/DNA_image_types.h M source/blender/makesdna/DNA_material_types.h M source/blender/makesdna/DNA_mesh_types.h M source/blender/makesdna/DNA_object_types.h M source/blender/makesdna/DNA_scene_types.h M source/blender/makesdna/DNA_screen_types.h M source/blender/makesdna/DNA_sequence_types.h M source/blender/makesdna/DNA_space_types.h M source/blender/makesdna/DNA_text_types.h M source/blender/makesdna/DNA_userdef_types.h M source/blender/makesdna/DNA_view3d_types.h M source/blender/makesdna/DNA_world_types.h === diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 3ea9c812d15..5caac97c0d1 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -1709,8 +1709,8 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) for (Brush *br = bmain->brushes.first; br; br = br->id.next) { br->falloff_angle = DEG2RADF(80); br->flag &= ~( - BRUSH_FLAG_DEPRECATED_1 | BRUSH_FLAG_DEPRECATED_6 | - BRUSH_FLAG_DEPRECATED_7 | BRUSH_FLAG_DEPRECATED_17 | + BRUSH_FLAG_UNUSED_1 | BRUSH_FLAG_UNUSED_6 | + BRUSH_FLAG_UNUSED_7 | BRUSH_FLAG_UNUSED_17 | BRUSH_FRONTFACE_FALLOFF); } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 71341b47c6e..986f35008bd 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -2487,44 +2487,44 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) { SpaceImage *sima = (SpaceImage *)sl; sima->flag &= ~( - SI_FLAG_DEPRECATED_0 | - SI_FLAG_DEPRECATED_1 | - SI_FLAG_DEPRECATED_3 | - SI_FLAG_DEPRECATED_6 | - SI_FLAG_DEPRECATED_7 | - SI_FLAG_DEPRECATED_8 | - SI_FLAG_DEPRECATED_17 | - SI_FLAG_DEPRECATED_18 | - SI_FLAG_DEPRECATED_23 | - SI_FLAG_DEPRECATED_24); + SI_FLAG_UNUSED_0 | + SI_FLAG_UNUSED_1 | + SI_FLAG_UNUSED_3 | + SI_FLAG_UNUSED_6 | + SI_FLAG_UNUSED_7 | + SI_FLAG_UNUSED_8 | + SI_FLAG_UNUSED_17 | + SI_FLAG_UNUSED_18 | + SI_FLAG_UNUSED_23 | + SI_FLAG_UNUSED_24); break; } case SPACE_VIEW3D: {
[Bf-blender-cvs] [cf5097d71f1] master: Cleanup: improve comments.
Commit: cf5097d71f17356810f04e052325792fca77de55 Author: mano-wii Date: Sat Mar 16 18:20:57 2019 -0300 Branches: master https://developer.blender.org/rBcf5097d71f17356810f04e052325792fca77de55 Cleanup: improve comments. === M source/blender/editors/space_view3d/view3d_draw_legacy.c === diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 3c38bb6d909..18e7522ea1c 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -386,15 +386,14 @@ uint ED_view3d_select_id_read_nearest( /* we got a hit */ int hit_co[2], center_co[2]; - /* get x,y pixel coords from the offset -* (manhatten distance in keeping with other screen-based selection) */ + /* get x,y pixel coords from the offset */ hit_co[0] = (int)(tbuf - buf) % (int)height; hit_co[1] = (int)(tbuf - buf) / (int)height; center_co[0] = (int)(height / 2); center_co[1] = (int)(width / 2); - /* for more efficiency, just sum the x, y pixel dist coords */ + /* manhatten distance in keeping with other screen-based selection */ *r_dist = (float)(abs(hit_co[0] - center_co[0]) + abs(hit_co[1] - center_co[1])); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8b62f203d9d] master: ED View3d: Fix possible bug when subtracting unsigned ints.
Commit: 8b62f203d9d0420b0d44c1c3a58efa350f8a9fcd Author: mano-wii Date: Sat Mar 16 18:10:15 2019 -0300 Branches: master https://developer.blender.org/rB8b62f203d9d0420b0d44c1c3a58efa350f8a9fcd ED View3d: Fix possible bug when subtracting unsigned ints. Related to rB681661dbed12. === M source/blender/editors/space_view3d/view3d_draw_legacy.c === diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 4660220fe27..3c38bb6d909 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -384,12 +384,19 @@ uint ED_view3d_select_id_read_nearest( for (int b = 0; b < nr; b++) { if (*tbuf && *tbuf >= min && *tbuf < max) { /* we got a hit */ + int hit_co[2], center_co[2]; /* get x,y pixel coords from the offset * (manhatten distance in keeping with other screen-based selection) */ - *r_dist = (float)( - abs(((int)(tbuf - buf) % height) - (height / 2)) + - abs(((int)(tbuf - buf) / height) - (height / 2))); + hit_co[0] = (int)(tbuf - buf) % (int)height; + hit_co[1] = (int)(tbuf - buf) / (int)height; + + center_co[0] = (int)(height / 2); + center_co[1] = (int)(width / 2); + + /* for more efficiency, just sum the x, y pixel dist coords */ + *r_dist = (float)(abs(hit_co[0] - center_co[0]) + + abs(hit_co[1] - center_co[1])); /* indices start at 1 here */ index = (*tbuf - min) + 1; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5797a5fc65c] master: Fix ID user counting issues with NodeCustomGroup.
Commit: 5797a5fc65c87b69460d910a82d219b5e3ea12ad Author: Miguel Porces Date: Sat Mar 16 18:54:00 2019 +0100 Branches: master https://developer.blender.org/rB5797a5fc65c87b69460d910a82d219b5e3ea12ad Fix ID user counting issues with NodeCustomGroup. User counting now happens before init() and after free() methods, so that the ID users are in a valid state when Python might modify them. ID user counting was moved into node.c and simplified. Patch by Miguel with further refactoring by Brecht. Ref D4370. === M source/blender/blenkernel/BKE_node.h M source/blender/blenkernel/intern/node.c M source/blender/editors/space_node/node_edit.c M source/blender/editors/space_node/node_group.c M source/blender/editors/space_node/node_templates.c M source/blender/editors/transform/transform_conversions.c M source/blender/makesrna/intern/rna_nodetree.c M source/blender/nodes/shader/node_shader_tree.c M source/blender/nodes/texture/node_texture_tree.c M source/blender/windowmanager/intern/wm_init_exit.c === diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 6e6ec31aa6a..951962d26f1 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -337,6 +337,7 @@ void ntreeUserDecrefID(struct bNodeTree *ntree); struct bNodeTree *ntreeFromID(const struct ID *id); void ntreeMakeLocal(struct Main *bmain, struct bNodeTree *ntree, bool id_in_mainlist, const bool lib_local); +void ntreeFreeLocalNode(struct bNodeTree *ntree, struct bNode *node); void ntreeFreeLocalTree(struct bNodeTree *ntree); struct bNode *ntreeFindType(const struct bNodeTree *ntree, int type); bool ntreeHasType(const struct bNodeTree *ntree, int type); @@ -445,10 +446,8 @@ struct bNode *nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntre voidnodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node); voidnodeUniqueName(struct bNodeTree *ntree, struct bNode *node); -/* Frees the node itself, without affect to anything else. */ -voidnodeFreeNode(struct bNodeTree *ntree, struct bNode *node); -/* Will additionally cleanup things like f-curves which uses this node. */ -voidnodeDeleteNode(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node); +/* Delete node, associated animation data and ID user count. */ +voidnodeRemoveNode(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node, bool do_id_user); struct bNode*BKE_node_copy_ex(struct bNodeTree *ntree, struct bNode *node_src, const int flag); @@ -502,6 +501,7 @@ voidntreeTagUsedSockets(struct bNodeTree *ntree); /* Node Clipboard */ void BKE_node_clipboard_init(struct bNodeTree *ntree); void BKE_node_clipboard_clear(void); +void BKE_node_clipboard_free(void); bool BKE_node_clipboard_validate(void); void BKE_node_clipboard_add_node(struct bNode *node); void BKE_node_clipboard_add_link(struct bNodeLink *link); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 09b44db02e5..57dcbcbebf8 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -139,6 +139,9 @@ static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node) if (ntree->typeinfo->node_add_init != NULL) ntree->typeinfo->node_add_init(ntree, node); + if (node->id) + id_us_plus(node->id); + /* extra init callback */ if (ntype->initfunc_api) { PointerRNA ptr; @@ -151,9 +154,6 @@ static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node) ntype->initfunc_api(C, &ptr); } - if (node->id) - id_us_plus(node->id); - node->flag |= NODE_INIT; } @@ -1007,7 +1007,8 @@ bNode *BKE_node_copy_ex(bNodeTree *ntree, bNode *node_src, const int flag) node_src->new_node = node_dst; node_dst->new_node = NULL; - if (node_dst->typeinfo->copyfunc_api) { + bool do_copy_api = !((flag & LIB_ID_CREATE_NO_MAIN) || (flag & LIB_ID_COPY_LOCALIZE)); + if (node_dst->typeinfo->copyfunc_api && do_copy_api) { PointerRNA ptr; RNA_pointer_create((ID *)ntree, &RNA_Node, node_dst, &ptr); @@ -1677,26 +1678,12 @@ static void node_unlink_attached(bNodeTree *ntree, bNode *parent) } } -/** \note caller needs to manage node->id user */ -static void node_free_node_ex( -Main *bmain, bNodeTree *ntree, bNode *node, -bool remove_animdata, bool use_api_free_cb) +/* Free
[Bf-blender-cvs] [b9af4efe417] master: Cleanup: fix compiler warnings.
Commit: b9af4efe41712680d554a389d771e83c66fce5c4 Author: Brecht Van Lommel Date: Sat Mar 16 19:48:28 2019 +0100 Branches: master https://developer.blender.org/rBb9af4efe41712680d554a389d771e83c66fce5c4 Cleanup: fix compiler warnings. === M intern/cycles/device/device_multi.cpp M source/blender/depsgraph/intern/builder/deg_builder_rna.h M source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc M source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h M source/blender/draw/engines/basic/basic_engine.c M source/blender/draw/intern/draw_cache_impl_mesh.c M source/blender/draw/intern/draw_common.c M source/blender/draw/modes/edit_curve_mode.c M source/blender/draw/modes/edit_lattice_mode.c M source/blender/draw/modes/edit_mesh_mode.c M source/blender/draw/modes/overlay_mode.c M source/blender/freestyle/intern/stroke/StrokeRep.cpp M source/blender/gpu/intern/gpu_shader.c === diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp index efb4d9dd288..bdb7c87fa57 100644 --- a/intern/cycles/device/device_multi.cpp +++ b/intern/cycles/device/device_multi.cpp @@ -145,6 +145,7 @@ public: return subresult; case DEVICE_KERNEL_USING_FEATURE_KERNEL: + case DEVICE_KERNEL_UNKNOWN: break; } } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.h b/source/blender/depsgraph/intern/builder/deg_builder_rna.h index a328124d6ec..5e121476087 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_rna.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.h @@ -35,7 +35,7 @@ namespace DEG { struct Depsgraph; struct Node; -struct RNANodeQueryIDData; +class RNANodeQueryIDData; /* For queries which gives operation node or key defines whether we are * interested in a result of the given property or whether we are linking some diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 6e2b401a09e..cf36892d9e6 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -929,7 +929,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, * generic backup structure. */ DrawDataList drawdata_backup; DrawDataList *drawdata_ptr = NULL; - ObjectRuntimeBackup object_runtime_backup = {{0}}; + ObjectRuntimeBackup object_runtime_backup = {{{0}}}; if (check_datablock_expanded(id_cow)) { switch (id_type) { case ID_OB: diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h index c6d44382cc7..6f9141a7c19 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h @@ -44,7 +44,7 @@ struct Depsgraph; namespace DEG { struct Depsgraph; -struct DepsgraphNodeBuilder; +class DepsgraphNodeBuilder; struct IDNode; /* Get fully expanded (ready for use) copy-on-write datablock for the given diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c index b851a0c4df5..1e8b529c23f 100644 --- a/source/blender/draw/engines/basic/basic_engine.c +++ b/source/blender/draw/engines/basic/basic_engine.c @@ -66,7 +66,7 @@ typedef struct BASIC_Shaders { static struct { BASIC_Shaders sh_data[GPU_SHADER_CFG_LEN]; -} e_data = {NULL}; /* Engine data */ +} e_data = {{{NULL}}}; /* Engine data */ typedef struct BASIC_PrivateData { DRWShadingGroup *depth_shgrp; diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 890181a532a..7c1ef09aaa7 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -2140,7 +2140,7 @@ static void mesh_create_edit_vertex_loops( uchar fflag; /* Static formats */ - static struct { GPUVertFormat sel_id, pos_nor, lnor, flag, uv; } format = { 0 }; + static struct { GPUVertFormat sel_id, pos_nor, lnor, flag, uv; } format = {{ 0 }}; static struct { uint sel_id, pos, nor, lnor, data, uvs; } attr_id; if (format.sel_id.attr_len == 0) { attr_id.sel_id = GPU_vertformat_attr_add(&format.sel_id, "color", GPU_COMP_U32, 1, GPU_FETCH_INT); diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index 849087d39af..2d1316f9406 100644 ---
[Bf-blender-cvs] [9e152f919f2] master: Python API: add Python-defined node groups for shaders and compositing.
Commit: 9e152f919f2f86cbe3530c6adc34373ebc703904 Author: Miguel Porces Date: Sat Mar 16 18:48:22 2019 +0100 Branches: master https://developer.blender.org/rB9e152f919f2f86cbe3530c6adc34373ebc703904 Python API: add Python-defined node groups for shaders and compositing. This was already supported for Cycles shader nodes, but now also works for Eevee and compositing nodes. Instead of a generic NodeCustomGroup, now there is ShaderNodeCustomGroup and CompositorNodeCustomGroup that can be subclassed and registered. Differential Revision: https://developer.blender.org/D4370 === M intern/cycles/blender/blender_shader.cpp M release/scripts/startup/nodeitems_builtins.py M source/blender/blenkernel/BKE_node.h M source/blender/blenkernel/intern/material.c M source/blender/blenkernel/intern/node.c M source/blender/compositor/intern/COM_NodeGraph.cpp M source/blender/depsgraph/intern/builder/deg_builder_nodes.cc M source/blender/depsgraph/intern/builder/deg_builder_relations.cc M source/blender/editors/space_node/node_relationships.c M source/blender/editors/space_node/node_templates.c M source/blender/makesrna/intern/rna_nodetree.c M source/blender/nodes/NOD_composite.h M source/blender/nodes/NOD_shader.h M source/blender/nodes/composite/nodes/node_composite_common.c M source/blender/nodes/shader/node_shader_tree.c M source/blender/nodes/shader/nodes/node_shader_common.c M source/blender/render/intern/source/pipeline.c === diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index b04a0394141..44ff29d4bf8 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -1050,13 +1050,18 @@ static void add_nodes(Scene *scene, graph->add(proxy); } } - else if(b_node->is_a(&RNA_ShaderNodeGroup) || b_node->is_a(&RNA_NodeCustomGroup)) { + else if(b_node->is_a(&RNA_ShaderNodeGroup) || + b_node->is_a(&RNA_NodeCustomGroup) || + b_node->is_a(&RNA_ShaderNodeCustomGroup)) { BL::ShaderNodeTree b_group_ntree(PointerRNA_NULL); if(b_node->is_a(&RNA_ShaderNodeGroup)) b_group_ntree = BL::ShaderNodeTree(((BL::NodeGroup)(*b_node)).node_tree()); - else + else if (b_node->is_a(&RNA_NodeCustomGroup)) b_group_ntree = BL::ShaderNodeTree(((BL::NodeCustomGroup)(*b_node)).node_tree()); + else + b_group_ntree = BL::ShaderNodeTree(((BL::ShaderNodeCustomGroup)(*b_node)).node_tree()); + ProxyMap group_proxy_input_map, group_proxy_output_map; /* Add a proxy node for each socket diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py index 99df0167557..60772062dcf 100644 --- a/release/scripts/startup/nodeitems_builtins.py +++ b/release/scripts/startup/nodeitems_builtins.py @@ -99,7 +99,9 @@ def node_group_items(context): # filter out recursive groups if contains_group(group, ntree): continue - +# filter out hidden nodetrees +if group.name.startswith('.'): +continue yield NodeItem(node_tree_group_type[group.bl_idname], group.name, {"node_tree": "bpy.data.node_groups[%r]" % group.name}) diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 951962d26f1..80b0f9a023f 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -618,6 +618,7 @@ bool BKE_node_is_connected_to_output(struct bNodeTree *ntree, struct bNode *node #define NODE_REROUTE 6 #define NODE_GROUP_INPUT 7 #define NODE_GROUP_OUTPUT 8 +#define NODE_CUSTOM_GROUP 9 void BKE_node_tree_unlink_id(ID *id, struct bNodeTree *ntree); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 90b25e8fd49..88a96ff098e 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1038,7 +1038,7 @@ static int count_texture_nodes_recursive(bNodeTree *nodetree) if (node->typeinfo->nclass == NODE_CLASS_TEXTURE && node->typeinfo->type == SH_NODE_TEX_IMAGE && node->id) { tex_nodes++; } - else if (node->type == NODE_GROUP && node->id) { + else if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id) { /* recurs
[Bf-blender-cvs] [ad390f514bf] master: GPencil: Fix compiler warning
Commit: ad390f514bfa33abadfd09e8fd673a0cfee68b39 Author: Antonioya Date: Sat Mar 16 20:05:15 2019 +0100 Branches: master https://developer.blender.org/rBad390f514bfa33abadfd09e8fd673a0cfee68b39 GPencil: Fix compiler warning The fill flag was wrong and it was checking the color, not a flag. === M source/blender/editors/gpencil/gpencil_add_stroke.c === diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c b/source/blender/editors/gpencil/gpencil_add_stroke.c index d8db3cda98d..8b261bf798b 100644 --- a/source/blender/editors/gpencil/gpencil_add_stroke.c +++ b/source/blender/editors/gpencil/gpencil_add_stroke.c @@ -48,7 +48,8 @@ typedef struct ColorTemplate { } ColorTemplate; /* Add color an ensure duplications (matched by name) */ -static int gp_stroke_material(Main *bmain, Object *ob, const ColorTemplate *pct) +static int gp_stroke_material( + Main *bmain, Object *ob, const ColorTemplate *pct, const bool fill) { short *totcol = give_totcolp(ob); Material *ma = NULL; @@ -68,7 +69,7 @@ static int gp_stroke_material(Main *bmain, Object *ob, const ColorTemplate *pct) copy_v4_v4(ma->gp_style->stroke_rgba, pct->line); copy_v4_v4(ma->gp_style->fill_rgba, pct->fill); - if (pct->fill) { + if (fill) { ma->gp_style->flag |= GP_STYLE_FILL_SHOW; } @@ -221,12 +222,12 @@ void ED_gpencil_create_stroke(bContext *C, Object *ob, float mat[4][4]) bGPDstroke *gps; /* create colors */ - int color_black = gp_stroke_material(bmain, ob, &gp_stroke_material_black); - gp_stroke_material(bmain, ob, &gp_stroke_material_white); - gp_stroke_material(bmain, ob, &gp_stroke_material_red); - gp_stroke_material(bmain, ob, &gp_stroke_material_green); - gp_stroke_material(bmain, ob, &gp_stroke_material_blue); - gp_stroke_material(bmain, ob, &gp_stroke_material_grey); + int color_black = gp_stroke_material(bmain, ob, &gp_stroke_material_black, false); + gp_stroke_material(bmain, ob, &gp_stroke_material_white, false); + gp_stroke_material(bmain, ob, &gp_stroke_material_red, false); + gp_stroke_material(bmain, ob, &gp_stroke_material_green, false); + gp_stroke_material(bmain, ob, &gp_stroke_material_blue, false); + gp_stroke_material(bmain, ob, &gp_stroke_material_grey, true); /* set first color as active and in brushes */ ob->actcol = color_black + 1; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8ea91b34d7f] greasepencil-object: GPencil: Back Canvas Grid to Draw position
Commit: 8ea91b34d7fa6c5fffc955bdac9eb368cf45756f Author: Antonioya Date: Sat Mar 16 19:33:18 2019 +0100 Branches: greasepencil-object https://developer.blender.org/rB8ea91b34d7fa6c5fffc955bdac9eb368cf45756f GPencil: Back Canvas Grid to Draw position Undo the previous commit and keep the Canvas in the position used in Draw mode. Change the position by mode looks strange. === M source/blender/draw/engines/gpencil/gpencil_engine.c === diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index f3ed7fb2594..7fbae5e98ea 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -662,24 +662,12 @@ void GPENCIL_cache_populate(void *vedata, Object *ob) } } - /* Move the origin to Object or Cursor -* In Draw mode the origin is defined by origin -* In other modes, the origin is defined by drawing plane */ - if (ob->mode == OB_MODE_PAINT_GPENCIL) { - if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) { - copy_v3_v3(stl->storage->grid_matrix[3], cursor->location); - } - else { - copy_v3_v3(stl->storage->grid_matrix[3], ob->obmat[3]); - } + /* Move the origin to Object or Cursor */ + if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) { + copy_v3_v3(stl->storage->grid_matrix[3], cursor->location); } else { - if (ts->gp_sculpt.lock_axis == GP_LOCKAXIS_CURSOR) { - copy_v3_v3(stl->storage->grid_matrix[3], cursor->location); - } - else { - copy_v3_v3(stl->storage->grid_matrix[3], ob->obmat[3]); - } + copy_v3_v3(stl->storage->grid_matrix[3], ob->obmat[3]); } DRW_shgroup_call_add( ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [45dbf1835f9] sculpt-mode-features: Brush cursor: Fix crash with 2D falloff
Commit: 45dbf1835f91fcc5aaca473360392f1918893c7c Author: Pablo Dobarro Date: Sat Mar 16 19:27:10 2019 +0100 Branches: sculpt-mode-features https://developer.blender.org/rB45dbf1835f91fcc5aaca473360392f1918893c7c Brush cursor: Fix crash with 2D falloff Disable the normal preview when 2D falloff is enabled. === M source/blender/editors/sculpt_paint/paint_cursor.c === diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 317e037ad95..a570600d9cb 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1236,7 +1236,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) } /* Only sculpt cursor for now */ - if ((mode == PAINT_MODE_SCULPT) && vc.obact->sculpt) { + if ((mode == PAINT_MODE_SCULPT) && vc.obact->sculpt && !(brush->falloff_shape & BRUSH_AIRBRUSH)) { Sculpt *sd = CTX_data_tool_settings(C)->sculpt; wmWindow *win = CTX_wm_window(C); if (sd->paint.brush->overlay_flags & BRUSH_OVERLAY_CURSOR) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [df04d1242d5] greasepencil-object: Merge branch 'master' into greasepencil-object
Commit: df04d1242d5bf50c40fe896cce231c4b6d1f1a3c Author: Antonioya Date: Sat Mar 16 19:22:01 2019 +0100 Branches: greasepencil-object https://developer.blender.org/rBdf04d1242d5bf50c40fe896cce231c4b6d1f1a3c Merge branch 'master' into greasepencil-object === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2d3fbadfe36] master: GPencil: Fix layers topbar panel
Commit: 2d3fbadfe36d67596ffe04897c13ac88c1cd9ba6 Author: Antonioya Date: Sat Mar 16 19:21:19 2019 +0100 Branches: master https://developer.blender.org/rB2d3fbadfe36d67596ffe04897c13ac88c1cd9ba6 GPencil: Fix layers topbar panel After a previous commit to fix the pin panels, this line was not working as expected. As this variable is not used, the line can be removed. === M release/scripts/startup/bl_ui/properties_grease_pencil_common.py === 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 774947654d1..ed75e212444 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -885,7 +885,6 @@ class GPENCIL_UL_layer(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.GPencilLayer) gpl = item -gpd = context.gpencil if self.layout_type in {'DEFAULT', 'COMPACT'}: if gpl.lock: ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9a4192277bf] master: GPencil: Disable Pressure for Block brush
Commit: 9a4192277bf84463860f8e887f06febebfe71d99 Author: Antonioya Date: Sat Mar 16 18:56:07 2019 +0100 Branches: master https://developer.blender.org/rB9a4192277bf84463860f8e887f06febebfe71d99 GPencil: Disable Pressure for Block brush === M source/blender/blenkernel/intern/brush.c === diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 6610d35da24..2e68c88c5f7 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -415,7 +415,6 @@ void BKE_brush_gpencil_presets(bContext *C) brush->gpencil_settings->draw_sensitivity = 1.0f; brush->gpencil_settings->draw_strength = 1.0f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; brush->gpencil_settings->draw_random_press = 0.0f; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9b50448e0da] greasepencil-object: GPencil: Test the option to move the grid depending of mode.
Commit: 9b50448e0da902eebe68da9532357475023e1a29 Author: Antonioya Date: Sat Mar 16 17:40:08 2019 +0100 Branches: greasepencil-object https://developer.blender.org/rB9b50448e0da902eebe68da9532357475023e1a29 GPencil: Test the option to move the grid depending of mode. === M source/blender/draw/engines/gpencil/gpencil_engine.c === diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index d67cca415fc..f3ed7fb2594 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -662,14 +662,24 @@ void GPENCIL_cache_populate(void *vedata, Object *ob) } } - /* now move the origin to Object or Cursor */ - if ((ob->mode == OB_MODE_PAINT_GPENCIL) && - (ts->gpencil_v3d_align & GP_PROJECT_CURSOR)) - { - copy_v3_v3(stl->storage->grid_matrix[3], cursor->location); + /* Move the origin to Object or Cursor +* In Draw mode the origin is defined by origin +* In other modes, the origin is defined by drawing plane */ + if (ob->mode == OB_MODE_PAINT_GPENCIL) { + if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) { + copy_v3_v3(stl->storage->grid_matrix[3], cursor->location); + } + else { + copy_v3_v3(stl->storage->grid_matrix[3], ob->obmat[3]); + } } else { - copy_v3_v3(stl->storage->grid_matrix[3], ob->obmat[3]); + if (ts->gp_sculpt.lock_axis == GP_LOCKAXIS_CURSOR) { + copy_v3_v3(stl->storage->grid_matrix[3], cursor->location); + } + else { + copy_v3_v3(stl->storage->grid_matrix[3], ob->obmat[3]); + } } DRW_shgroup_call_add( ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4ee23876b59] greasepencil-object: Revert "GPencil: Show Canvas Grid only in Draw Mode"
Commit: 4ee23876b59dcfbe8a640d000592db8a615cfc1b Author: Antonioya Date: Sat Mar 16 16:53:04 2019 +0100 Branches: greasepencil-object https://developer.blender.org/rB4ee23876b59dcfbe8a640d000592db8a615cfc1b Revert "GPencil: Show Canvas Grid only in Draw Mode" This reverts commit a6ca1b27fbdf32b68d13cea5413d97f588d1ce37. === M source/blender/draw/engines/gpencil/gpencil_engine.c === diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index 6df56cae8e1..d67cca415fc 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -628,7 +628,6 @@ void GPENCIL_cache_populate(void *vedata, Object *ob) ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) && (v3d->gp_flag & V3D_GP_SHOW_GRID) && (ob->type == OB_GPENCIL) && (ob == draw_ctx->obact) && - (ob->mode == OB_MODE_PAINT_GPENCIL) && ((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) == 0) && ((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) == 0)) { @@ -664,7 +663,9 @@ void GPENCIL_cache_populate(void *vedata, Object *ob) } /* now move the origin to Object or Cursor */ - if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) { + if ((ob->mode == OB_MODE_PAINT_GPENCIL) && + (ts->gpencil_v3d_align & GP_PROJECT_CURSOR)) + { copy_v3_v3(stl->storage->grid_matrix[3], cursor->location); } else { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a6ca1b27fbd] greasepencil-object: GPencil: Show Canvas Grid only in Draw Mode
Commit: a6ca1b27fbdf32b68d13cea5413d97f588d1ce37 Author: Antonioya Date: Sat Mar 16 16:53:04 2019 +0100 Branches: greasepencil-object https://developer.blender.org/rBa6ca1b27fbdf32b68d13cea5413d97f588d1ce37 GPencil: Show Canvas Grid only in Draw Mode The grid is not used in Edit mode and in Sculpt mode the position depends of point, so the visual help is not valid. === M source/blender/draw/engines/gpencil/gpencil_engine.c === diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index d67cca415fc..6df56cae8e1 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -628,6 +628,7 @@ void GPENCIL_cache_populate(void *vedata, Object *ob) ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) && (v3d->gp_flag & V3D_GP_SHOW_GRID) && (ob->type == OB_GPENCIL) && (ob == draw_ctx->obact) && + (ob->mode == OB_MODE_PAINT_GPENCIL) && ((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) == 0) && ((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) == 0)) { @@ -663,9 +664,7 @@ void GPENCIL_cache_populate(void *vedata, Object *ob) } /* now move the origin to Object or Cursor */ - if ((ob->mode == OB_MODE_PAINT_GPENCIL) && - (ts->gpencil_v3d_align & GP_PROJECT_CURSOR)) - { + if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) { copy_v3_v3(stl->storage->grid_matrix[3], cursor->location); } else { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e5e6c3b52c0] master: Fix T62576: The remaining two unported official add-ons: X3D and 3DS.
Commit: e5e6c3b52c0b651e1f301736e47a0c4379c616fa Author: Bastien Montagne Date: Sat Mar 16 13:00:17 2019 +0100 Branches: master https://developer.blender.org/rBe5e6c3b52c0b651e1f301736e47a0c4379c616fa Fix T62576: The remaining two unported official add-ons: X3D and 3DS. X3D has been (basically) ported in rBAe8da70ab73d2dd5ff46, and 3DS has been downgraded to 'community' support, so we can get rid of that ugly 'slience warning' hack. === M release/scripts/modules/addon_utils.py === diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index ef5ec77a6c5..4e7c278f196 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -365,13 +365,6 @@ def enable(module_name, *, default_set=False, persistent=False, handle_error=Non # 1.1) fail when add-on is too old # This is a temporary 2.8x migration check, so we can manage addons that are supported. -# Silent default, we know these need updating. -if module_name in { -"io_scene_3ds", -"io_scene_x3d", -}: -return None - try: if mod.bl_info.get("blender", (0, 0, 0)) < (2, 80, 0): raise Exception(f"Add-on '{module_name:s}' has not been upgraded to 2.8, ignoring") ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [03ee447dd2d] master: UI: Remove redundant 'settings' from GPencil Tool Properties panel titles
Commit: 03ee447dd2d2b2000ff9019f7f80984a0e895865 Author: William Reynish Date: Sat Mar 16 12:54:08 2019 +0100 Branches: master https://developer.blender.org/rB03ee447dd2d2b2000ff9019f7f80984a0e895865 UI: Remove redundant 'settings' from GPencil Tool Properties panel titles === M release/scripts/startup/bl_ui/space_view3d_toolbar.py === diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index f95796a3cde..0f7305800be 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1550,7 +1550,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel): class VIEW3D_PT_tools_grease_pencil_brush_stabilizer(View3DPanel, Panel): bl_context = ".greasepencil_paint" bl_parent_id = 'VIEW3D_PT_tools_grease_pencil_brush_option' -bl_label = "Stabilizer Settings" +bl_label = "Stabilize" bl_options = {'DEFAULT_CLOSED'} @classmethod @@ -1579,7 +1579,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_stabilizer(View3DPanel, Panel): class VIEW3D_PT_tools_grease_pencil_brush_settings(View3DPanel, Panel): bl_context = ".greasepencil_paint" bl_parent_id = 'VIEW3D_PT_tools_grease_pencil_brush_option' -bl_label = "Post-processing Settings" +bl_label = "Post-Processing" bl_options = {'DEFAULT_CLOSED'} @classmethod @@ -1620,7 +1620,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_settings(View3DPanel, Panel): class VIEW3D_PT_tools_grease_pencil_brush_random(View3DPanel, Panel): bl_context = ".greasepencil_paint" bl_parent_id = 'VIEW3D_PT_tools_grease_pencil_brush_option' -bl_label = "Random Settings" +bl_label = "Randomize" bl_options = {'DEFAULT_CLOSED'} @classmethod ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4d390c2af62] greasepencil-object: Merge branch 'master' into greasepencil-object
Commit: 4d390c2af6227cf97156721dfa2cc112a7fe09d7 Author: Antonioya Date: Sat Mar 16 12:01:56 2019 +0100 Branches: greasepencil-object https://developer.blender.org/rB4d390c2af6227cf97156721dfa2cc112a7fe09d7 Merge branch 'master' into greasepencil-object === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [cabb53effa7] master: Correct error in 6aebb5a4d5f5c
Commit: cabb53effa71d61684aea083c56bd5db3b3ac0c9 Author: Campbell Barton Date: Sat Mar 16 21:49:33 2019 +1100 Branches: master https://developer.blender.org/rBcabb53effa71d61684aea083c56bd5db3b3ac0c9 Correct error in 6aebb5a4d5f5c === M source/blender/draw/modes/edit_text_mode.c === diff --git a/source/blender/draw/modes/edit_text_mode.c b/source/blender/draw/modes/edit_text_mode.c index f52bfaccd5b..caebc94f3ce 100644 --- a/source/blender/draw/modes/edit_text_mode.c +++ b/source/blender/draw/modes/edit_text_mode.c @@ -151,9 +151,11 @@ static void EDIT_TEXT_engine_init(void *vedata) * Assume that all Passes are NULL */ static void EDIT_TEXT_cache_init(void *vedata) { + const DRWContextState *draw_ctx = DRW_context_state_get(); EDIT_TEXT_PassList *psl = ((EDIT_TEXT_Data *)vedata)->psl; EDIT_TEXT_StorageList *stl = ((EDIT_TEXT_Data *)vedata)->stl; + if (!stl->g_data) { /* Alloc transient pointers */ stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__); @@ -179,8 +181,8 @@ static void EDIT_TEXT_cache_init(void *vedata) psl->text_box_pass = DRW_pass_create( "Font Text Boxes", DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH); - stl->g_data->box_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, G_draw.block.colorWire); - stl->g_data->box_active_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, G_draw.block.colorActive); + stl->g_data->box_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, G_draw.block.colorWire, draw_ctx->sh_cfg); + stl->g_data->box_active_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, G_draw.block.colorActive, draw_ctx->sh_cfg); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [37af7ce779a] master: DRW: support clipping for armature bone axes
Commit: 37af7ce779af9bdf0e858251edc866687d895913 Author: Campbell Barton Date: Sat Mar 16 18:41:34 2019 +1100 Branches: master https://developer.blender.org/rB37af7ce779af9bdf0e858251edc866687d895913 DRW: support clipping for armature bone axes Also minor changes to make empty axis match armature axis. === M source/blender/draw/intern/draw_armature.c M source/blender/draw/intern/draw_common.c M source/blender/draw/intern/draw_common.h M source/blender/draw/modes/shaders/armature_axes_vert.glsl M source/blender/draw/modes/shaders/object_empty_axes_vert.glsl === diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index cab0872bc35..a26313a1402 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -417,10 +417,12 @@ static void drw_shgroup_bone_point( } /* Axes */ -static void drw_shgroup_bone_axes(const float (*bone_mat)[4], const float color[4]) +static void drw_shgroup_bone_axes( +const float (*bone_mat)[4], const float color[4], +const eGPUShaderConfig sh_cfg) { if (g_data.bone_axes == NULL) { - g_data.bone_axes = shgroup_instance_bone_axes(g_data.passes.bone_axes); + g_data.bone_axes = shgroup_instance_bone_axes(g_data.passes.bone_axes, sh_cfg); } float final_bonemat[4][4]; mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat); @@ -1172,7 +1174,9 @@ static void draw_bone_update_disp_matrix_custom(bPoseChannel *pchan) translate_m4(disp_tail_mat, 0.0f, 1.0f, 0.0f); } -static void draw_axes(EditBone *eBone, bPoseChannel *pchan) +static void draw_axes( +EditBone *eBone, bPoseChannel *pchan, +const eGPUShaderConfig sh_cfg) { float final_col[4]; const float *col = (g_theme.const_color) ? g_theme.const_color : @@ -1180,7 +1184,7 @@ static void draw_axes(EditBone *eBone, bPoseChannel *pchan) copy_v4_v4(final_col, col); /* Mix with axes color. */ final_col[3] = (g_theme.const_color) ? 1.0 : (BONE_FLAG(eBone, pchan) & BONE_SELECTED) ? 0.3 : 0.8; - drw_shgroup_bone_axes(BONE_VAR(eBone, pchan, disp_mat), final_col); + drw_shgroup_bone_axes(BONE_VAR(eBone, pchan, disp_mat), final_col, sh_cfg); } static void draw_points( @@ -1783,7 +1787,7 @@ static void draw_armature_edit(Object *ob) /* Draw additional axes */ if (arm->flag & ARM_DRAWAXES) { - draw_axes(eBone, NULL); + draw_axes(eBone, NULL, draw_ctx->sh_cfg); } } } @@ -1907,7 +1911,7 @@ static void draw_armature_pose(Object *ob, const float const_color[4]) /* Draw additional axes */ if (arm->flag & ARM_DRAWAXES) { - draw_axes(NULL, pchan); + draw_axes(NULL, pchan, draw_ctx->sh_cfg); } } } diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index b5141fa0af1..849087d39af 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -602,13 +602,16 @@ DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct GPUBatch *geom, eGP return grp; } -DRWShadingGroup *shgroup_instance_bone_axes(DRWPass *pass) +DRWShadingGroup *shgroup_instance_bone_axes(DRWPass *pass, eGPUShaderConfig sh_cfg) { - COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT]; + COMMON_Shaders *sh_data = &g_shaders[sh_cfg]; if (sh_data->bone_axes == NULL) { - sh_data->bone_axes = DRW_shader_create( - datatoc_armature_axes_vert_glsl, NULL, - datatoc_gpu_shader_flat_color_frag_glsl, NULL); + const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg]; + sh_data->bone_axes = GPU_shader_create_from_arrays({ + .vert = (const char *[]){sh_cfg_data->lib, datatoc_armature_axes_vert_glsl, NULL}, + .frag = (const char *[]){datatoc_gpu_shader_flat_color_frag_glsl, NULL}, + .defs = (const char *[]){sh_cfg_data->def, NULL}, + }); } DRW_shgroup_instance_format(g_formats.instance_color, { @@ -621,7 +624,9 @@ DRWShadingGroup *shgroup_instance_bone_axes(DRWPass *pass) pass, DRW_cache_bone_arrows_get(), g_formats.instance_color); DRW_shgroup_uniform_vec3(grp, "screenVecs[0]", DRW_viewport_sc
[Bf-blender-cvs] [c55fb58e8a4] master: DRW: support clipping for envelope armature draw type
Commit: c55fb58e8a4f1fd34d24deeed3a86b32e819d677 Author: Campbell Barton Date: Sat Mar 16 18:01:22 2019 +1100 Branches: master https://developer.blender.org/rBc55fb58e8a4f1fd34d24deeed3a86b32e819d677 DRW: support clipping for envelope armature draw type === M source/blender/draw/intern/draw_armature.c M source/blender/draw/intern/draw_common.c M source/blender/draw/intern/draw_common.h M source/blender/draw/modes/shaders/armature_envelope_outline_vert.glsl M source/blender/draw/modes/shaders/armature_envelope_solid_vert.glsl === diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index 417132e6d2f..cab0872bc35 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -207,11 +207,12 @@ static void drw_shgroup_bone_stick( /* Envelope */ static void drw_shgroup_bone_envelope_distance( const float (*bone_mat)[4], -const float *radius_head, const float *radius_tail, const float *distance) +const float *radius_head, const float *radius_tail, const float *distance, +const eGPUShaderConfig sh_cfg) { if (g_data.passes.bone_envelope != NULL) { if (g_data.bone_envelope_distance == NULL) { - g_data.bone_envelope_distance = shgroup_instance_bone_envelope_distance(g_data.passes.bone_envelope); + g_data.bone_envelope_distance = shgroup_instance_bone_envelope_distance(g_data.passes.bone_envelope, sh_cfg); /* passes.bone_envelope should have the DRW_STATE_CULL_FRONT state enabled. */ } float head_sphere[4] = {0.0f, 0.0f, 0.0f, 1.0f}, tail_sphere[4] = {0.0f, 1.0f, 0.0f, 1.0f}; @@ -244,12 +245,12 @@ static void drw_shgroup_bone_envelope( g_data.bone_point_solid = shgroup_instance_bone_sphere_solid(g_data.passes.bone_solid, g_data.transparent, sh_cfg); } if (g_data.bone_envelope_wire == NULL) { - g_data.bone_envelope_wire = shgroup_instance_bone_envelope_outline(g_data.passes.bone_wire); + g_data.bone_envelope_wire = shgroup_instance_bone_envelope_outline(g_data.passes.bone_wire, sh_cfg); } if (g_data.bone_envelope_solid == NULL && g_data.passes.bone_solid != NULL) { - g_data.bone_envelope_solid = shgroup_instance_bone_envelope_solid(g_data.passes.bone_solid, g_data.transparent); + g_data.bone_envelope_solid = shgroup_instance_bone_envelope_solid(g_data.passes.bone_solid, g_data.transparent, sh_cfg); /* We can have a lot of overdraw if we don't do this. Also envelope are not subject to * inverted matrix. */ DRW_shgroup_state_enable(g_data.bone_envelope_solid, DRW_STATE_CULL_BACK); @@ -1332,7 +1333,7 @@ static void draw_bone_envelope( (boneflag & BONE_NO_DEFORM) == 0 && ((boneflag & BONE_SELECTED) || (eBone && (boneflag & (BONE_ROOTSEL | BONE_TIPSEL) { - drw_shgroup_bone_envelope_distance(BONE_VAR(eBone, pchan, disp_mat), rad_head, rad_tail, distance); + drw_shgroup_bone_envelope_distance(BONE_VAR(eBone, pchan, disp_mat), rad_head, rad_tail, distance, sh_cfg); } if (select_id != -1) { diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index 9a7f69c5e58..b5141fa0af1 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -625,13 +625,16 @@ DRWShadingGroup *shgroup_instance_bone_axes(DRWPass *pass) return grp; } -DRWShadingGroup *shgroup_instance_bone_envelope_outline(DRWPass *pass) +DRWShadingGroup *shgroup_instance_bone_envelope_outline(DRWPass *pass, eGPUShaderConfig sh_cfg) { - COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT]; + COMMON_Shaders *sh_data = &g_shaders[sh_cfg]; if (sh_data->bone_envelope_outline == NULL) { - sh_data->bone_envelope_outline = DRW_shader_create( - datatoc_armature_envelope_outline_vert_glsl, NULL, - datatoc_gpu_shader_flat_color_frag_glsl, NULL); + const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg]; + sh_data->bone_envelope_outline = GPU_shader_create_from_arrays({ + .vert = (const char *[]){sh_cfg_data->lib, datatoc_armature_envelope_outline_vert_glsl, NULL}, + .frag = (const char *[]){datatoc_gpu_shader_flat_color_frag_glsl, NULL}, + .defs = (const char *[]){sh_cfg_data->def, NULL}, + }); } DRW_shgroup_instance_format(g_formats.instance_bone_envelope_outline, { @@ -646,1