Fix compilation issues related to open_doc_*()

This commit is contained in:
Serhii Snitsaruk 2024-01-14 16:35:19 +01:00
parent 34e763c8f3
commit 80781db7cd
3 changed files with 9 additions and 8 deletions

View File

@ -188,14 +188,7 @@ void TaskPalette::_menu_action_selected(int p_id) {
ERR_FAIL_COND(context_task.is_empty()); ERR_FAIL_COND(context_task.is_empty());
switch (p_id) { switch (p_id) {
case MENU_OPEN_DOC: { case MENU_OPEN_DOC: {
String help_class; LimboUtility::get_singleton()->open_doc_class(context_task);
if (context_task.begins_with("res://")) {
help_class = context_task;
} else {
// Assuming context task is core class.
help_class = context_task;
}
LimboUtility::get_singleton()->open_doc_class(help_class);
} break; } break;
case MENU_EDIT_SCRIPT: { case MENU_EDIT_SCRIPT: {
ERR_FAIL_COND(!context_task.begins_with("res://")); ERR_FAIL_COND(!context_task.begins_with("res://"));

View File

@ -288,6 +288,8 @@ Variant LimboUtility::perform_operation(Operation p_operation, const Variant &le
return ret; return ret;
} }
#ifdef TOOLS_ENABLED
Ref<Shortcut> LimboUtility::add_shortcut(const String &p_path, const String &p_name, Key p_keycode) { Ref<Shortcut> LimboUtility::add_shortcut(const String &p_path, const String &p_name, Key p_keycode) {
Ref<Shortcut> sc = memnew(Shortcut); Ref<Shortcut> sc = memnew(Shortcut);
sc->set_name(p_name); sc->set_name(p_name);
@ -341,6 +343,8 @@ void LimboUtility::open_doc_class(const String &p_class_name) {
#endif #endif
} }
#endif // ! TOOLS_ENABLED
void LimboUtility::_bind_methods() { void LimboUtility::_bind_methods() {
ClassDB::bind_method(D_METHOD("decorate_var", "p_variable"), &LimboUtility::decorate_var); ClassDB::bind_method(D_METHOD("decorate_var", "p_variable"), &LimboUtility::decorate_var);
ClassDB::bind_method(D_METHOD("get_status_name", "p_status"), &LimboUtility::get_status_name); ClassDB::bind_method(D_METHOD("get_status_name", "p_status"), &LimboUtility::get_status_name);

View File

@ -42,7 +42,9 @@ class LimboUtility : public Object {
GDCLASS(LimboUtility, Object); GDCLASS(LimboUtility, Object);
private: private:
#ifdef TOOLS_ENABLED
HashMap<String, Ref<Shortcut>> shortcuts; HashMap<String, Ref<Shortcut>> shortcuts;
#endif // TOOLS_ENABLED
public: public:
enum CheckType : unsigned int { enum CheckType : unsigned int {
@ -86,6 +88,7 @@ public:
String get_operation_string(Operation p_operation) const; String get_operation_string(Operation p_operation) const;
Variant perform_operation(Operation p_operation, const Variant &left_value, const Variant &right_value); Variant perform_operation(Operation p_operation, const Variant &left_value, const Variant &right_value);
#ifdef TOOLS_ENABLED
Ref<Shortcut> add_shortcut(const String &p_path, const String &p_name, Key p_keycode = LW_KEY(NONE)); Ref<Shortcut> add_shortcut(const String &p_path, const String &p_name, Key p_keycode = LW_KEY(NONE));
bool is_shortcut(const String &p_path, const Ref<InputEvent> &p_event) const; bool is_shortcut(const String &p_path, const Ref<InputEvent> &p_event) const;
Ref<Shortcut> get_shortcut(const String &p_path) const; Ref<Shortcut> get_shortcut(const String &p_path) const;
@ -93,6 +96,7 @@ public:
void open_doc_introduction(); void open_doc_introduction();
void open_doc_online(); void open_doc_online();
void open_doc_class(const String &p_class_name); void open_doc_class(const String &p_class_name);
#endif // TOOLS_ENABLED
LimboUtility(); LimboUtility();
~LimboUtility(); ~LimboUtility();