WIP: Brush assets project #106303

Draft
Julian Eisel wants to merge 352 commits from brush-assets-project into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 48 additions and 16 deletions
Showing only changes of commit 16875c82bb - Show all commits

View File

@ -7332,7 +7332,9 @@ static void rna_def_modifier_nodes(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, nullptr);
rna_def_modifier_panel_open_prop(srna, "open_output_attributes_panel", 0);
rna_def_modifier_panel_open_prop(srna, "open_internal_dependencies_panel", 1);
rna_def_modifier_panel_open_prop(srna, "open_manage_panel", 1);
rna_def_modifier_panel_open_prop(srna, "open_bake_panel", 2);
rna_def_modifier_panel_open_prop(srna, "open_named_attributes_panel", 3);
RNA_define_lib_overridable(false);
}

View File

@ -1931,37 +1931,48 @@ static void draw_interface_panel_content(const bContext *C,
}
}
static bool has_output_attribute(const NodesModifierData &nmd)
{
if (!nmd.node_group) {
return false;
}
for (const bNodeTreeInterfaceSocket *interface_socket : nmd.node_group->interface_outputs()) {
const bNodeSocketType *typeinfo = interface_socket->socket_typeinfo();
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) : SOCK_CUSTOM;
if (nodes::socket_type_has_attribute_toggle(type)) {
return true;
}
}
return false;
}
static void draw_output_attributes_panel(const bContext *C,
uiLayout *layout,
const NodesModifierData &nmd,
PointerRNA *ptr)
{
bool has_output_attribute = false;
if (nmd.node_group != nullptr && nmd.settings.properties != nullptr) {
for (const bNodeTreeInterfaceSocket *socket : nmd.node_group->interface_outputs()) {
const bNodeSocketType *typeinfo = socket->socket_typeinfo();
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) :
SOCK_CUSTOM;
if (nodes::socket_type_has_attribute_toggle(type)) {
has_output_attribute = true;
draw_property_for_output_socket(*C, layout, nmd, ptr, *socket);
}
}
}
if (!has_output_attribute) {
uiItemL(layout, RPT_("No group output attributes connected"), ICON_INFO);
}
}
static void draw_internal_dependencies_panel(uiLayout *layout,
PointerRNA *ptr,
const NodesModifierData &nmd)
static void draw_bake_panel(uiLayout *layout, PointerRNA *modifier_ptr)
{
uiLayout *col = uiLayoutColumn(layout, false);
uiLayoutSetPropSep(col, true);
uiLayoutSetPropDecorate(col, false);
uiItemR(col, ptr, "bake_directory", UI_ITEM_NONE, IFACE_("Bake"), ICON_NONE);
uiItemR(col, modifier_ptr, "bake_directory", UI_ITEM_NONE, IFACE_("Bake Path"), ICON_NONE);
}
static void draw_named_attributes_panel(uiLayout *layout, NodesModifierData &nmd)
{
geo_log::GeoTreeLog *tree_log = get_root_tree_log(nmd);
if (tree_log == nullptr) {
return;
@ -2026,6 +2037,23 @@ static void draw_internal_dependencies_panel(uiLayout *layout,
}
}
static void draw_manage_panel(const bContext *C,
uiLayout *layout,
PointerRNA *modifier_ptr,
NodesModifierData &nmd)
{
if (uiLayout *panel_layout = uiLayoutPanel(
C, layout, IFACE_("Bake"), modifier_ptr, "open_bake_panel"))
{
draw_bake_panel(panel_layout, modifier_ptr);
}
if (uiLayout *panel_layout = uiLayoutPanel(
C, layout, IFACE_("Named Attributes"), modifier_ptr, "open_named_attributes_panel"))
{
draw_named_attributes_panel(panel_layout, nmd);
}
}
static void panel_draw(const bContext *C, Panel *panel)
{
uiLayout *layout = panel->layout;
@ -2069,15 +2097,17 @@ static void panel_draw(const bContext *C, Panel *panel)
modifier_panel_end(layout, ptr);
if (uiLayout *panel_layout = uiLayoutPanel(
C, layout, IFACE_("Output Attributes"), ptr, "open_output_attributes_panel"))
{
draw_output_attributes_panel(C, panel_layout, *nmd, ptr);
if (has_output_attribute(*nmd)) {
if (uiLayout *panel_layout = uiLayoutPanel(
C, layout, IFACE_("Output Attributes"), ptr, "open_output_attributes_panel"))
{
draw_output_attributes_panel(C, panel_layout, *nmd, ptr);
}
}
if (uiLayout *panel_layout = uiLayoutPanel(
C, layout, IFACE_("Internal Dependencies"), ptr, "open_internal_dependencies_panel"))
C, layout, IFACE_("Manage"), ptr, "open_manage_panel"))
{
draw_internal_dependencies_panel(panel_layout, ptr, *nmd);
draw_manage_panel(C, panel_layout, ptr, *nmd);
}
}