Solved Create custom menu category for nodes?

Is it possible to create a custom menu category for nodes or should we use the ones that already exist?
I could not find any way or example of how I can achieve this.

Thank you.



Categories are also assets. You can use the CategoryAssetInterface to create a category asset.
and you can "parent" this category to another category using SetAssetCategory.

maxon::Result<maxon::AssetDescription> CreateCategoryAsset(
  const maxon::AssetRepositoryRef& repository, const maxon::String& name, 
  const maxon::Id& category)

  if (name.IsEmpty())
    return maxon::IllegalArgumentError(MAXON_SOURCE_LOCATION, "Invalid category name."_s);

  // Create and store a new category asset.
  maxon::CategoryAsset categoryAsset = maxon::CategoryAssetInterface::Create() iferr_return;
  maxon::Id	categoryId = maxon::AssetInterface::MakeUuid("category", false) iferr_return;
  maxon::AssetDescription assetDescription = repository.StoreAsset(
    categoryId, categoryAsset) iferr_return;

  // Set the category name.
  maxon::LanguageRef language = maxon::Resource::GetCurrentLanguage();
  assetDescription.StoreMetaString(maxon::OBJECT::BASE::NAME, name, language) iferr_return;

  // Set the category of the asset when the category is not the empty id.
  if (!category.IsEmpty())
    maxon::CategoryAssetInterface::SetAssetCategory(assetDescription, category) iferr_return;

  ApplicationOutput("Created category asset with the id: '@'", assetDescription.GetId());

  return assetDescription;


MAXON SDK Specialist

MAXON Registered Developer