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 9410031d45
commit 8f294ac5ea
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) { if (status_changed) {
item->set_metadata(1, current_status); item->set_metadata(1, current_status);
if (current_status == BTTask::SUCCESS) { 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); item->set_icon(1, theme_cache.icon_success);
} else if (current_status == BTTask::FAILURE) { } 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); item->set_icon(1, theme_cache.icon_failure);
} else if (current_status == BTTask::RUNNING) { } 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); item->set_icon(1, theme_cache.icon_running);
} else { } 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); 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. item->set_icon_max_width(0, 16 * _get_editor_scale()); // Force user icon size.
if (task_data.status == BTTask::SUCCESS) { 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); item->set_icon(1, theme_cache.icon_success);
} else if (task_data.status == BTTask::FAILURE) { } 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); item->set_icon(1, theme_cache.icon_failure);
} else if (task_data.status == BTTask::RUNNING) { } 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); 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()) { if (p_item->get_parent()) {
Ref<BTProbabilitySelector> sel = p_item->get_parent()->get_metadata(0); Ref<BTProbabilitySelector> sel = p_item->get_parent()->get_metadata(0);
if (sel.is_valid() && sel->has_probability(p_item->get_index())) { 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); p_item->set_cell_mode(0, TreeItem::CELL_MODE_CUSTOM);
} }
} }

View File

@ -27,11 +27,6 @@
LimboStringNames *LimboStringNames::singleton = nullptr; LimboStringNames *LimboStringNames::singleton = nullptr;
LimboStringNames::LimboStringNames() { 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"); _enter = SN("_enter");
_exit = SN("_exit"); _exit = SN("_exit");
_generate_name = SN("_generate_name"); _generate_name = SN("_generate_name");

View File

@ -43,11 +43,6 @@ class LimboStringNames {
public: public:
_FORCE_INLINE_ static LimboStringNames *get_singleton() { return singleton; } _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 _enter;
StringName _exit; StringName _exit;
StringName _generate_name; StringName _generate_name;