Editor Tab
Object-Collab comes with 2 ways of registering objects. Using the vanilla tabs and alternatively custom tabs using EditorTab API.
Vanilla Tabs
Vanilla tabs work based on the numeric tab ID Geometry Dash uses. Object-Collab provides the EditorTab enum to simplify the process of registering your objects under a specific tab.
⚠️ Custom tabs take precedence over regular tabs.
#include <smjs.object-collab/include/object_collab.hpp>
using namespace object_collab::prelude;
$on_mod(Loaded) {
ObjectAPI::registerObject(ObjectInfo::builder()
.id("id"_spr)
.sprite("object"_spr)
// Puts the object in the first tab.
.editorTab(EditorTab::Solids)
// Puts the object after the basic square object.
.afterEditorTabMenuItem("square_01_001.png")
.build());
}
Custom Tabs
As stated earlier. You can register your own custom tabs by using the EditorTab API integration Object-Collab provides. After registration all the loading and linking will be handled by Object-Collab internally.
ℹ️ Most of the callback documentation & API are based on that of EditorTab API
#include <smjs.object-collab/include/object_collab.hpp>
using namespace geode::prelude;
using namespace object_collab::prelude;
$on_mod(Loaded) {
// Order of execution doesn't matter. The tab info will only be used once the editor is opened.
EditorTabAPI::registerTab(TabInfo::builder()
// Registers the tab as "tab"_spr.
.id("tab"_spr)
// This is by default a nullptr, when not filled it will automatically resolve.
.createTabIcon([] {
return CCSprite::createWithSpriteFrameName("some_sprite"_spr);
})
// Executes when the tab is entered or exited.
.toggleTab([](bool state, CCNode* tab) {
// ...
})
// Executes when the tab is reloaded.
.reloadTab([](int rows, int cols, CCNode* tab) {
// ...
})
.build());
ObjectAPI::registerObject(ObjectInfo::builder()
.id("id"_spr)
.sprite("other_object"_spr)
// Puts the object in the custom tab with the ID "tab"_spr.
.customEditorTab("tab"_spr)
// Puts the object after an object with "object.png"_spr as sprite.
.afterEditorTabMenuItem("object.png"_spr)
.build());
}