Fix #113619: Incorrect nested group assets in compositor add menu
The menu structure currently needs to be duplicated in the code to avoid
adding assets to more than one menu. This was done for geometry nodes
in b49c84276c but was missed for the compositor and shader
nodes. Also remove an unnecessary separator.
This commit is contained in:
@@ -45,7 +45,7 @@ class NODE_MT_category_compositor_input_constant(Menu):
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeRGB")
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeValue")
|
||||
|
||||
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
||||
node_add_menu.draw_assets_for_catalog(layout, "Input/Constant")
|
||||
|
||||
|
||||
class NODE_MT_category_compositor_input_scene(Menu):
|
||||
@@ -58,7 +58,7 @@ class NODE_MT_category_compositor_input_scene(Menu):
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeSceneTime")
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeTime")
|
||||
|
||||
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
||||
node_add_menu.draw_assets_for_catalog(layout, "Input/Scene")
|
||||
|
||||
|
||||
class NODE_MT_category_compositor_output(Menu):
|
||||
@@ -120,7 +120,7 @@ class NODE_MT_category_compositor_color_adjust(Menu):
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeCurveRGB")
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeTonemap")
|
||||
|
||||
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
||||
node_add_menu.draw_assets_for_catalog(layout, "Color/Adjust")
|
||||
|
||||
|
||||
class NODE_MT_category_compositor_color_mix(Menu):
|
||||
@@ -138,7 +138,7 @@ class NODE_MT_category_compositor_color_mix(Menu):
|
||||
layout, "CompositorNodeMixRGB",
|
||||
label=iface_("Mix Color"))
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeZcombine")
|
||||
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
||||
node_add_menu.draw_assets_for_catalog(layout, "Color/Mix")
|
||||
|
||||
|
||||
class NODE_MT_category_compositor_filter(Menu):
|
||||
@@ -179,7 +179,7 @@ class NODE_MT_category_compositor_filter_blur(Menu):
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeDBlur")
|
||||
node_add_menu.add_node_type(layout, "CompositorNodeVecBlur")
|
||||
|
||||
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
|
||||
node_add_menu.draw_assets_for_catalog(layout, "Filter/Blur")
|
||||
|
||||
|
||||
class NODE_MT_category_compositor_group(Menu):
|
||||
|
||||
@@ -64,51 +64,83 @@ static asset::AssetItemTree build_catalog_tree(const bContext &C, const bNodeTre
|
||||
* removing the need to define the add menu completely, instead using a per-node-type path which
|
||||
* can be merged with catalog tree.
|
||||
*/
|
||||
static const Set<StringRef> get_builtin_menus()
|
||||
static Set<StringRef> get_builtin_menus(const int tree_type)
|
||||
{
|
||||
Set<StringRef> menus;
|
||||
menus.add_multiple_new({"Attribute",
|
||||
"Input",
|
||||
"Input/Constant",
|
||||
"Input/Group",
|
||||
"Input/Scene",
|
||||
"Output",
|
||||
"Geometry",
|
||||
"Geometry/Read",
|
||||
"Geometry/Sample",
|
||||
"Geometry/Write",
|
||||
"Geometry/Operations",
|
||||
"Curve",
|
||||
"Curve/Read",
|
||||
"Curve/Sample",
|
||||
"Curve/Write",
|
||||
"Curve/Operations",
|
||||
"Curve/Primitives",
|
||||
"Curve/Topology",
|
||||
"Mesh",
|
||||
"Mesh/Read",
|
||||
"Mesh/Sample",
|
||||
"Mesh/Write",
|
||||
"Mesh/Operations",
|
||||
"Mesh/Primitives",
|
||||
"Mesh/Topology",
|
||||
"Mesh/UV",
|
||||
"Point",
|
||||
"Volume",
|
||||
"Simulation",
|
||||
"Material",
|
||||
"Texture",
|
||||
"Utilities",
|
||||
"Utilities/Color",
|
||||
"Utilities/Text",
|
||||
"Utilities/Vector",
|
||||
"Utilities/Field",
|
||||
"Utilities/Math",
|
||||
"Utilities/Rotation",
|
||||
"Group",
|
||||
"Layout",
|
||||
"Unassigned"});
|
||||
return menus;
|
||||
switch (tree_type) {
|
||||
case NTREE_GEOMETRY:
|
||||
return {"Attribute",
|
||||
"Input",
|
||||
"Input/Constant",
|
||||
"Input/Group",
|
||||
"Input/Scene",
|
||||
"Output",
|
||||
"Geometry",
|
||||
"Geometry/Read",
|
||||
"Geometry/Sample",
|
||||
"Geometry/Write",
|
||||
"Geometry/Operations",
|
||||
"Curve",
|
||||
"Curve/Read",
|
||||
"Curve/Sample",
|
||||
"Curve/Write",
|
||||
"Curve/Operations",
|
||||
"Curve/Primitives",
|
||||
"Curve/Topology",
|
||||
"Mesh",
|
||||
"Mesh/Read",
|
||||
"Mesh/Sample",
|
||||
"Mesh/Write",
|
||||
"Mesh/Operations",
|
||||
"Mesh/Primitives",
|
||||
"Mesh/Topology",
|
||||
"Mesh/UV",
|
||||
"Point",
|
||||
"Volume",
|
||||
"Simulation",
|
||||
"Material",
|
||||
"Texture",
|
||||
"Utilities",
|
||||
"Utilities/Color",
|
||||
"Utilities/Text",
|
||||
"Utilities/Vector",
|
||||
"Utilities/Field",
|
||||
"Utilities/Math",
|
||||
"Utilities/Rotation",
|
||||
"Group",
|
||||
"Layout",
|
||||
"Unassigned"};
|
||||
case NTREE_COMPOSIT:
|
||||
return {"Input",
|
||||
"Input/Constant",
|
||||
"Input/Scene",
|
||||
"Output",
|
||||
"Color",
|
||||
"Color/Adjust",
|
||||
"Color/Mix",
|
||||
"Filter",
|
||||
"Filter/Blur",
|
||||
"Keying",
|
||||
"Mask",
|
||||
"Tracking",
|
||||
"Transform",
|
||||
"Utilities",
|
||||
"Vector",
|
||||
"Group",
|
||||
"Layout"};
|
||||
case NTREE_SHADER:
|
||||
return {"Input",
|
||||
"Output",
|
||||
"Color",
|
||||
"Converter",
|
||||
"Shader",
|
||||
"Texture",
|
||||
"Vector",
|
||||
"Script",
|
||||
"Group",
|
||||
"Layout"};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
static void node_add_catalog_assets_draw(const bContext *C, Menu *menu)
|
||||
@@ -167,7 +199,7 @@ static void node_add_catalog_assets_draw(const bContext *C, Menu *menu)
|
||||
return;
|
||||
}
|
||||
|
||||
const Set<StringRef> all_builtin_menus = get_builtin_menus();
|
||||
const Set<StringRef> all_builtin_menus = get_builtin_menus(edit_tree->type);
|
||||
|
||||
catalog_item->foreach_child([&](asset_system::AssetCatalogTreeItem &item) {
|
||||
if (all_builtin_menus.contains_as(item.catalog_path().str())) {
|
||||
@@ -235,7 +267,7 @@ static void add_root_catalogs_draw(const bContext *C, Menu *menu)
|
||||
uiItemL(layout, IFACE_("Loading Asset Libraries"), ICON_INFO);
|
||||
}
|
||||
|
||||
const Set<StringRef> all_builtin_menus = get_builtin_menus();
|
||||
const Set<StringRef> all_builtin_menus = get_builtin_menus(edit_tree->type);
|
||||
|
||||
asset_system::AssetLibrary *all_library = ED_assetlist_library_get_once_available(
|
||||
asset_system::all_library_reference());
|
||||
@@ -314,7 +346,6 @@ void ui_template_node_asset_menu_items(uiLayout &layout,
|
||||
if (path_ptr.data == nullptr) {
|
||||
return;
|
||||
}
|
||||
uiItemS(&layout);
|
||||
uiLayout *col = uiLayoutColumn(&layout, false);
|
||||
uiLayoutSetContextPointer(col, "asset_catalog_path", &path_ptr);
|
||||
uiItemMContents(col, "NODE_MT_node_add_catalog_assets");
|
||||
|
||||
Reference in New Issue
Block a user