summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-08-20 12:55:46 -0300
committerGitHub <noreply@github.com>2017-08-20 12:55:46 -0300
commit541fdffc0ab2115238fe9cedbf1c088b15f11fdf (patch)
tree187c5d0278e5075907fef8a86b4d00d6a0b7161a /core
parent831e21e89ba0275b43b6a351e538256b8ce715a3 (diff)
parent90b8a5b71ef79e0339826507c4b290f0c51b7cd2 (diff)
Merge pull request #10319 from neikeq/pr-engine-editor-hint
Adds Engine::is_editor_hint() method
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp13
-rw-r--r--core/bind/core_bind.h3
-rw-r--r--core/engine.cpp1
-rw-r--r--core/engine.h11
4 files changed, 28 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 273ef78669..185c2e670c 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -2568,6 +2568,16 @@ bool _Engine::is_in_fixed_frame() const {
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() {
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("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;
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 61c80aaba3..71038cd5a6 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -647,6 +647,9 @@ public:
bool is_in_fixed_frame() const;
+ void set_editor_hint(bool p_enabled);
+ bool is_editor_hint() const;
+
_Engine();
};
diff --git a/core/engine.cpp b/core/engine.cpp
index c16a2903d3..c8218e47ac 100644
--- a/core/engine.cpp
+++ b/core/engine.cpp
@@ -121,4 +121,5 @@ Engine::Engine() {
_in_fixed = false;
_frame_ticks = 0;
_frame_step = 0;
+ editor_hint = false;
}
diff --git a/core/engine.h b/core/engine.h
index 16dfb77593..1a07f5d1df 100644
--- a/core/engine.h
+++ b/core/engine.h
@@ -51,9 +51,12 @@ class Engine {
float _time_scale;
bool _pixel_snap;
uint64_t _fixed_frames;
+
uint64_t _idle_frames;
bool _in_fixed;
+ bool editor_hint;
+
static Engine *singleton;
public:
@@ -85,6 +88,14 @@ public:
_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;
Engine();