Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Godot 4.4 #223

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion blackboard/bb_param/bb_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

Variant BBNode::get_value(Node *p_scene_root, const Ref<Blackboard> &p_blackboard, const Variant &p_default) {
ERR_FAIL_NULL_V_MSG(p_scene_root, Variant(), "BBNode: get_value() failed - scene_root is null.");
ERR_FAIL_NULL_V_MSG(p_blackboard, Variant(), "BBNode: get_value() failed - blackboard is null.");
ERR_FAIL_COND_V_MSG(p_blackboard.is_null(), Variant(), "BBNode: get_value() failed - blackboard is null.");

Variant val;
if (get_value_source() == SAVED_VALUE) {
Expand Down
2 changes: 1 addition & 1 deletion blackboard/blackboard_plan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ void BlackboardPlan::populate_blackboard(const Ref<Blackboard> &p_blackboard, bo
if (has_mapping) {
StringName target_var = parent_scope_mapping[p.first];
if (target_var != StringName()) {
ERR_CONTINUE_MSG(p_blackboard->get_parent() == nullptr, vformat("BlackboardPlan: Cannot link variable %s to parent scope because the parent scope is not set.", LimboUtility::get_singleton()->decorate_var(p.first)));
ERR_CONTINUE_MSG(p_blackboard->get_parent().is_null(), vformat("BlackboardPlan: Cannot link variable %s to parent scope because the parent scope is not set.", LimboUtility::get_singleton()->decorate_var(p.first)));
p_blackboard->link_var(p.first, p_blackboard->get_parent(), target_var);
}
} else if (is_bound) {
Expand Down
4 changes: 2 additions & 2 deletions bt/behavior_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ void BehaviorTree::copy_other(const Ref<BehaviorTree> &p_other) {
}

Ref<BTInstance> BehaviorTree::instantiate(Node *p_agent, const Ref<Blackboard> &p_blackboard, Node *p_instance_owner, Node *p_custom_scene_root) const {
ERR_FAIL_COND_V_MSG(root_task == nullptr, nullptr, "BehaviorTree: Instantiation failed - BT has no valid root task.");
ERR_FAIL_COND_V_MSG(root_task.is_null(), nullptr, "BehaviorTree: Instantiation failed - BT has no valid root task.");
ERR_FAIL_NULL_V_MSG(p_agent, nullptr, "BehaviorTree: Instantiation failed - agent can't be null.");
ERR_FAIL_NULL_V_MSG(p_instance_owner, nullptr, "BehaviorTree: Instantiation failed -- instance owner can't be null.");
ERR_FAIL_NULL_V_MSG(p_blackboard, nullptr, "BehaviorTree: Instantiation failed - blackboard can't be null.");
ERR_FAIL_COND_V_MSG(p_blackboard.is_null(), nullptr, "BehaviorTree: Instantiation failed - blackboard can't be null.");
Node *scene_root = p_custom_scene_root ? p_custom_scene_root : p_instance_owner->get_owner();
ERR_FAIL_NULL_V_MSG(scene_root, nullptr, "BehaviorTree: Instantiation failed - unable to establish scene root. This is likely due to the instance owner not being owned by a scene node and custom_scene_root being null.");
Ref<BTTask> root_copy = root_task->clone();
Expand Down
4 changes: 2 additions & 2 deletions bt/bt_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#endif

Ref<BTInstance> BTInstance::create(Ref<BTTask> p_root_task, String p_source_bt_path, Node *p_owner_node) {
ERR_FAIL_NULL_V(p_root_task, nullptr);
ERR_FAIL_COND_V(p_root_task.is_null(), nullptr);
ERR_FAIL_NULL_V(p_owner_node, nullptr);
Ref<BTInstance> inst;
inst.instantiate();
Expand Down Expand Up @@ -103,7 +103,7 @@ double BTInstance::_get_mean_update_time_msec_and_reset() {

void BTInstance::_add_custom_monitor() {
ERR_FAIL_NULL(get_owner_node());
ERR_FAIL_NULL(root_task);
ERR_FAIL_COND(root_task.is_null());
ERR_FAIL_NULL(root_task->get_agent());

if (monitor_id == StringName()) {
Expand Down
2 changes: 1 addition & 1 deletion bt/bt_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void BTState::_update(double p_delta) {
// Bail out if a transition happened in the meantime.
return;
}
ERR_FAIL_NULL(bt_instance);
ERR_FAIL_COND(bt_instance.is_null());
BT::Status status = bt_instance->update(p_delta);
if (status == BTTask::SUCCESS) {
get_root()->dispatch(success_event, Variant());
Expand Down
2 changes: 1 addition & 1 deletion bt/tasks/bt_comment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PackedStringArray BTComment::get_configuration_warnings() {
if (get_child_count_excluding_comments() > 0) {
warnings.append("Can only have other comment tasks as children.");
}
if (get_parent() == nullptr) {
if (get_parent().is_null()) {
warnings.append("Can't be the root task.");
}
return warnings;
Expand Down
2 changes: 1 addition & 1 deletion bt/tasks/bt_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void BTTask::set_custom_name(const String &p_name) {

void BTTask::initialize(Node *p_agent, const Ref<Blackboard> &p_blackboard, Node *p_scene_root) {
ERR_FAIL_NULL(p_agent);
ERR_FAIL_NULL(p_blackboard);
ERR_FAIL_COND(p_blackboard.is_null());
ERR_FAIL_NULL(p_scene_root);
data.agent = p_agent;
data.blackboard = p_blackboard;
Expand Down
2 changes: 1 addition & 1 deletion bt/tasks/decorators/bt_cooldown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void BTCooldown::_chill() {
timer->set_time_left(duration);
} else {
timer = SCENE_TREE()->create_timer(duration, process_pause);
ERR_FAIL_NULL(timer);
ERR_FAIL_COND(timer.is_null());
timer->connect(LW_NAME(timeout), callable_mp(this, &BTCooldown::_on_timeout), CONNECT_ONE_SHOT);
}
}
Expand Down
6 changes: 3 additions & 3 deletions bt/tasks/decorators/bt_new_scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ void BTNewScope::set_blackboard_plan(const Ref<BlackboardPlan> &p_plan) {

#ifdef TOOLS_ENABLED
void BTNewScope::_set_parent_scope_plan_from_bt() {
ERR_FAIL_NULL(get_blackboard_plan());
ERR_FAIL_COND(get_blackboard_plan().is_null());
Ref<BehaviorTree> bt = get_root()->editor_get_behavior_tree();
ERR_FAIL_NULL(bt);
ERR_FAIL_COND(bt.is_null());
get_blackboard_plan()->set_parent_scope_plan_provider(Callable(bt.ptr(), "get_blackboard_plan"));
}
#endif // TOOLS_ENABLED

void BTNewScope::initialize(Node *p_agent, const Ref<Blackboard> &p_blackboard, Node *p_scene_root) {
ERR_FAIL_COND(p_agent == nullptr);
ERR_FAIL_COND(p_blackboard == nullptr);
ERR_FAIL_COND(p_blackboard.is_null());

Ref<Blackboard> bb;
if (blackboard_plan.is_valid()) {
Expand Down
32 changes: 16 additions & 16 deletions editor/blackboard_plan_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ LineEdit *BlackboardPlanEditor::_get_name_edit(int p_row_index) const {
}

void BlackboardPlanEditor::_add_var() {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());

int suffix = 1;
StringName var_name = default_var_name == StringName() ? "var" : default_var_name;
Expand All @@ -65,14 +65,14 @@ void BlackboardPlanEditor::_add_var() {
}

void BlackboardPlanEditor::_trash_var(int p_index) {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
StringName var_name = plan->get_var_by_index(p_index).first;
plan->remove_var(var_name);
_refresh();
}

void BlackboardPlanEditor::_rename_var(const StringName &p_new_name, int p_index) {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());

LineEdit *name_edit = _get_name_edit(p_index);
ERR_FAIL_NULL(name_edit);
Expand All @@ -96,7 +96,7 @@ void BlackboardPlanEditor::_rename_var(const StringName &p_new_name, int p_index
}

void BlackboardPlanEditor::_change_var_type(Variant::Type p_new_type, int p_index) {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());

BBVariable var = plan->get_var_by_index(p_index).second;
if (var.get_type() == p_new_type) {
Expand All @@ -115,14 +115,14 @@ void BlackboardPlanEditor::_change_var_type(Variant::Type p_new_type, int p_inde
}

void BlackboardPlanEditor::_change_var_hint(PropertyHint p_new_hint, int p_index) {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
plan->get_var_by_index(p_index).second.set_hint(p_new_hint);
plan->notify_property_list_changed();
_refresh();
}

void BlackboardPlanEditor::_change_var_hint_string(const String &p_new_hint_string, int p_index) {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
plan->get_var_by_index(p_index).second.set_hint_string(p_new_hint_string);
plan->notify_property_list_changed();
}
Expand Down Expand Up @@ -278,7 +278,7 @@ void BlackboardPlanEditor::_refresh() {
Button *drag_button = memnew(Button);
props_hbox->add_child(drag_button);
drag_button->set_custom_minimum_size(Size2(28.0, 28.0) * EDSCALE);
BUTTON_SET_ICON(drag_button, theme_cache.grab_icon);
drag_button->set_button_icon(theme_cache.grab_icon);
drag_button->connect(LW_NAME(gui_input), callable_mp(this, &BlackboardPlanEditor::_drag_button_gui_input));
drag_button->connect(LW_NAME(button_down), callable_mp(this, &BlackboardPlanEditor::_drag_button_down).bind(row_panel));
drag_button->connect(LW_NAME(button_up), callable_mp(this, &BlackboardPlanEditor::_drag_button_up));
Expand All @@ -297,7 +297,7 @@ void BlackboardPlanEditor::_refresh() {
type_choice->set_custom_minimum_size(Size2(170, 0.0) * EDSCALE);
type_choice->set_text(Variant::get_type_name(var.get_type()));
type_choice->set_tooltip_text(Variant::get_type_name(var.get_type()));
BUTTON_SET_ICON(type_choice, get_theme_icon(Variant::get_type_name(var.get_type()), LW_NAME(EditorIcons)));
type_choice->set_button_icon(get_theme_icon(Variant::get_type_name(var.get_type()), LW_NAME(EditorIcons)));
type_choice->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS);
type_choice->set_flat(true);
type_choice->set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT);
Expand Down Expand Up @@ -326,7 +326,7 @@ void BlackboardPlanEditor::_refresh() {
Button *trash_button = memnew(Button);
props_hbox->add_child(trash_button);
trash_button->set_custom_minimum_size(Size2(24.0, 0.0) * EDSCALE);
BUTTON_SET_ICON(trash_button, theme_cache.trash_icon);
trash_button->set_button_icon(theme_cache.trash_icon);
trash_button->connect(LW_NAME(pressed), callable_mp(this, &BlackboardPlanEditor::_trash_var).bind(i));
}
}
Expand All @@ -337,7 +337,7 @@ void BlackboardPlanEditor::_notification(int p_what) {
theme_cache.trash_icon = get_theme_icon(LW_NAME(Remove), LW_NAME(EditorIcons));
theme_cache.grab_icon = get_theme_icon(LW_NAME(TripleBar), LW_NAME(EditorIcons));

BUTTON_SET_ICON(add_var_tool, get_theme_icon(LW_NAME(Add), LW_NAME(EditorIcons)));
add_var_tool->set_button_icon(get_theme_icon(LW_NAME(Add), LW_NAME(EditorIcons)));

type_menu->clear();
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
Expand Down Expand Up @@ -472,14 +472,14 @@ BlackboardPlanEditor::BlackboardPlanEditor() {
// ***** EditorInspectorPluginBBPlan *****

void EditorInspectorPluginBBPlan::_edit_plan(const Ref<BlackboardPlan> &p_plan) {
ERR_FAIL_NULL(p_plan);
ERR_FAIL_COND(p_plan.is_null());
plan_editor->edit_plan(p_plan);
plan_editor->popup_centered();
}

void EditorInspectorPluginBBPlan::_open_base_plan(const Ref<BlackboardPlan> &p_plan) {
ERR_FAIL_NULL(p_plan);
ERR_FAIL_NULL(p_plan->get_base_plan());
ERR_FAIL_COND(p_plan.is_null());
ERR_FAIL_COND(p_plan->get_base_plan().is_null());
EditorInterface::get_singleton()->call_deferred("edit_resource", p_plan->get_base_plan());
}

Expand All @@ -501,7 +501,7 @@ void EditorInspectorPluginBBPlan::parse_begin(Object *p_object) {
void EditorInspectorPluginBBPlan::_parse_begin(Object *p_object) {
#endif
Ref<BlackboardPlan> plan = Object::cast_to<BlackboardPlan>(p_object);
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());

PanelContainer *panel = memnew(PanelContainer);
ADD_STYLEBOX_OVERRIDE(panel, LW_NAME(panel), toolbar_style);
Expand All @@ -522,15 +522,15 @@ void EditorInspectorPluginBBPlan::_parse_begin(Object *p_object) {
goto_btn->set_text(TTR("Edit Base"));
goto_btn->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
goto_btn->set_custom_minimum_size(Size2(150.0, 0.0) * EDSCALE);
BUTTON_SET_ICON(goto_btn, EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(Edit), LW_NAME(EditorIcons)));
goto_btn->set_button_icon(EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(Edit), LW_NAME(EditorIcons)));
goto_btn->connect(LW_NAME(pressed), callable_mp(this, &EditorInspectorPluginBBPlan::_open_base_plan).bind(plan));
} else {
Button *edit_btn = memnew(Button);
toolbar->add_child(edit_btn);
edit_btn->set_text(TTR("Manage..."));
edit_btn->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
edit_btn->set_custom_minimum_size(Size2(150.0, 0.0) * EDSCALE);
BUTTON_SET_ICON(edit_btn, EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(EditAddRemove), LW_NAME(EditorIcons)));
edit_btn->set_button_icon(EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(EditAddRemove), LW_NAME(EditorIcons)));
edit_btn->connect(LW_NAME(pressed), callable_mp(this, &EditorInspectorPluginBBPlan::_edit_plan).bind(plan));
}

Expand Down
2 changes: 1 addition & 1 deletion editor/debugger/limbo_debugger_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void LimboDebuggerTab::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
alert_icon->set_texture(get_theme_icon(LW_NAME(StatusWarning), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(resource_header, LimboUtility::get_singleton()->get_task_icon("BehaviorTree"));
resource_header->set_button_icon(LimboUtility::get_singleton()->get_task_icon("BehaviorTree"));
} break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions editor/editor_property_bb_param.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,14 @@ void EditorPropertyBBParam::update_property() {
variable_editor->update_property();
variable_editor->show();
bottom_container->hide();
type_choice->set_icon(get_editor_theme_icon(SNAME("LimboExtraVariable")));
type_choice->set_button_icon(get_editor_theme_icon(SNAME("LimboExtraVariable")));
} else {
_create_value_editor(param->get_type());
variable_editor->hide();
value_editor->show();
value_editor->set_object_and_property(param.ptr(), SNAME("saved_value"));
value_editor->update_property();
type_choice->set_icon(get_editor_theme_icon(Variant::get_type_name(param->get_type())));
type_choice->set_button_icon(get_editor_theme_icon(Variant::get_type_name(param->get_type())));
}
}

Expand All @@ -316,7 +316,7 @@ void EditorPropertyBBParam::_notification(int p_what) {

{
String type = Variant::get_type_name(_get_edited_param()->get_type());
type_choice->set_icon(get_editor_theme_icon(type));
type_choice->set_button_icon(get_editor_theme_icon(type));
}

// Initialize type choice.
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_property_property_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void EditorPropertyPropertyPath::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
BUTTON_SET_ICON(action_menu, get_theme_icon(LW_NAME(GuiTabMenuHl), LW_NAME(EditorIcons)));
action_menu->set_button_icon(get_theme_icon(LW_NAME(GuiTabMenuHl), LW_NAME(EditorIcons)));
action_menu->get_popup()->set_item_icon(ACTION_CLEAR, get_theme_icon(LW_NAME(Clear), LW_NAME(EditorIcons)));
action_menu->get_popup()->set_item_icon(ACTION_COPY, get_theme_icon(LW_NAME(ActionCopy), LW_NAME(EditorIcons)));
action_menu->get_popup()->set_item_icon(ACTION_EDIT, get_theme_icon(LW_NAME(Edit), LW_NAME(EditorIcons)));
Expand Down
26 changes: 13 additions & 13 deletions editor/editor_property_variable_name.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int EditorPropertyVariableName::last_caret_column = 0;
//***** EditorPropertyVariableName

void EditorPropertyVariableName::_show_variables_popup() {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());

variables_popup->clear();
variables_popup->reset_size();
Expand Down Expand Up @@ -86,30 +86,30 @@ void EditorPropertyVariableName::_update_status() {
}
String var_name = name_edit->get_text();
if (var_name.is_empty() && allow_empty) {
BUTTON_SET_ICON(status_btn, theme_cache.var_empty_icon);
status_btn->set_button_icon(theme_cache.var_empty_icon);
status_btn->set_tooltip_text(TTR("Variable name not specified.\nClick to open the blackboard plan."));
} else if (plan->has_var(var_name)) {
if (expected_type == Variant::NIL || plan->get_var(var_name).get_type() == Variant::NIL || plan->get_var(var_name).get_type() == expected_type) {
BUTTON_SET_ICON(status_btn, theme_cache.var_exists_icon);
status_btn->set_button_icon(theme_cache.var_exists_icon);
status_btn->set_tooltip_text(TTR("This variable is present in the blackboard plan.\nClick to open the blackboard plan."));
} else {
BUTTON_SET_ICON(status_btn, theme_cache.var_error_icon);
status_btn->set_button_icon(theme_cache.var_error_icon);
status_btn->set_tooltip_text(TTR(vformat(
"The %s variable in the blackboard plan should be of type %s.\nClick to open the blackboard plan.",
LimboUtility::get_singleton()->decorate_var(var_name),
Variant::get_type_name(expected_type))));
}
} else if (name_edit->get_text().begins_with("_")) {
BUTTON_SET_ICON(status_btn, theme_cache.var_private_icon);
status_btn->set_button_icon(theme_cache.var_private_icon);
status_btn->set_tooltip_text(TTR("This variable is private and is not included in the blackboard plan.\nClick to open the blackboard plan."));
} else {
BUTTON_SET_ICON(status_btn, theme_cache.var_not_found_icon);
status_btn->set_button_icon(theme_cache.var_not_found_icon);
status_btn->set_tooltip_text(TTR("No matching variable found in the blackboard plan!\nClick to open the blackboard plan."));
}
}

void EditorPropertyVariableName::_status_pressed() {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
if (!plan->has_var(name_edit->get_text())) {
BlackboardPlanEditor::get_singleton()->set_defaults(name_edit->get_text(),
expected_type == Variant::NIL ? Variant::FLOAT : expected_type,
Expand All @@ -120,14 +120,14 @@ void EditorPropertyVariableName::_status_pressed() {
}

void EditorPropertyVariableName::_status_mouse_entered() {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
if (!plan->has_var(name_edit->get_text())) {
BUTTON_SET_ICON(status_btn, theme_cache.var_add_icon);
status_btn->set_button_icon(theme_cache.var_add_icon);
}
}

void EditorPropertyVariableName::_status_mouse_exited() {
ERR_FAIL_NULL(plan);
ERR_FAIL_COND(plan.is_null());
_update_status();
}

Expand Down Expand Up @@ -182,7 +182,7 @@ void EditorPropertyVariableName::_notification(int p_what) {
}
} break;
case NOTIFICATION_THEME_CHANGED: {
BUTTON_SET_ICON(drop_btn, get_theme_icon(LW_NAME(GuiOptionArrow), LW_NAME(EditorIcons)));
drop_btn->set_button_icon(get_theme_icon(LW_NAME(GuiOptionArrow), LW_NAME(EditorIcons)));
theme_cache.var_add_icon = LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboVarAdd));
theme_cache.var_exists_icon = LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboVarExists));
theme_cache.var_not_found_icon = LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboVarNotFound));
Expand Down Expand Up @@ -262,7 +262,7 @@ bool EditorInspectorPluginVariableName::_parse_property(Object *p_object, const
Variant default_value;
if (is_mapping) {
plan.reference_ptr(Object::cast_to<BlackboardPlan>(p_object));
ERR_FAIL_NULL_V(plan, false);
ERR_FAIL_COND_V(plan.is_null(), false);
String var_name = p_path.trim_prefix("mapping/");
if (plan->has_var(var_name)) {
BBVariable variable = plan->get_var(var_name);
Expand All @@ -277,7 +277,7 @@ bool EditorInspectorPluginVariableName::_parse_property(Object *p_object, const
plan = parent_plan;
}
}
ERR_FAIL_NULL_V(plan, false);
ERR_FAIL_COND_V(plan.is_null(), false);
} else {
plan = editor_plan_provider.call();
}
Expand Down
Loading
Loading