Migrate to Tree::set_custom_draw_callback

Due to upstream change:

	a32a2eaedc
This commit is contained in:
Wilson E. Alvarez 2024-02-18 18:36:36 -05:00
parent 5e5f849208
commit 127696e5ac
No known key found for this signature in database
GPG Key ID: A32174A3D2ED3F9E
4 changed files with 8 additions and 18 deletions

View File

@ -127,16 +127,16 @@ void BehaviorTreeView::_update_tree(const Ref<BehaviorTreeData> &p_data) {
if (status_changed) {
item->set_metadata(1, current_status);
if (current_status == BTTask::SUCCESS) {
item->set_custom_draw(0, this, LW_NAME(_draw_success_status));
item->set_custom_draw_callback(0, callable_mp(this, &BehaviorTreeView::_draw_success_status));
item->set_icon(1, theme_cache.icon_success);
} else if (current_status == BTTask::FAILURE) {
item->set_custom_draw(0, this, LW_NAME(_draw_failure_status));
item->set_custom_draw_callback(0, callable_mp(this, &BehaviorTreeView::_draw_failure_status));
item->set_icon(1, theme_cache.icon_failure);
} else if (current_status == BTTask::RUNNING) {
item->set_custom_draw(0, this, LW_NAME(_draw_running_status));
item->set_custom_draw_callback(0, callable_mp(this, &BehaviorTreeView::_draw_running_status));
item->set_icon(1, theme_cache.icon_running);
} else {
item->set_custom_draw(0, this, LW_NAME(_draw_fresh));
item->set_custom_draw_callback(0, callable_mp(this, &BehaviorTreeView::_draw_fresh));
item->set_icon(1, nullptr);
}
}
@ -204,13 +204,13 @@ void BehaviorTreeView::_update_tree(const Ref<BehaviorTreeData> &p_data) {
item->set_icon_max_width(0, 16 * _get_editor_scale()); // Force user icon size.
if (task_data.status == BTTask::SUCCESS) {
item->set_custom_draw(0, this, LW_NAME(_draw_success_status));
item->set_custom_draw_callback(0, callable_mp(this, &BehaviorTreeView::_draw_success_status));
item->set_icon(1, theme_cache.icon_success);
} else if (task_data.status == BTTask::FAILURE) {
item->set_custom_draw(0, this, LW_NAME(_draw_failure_status));
item->set_custom_draw_callback(0, callable_mp(this, &BehaviorTreeView::_draw_failure_status));
item->set_icon(1, theme_cache.icon_failure);
} else if (task_data.status == BTTask::RUNNING) {
item->set_custom_draw(0, this, LW_NAME(_draw_running_status));
item->set_custom_draw_callback(0, callable_mp(this, &BehaviorTreeView::_draw_running_status));
item->set_icon(1, theme_cache.icon_running);
}

View File

@ -50,7 +50,7 @@ void TaskTree::_update_item(TreeItem *p_item) {
if (p_item->get_parent()) {
Ref<BTProbabilitySelector> sel = p_item->get_parent()->get_metadata(0);
if (sel.is_valid() && sel->has_probability(p_item->get_index())) {
p_item->set_custom_draw(0, this, LW_NAME(_draw_probability));
p_item->set_custom_draw_callback(0, callable_mp(this, &TaskTree::_draw_probability));
p_item->set_cell_mode(0, TreeItem::CELL_MODE_CUSTOM);
}
}

View File

@ -27,11 +27,6 @@
LimboStringNames *LimboStringNames::singleton = nullptr;
LimboStringNames::LimboStringNames() {
_draw_failure_status = SN("_draw_failure_status");
_draw_fresh = SN("_draw_fresh");
_draw_probability = SN("_draw_probability");
_draw_running_status = SN("_draw_running_status");
_draw_success_status = SN("_draw_success_status");
_enter = SN("_enter");
_exit = SN("_exit");
_generate_name = SN("_generate_name");

View File

@ -41,11 +41,6 @@ class LimboStringNames {
public:
_FORCE_INLINE_ static LimboStringNames *get_singleton() { return singleton; }
StringName _draw_failure_status;
StringName _draw_fresh;
StringName _draw_probability;
StringName _draw_running_status;
StringName _draw_success_status;
StringName _enter;
StringName _exit;
StringName _generate_name;