diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-05-01 17:28:02 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-05-01 17:28:02 +0300 |
commit | 43452c254e2dae31361a74ff90eb44ac35368f3f (patch) | |
tree | d32a1922353e13d5fe79e61feae3371677a020d1 | |
parent | be88f23b834b9f9e9c7c71215284a4c1f6fe0f66 (diff) | |
parent | c5c3fa3eacb32b6e9f8ece47d1c69f274b9070c0 (diff) |
Merge branch 'blender2.8' of git.blender.org:blender into blender2.8
15 files changed, 268 insertions, 71 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 5312aac4764..c621e27ae00 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -613,28 +613,42 @@ class _defs_weight_paint: ) @ToolDef.from_fn - def gradient_linear(): + def sample_weight(): return dict( - text="Linear Gradient", - icon=None, + text="Sample Weight", + icon="ops.paint.weight_sample", widget=None, keymap=( - ("paint.weight_gradient", dict(type='LINEAR'), - dict(type='EVT_TWEAK_A', value='ANY')), + ("paint.weight_sample", dict(), dict(type='ACTIONMOUSE', value='PRESS')), ), ) @ToolDef.from_fn - def gradient_radial(): + def sample_weight_group(): return dict( - text="Radial Gradient", - icon=None, + text="Sample Vertex Group", + icon="ops.paint.weight_sample_group", widget=None, keymap=( - ("paint.weight_gradient", - dict(type='RADIAL'), - dict(type='EVT_TWEAK_A', value='ANY')), + ("paint.weight_sample_group", dict(), dict(type='ACTIONMOUSE', value='PRESS')), + ), + ) + + @ToolDef.from_fn + def gradient(): + def draw_settings(context, layout): + wm = context.window_manager + props = wm.operator_properties_last("paint.weight_gradient") + layout.prop(props, "type") + + return dict( + text="Gradient", + icon="ops.paint.weight_gradient", + widget=None, + keymap=( + ("paint.weight_gradient", dict(), dict(type='EVT_TWEAK_A', value='ANY')), ), + draw_settings=draw_settings, ) @@ -771,13 +785,14 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): ], 'PAINT_WEIGHT': [ _defs_weight_paint.generate_from_brushes, - + None, + _defs_weight_paint.sample_weight, + _defs_weight_paint.sample_weight_group, + None, # TODO, override brush events *_tools_select, - ( - _defs_weight_paint.gradient_linear, - _defs_weight_paint.gradient_radial, - ), + None, + _defs_weight_paint.gradient, ], } diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 519a9f5a9b9..0189f9fc100 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -224,7 +224,7 @@ class _draw_left_context_mode: from .properties_paint_common import UnifiedPaintPanel - layout.prop(brush, "weight") + UnifiedPaintPanel.prop_unified_weight(layout, context, brush, "weight", slider=True, text="Weight") UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True, text="Radius") UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength") diff --git a/source/blender/blenkernel/intern/library_override.c b/source/blender/blenkernel/intern/library_override.c index 625af190bbc..8917fac198c 100644 --- a/source/blender/blenkernel/intern/library_override.c +++ b/source/blender/blenkernel/intern/library_override.c @@ -28,6 +28,7 @@ */ #include <stdlib.h> +#include <string.h> #include "MEM_guardedalloc.h" @@ -303,30 +304,46 @@ IDOverrideStaticPropertyOperation *BKE_override_static_property_operation_find( *r_strict = true; } - if (subitem_locname && - (opop = BLI_findstring_ptr(&override_property->operations, subitem_locname, - offsetof(IDOverrideStaticPropertyOperation, subitem_local_name)))) - { - return opop; + if (subitem_locname != NULL) { + opop = BLI_findstring_ptr(&override_property->operations, subitem_locname, + offsetof(IDOverrideStaticPropertyOperation, subitem_local_name)); + + if (opop == NULL) { + return NULL; + } + + if (subitem_refname == NULL || opop->subitem_reference_name == NULL) { + return subitem_refname == opop->subitem_reference_name ? opop : NULL; + } + return (subitem_refname != NULL && opop->subitem_reference_name != NULL && + STREQ(subitem_refname, opop->subitem_reference_name)) ? opop : NULL; } - if (subitem_refname && - (opop = BLI_findstring_ptr(&override_property->operations, subitem_refname, - offsetof(IDOverrideStaticPropertyOperation, subitem_reference_name)))) - { - return opop; + if (subitem_refname != NULL) { + opop = BLI_findstring_ptr(&override_property->operations, subitem_refname, + offsetof(IDOverrideStaticPropertyOperation, subitem_reference_name)); + + if (opop == NULL) { + return NULL; + } + + if (subitem_locname == NULL || opop->subitem_local_name == NULL) { + return subitem_locname == opop->subitem_local_name ? opop : NULL; + } + return (subitem_locname != NULL && opop->subitem_local_name != NULL && + STREQ(subitem_locname, opop->subitem_local_name)) ? opop : NULL; } if ((opop = BLI_listbase_bytes_find(&override_property->operations, &subitem_locindex, sizeof(subitem_locindex), offsetof(IDOverrideStaticPropertyOperation, subitem_local_index)))) { - return opop; + return ELEM(subitem_refindex, -1, opop->subitem_reference_index) ? opop : NULL; } if ((opop = BLI_listbase_bytes_find(&override_property->operations, &subitem_refindex, sizeof(subitem_refindex), offsetof(IDOverrideStaticPropertyOperation, subitem_reference_index)))) { - return opop; + return ELEM(subitem_locindex, -1, opop->subitem_local_index) ? opop : NULL; } /* index == -1 means all indices, that is valid fallback in case we requested specific index. */ diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 62c3bb5be35..b209b96e3fb 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1989,9 +1989,6 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) if (ntree) { bNodeTree *ltree; bNode *node; - AnimData *adt; - - bAction *action_backup = NULL, *tmpact_backup = NULL; BLI_spin_lock(&spin); if (!ntree->duplilock) { @@ -2001,18 +1998,6 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) BLI_mutex_lock(ntree->duplilock); - /* Workaround for copying an action on each render! - * set action to NULL so animdata actions don't get copied */ - adt = BKE_animdata_from_id(&ntree->id); - - if (adt) { - action_backup = adt->action; - tmpact_backup = adt->tmpact; - - adt->action = NULL; - adt->tmpact = NULL; - } - /* Make full copy outside of Main database. * Note: previews are not copied here. */ @@ -2026,20 +2011,6 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) } } - if (adt) { - AnimData *ladt = BKE_animdata_from_id(<ree->id); - - adt->action = ladt->action = action_backup; - adt->tmpact = ladt->tmpact = tmpact_backup; - - if (action_backup) - id_us_plus(&action_backup->id); - if (tmpact_backup) - id_us_plus(&tmpact_backup->id); - - } - /* end animdata uglyness */ - /* ensures only a single output node is enabled */ ntreeSetOutput(ntree); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 201df94b691..5514d4b9452 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -563,6 +563,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object) ComponentKey geometry_key((ID *)object->data, DEG_NODE_TYPE_GEOMETRY); ComponentKey key_key(&key->id, DEG_NODE_TYPE_GEOMETRY); add_relation(key_key, geometry_key, "Shapekeys"); + build_nested_shapekey(&object->id, key); } } @@ -1273,6 +1274,7 @@ void DepsgraphRelationBuilder::build_world(World *world) ComponentKey ntree_key(&world->nodetree->id, DEG_NODE_TYPE_SHADING); ComponentKey world_key(&world->id, DEG_NODE_TYPE_SHADING); add_relation(ntree_key, world_key, "NTree->World Shading Update"); + build_nested_nodetree(&world->id, world->nodetree); } } @@ -1804,6 +1806,7 @@ void DepsgraphRelationBuilder::build_lamp(Object *object) build_nodetree(lamp->nodetree); ComponentKey nodetree_key(&lamp->nodetree->id, DEG_NODE_TYPE_SHADING); add_relation(nodetree_key, lamp_parameters_key, "NTree->Lamp Parameters"); + build_nested_nodetree(&lamp->id, lamp->nodetree); } if (DEG_depsgraph_use_copy_on_write()) { @@ -1896,6 +1899,7 @@ void DepsgraphRelationBuilder::build_material(Material *material) DEG_NODE_TYPE_SHADING, DEG_OPCODE_MATERIAL_UPDATE); add_relation(ntree_key, material_key, "Material's NTree"); + build_nested_nodetree(&material->id, material->nodetree); } } @@ -1909,6 +1913,7 @@ void DepsgraphRelationBuilder::build_texture(Tex *texture) build_animdata(&texture->id); /* texture's nodetree */ build_nodetree(texture->nodetree); + build_nested_nodetree(&texture->id, texture->nodetree); } void DepsgraphRelationBuilder::build_compositor(Scene *scene) @@ -1979,6 +1984,43 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations() } } +/* Nested datablocks (node trees, shape keys) requires special relation to + * ensure owner's datablock remapping happens after node tree itself is ready. + * + * This is similar to what happens in ntree_hack_remap_pointers(). + */ +void DepsgraphRelationBuilder::build_nested_datablock(ID *owner, ID *id) { + if (!DEG_depsgraph_use_copy_on_write()) { + return; + } + OperationKey owner_copy_on_write_key(owner, + DEG_NODE_TYPE_COPY_ON_WRITE, + DEG_OPCODE_COPY_ON_WRITE); + OperationKey id_copy_on_write_key(id, + DEG_NODE_TYPE_COPY_ON_WRITE, + DEG_OPCODE_COPY_ON_WRITE); + add_relation(id_copy_on_write_key, + owner_copy_on_write_key, + "Eval Order"); +} + +void DepsgraphRelationBuilder::build_nested_nodetree(ID *owner, + bNodeTree *ntree) +{ + if (ntree == NULL) { + return; + } + build_nested_datablock(owner, &ntree->id); +} + +void DepsgraphRelationBuilder::build_nested_shapekey(ID *owner, Key *key) +{ + if (key == NULL) { + return; + } + build_nested_datablock(owner, &key->id); +} + void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node) { ID *id_orig = id_node->id_orig; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 7469540521b..7c88eea6f72 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -251,6 +251,10 @@ struct DepsgraphRelationBuilder void build_movieclip(MovieClip *clip); void build_lightprobe(Object *object); + void build_nested_datablock(ID *owner, ID *id); + void build_nested_nodetree(ID *owner, bNodeTree *ntree); + void build_nested_shapekey(ID *owner, Key *key); + void add_collision_relations(const OperationKey &key, Scene *scene, Object *object, diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 11fb65242f5..2e6c90cacb2 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -2314,6 +2314,7 @@ bool EDBM_selectmode_toggle( bContext *C, const short selectmode_new, const int action, const bool use_extend, const bool use_expand) { + Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); ToolSettings *ts = CTX_data_tool_settings(C); Object *obedit = CTX_data_edit_object(C); @@ -2420,9 +2421,11 @@ bool EDBM_selectmode_toggle( Object *ob_iter = objects[ob_index]; BMEditMesh *em_iter = BKE_editmesh_from_object(ob_iter); EDBM_selectmode_set(em_iter); + DEG_id_tag_update(ob_iter->data, DEG_TAG_COPY_ON_WRITE); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob_iter->data); } WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL); + DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE); } MEM_SAFE_FREE(objects); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index dbb12282d0a..3207b4f6a0a 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -264,7 +264,7 @@ static Brush *image_paint_brush(bContext *C) return BKE_paint_brush(&settings->imapaint.paint); } -static int image_paint_poll(bContext *C) +static int image_paint_poll_ex(bContext *C, bool check_tool) { Object *obact; @@ -273,7 +273,9 @@ static int image_paint_poll(bContext *C) obact = CTX_data_active_object(C); if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) { - return 1; + if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) { + return 1; + } } else { SpaceImage *sima = CTX_wm_space_image(C); @@ -290,6 +292,16 @@ static int image_paint_poll(bContext *C) return 0; } +static int image_paint_poll(bContext *C) +{ + return image_paint_poll_ex(C, true); +} + +static int image_paint_poll_ignore_tool(bContext *C) +{ + return image_paint_poll_ex(C, false); +} + static int image_paint_2d_clone_poll(bContext *C) { Brush *brush = image_paint_brush(C); @@ -999,7 +1011,7 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event) static int sample_color_poll(bContext *C) { - return (image_paint_poll(C) || vertex_paint_poll(C)); + return (image_paint_poll_ignore_tool(C) || image_paint_poll_ignore_tool(C)); } void PAINT_OT_sample_color(wmOperatorType *ot) diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index ca82ca52463..a6d8a90e95a 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -94,8 +94,10 @@ void paint_cursor_delete_textures(void); /* paint_vertex.c */ int weight_paint_poll(struct bContext *C); +int weight_paint_poll_ignore_tool(bContext *C); int weight_paint_mode_poll(struct bContext *C); int vertex_paint_poll(struct bContext *C); +int vertex_paint_poll_ignore_tool(struct bContext *C); int vertex_paint_mode_poll(struct bContext *C); typedef void (*VPaintTransform_Callback)(const float col[3], const void *user_data, float r_col[3]); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 7e9c98d3822..d5991ac67d4 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -206,7 +206,7 @@ int vertex_paint_mode_poll(bContext *C) return ob && ob->mode == OB_MODE_VERTEX_PAINT && ((Mesh *)ob->data)->totpoly; } -int vertex_paint_poll(bContext *C) +static int vertex_paint_poll_ex(bContext *C, bool check_tool) { if (vertex_paint_mode_poll(C) && BKE_paint_brush(&CTX_data_tool_settings(C)->vpaint->paint)) @@ -214,13 +214,26 @@ int vertex_paint_poll(bContext *C) ScrArea *sa = CTX_wm_area(C); if (sa && sa->spacetype == SPACE_VIEW3D) { ARegion *ar = CTX_wm_region(C); - if (ar->regiontype == RGN_TYPE_WINDOW) - return 1; + if (ar->regiontype == RGN_TYPE_WINDOW) { + if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) { + return 1; + } + } } } return 0; } +int vertex_paint_poll(bContext *C) +{ + return vertex_paint_poll_ex(C, true); +} + +int vertex_paint_poll_ignore_tool(bContext *C) +{ + return vertex_paint_poll_ex(C, true); +} + int weight_paint_mode_poll(bContext *C) { Object *ob = CTX_data_active_object(C); @@ -228,7 +241,7 @@ int weight_paint_mode_poll(bContext *C) return ob && ob->mode == OB_MODE_WEIGHT_PAINT && ((Mesh *)ob->data)->totpoly; } -int weight_paint_poll(bContext *C) +static int weight_paint_poll_ex(bContext *C, bool check_tool) { Object *ob = CTX_data_active_object(C); ScrArea *sa; @@ -241,12 +254,24 @@ int weight_paint_poll(bContext *C) { ARegion *ar = CTX_wm_region(C); if (ar->regiontype == RGN_TYPE_WINDOW) { - return 1; + if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) { + return 1; + } } } return 0; } +int weight_paint_poll(bContext *C) +{ + return weight_paint_poll_ex(C, true); +} + +int weight_paint_poll_ignore_tool(bContext *C) +{ + return weight_paint_poll_ex(C, false); +} + static VPaint *new_vpaint(void) { VPaint *vp = MEM_callocN(sizeof(VPaint), "VPaint"); @@ -1209,7 +1234,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) ED_object_wpaintmode_exit_ex(ob); } else { - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C); wmWindowManager *wm = CTX_wm_manager(C); ED_object_wpaintmode_enter_ex(depsgraph, wm, scene, ob); } diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 3773806e192..e560a4cddff 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -849,7 +849,7 @@ void PAINT_OT_weight_gradient(wmOperatorType *ot) ot->invoke = paint_weight_gradient_invoke; ot->modal = paint_weight_gradient_modal; ot->exec = paint_weight_gradient_exec; - ot->poll = weight_paint_poll; + ot->poll = weight_paint_poll_ignore_tool; ot->cancel = WM_gesture_straightline_cancel; /* flags */ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 6875971de24..25e40ccf6e5 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1596,7 +1596,7 @@ static void outliner_draw_hierarchy_lines_recursive(unsigned pos, SpaceOops *soo const unsigned char grayed_alpha = col[3] / 2; /* For vertical lines between objects. */ - y1 = *starty; + y1 = y2 = *starty; for (te = lb->first; te; te = te->next) { bool draw_childs_grayed_out = draw_grayed_out || (te->drag_data != NULL); tselem = TREESTORE(te); diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 088b2b67af5..deb9e20f34b 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -108,6 +108,31 @@ const EnumPropertyItem rna_enum_id_type_items[] = { #include "WM_api.h" +void rna_ID_override_static_property_operation_refname_get(PointerRNA *ptr, char *value) +{ + IDOverrideStaticPropertyOperation *opop = ptr->data; + strcpy(value, (opop->subitem_reference_name == NULL) ? "" : opop->subitem_reference_name); +} + +int rna_ID_override_static_property_operation_refname_length(PointerRNA *ptr) +{ + IDOverrideStaticPropertyOperation *opop = ptr->data; + return (opop->subitem_reference_name == NULL) ? 0 : strlen(opop->subitem_reference_name); +} + +void rna_ID_override_static_property_operation_locname_get(PointerRNA *ptr, char *value) +{ + IDOverrideStaticPropertyOperation *opop = ptr->data; + strcpy(value, (opop->subitem_local_name == NULL) ? "" : opop->subitem_local_name); +} + +int rna_ID_override_static_property_operation_locname_length(PointerRNA *ptr) +{ + IDOverrideStaticPropertyOperation *opop = ptr->data; + return (opop->subitem_local_name == NULL) ? 0 : strlen(opop->subitem_local_name); +} + + /* name functions that ignore the first two ID characters */ void rna_ID_name_get(PointerRNA *ptr, char *value) { @@ -997,6 +1022,68 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_function_ui_description(func, "Reload the preview from its source path"); } +static void rna_def_ID_override_static_property_operation(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static const EnumPropertyItem static_override_property_operation_items[] = { + {IDOVERRIDESTATIC_OP_NOOP, "NOOP", 0, "No-Op", "Does nothing, prevents adding actual overrides (NOT USED)"}, + {IDOVERRIDESTATIC_OP_REPLACE, "REPLACE", 0, "Replace", "Replace value of reference by overriding one"}, + {IDOVERRIDESTATIC_OP_ADD, "DIFF_ADD", 0, "Differential", + "Stores and apply difference between reference and local value (NOT USED)"}, + {IDOVERRIDESTATIC_OP_SUBTRACT, "DIFF_SUB", 0, "Differential", + "Stores and apply difference between reference and local value (NOT USED)"}, + {IDOVERRIDESTATIC_OP_MULTIPLY, "FACT_MULTIPLY", 0, "Factor", + "Stores and apply multiplication factor between reference and local value (NOT USED)"}, + {IDOVERRIDESTATIC_OP_INSERT_AFTER, "INSERT_AFTER", 0, "Insert After", + "Insert a new item into collection after the one referenced in subitem_reference_name or _index"}, + {IDOVERRIDESTATIC_OP_INSERT_BEFORE, "INSERT_BEFORE", 0, "Insert Before", + "Insert a new item into collection after the one referenced in subitem_reference_name or _index (NOT USED)"}, + {0, NULL, 0, NULL, NULL} + }; + + static const EnumPropertyItem static_override_property_flag_items[] = { + {IDOVERRIDESTATIC_FLAG_MANDATORY, "MANDATORY", 0, "Mandatory", + "For templates, prevents the user from removing pre-defined operation (NOT USED)"}, + {IDOVERRIDESTATIC_FLAG_LOCKED, "LOCKED", 0, "Locked", + "Prevents the user from modifying that override operation (NOT USED)"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "IDOverrideStaticPropertyOperation", NULL); + RNA_def_struct_ui_text(srna, "ID Static Override Property Operation", + "Description of an override operation over an overridden property"); + + prop = RNA_def_enum(srna, "operation", static_override_property_operation_items, IDOVERRIDESTATIC_OP_REPLACE, + "Operation", "What override operation is performed"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ + + prop = RNA_def_enum(srna, "flag", static_override_property_flag_items, 0, + "Flags", "Optional flags (NOT USED)"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ + + prop = RNA_def_string(srna, "subitem_reference_name", NULL, INT_MAX, "Subitem Reference Name", + "Used to handle insertions into collection"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ + RNA_def_property_string_funcs(prop, "rna_ID_override_static_property_operation_refname_get", + "rna_ID_override_static_property_operation_refname_length", NULL); + + prop = RNA_def_string(srna, "subitem_local_name", NULL, INT_MAX, "Subitem Local Name", + "Used to handle insertions into collection"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ + RNA_def_property_string_funcs(prop, "rna_ID_override_static_property_operation_locname_get", + "rna_ID_override_static_property_operation_locname_length", NULL); + + prop = RNA_def_int(srna, "subitem_reference_index", -1, -1, INT_MAX, "Subitem Reference Index", + "Used to handle insertions into collection", -1, INT_MAX); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ + + prop = RNA_def_int(srna, "subitem_local_index", -1, -1, INT_MAX, "Subitem Local Index", + "Used to handle insertions into collection", -1, INT_MAX); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ +} + static void rna_def_ID_override_static_property(BlenderRNA *brna) { StructRNA *srna; @@ -1005,11 +1092,18 @@ static void rna_def_ID_override_static_property(BlenderRNA *brna) srna = RNA_def_struct(brna, "IDOverrideStaticProperty", NULL); RNA_def_struct_ui_text(srna, "ID Static Override Property", "Description of an overridden property"); - prop = RNA_def_string(srna, "rna_path", NULL, INT_MAX, "RNA Path", "RNA path leading to that property, from owning ID"); + /* String pointer, we *should* add get/set/etc. But NULL rna_path would be a nasty bug anyway... */ + prop = RNA_def_string(srna, "rna_path", NULL, INT_MAX, "RNA Path", + "RNA path leading to that property, from owning ID"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ + + RNA_def_collection(srna, "operations", "IDOverrideStaticPropertyOperation", "Operations", + "List of overriding operations for a property"); + + rna_def_ID_override_static_property_operation(brna); } - static void rna_def_ID_override_static(BlenderRNA *brna) +static void rna_def_ID_override_static(BlenderRNA *brna) { StructRNA *srna; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index c65f1064830..febf69aa789 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -595,6 +595,8 @@ void WM_toolsystem_link(struct bContext *C, struct WorkSpace *workspace); void WM_toolsystem_set(struct bContext *C, const struct bToolDef *tool); void WM_toolsystem_init(struct bContext *C); +bool WM_toolsystem_active_tool_is_brush(const struct bContext *C); + /* wm_tooltip.c */ typedef struct ARegion *(*wmTooltipInitFn)(struct bContext *, struct ARegion *, bool *); diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index 66e84406ebb..690628bbd3b 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -140,3 +140,13 @@ void WM_toolsystem_init(bContext *C) WM_toolsystem_link(C, workspace); } } + +/** + * For paint modes to support non-brush tools. + */ +bool WM_toolsystem_active_tool_is_brush(const bContext *C) +{ + WorkSpace *workspace = CTX_wm_workspace(C); + /* Will need to become more comprehensive, for now check tool data-block. */ + return workspace->tool.data_block[0] != '\0'; +} |