Adds editor_hint to Engine class
This commit is contained in:
parent
ff2cb35b90
commit
fd69604bd9
@ -2568,6 +2568,16 @@ bool _Engine::is_in_fixed_frame() const {
|
|||||||
return Engine::get_singleton()->is_in_fixed_frame();
|
return Engine::get_singleton()->is_in_fixed_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _Engine::set_editor_hint(bool p_enabled) {
|
||||||
|
|
||||||
|
Engine::get_singleton()->set_editor_hint(p_enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _Engine::is_editor_hint() const {
|
||||||
|
|
||||||
|
return Engine::get_singleton()->is_editor_hint();
|
||||||
|
}
|
||||||
|
|
||||||
void _Engine::_bind_methods() {
|
void _Engine::_bind_methods() {
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_iterations_per_second", "iterations_per_second"), &_Engine::set_iterations_per_second);
|
ClassDB::bind_method(D_METHOD("set_iterations_per_second", "iterations_per_second"), &_Engine::set_iterations_per_second);
|
||||||
@ -2588,6 +2598,9 @@ void _Engine::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("get_version_info"), &_Engine::get_version_info);
|
ClassDB::bind_method(D_METHOD("get_version_info"), &_Engine::get_version_info);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("is_in_fixed_frame"), &_Engine::is_in_fixed_frame);
|
ClassDB::bind_method(D_METHOD("is_in_fixed_frame"), &_Engine::is_in_fixed_frame);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_editor_hint", "enabled"), &_Engine::set_editor_hint);
|
||||||
|
ClassDB::bind_method(D_METHOD("is_editor_hint"), &_Engine::is_editor_hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Engine *_Engine::singleton = NULL;
|
_Engine *_Engine::singleton = NULL;
|
||||||
|
@ -647,6 +647,9 @@ public:
|
|||||||
|
|
||||||
bool is_in_fixed_frame() const;
|
bool is_in_fixed_frame() const;
|
||||||
|
|
||||||
|
void set_editor_hint(bool p_enabled);
|
||||||
|
bool is_editor_hint() const;
|
||||||
|
|
||||||
_Engine();
|
_Engine();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -121,4 +121,5 @@ Engine::Engine() {
|
|||||||
_in_fixed = false;
|
_in_fixed = false;
|
||||||
_frame_ticks = 0;
|
_frame_ticks = 0;
|
||||||
_frame_step = 0;
|
_frame_step = 0;
|
||||||
|
editor_hint = false;
|
||||||
}
|
}
|
||||||
|
@ -51,9 +51,12 @@ class Engine {
|
|||||||
float _time_scale;
|
float _time_scale;
|
||||||
bool _pixel_snap;
|
bool _pixel_snap;
|
||||||
uint64_t _fixed_frames;
|
uint64_t _fixed_frames;
|
||||||
|
|
||||||
uint64_t _idle_frames;
|
uint64_t _idle_frames;
|
||||||
bool _in_fixed;
|
bool _in_fixed;
|
||||||
|
|
||||||
|
bool editor_hint;
|
||||||
|
|
||||||
static Engine *singleton;
|
static Engine *singleton;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -85,6 +88,14 @@ public:
|
|||||||
|
|
||||||
_FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; }
|
_FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; }
|
||||||
|
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
_FORCE_INLINE_ void set_editor_hint(bool p_enabled) { editor_hint = p_enabled; }
|
||||||
|
_FORCE_INLINE_ bool is_editor_hint() const { return editor_hint; }
|
||||||
|
#else
|
||||||
|
_FORCE_INLINE_ void set_editor_hint(bool p_enabled) {}
|
||||||
|
_FORCE_INLINE_ bool is_editor_hint() const { return false; }
|
||||||
|
#endif
|
||||||
|
|
||||||
Dictionary get_version_info() const;
|
Dictionary get_version_info() const;
|
||||||
|
|
||||||
Engine();
|
Engine();
|
||||||
|
@ -277,6 +277,8 @@ void EditorNode::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||||
|
|
||||||
|
Engine::get_singleton()->set_editor_hint(true);
|
||||||
|
|
||||||
get_tree()->get_root()->set_disable_3d(true);
|
get_tree()->get_root()->set_disable_3d(true);
|
||||||
//MessageQueue::get_singleton()->push_call(this,"_get_scene_metadata");
|
//MessageQueue::get_singleton()->push_call(this,"_get_scene_metadata");
|
||||||
get_tree()->set_editor_hint(true);
|
get_tree()->set_editor_hint(true);
|
||||||
|
@ -465,6 +465,7 @@ void ProjectManager::_notification(int p_what) {
|
|||||||
|
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||||
|
|
||||||
|
Engine::get_singleton()->set_editor_hint(true);
|
||||||
get_tree()->set_editor_hint(true);
|
get_tree()->set_editor_hint(true);
|
||||||
|
|
||||||
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||||
@ -966,7 +967,6 @@ void ProjectManager::_run_project_confirm() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const String &selected = E->key();
|
const String &selected = E->key();
|
||||||
String path = EditorSettings::get_singleton()->get("projects/" + selected);
|
String path = EditorSettings::get_singleton()->get("projects/" + selected);
|
||||||
|
|
||||||
|
@ -660,6 +660,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (editor) {
|
if (editor) {
|
||||||
|
Engine::get_singleton()->set_editor_hint(true);
|
||||||
main_args.push_back("-editor");
|
main_args.push_back("-editor");
|
||||||
init_maximized = true;
|
init_maximized = true;
|
||||||
use_custom_res = false;
|
use_custom_res = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user