Geometry Nodes: reorganize panels in modifier #117170
|
@ -7332,7 +7332,9 @@ static void rna_def_modifier_nodes(BlenderRNA *brna)
|
||||||
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, nullptr);
|
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_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);
|
RNA_define_lib_overridable(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
static void draw_output_attributes_panel(const bContext *C,
|
||||||
uiLayout *layout,
|
uiLayout *layout,
|
||||||
const NodesModifierData &nmd,
|
const NodesModifierData &nmd,
|
||||||
PointerRNA *ptr)
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
bool has_output_attribute = false;
|
|
||||||
if (nmd.node_group != nullptr && nmd.settings.properties != nullptr) {
|
if (nmd.node_group != nullptr && nmd.settings.properties != nullptr) {
|
||||||
for (const bNodeTreeInterfaceSocket *socket : nmd.node_group->interface_outputs()) {
|
for (const bNodeTreeInterfaceSocket *socket : nmd.node_group->interface_outputs()) {
|
||||||
const bNodeSocketType *typeinfo = socket->socket_typeinfo();
|
const bNodeSocketType *typeinfo = socket->socket_typeinfo();
|
||||||
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) :
|
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) :
|
||||||
SOCK_CUSTOM;
|
SOCK_CUSTOM;
|
||||||
if (nodes::socket_type_has_attribute_toggle(type)) {
|
if (nodes::socket_type_has_attribute_toggle(type)) {
|
||||||
has_output_attribute = true;
|
|
||||||
draw_property_for_output_socket(*C, layout, nmd, ptr, *socket);
|
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,
|
static void draw_bake_panel(uiLayout *layout, PointerRNA *modifier_ptr)
|
||||||
PointerRNA *ptr,
|
|
||||||
const NodesModifierData &nmd)
|
|
||||||
{
|
{
|
||||||
uiLayout *col = uiLayoutColumn(layout, false);
|
uiLayout *col = uiLayoutColumn(layout, false);
|
||||||
uiLayoutSetPropSep(col, true);
|
uiLayoutSetPropSep(col, true);
|
||||||
uiLayoutSetPropDecorate(col, false);
|
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);
|
geo_log::GeoTreeLog *tree_log = get_root_tree_log(nmd);
|
||||||
if (tree_log == nullptr) {
|
if (tree_log == nullptr) {
|
||||||
return;
|
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)
|
static void panel_draw(const bContext *C, Panel *panel)
|
||||||
{
|
{
|
||||||
uiLayout *layout = panel->layout;
|
uiLayout *layout = panel->layout;
|
||||||
|
@ -2069,15 +2097,17 @@ static void panel_draw(const bContext *C, Panel *panel)
|
||||||
|
|
||||||
modifier_panel_end(layout, ptr);
|
modifier_panel_end(layout, ptr);
|
||||||
|
|
||||||
if (uiLayout *panel_layout = uiLayoutPanel(
|
if (has_output_attribute(*nmd)) {
|
||||||
C, layout, IFACE_("Output Attributes"), ptr, "open_output_attributes_panel"))
|
if (uiLayout *panel_layout = uiLayoutPanel(
|
||||||
{
|
C, layout, IFACE_("Output Attributes"), ptr, "open_output_attributes_panel"))
|
||||||
draw_output_attributes_panel(C, panel_layout, *nmd, ptr);
|
{
|
||||||
|
draw_output_attributes_panel(C, panel_layout, *nmd, ptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (uiLayout *panel_layout = uiLayoutPanel(
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue