diff options
author | Jeroen Bakker <jbakker> | 2022-04-08 17:37:35 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-04-08 17:42:50 +0300 |
commit | 8b7cd1ed2a17e40661101eea4adae99e8e3d02e9 (patch) | |
tree | 8c3f1f2a14d699fad0367ce529254f2efb517acf /source/blender/makesrna/intern/rna_workspace.c | |
parent | 63d2980efa2fb170b471e4905ec81cd1472e5268 (diff) |
Painting: Canvas switcher for painting brushes/tools.
This patch adds color attributes to TexPaintSlot. This allows an easier selection
when painting color attributes.
Previously when selecting a paint tool the user had to start a stroke, before the
UI reflected the correct TexPaintSlot. Now when switching the slot the active
tool is checked and immediate the UI is drawn correctly.
In the future the canvas selector will also be used to select an image or image texture node
to paint on. Basic implementation has already been done inside this patch.
A limitation of this patch is that is isn't possible anymore to rename images directly from
the selection panel. This is currently allowed in master. But as CustomDataLayers
aren't ID fields and not owned by the material supporting this wouldn't be easy.
{F12953989}
In the future we should update the create slot operator to also include color attributes.
Sources could also be extended to use other areas of the object that use image textures
(particles, geom nodes, etc... ).
Reviewed By: brecht
Maniphest Tasks: T96709
Differential Revision: https://developer.blender.org/D14455
Diffstat (limited to 'source/blender/makesrna/intern/rna_workspace.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_workspace.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c index f32a74be6e2..0b6c3934985 100644 --- a/source/blender/makesrna/intern/rna_workspace.c +++ b/source/blender/makesrna/intern/rna_workspace.c @@ -32,6 +32,7 @@ # include "DNA_space_types.h" # include "ED_asset.h" +# include "ED_paint.h" # include "RNA_access.h" @@ -180,6 +181,12 @@ const EnumPropertyItem *rna_WorkSpace_tools_mode_itemf(bContext *UNUSED(C), return DummyRNA_DEFAULT_items; } +static bool rna_WorkSpaceTool_use_paint_canvas_get(PointerRNA *ptr) +{ + bToolRef *tref = ptr->data; + return ED_paint_tool_use_canvas(NULL, tref); +} + static int rna_WorkSpaceTool_index_get(PointerRNA *ptr) { bToolRef *tref = ptr->data; @@ -291,6 +298,12 @@ static void rna_def_workspace_tool(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Tool Mode", ""); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "use_paint_canvas", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Index", ""); + RNA_def_property_boolean_funcs(prop, "rna_WorkSpaceTool_use_paint_canvas_get", NULL); + RNA_def_property_ui_text(prop, "Use Paint Canvas", "Does this tool use an painting canvas"); + RNA_define_verify_sdna(0); prop = RNA_def_property(srna, "has_datablock", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); |