Skip to content

Commit

Permalink
EditButtonBar ids
Browse files Browse the repository at this point in the history
  • Loading branch information
HJfod committed May 22, 2024
1 parent f26592d commit bf650c8
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Node IDs Changelog

## v1.11.0
* Add IDs for all the EditButtonBars in EditorUI as well as for the edit buttons (move, rotate, etc.)

## v1.10.1
* Temporarily remove LevelListLayer IDs as there were no layouts which will need to be added due to API breaks

Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"mac": "2.200",
"ios": "2.205"
},
"version": "v1.10.2",
"version": "v1.11.0",
"id": "geode.node-ids",
"name": "Node IDs",
"developer": "Geode Team",
Expand Down
66 changes: 66 additions & 0 deletions src/EditorUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,75 @@ using namespace geode::node_ids;
deleteFilterMenu->updateLayout();
}

auto buttonBarIDs = {
"block-tab-bar",
"outline-tab-bar",
"slope-tab-bar",
"hazard-tab-bar",
"3d-tab-bar",
"portal-tab-bar",
"monster-tab-bar",
"pixel-tab-bar",
"collectible-tab-bar",
"icon-tab-bar",
"deco-tab-bar",
"sawblade-tab-bar",
"trigger-tab-bar",
"custom-tab-bar",
"edit-tab-bar",
};

size_t buttonBarIndex = 0;
for (auto id : buttonBarIDs) {
if (auto bar = getChildOfType<EditButtonBar>(this, buttonBarIndex++)) {
bar->setID(id);
}
}

if (auto editBar = static_cast<EditButtonBar*>(this->getChildByID("edit-tab-bar"))) {
auto editButtonIDs = {
"move-up-small-button",
"move-down-small-button",
"move-left-small-button",
"move-right-small-button",
"move-up-button",
"move-down-button",
"move-left-button",
"move-right-button",
"move-up-big-button",
"move-down-big-button",
"move-left-big-button",
"move-right-big-button",
"move-up-tiny-button",
"move-down-tiny-button",
"move-left-tiny-button",
"move-right-tiny-button",
"move-up-half-button",
"move-down-half-button",
"move-left-half-button",
"move-right-half-button",
"flip-x-button",
"flip-y-button",
"rotate-cw-button",
"rotate-ccw-button",
"rotate-cw-45-button",
"rotate-ccw-45-button",
"rotate-free-button",
"rotate-snap-button",
"scale-button",
"scale-xy-button",
"warp-button",
};
size_t i = 0;
for (auto id : editButtonIDs) {
static_cast<CCNode*>(editBar->m_buttonArray->objectAtIndex(i++))->setID(id);
}
}

if (auto menu = getChildOfType<CCMenu>(this, 2)) {
menu->setID("build-tabs-menu");

// todo: maybe form these from buttonBarIDs to avoid duplication?
setIDs(
menu,
0,
Expand Down

0 comments on commit bf650c8

Please sign in to comment.