summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp20
-rw-r--r--core/bind/core_bind.h5
-rw-r--r--core/command_queue_mt.cpp2
-rw-r--r--core/command_queue_mt.h63
-rw-r--r--core/engine.cpp1
-rw-r--r--core/engine.h14
-rw-r--r--core/io/marshalls.cpp7
-rw-r--r--core/reference.h7
-rw-r--r--core/script_debugger_remote.cpp2
-rw-r--r--core/variant_call.cpp4
-rw-r--r--doc/base/classes.xml7
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp7
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp48
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h4
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp18
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h2
-rw-r--r--drivers/unix/dir_access_unix.cpp45
-rw-r--r--editor/code_editor.cpp13
-rw-r--r--editor/editor_export.cpp36
-rw-r--r--editor/editor_node.cpp54
-rw-r--r--editor/editor_run.cpp44
-rw-r--r--editor/editor_settings.cpp11
-rw-r--r--editor/editor_themes.cpp8
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp2
-rw-r--r--editor/plugins/cube_grid_theme_editor_plugin.cpp1
-rw-r--r--editor/plugins/sample_editor_plugin.cpp4
-rw-r--r--editor/plugins/script_editor_plugin.cpp7
-rw-r--r--editor/plugins/script_text_editor.cpp17
-rw-r--r--editor/plugins/script_text_editor.h1
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp18
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp1
-rw-r--r--editor/project_manager.cpp11
-rw-r--r--editor/property_editor.cpp6
-rw-r--r--editor/run_settings_dialog.cpp2
-rw-r--r--editor/scene_tree_editor.cpp6
-rw-r--r--editor/script_editor_debugger.cpp3
-rw-r--r--main/main.cpp354
-rw-r--r--modules/gdnative/gdnative.cpp4
-rw-r--r--modules/gdnative/godot/string.h2
-rw-r--r--modules/gdscript/gd_editor.cpp3
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp2
-rw-r--r--modules/visual_script/visual_script.cpp13
-rw-r--r--modules/visual_script/visual_script_editor.cpp1
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp2
-rw-r--r--platform/android/export/export.cpp28
-rw-r--r--platform/android/godot_android.cpp1
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java12
-rw-r--r--platform/android/java_glue.cpp4
-rw-r--r--platform/iphone/view_controller.mm2
-rw-r--r--platform/osx/os_osx.mm11
-rw-r--r--platform/uwp/app.cpp2
-rw-r--r--platform/uwp/export/export.cpp2
-rw-r--r--scene/2d/audio_stream_player_2d.cpp5
-rw-r--r--scene/2d/camera_2d.cpp14
-rw-r--r--scene/2d/canvas_item.cpp12
-rw-r--r--scene/2d/canvas_item.h4
-rw-r--r--scene/2d/collision_polygon_2d.cpp5
-rw-r--r--scene/2d/collision_shape_2d.cpp6
-rw-r--r--scene/2d/joints_2d.cpp8
-rw-r--r--scene/2d/light_2d.cpp4
-rw-r--r--scene/2d/light_occluder_2d.cpp4
-rw-r--r--scene/2d/navigation_polygon.cpp7
-rw-r--r--scene/2d/parallax_layer.cpp4
-rw-r--r--scene/2d/particles_2d.cpp3
-rw-r--r--scene/2d/path_2d.cpp6
-rw-r--r--scene/2d/physics_body_2d.cpp6
-rw-r--r--scene/2d/polygon_2d.cpp20
-rw-r--r--scene/2d/polygon_2d.h4
-rw-r--r--scene/2d/position_2d.cpp4
-rw-r--r--scene/2d/ray_cast_2d.cpp10
-rw-r--r--scene/2d/screen_button.cpp10
-rw-r--r--scene/2d/visibility_notifier_2d.cpp14
-rw-r--r--scene/3d/audio_stream_player_3d.cpp2
-rw-r--r--scene/3d/interpolated_camera.cpp6
-rw-r--r--scene/3d/light.cpp19
-rw-r--r--scene/3d/light.h4
-rw-r--r--scene/3d/path.cpp6
-rw-r--r--scene/3d/physics_body.cpp6
-rw-r--r--scene/3d/ray_cast.cpp8
-rw-r--r--scene/3d/spatial.cpp7
-rw-r--r--scene/3d/visibility_notifier.cpp6
-rw-r--r--scene/3d/visual_instance.cpp19
-rw-r--r--scene/3d/visual_instance.h1
-rw-r--r--scene/animation/animation_player.cpp7
-rw-r--r--scene/audio/audio_player.cpp4
-rw-r--r--scene/gui/color_picker.cpp2
-rw-r--r--scene/gui/control.cpp2
-rw-r--r--scene/gui/dialogs.cpp4
-rw-r--r--scene/gui/label.cpp5
-rw-r--r--scene/gui/line_edit.cpp2
-rw-r--r--scene/gui/popup.cpp11
-rw-r--r--scene/gui/reference_rect.cpp4
-rw-r--r--scene/gui/scroll_bar.cpp54
-rw-r--r--scene/gui/scroll_bar.h7
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/gui/text_edit.cpp101
-rw-r--r--scene/gui/text_edit.h11
-rw-r--r--scene/gui/texture_progress.cpp4
-rw-r--r--scene/gui/video_player.cpp2
-rw-r--r--scene/main/scene_tree.cpp24
-rw-r--r--scene/main/scene_tree.h9
-rwxr-xr-xscene/main/timer.cpp4
-rw-r--r--scene/main/viewport.cpp8
-rw-r--r--scene/resources/color_ramp.cpp4
-rw-r--r--scene/resources/style_box.cpp15
-rw-r--r--servers/visual/rasterizer.h2
-rw-r--r--servers/visual/shader_language.cpp8
-rw-r--r--servers/visual/visual_server_canvas.cpp5
-rw-r--r--servers/visual/visual_server_canvas.h2
-rw-r--r--servers/visual/visual_server_raster.h3
-rw-r--r--servers/visual/visual_server_scene.cpp18
-rw-r--r--servers/visual/visual_server_wrap_mt.h3
-rw-r--r--servers/visual_server.cpp15
-rw-r--r--servers/visual_server.h4
115 files changed, 896 insertions, 630 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 273ef78669..1c9eef3d16 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -2534,11 +2534,6 @@ float _Engine::get_frames_per_second() const {
return Engine::get_singleton()->get_frames_per_second();
}
-String _Engine::get_custom_level() const {
-
- return Engine::get_singleton()->get_custom_level();
-}
-
void _Engine::set_time_scale(float p_scale) {
Engine::get_singleton()->set_time_scale(p_scale);
}
@@ -2568,6 +2563,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);
@@ -2578,8 +2583,6 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_time_scale", "time_scale"), &_Engine::set_time_scale);
ClassDB::bind_method(D_METHOD("get_time_scale"), &_Engine::get_time_scale);
- ClassDB::bind_method(D_METHOD("get_custom_level"), &_Engine::get_custom_level);
-
ClassDB::bind_method(D_METHOD("get_frames_drawn"), &_Engine::get_frames_drawn);
ClassDB::bind_method(D_METHOD("get_frames_per_second"), &_Engine::get_frames_per_second);
@@ -2588,6 +2591,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..d3314cc3b3 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -639,14 +639,15 @@ public:
void set_time_scale(float p_scale);
float get_time_scale();
- String get_custom_level() const;
-
MainLoop *get_main_loop() const;
Dictionary get_version_info() const;
bool is_in_fixed_frame() const;
+ void set_editor_hint(bool p_enabled);
+ bool is_editor_hint() const;
+
_Engine();
};
diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp
index 823494ff67..c9edd1d47b 100644
--- a/core/command_queue_mt.cpp
+++ b/core/command_queue_mt.cpp
@@ -55,6 +55,7 @@ CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() {
while (true) {
+ lock();
for (int i = 0; i < SYNC_SEMAPHORES; i++) {
if (!sync_sems[i].in_use) {
@@ -63,6 +64,7 @@ CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() {
break;
}
}
+ unlock();
if (idx == -1) {
wait_for_flush();
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h
index 2e0c478108..c3e44f731f 100644
--- a/core/command_queue_mt.h
+++ b/core/command_queue_mt.h
@@ -911,12 +911,14 @@ public:
template <class T, class M, class R>
void push_and_ret(T *p_instance, M p_method, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet0<T, M, R> *cmd = allocate_and_lock<CommandRet0<T, M, R> >();
cmd->instance = p_instance;
cmd->method = p_method;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -928,13 +930,15 @@ public:
template <class T, class M, class P1, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet1<T, M, P1, R> *cmd = allocate_and_lock<CommandRet1<T, M, P1, R> >();
cmd->instance = p_instance;
cmd->method = p_method;
cmd->p1 = p1;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -946,6 +950,8 @@ public:
template <class T, class M, class P1, class P2, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet2<T, M, P1, P2, R> *cmd = allocate_and_lock<CommandRet2<T, M, P1, P2, R> >();
cmd->instance = p_instance;
@@ -953,7 +959,7 @@ public:
cmd->p1 = p1;
cmd->p2 = p2;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -965,6 +971,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet3<T, M, P1, P2, P3, R> *cmd = allocate_and_lock<CommandRet3<T, M, P1, P2, P3, R> >();
cmd->instance = p_instance;
@@ -973,7 +981,7 @@ public:
cmd->p2 = p2;
cmd->p3 = p3;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -985,6 +993,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet4<T, M, P1, P2, P3, P4, R> *cmd = allocate_and_lock<CommandRet4<T, M, P1, P2, P3, P4, R> >();
cmd->instance = p_instance;
@@ -994,7 +1004,7 @@ public:
cmd->p3 = p3;
cmd->p4 = p4;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -1006,6 +1016,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet5<T, M, P1, P2, P3, P4, P5, R> *cmd = allocate_and_lock<CommandRet5<T, M, P1, P2, P3, P4, P5, R> >();
cmd->instance = p_instance;
@@ -1016,7 +1028,7 @@ public:
cmd->p4 = p4;
cmd->p5 = p5;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -1028,6 +1040,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet6<T, M, P1, P2, P3, P4, P5, P6, R> *cmd = allocate_and_lock<CommandRet6<T, M, P1, P2, P3, P4, P5, P6, R> >();
cmd->instance = p_instance;
@@ -1039,7 +1053,7 @@ public:
cmd->p5 = p5;
cmd->p6 = p6;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -1051,6 +1065,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet7<T, M, P1, P2, P3, P4, P5, P6, P7, R> *cmd = allocate_and_lock<CommandRet7<T, M, P1, P2, P3, P4, P5, P6, P7, R> >();
cmd->instance = p_instance;
@@ -1063,7 +1079,7 @@ public:
cmd->p6 = p6;
cmd->p7 = p7;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -1075,6 +1091,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class R>
void push_and_ret(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, R *r_ret) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandRet8<T, M, P1, P2, P3, P4, P5, P6, P7, P8, R> *cmd = allocate_and_lock<CommandRet8<T, M, P1, P2, P3, P4, P5, P6, P7, P8, R> >();
cmd->instance = p_instance;
@@ -1088,7 +1106,7 @@ public:
cmd->p7 = p7;
cmd->p8 = p8;
cmd->ret = r_ret;
- SyncSemaphore *ss = _alloc_sync_sem();
+
cmd->sync = ss;
unlock();
@@ -1100,12 +1118,13 @@ public:
template <class T, class M>
void push_and_sync(T *p_instance, M p_method) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync0<T, M> *cmd = allocate_and_lock<CommandSync0<T, M> >();
cmd->instance = p_instance;
cmd->method = p_method;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1117,13 +1136,14 @@ public:
template <class T, class M, class P1>
void push_and_sync(T *p_instance, M p_method, P1 p1) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync1<T, M, P1> *cmd = allocate_and_lock<CommandSync1<T, M, P1> >();
cmd->instance = p_instance;
cmd->method = p_method;
cmd->p1 = p1;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1135,6 +1155,8 @@ public:
template <class T, class M, class P1, class P2>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync2<T, M, P1, P2> *cmd = allocate_and_lock<CommandSync2<T, M, P1, P2> >();
cmd->instance = p_instance;
@@ -1142,7 +1164,6 @@ public:
cmd->p1 = p1;
cmd->p2 = p2;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1154,6 +1175,8 @@ public:
template <class T, class M, class P1, class P2, class P3>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync3<T, M, P1, P2, P3> *cmd = allocate_and_lock<CommandSync3<T, M, P1, P2, P3> >();
cmd->instance = p_instance;
@@ -1162,7 +1185,6 @@ public:
cmd->p2 = p2;
cmd->p3 = p3;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1174,6 +1196,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync4<T, M, P1, P2, P3, P4> *cmd = allocate_and_lock<CommandSync4<T, M, P1, P2, P3, P4> >();
cmd->instance = p_instance;
@@ -1183,7 +1207,6 @@ public:
cmd->p3 = p3;
cmd->p4 = p4;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1195,6 +1218,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync5<T, M, P1, P2, P3, P4, P5> *cmd = allocate_and_lock<CommandSync5<T, M, P1, P2, P3, P4, P5> >();
cmd->instance = p_instance;
@@ -1205,7 +1230,6 @@ public:
cmd->p4 = p4;
cmd->p5 = p5;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1217,6 +1241,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync6<T, M, P1, P2, P3, P4, P5, P6> *cmd = allocate_and_lock<CommandSync6<T, M, P1, P2, P3, P4, P5, P6> >();
cmd->instance = p_instance;
@@ -1228,7 +1254,6 @@ public:
cmd->p5 = p5;
cmd->p6 = p6;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1240,6 +1265,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync7<T, M, P1, P2, P3, P4, P5, P6, P7> *cmd = allocate_and_lock<CommandSync7<T, M, P1, P2, P3, P4, P5, P6, P7> >();
cmd->instance = p_instance;
@@ -1252,7 +1279,6 @@ public:
cmd->p6 = p6;
cmd->p7 = p7;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
@@ -1264,6 +1290,8 @@ public:
template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
void push_and_sync(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {
+ SyncSemaphore *ss = _alloc_sync_sem();
+
CommandSync8<T, M, P1, P2, P3, P4, P5, P6, P7, P8> *cmd = allocate_and_lock<CommandSync8<T, M, P1, P2, P3, P4, P5, P6, P7, P8> >();
cmd->instance = p_instance;
@@ -1277,7 +1305,6 @@ public:
cmd->p7 = p7;
cmd->p8 = p8;
- SyncSemaphore *ss = _alloc_sync_sem();
cmd->sync = ss;
unlock();
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..c46ae1cb64 100644
--- a/core/engine.h
+++ b/core/engine.h
@@ -39,7 +39,6 @@ class Engine {
friend class Main;
- String _custom_level;
uint64_t frames_drawn;
uint32_t _frame_delay;
uint64_t _frame_ticks;
@@ -51,9 +50,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:
@@ -67,8 +69,6 @@ public:
virtual float get_frames_per_second() const { return _fps; }
- String get_custom_level() const { return _custom_level; }
-
uint64_t get_frames_drawn();
uint64_t get_fixed_frames() const { return _fixed_frames; }
@@ -85,6 +85,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();
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index c5d59f786d..e701a89c78 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -807,11 +807,16 @@ static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) {
encode_uint32(utf8.length(), buf);
buf += 4;
copymem(buf, utf8.get_data(), utf8.length());
+ buf += utf8.length();
}
r_len += 4 + utf8.length();
- while (r_len % 4)
+ while (r_len % 4) {
r_len++; //pad
+ if (buf) {
+ buf++;
+ }
+ }
}
Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_object_as_id) {
diff --git a/core/reference.h b/core/reference.h
index 7f48f8323e..69250a4701 100644
--- a/core/reference.h
+++ b/core/reference.h
@@ -374,6 +374,10 @@ struct PtrToArg<const RefPtr &> {
}
};
+#endif // PTRCALL_ENABLED
+
+#ifdef DEBUG_METHODS_ENABLED
+
template <class T>
struct GetTypeInfo<Ref<T> > {
enum { VARIANT_TYPE = Variant::OBJECT };
@@ -392,5 +396,6 @@ struct GetTypeInfo<const Ref<T> &> {
}
};
-#endif
+#endif // DEBUG_METHODS_ENABLED
+
#endif // REFERENCE_H
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 25f0044cc6..9e4f4380c9 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -142,8 +142,6 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue)
ERR_FAIL();
}
- OS::get_singleton()->enable_for_stealing_focus(ProjectSettings::get_singleton()->get("editor_pid"));
-
packet_peer_stream->put_var("debug_enter");
packet_peer_stream->put_var(2);
packet_peer_stream->put_var(p_can_continue);
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index aabc2546bc..59d31d2586 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -747,6 +747,7 @@ struct _VariantCall {
VCALL_PTR1R(Transform, translated);
VCALL_PTR0R(Transform, orthonormalized);
VCALL_PTR2R(Transform, looking_at);
+ VCALL_PTR2R(Transform, interpolate_with);
static void _call_Transform_xform(Variant &r_ret, Variant &p_self, const Variant **p_args) {
@@ -1691,7 +1692,7 @@ void register_variant_methods() {
ADDFUNC1(TRANSFORM2D, TRANSFORM2D, Transform2D, xform_inv, NIL, "v", varray());
ADDFUNC1(TRANSFORM2D, TRANSFORM2D, Transform2D, basis_xform, NIL, "v", varray());
ADDFUNC1(TRANSFORM2D, TRANSFORM2D, Transform2D, basis_xform_inv, NIL, "v", varray());
- ADDFUNC2(TRANSFORM2D, TRANSFORM2D, Transform2D, interpolate_with, TRANSFORM2D, "m", REAL, "c", varray());
+ ADDFUNC2(TRANSFORM2D, TRANSFORM2D, Transform2D, interpolate_with, TRANSFORM2D, "transform", REAL, "weight", varray());
ADDFUNC0(BASIS, BASIS, Basis, inverse, varray());
ADDFUNC0(BASIS, BASIS, Basis, transposed, varray());
@@ -1718,6 +1719,7 @@ void register_variant_methods() {
ADDFUNC1(TRANSFORM, TRANSFORM, Transform, scaled, VECTOR3, "scale", varray());
ADDFUNC1(TRANSFORM, TRANSFORM, Transform, translated, VECTOR3, "ofs", varray());
ADDFUNC2(TRANSFORM, TRANSFORM, Transform, looking_at, VECTOR3, "target", VECTOR3, "up", varray());
+ ADDFUNC2(TRANSFORM, TRANSFORM, Transform, interpolate_with, TRANSFORM, "transform", REAL, "weight", varray());
ADDFUNC1(TRANSFORM, NIL, Transform, xform, NIL, "v", varray());
ADDFUNC1(TRANSFORM, NIL, Transform, xform_inv, NIL, "v", varray());
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index fd3e428c8b..570d90f81e 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -14960,13 +14960,6 @@
<description>
</description>
<methods>
- <method name="get_custom_level" qualifiers="const">
- <return type="String">
- </return>
- <description>
- Returns the value of the commandline argument "-level".
- </description>
- </method>
<method name="get_frames_drawn">
<return type="int">
</return>
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index e6ffa39197..376a208559 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -691,6 +691,13 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
state.canvas_shader.set_uniform(CanvasShaderGLES3::COLOR_TEXPIXEL_SIZE, texpixel_size);
}
_draw_polygon(polygon->indices.ptr(), polygon->count, polygon->points.size(), polygon->points.ptr(), polygon->uvs.ptr(), polygon->colors.ptr(), polygon->colors.size() == 1);
+#ifdef GLES_OVER_GL
+ if (polygon->antialiased) {
+ glEnable(GL_LINE_SMOOTH);
+ _draw_generic(GL_LINE_LOOP, polygon->points.size(), polygon->points.ptr(), polygon->uvs.ptr(), polygon->colors.ptr(), polygon->colors.size() == 1);
+ glDisable(GL_LINE_SMOOTH);
+ }
+#endif
} break;
case Item::Command::TYPE_PARTICLES: {
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index ac6ca1ec0c..52c7327baf 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1088,11 +1088,12 @@ void RasterizerSceneGLES3::gi_probe_instance_set_bounds(RID p_probe, const Vecto
bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_material, bool p_alpha_pass) {
+ /* this is handled outside
if (p_material->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_DISABLED) {
glDisable(GL_CULL_FACE);
} else {
glEnable(GL_CULL_FACE);
- }
+ } */
if (state.current_line_width != p_material->line_width) {
//glLineWidth(MAX(p_material->line_width,1.0));
@@ -1857,12 +1858,21 @@ void RasterizerSceneGLES3::_setup_light(RenderList::Element *e, const Transform
}
}
-void RasterizerSceneGLES3::_set_cull(bool p_front, bool p_reverse_cull) {
+void RasterizerSceneGLES3::_set_cull(bool p_front, bool p_disabled, bool p_reverse_cull) {
bool front = p_front;
if (p_reverse_cull)
front = !front;
+ if (p_disabled != state.cull_disabled) {
+ if (p_disabled)
+ glDisable(GL_CULL_FACE);
+ else
+ glEnable(GL_CULL_FACE);
+
+ state.cull_disabled = p_disabled;
+ }
+
if (front != state.cull_front) {
glCullFace(front ? GL_FRONT : GL_BACK);
@@ -1900,7 +1910,9 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
}
state.cull_front = false;
+ state.cull_disabled = false;
glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
state.current_depth_test = true;
glEnable(GL_DEPTH_TEST);
@@ -2101,7 +2113,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
storage->info.render.surface_switch_count++;
}
- _set_cull(e->sort_key & RenderList::SORT_KEY_MIRROR_FLAG, p_reverse_cull);
+ _set_cull(e->sort_key & RenderList::SORT_KEY_MIRROR_FLAG, e->sort_key & RenderList::SORT_KEY_CULL_DISABLED_FLAG, p_reverse_cull);
state.scene_shader.set_uniform(SceneShaderGLES3::NORMAL_MULT, e->instance->mirror ? -1.0 : 1.0);
state.scene_shader.set_uniform(SceneShaderGLES3::WORLD_TRANSFORM, e->instance->transform);
@@ -2188,8 +2200,12 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
bool shadow = false;
bool mirror = p_instance->mirror;
+ bool no_cull = false;
- if (p_material->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_FRONT) {
+ if (p_material->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_DISABLED) {
+ no_cull = true;
+ mirror = false;
+ } else if (p_material->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_FRONT) {
mirror = !mirror;
}
@@ -2208,10 +2224,13 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
if (!p_material->shader->spatial.uses_alpha_scissor && !p_material->shader->spatial.writes_modelview_or_projection && !p_material->shader->spatial.uses_vertex && !p_material->shader->spatial.uses_discard && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
//shader does not use discard and does not write a vertex position, use generic material
- if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED)
+ if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) {
p_material = storage->material_owner.getptr(default_material_twosided);
- else
+ no_cull = true;
+ mirror = false;
+ } else {
p_material = storage->material_owner.getptr(default_material);
+ }
}
has_alpha = false;
@@ -2275,6 +2294,10 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
e->sort_key |= RenderList::SORT_KEY_MIRROR_FLAG;
}
+ if (no_cull) {
+ e->sort_key |= RenderList::SORT_KEY_CULL_DISABLED_FLAG;
+ }
+
//e->light_type=0xFF; // no lights!
if (shadow || p_material->shader->spatial.unshaded || state.debug_draw == VS::VIEWPORT_DEBUG_DRAW_UNSHADED) {
@@ -2286,6 +2309,16 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
e->sort_key |= SORT_KEY_VERTEX_LIT_FLAG;
}
+
+ if (!shadow && has_alpha && p_material->shader->spatial.depth_draw_mode == RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
+ //depth prepass for alpha
+ RenderList::Element *eo = render_list.add_element();
+
+ eo->instance = e->instance;
+ eo->geometry = e->geometry;
+ eo->material = e->material;
+ eo->sort_key = e->sort_key;
+ }
}
void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale, float p_energy) {
@@ -4535,6 +4568,9 @@ void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_
state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH, true);
+ if (light->reverse_cull) {
+ flip_facing = !flip_facing;
+ }
_render_list(render_list.elements, render_list.element_count, light_transform, light_projection, 0, flip_facing, false, true, false, false);
state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH, false);
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index e1d96f23dd..740d277a3a 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -187,6 +187,7 @@ public:
int reflection_probe_count;
bool cull_front;
+ bool cull_disabled;
bool used_sss;
bool used_screen_texture;
bool using_contact_shadows;
@@ -654,6 +655,7 @@ public:
SORT_KEY_MATERIAL_INDEX_SHIFT = 40,
SORT_KEY_GEOMETRY_INDEX_SHIFT = 20,
SORT_KEY_GEOMETRY_TYPE_SHIFT = 15,
+ SORT_KEY_CULL_DISABLED_FLAG = 4,
SORT_KEY_SKELETON_FLAG = 2,
SORT_KEY_MIRROR_FLAG = 1
@@ -779,7 +781,7 @@ public:
RenderList render_list;
- _FORCE_INLINE_ void _set_cull(bool p_front, bool p_reverse_cull);
+ _FORCE_INLINE_ void _set_cull(bool p_front, bool p_disabled, bool p_reverse_cull);
_FORCE_INLINE_ bool _setup_material(RasterizerStorageGLES3::Material *p_material, bool p_alpha_pass);
_FORCE_INLINE_ void _setup_geometry(RenderList::Element *e, const Transform &p_view_transform);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 8dd083fbe8..dc9006a4e1 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -2497,7 +2497,13 @@ void RasterizerStorageGLES3::_update_material(Material *material) {
//value=E->get().default_value;
} else {
//zero because it was not provided
- _fill_std140_ubo_empty(E->get().type, data);
+ if (E->get().type == ShaderLanguage::TYPE_VEC4 && E->get().hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ //colors must be set as black, with alpha as 1.0
+ _fill_std140_variant_ubo_value(E->get().type, Color(0, 0, 0, 1), data, material->shader->mode == VS::SHADER_SPATIAL);
+ } else {
+ //else just zero it out
+ _fill_std140_ubo_empty(E->get().type, data);
+ }
}
}
@@ -4451,7 +4457,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type) {
light->omni_shadow_mode = VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID;
light->omni_shadow_detail = VS::LIGHT_OMNI_SHADOW_DETAIL_VERTICAL;
light->directional_blend_splits = false;
-
+ light->reverse_cull = false;
light->version = 0;
return light_owner.make_rid(light);
@@ -4530,6 +4536,14 @@ void RasterizerStorageGLES3::light_set_cull_mask(RID p_light, uint32_t p_mask) {
light->instance_change_notify();
}
+void RasterizerStorageGLES3::light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {
+
+ Light *light = light_owner.getornull(p_light);
+ ERR_FAIL_COND(!light);
+
+ light->reverse_cull = p_enabled;
+}
+
void RasterizerStorageGLES3::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {
Light *light = light_owner.getornull(p_light);
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 3c7ea000ba..f612d9e879 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -868,6 +868,7 @@ public:
RID projector;
bool shadow;
bool negative;
+ bool reverse_cull;
uint32_t cull_mask;
VS::LightOmniShadowMode omni_shadow_mode;
VS::LightOmniShadowDetail omni_shadow_detail;
@@ -887,6 +888,7 @@ public:
virtual void light_set_projector(RID p_light, RID p_texture);
virtual void light_set_negative(RID p_light, bool p_enable);
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask);
+ virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled);
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail);
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index a183a37446..cf54f3fea0 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -223,37 +223,36 @@ Error DirAccessUnix::make_dir(String p_dir) {
Error DirAccessUnix::change_dir(String p_dir) {
GLOBAL_LOCK_FUNCTION
+ p_dir = fix_path(p_dir);
- // make sure current_dir is valid absolute path
- if (current_dir == "." || current_dir == "") {
- char real_current_dir_name[2048];
- getcwd(real_current_dir_name, 2048);
- current_dir.parse_utf8(real_current_dir_name);
- }
-
- if (p_dir == ".") {
- return OK;
- }
+ char real_current_dir_name[2048];
+ getcwd(real_current_dir_name, 2048);
+ String prev_dir;
+ if (prev_dir.parse_utf8(real_current_dir_name))
+ prev_dir = real_current_dir_name; //no utf8, maybe latin?
- p_dir = fix_path(p_dir);
+ chdir(current_dir.utf8().get_data()); //ascii since this may be unicode or wathever the host os wants
+ bool worked = (chdir(p_dir.utf8().get_data()) == 0); // we can only give this utf8
- String prev_dir = current_dir;
+ String base = _get_root_path();
+ if (base != "") {
- if (p_dir.is_rel_path()) {
- String next_dir = current_dir + "/" + p_dir;
- next_dir = next_dir.simplify_path();
- current_dir = next_dir;
- } else {
- current_dir = p_dir;
+ getcwd(real_current_dir_name, 2048);
+ String new_dir;
+ new_dir.parse_utf8(real_current_dir_name);
+ if (!new_dir.begins_with(base))
+ worked = false;
}
- bool worked = (chdir(current_dir.utf8().get_data()) == 0); // we can only give this utf8
- if (!worked) {
- current_dir = prev_dir;
- return ERR_INVALID_PARAMETER;
+ if (worked) {
+
+ getcwd(real_current_dir_name, 2048);
+ if (current_dir.parse_utf8(real_current_dir_name))
+ current_dir = real_current_dir_name; //no utf8, maybe latin?
}
- return OK;
+ chdir(prev_dir.utf8().get_data());
+ return worked ? OK : ERR_INVALID_PARAMETER;
}
String DirAccessUnix::get_current_dir() {
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 07c0945114..a809f4b15e 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1087,6 +1087,8 @@ void CodeTextEditor::update_editor_settings() {
text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed"));
text_editor->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_breakpoint_gutter"));
text_editor->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret"));
+ text_editor->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/open_scripts/smooth_scrolling"));
+ text_editor->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/open_scripts/v_scroll_speed"));
}
void CodeTextEditor::set_error(const String &p_error) {
@@ -1222,10 +1224,11 @@ CodeTextEditor::CodeTextEditor() {
error = memnew(Label);
status_bar->add_child(error);
error->hide();
+ error->set_clip_text(true); //do not change, or else very long errors can push the whole container to the right
error->set_valign(Label::VALIGN_CENTER);
error->add_color_override("font_color", Color(1, 0.7, 0.6, 0.9));
-
- status_bar->add_spacer();
+ error->set_h_size_flags(SIZE_EXPAND_FILL); //required for it to display, given now it's clipping contents, do not touch
+ //status_bar->add_spacer();
Label *line_txt = memnew(Label);
status_bar->add_child(line_txt);
@@ -1238,7 +1241,8 @@ CodeTextEditor::CodeTextEditor() {
status_bar->add_child(line_nb);
line_nb->set_valign(Label::VALIGN_CENTER);
line_nb->set_v_size_flags(SIZE_FILL);
- line_nb->set_autowrap(true); // workaround to prevent resizing the label on each change
+ line_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch
+ line_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch
line_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE);
Label *col_txt = memnew(Label);
@@ -1252,7 +1256,8 @@ CodeTextEditor::CodeTextEditor() {
status_bar->add_child(col_nb);
col_nb->set_valign(Label::VALIGN_CENTER);
col_nb->set_v_size_flags(SIZE_FILL);
- col_nb->set_autowrap(true); // workaround to prevent resizing the label on each change
+ col_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch
+ col_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch
col_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE);
text_editor->connect("gui_input", this, "_text_editor_gui_input");
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index fe1dfa281c..d8d3554612 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -229,17 +229,17 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
int port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
- r_flags.push_back("-rfs");
+ r_flags.push_back("--remote-fs");
r_flags.push_back(host + ":" + itos(port));
if (passwd != "") {
- r_flags.push_back("-rfs_pass");
+ r_flags.push_back("--remote-fs-password");
r_flags.push_back(passwd);
}
}
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) {
- r_flags.push_back("-rdebug");
+ r_flags.push_back("--remote-debug");
r_flags.push_back(host + ":" + String::num(remote_port));
@@ -248,7 +248,7 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
if (breakpoints.size()) {
- r_flags.push_back("-bp");
+ r_flags.push_back("--breakpoints");
String bpoints;
for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) {
@@ -263,12 +263,12 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) {
- r_flags.push_back("-debugcol");
+ r_flags.push_back("--debug-collisions");
}
if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) {
- r_flags.push_back("-debugnav");
+ r_flags.push_back("--debug-navigation");
}
}
@@ -714,17 +714,17 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
int port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
- r_flags.push_back("-rfs");
+ r_flags.push_back("--remote-fs");
r_flags.push_back(host + ":" + itos(port));
if (passwd != "") {
- r_flags.push_back("-rfs_pass");
+ r_flags.push_back("--remote-fs-password");
r_flags.push_back(passwd);
}
}
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) {
- r_flags.push_back("-rdebug");
+ r_flags.push_back("--remote-debug");
r_flags.push_back(host + ":" + String::num(remote_port));
@@ -733,7 +733,7 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (breakpoints.size()) {
- r_flags.push_back("-bp");
+ r_flags.push_back("--breakpoints");
String bpoints;
for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) {
@@ -748,12 +748,12 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) {
- r_flags.push_back("-debugcol");
+ r_flags.push_back("--debug-collisions");
}
if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) {
- r_flags.push_back("-debugnav");
+ r_flags.push_back("--debug-navigation");
}
}
EditorExportPlatform::EditorExportPlatform() {
@@ -2231,17 +2231,17 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (p_flags&EXPORT_DUMB_CLIENT) {
int port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
- r_flags.push_back("-rfs");
+ r_flags.push_back("--remote-fs");
r_flags.push_back(host+":"+itos(port));
if (passwd!="") {
- r_flags.push_back("-rfs_pass");
+ r_flags.push_back("--remote-fs-password");
r_flags.push_back(passwd);
}
}
if (p_flags&EXPORT_REMOTE_DEBUG) {
- r_flags.push_back("-rdebug");
+ r_flags.push_back("--remote-debug");
r_flags.push_back(host+":"+String::num(remote_port));
@@ -2251,7 +2251,7 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (breakpoints.size()) {
- r_flags.push_back("-bp");
+ r_flags.push_back("--breakpoints");
String bpoints;
for(const List<String>::Element *E=breakpoints.front();E;E=E->next()) {
@@ -2267,12 +2267,12 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (p_flags&EXPORT_VIEW_COLLISONS) {
- r_flags.push_back("-debugcol");
+ r_flags.push_back("--debug-collisions");
}
if (p_flags&EXPORT_VIEW_NAVIGATION) {
- r_flags.push_back("-debugnav");
+ r_flags.push_back("--debug-navigation");
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index a5f0478854..6f29a8695c 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -277,9 +277,10 @@ void EditorNode::_notification(int p_what) {
}
if (p_what == NOTIFICATION_ENTER_TREE) {
+ Engine::get_singleton()->set_editor_hint(true);
+
get_tree()->get_root()->set_disable_3d(true);
//MessageQueue::get_singleton()->push_call(this,"_get_scene_metadata");
- get_tree()->set_editor_hint(true);
get_tree()->get_root()->set_as_audio_listener(false);
get_tree()->get_root()->set_as_audio_listener_2d(false);
get_tree()->set_auto_accept_quit(false);
@@ -1850,47 +1851,6 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
_playing_edited = p_current;
}
-void EditorNode::_cleanup_scene() {
-
-#if 0
- Node *scene = editor_data.get_edited_scene_root();
- editor_selection->clear();
- editor_data.clear_editor_states();
- editor_history.clear();
- _hide_top_editors();
- animation_editor->cleanup();
- property_editor->edit(NULL);
- resources_dock->cleanup();
- scene_import_metadata.unref();
- //set_edited_scene(NULL);
- if (scene) {
- if (scene->get_filename()!="") {
- previous_scenes.push_back(scene->get_filename());
- }
-
- memdelete(scene);
- }
- editor_data.get_undo_redo().clear_history();
- saved_version=editor_data.get_undo_redo().get_version();
- run_settings_dialog->set_run_mode(0);
- run_settings_dialog->set_custom_arguments("-l $scene");
-
- List<Ref<Resource> > cached;
- ResourceCache::get_cached_resources(&cached);
-
- for(List<Ref<Resource> >::Element *E=cached.front();E;E=E->next()) {
-
- String path = E->get()->get_path();
- if (path.is_resource_file()) {
- ERR_PRINT(("Stray resource not cleaned:"+path).utf8().get_data());
- }
-
- }
-
- _update_title();
-#endif
-}
-
void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
//print_line("option "+itos(p_option)+" confirm "+itos(p_confirmed));
@@ -1914,8 +1874,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
_scene_tab_changed(idx);
editor_data.clear_editor_states();
- //_cleanup_scene();
-
} break;
case FILE_NEW_INHERITED_SCENE:
case FILE_OPEN_SCENE: {
@@ -2736,8 +2694,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
import_reload_fn = scene->get_filename();
_save_scene(import_reload_fn);
- _cleanup_scene();
-
}
@@ -2823,9 +2779,9 @@ void EditorNode::_discard_changes(const String &p_str) {
String exec = OS::get_singleton()->get_executable_path();
List<String> args;
- args.push_back("-path");
+ args.push_back("--path");
args.push_back(exec.get_base_dir());
- args.push_back("-pm");
+ args.push_back("--project-manager");
OS::ProcessID pid = 0;
Error err = OS::get_singleton()->execute(exec, args, false, &pid);
@@ -3327,8 +3283,6 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
_scene_tab_changed(idx);
}
- //_cleanup_scene(); // i'm sorry but this MUST happen to avoid modified resources to not be reloaded.
-
dependency_errors.clear();
Ref<PackedScene> sdata = ResourceLoader::load(lpath, "", true);
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 4954b1f741..9a0731eb55 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -45,28 +45,27 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
if (resource_path != "") {
- args.push_back("-path");
+ args.push_back("--path");
args.push_back(resource_path.replace(" ", "%20"));
}
if (true) {
- args.push_back("-rdebug");
+ args.push_back("--remote-debug");
args.push_back(remote_host + ":" + String::num(remote_port));
}
- args.push_back("-epid");
- args.push_back(String::num(OS::get_singleton()->get_process_id()));
+ args.push_back("--allow_focus_steal_pid");
+ args.push_back(itos(OS::get_singleton()->get_process_id()));
if (debug_collisions) {
- args.push_back("-debugcol");
+ args.push_back("--debug-collisions");
}
if (debug_navigation) {
- args.push_back("-debugnav");
+ args.push_back("--debug-navigation");
}
int screen = EditorSettings::get_singleton()->get("run/window_placement/screen");
-
if (screen == 0) {
screen = OS::get_singleton()->get_current_screen();
} else {
@@ -78,7 +77,6 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
screen_rect.size = OS::get_singleton()->get_screen_size(screen);
Size2 desired_size;
-
desired_size.x = ProjectSettings::get_singleton()->get("display/window/size/width");
desired_size.y = ProjectSettings::get_singleton()->get("display/window/size/height");
@@ -93,41 +91,41 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
int window_placement = EditorSettings::get_singleton()->get("run/window_placement/rect");
switch (window_placement) {
- case 0: { // default
+ case 0: { // top left
- args.push_back("-p");
- args.push_back(itos(screen_rect.position.x) + "x" + itos(screen_rect.position.y));
+ args.push_back("--position");
+ args.push_back(itos(screen_rect.position.x) + "," + itos(screen_rect.position.y));
} break;
case 1: { // centered
Vector2 pos = screen_rect.position + ((screen_rect.size - desired_size) / 2).floor();
- args.push_back("-p");
- args.push_back(itos(pos.x) + "x" + itos(pos.y));
+ args.push_back("--position");
+ args.push_back(itos(pos.x) + "," + itos(pos.y));
} break;
case 2: { // custom pos
Vector2 pos = EditorSettings::get_singleton()->get("run/window_placement/rect_custom_position");
pos += screen_rect.position;
- args.push_back("-p");
- args.push_back(itos(pos.x) + "x" + itos(pos.y));
+ args.push_back("--position");
+ args.push_back(itos(pos.x) + "," + itos(pos.y));
} break;
case 3: { // force maximized
Vector2 pos = screen_rect.position;
- args.push_back("-p");
- args.push_back(itos(pos.x) + "x" + itos(pos.y));
- args.push_back("-mx");
+ args.push_back("--position");
+ args.push_back(itos(pos.x) + "," + itos(pos.y));
+ args.push_back("--maximized");
} break;
case 4: { // force fullscreen
Vector2 pos = screen_rect.position;
- args.push_back("-p");
- args.push_back(itos(pos.x) + "x" + itos(pos.y));
- args.push_back("-f");
+ args.push_back("--position");
+ args.push_back(itos(pos.x) + "," + itos(pos.y));
+ args.push_back("--fullscreen");
} break;
}
if (p_breakpoints.size()) {
- args.push_back("-bp");
+ args.push_back("--breakpoints");
String bpoints;
for (const List<String>::Element *E = p_breakpoints.front(); E; E = E->next()) {
@@ -152,7 +150,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
String exec = OS::get_singleton()->get_executable_path();
- printf("running: %ls", exec.c_str());
+ printf("Running: %ls", exec.c_str());
for (List<String>::Element *E = args.front(); E; E = E->next()) {
printf(" %ls", E->get().c_str());
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 70367f1e07..5c8e166730 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -615,6 +615,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("text_editor/line_numbers/line_length_guideline_column", 80);
hints["text_editor/line_numbers/line_length_guideline_column"] = PropertyInfo(Variant::INT, "text_editor/line_numbers/line_length_guideline_column", PROPERTY_HINT_RANGE, "20, 160, 10");
+ set("text_editor/open_scripts/smooth_scrolling", true);
+ set("text_editor/open_scripts/v_scroll_speed", 80);
set("text_editor/open_scripts/show_members_overview", true);
set("text_editor/files/trim_trailing_whitespace_on_save", false);
@@ -663,6 +665,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("editors/3d/emulate_3_button_mouse", false);
set("editors/3d/warped_mouse_panning", true);
+ set("editors/3d/orbit_sensitivity", 0.4);
+
set("editors/3d/freelook_base_speed", 1);
set("editors/3d/freelook_activation_modifier", 0);
@@ -683,7 +687,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("editors/poly_editor/point_grab_radius", 8);
set("run/window_placement/rect", 1);
- hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Default,Centered,Custom Position,Force Maximized,Force Full Screen");
+ hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Top Left,Centered,Custom Position,Force Maximized,Force Fullscreen");
String screen_hints = TTR("Default (Same as Editor)");
for (int i = 0; i < OS::get_singleton()->get_screen_count(); i++) {
screen_hints += ",Monitor " + itos(i + 1);
@@ -721,11 +725,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("filesystem/import/pvrtc_texture_tool", "");
#ifdef WINDOWS_ENABLED
- hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "*.exe");
+ hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "*.exe");
#else
- hints["import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "");
+ hints["filesystem/import/pvrtc_texture_tool"] = PropertyInfo(Variant::STRING, "filesystem/import/pvrtc_texture_tool", PROPERTY_HINT_GLOBAL_FILE, "");
#endif
- // TODO: Rename to "filesystem/import/pvrtc_fast_conversion" to match other names?
set("filesystem/import/pvrtc_fast_conversion", false);
set("run/auto_save/save_before_running", true);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 11150371d2..7843b53ce9 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -513,19 +513,19 @@ Ref<Theme> create_editor_theme() {
Ref<StyleBoxFlat> graphsb = make_flat_stylebox(Color(0, 0, 0, 0.3), 16, 24, 16, 5);
graphsb->set_border_width_all(border_width);
graphsb->set_border_color_all(Color(1, 1, 1, 0.6));
- graphsb = add_additional_border(graphsb, 0, -22, 0, 0);
+ graphsb->set_border_width(MARGIN_TOP, 22 * EDSCALE + border_width);
Ref<StyleBoxFlat> graphsbselected = make_flat_stylebox(Color(0, 0, 0, 0.4), 16, 24, 16, 5);
graphsbselected->set_border_width_all(border_width);
graphsbselected->set_border_color_all(Color(1, 1, 1, 0.9));
- graphsbselected = add_additional_border(graphsbselected, 0, -22, 0, 0);
+ graphsbselected->set_border_width(MARGIN_TOP, 22 * EDSCALE + border_width);
Ref<StyleBoxFlat> graphsbcomment = make_flat_stylebox(Color(0, 0, 0, 0.3), 16, 24, 16, 5);
graphsbcomment->set_border_width_all(border_width);
graphsbcomment->set_border_color_all(Color(1, 1, 1, 0.6));
- graphsbcomment = add_additional_border(graphsbcomment, 0, -22, 0, 0);
+ graphsbcomment->set_border_width(MARGIN_TOP, 22 * EDSCALE + border_width);
Ref<StyleBoxFlat> graphsbcommentselected = make_flat_stylebox(Color(0, 0, 0, 0.4), 16, 24, 16, 5);
graphsbcommentselected->set_border_width_all(border_width);
graphsbcommentselected->set_border_color_all(Color(1, 1, 1, 0.9));
- graphsbcommentselected = add_additional_border(graphsbcommentselected, 0, -22, 0, 0);
+ graphsbcommentselected->set_border_width(MARGIN_TOP, 22 * EDSCALE + border_width);
theme->set_stylebox("frame", "GraphNode", graphsb);
theme->set_stylebox("selectedframe", "GraphNode", graphsbselected);
theme->set_stylebox("comment", "GraphNode", graphsbcomment);
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 6e24d4d2cb..55975bdefa 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -212,7 +212,7 @@ void AnimationTreeEditor::_edit_dialog_animation_changed() {
void AnimationTreeEditor::_edit_dialog_edit_animation() {
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
get_tree()->get_root()->get_child(0)->call("_resource_selected", property_editor->get_variant().operator RefPtr());
};
};
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 9e57e53a24..79bf68b061 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -561,7 +561,7 @@ bool CanvasItemEditor::_select_click_on_item(CanvasItem *item, Point2 p_click_po
editor_selection->clear();
editor_selection->add_node(item);
// Reselect
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
editor->call("edit_node", item);
}
}
diff --git a/editor/plugins/cube_grid_theme_editor_plugin.cpp b/editor/plugins/cube_grid_theme_editor_plugin.cpp
index b26b2aec4f..1fcd514b31 100644
--- a/editor/plugins/cube_grid_theme_editor_plugin.cpp
+++ b/editor/plugins/cube_grid_theme_editor_plugin.cpp
@@ -368,7 +368,6 @@ MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) {
p_node->get_viewport()->add_child(theme_editor);
theme_editor->set_area_as_parent_rect();
- theme_editor->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
theme_editor->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_BEGIN);
theme_editor->set_end(Point2(0, 22));
theme_editor->hide();
diff --git a/editor/plugins/sample_editor_plugin.cpp b/editor/plugins/sample_editor_plugin.cpp
index 1d6417e2d5..2dd6de1683 100644
--- a/editor/plugins/sample_editor_plugin.cpp
+++ b/editor/plugins/sample_editor_plugin.cpp
@@ -374,8 +374,8 @@ SampleEditor::SampleEditor() {
sample_texframe->add_child(info_label);
info_label->set_area_as_parent_rect();
info_label->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,-15);
- info_label->set_margin(MARGIN_BOTTOM,4);
- info_label->set_margin(MARGIN_RIGHT,4);
+ info_label->set_margin(MARGIN_BOTTOM,-4);
+ info_label->set_margin(MARGIN_RIGHT,-4);
info_label->set_align(Label::ALIGN_RIGHT);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index fc89a4b9b4..6db732ba5d 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1126,10 +1126,6 @@ void ScriptEditor::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
tab_container->add_style_override("panel", editor->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles"));
-
- Ref<StyleBox> sb = editor->get_gui_base()->get_stylebox("panel", "TabContainer")->duplicate();
- sb->set_default_margin(MARGIN_TOP, 0);
- add_style_override("panel", sb);
} break;
default:
@@ -2269,9 +2265,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
members_overview_enabled = true;
editor = p_editor;
- Ref<StyleBox> sb = p_editor->get_gui_base()->get_stylebox("panel", "TabContainer")->duplicate();
- sb->set_default_margin(MARGIN_TOP, 0);
- add_style_override("panel", sb);
VBoxContainer *main_container = memnew(VBoxContainer);
add_child(main_container);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 1aa9f04484..1a3092b6e4 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -867,6 +867,21 @@ void ScriptTextEditor::_edit_option(int p_op) {
//tx->deselect();
} break;
+ case EDIT_DELETE_LINE: {
+
+ TextEdit *tx = code_editor->get_text_edit();
+ Ref<Script> scr = get_edited_script();
+ if (scr.is_null())
+ return;
+
+ tx->begin_complex_operation();
+ int line = tx->cursor_get_line();
+ tx->set_line(tx->cursor_get_line(), "");
+ tx->backspace_at_cursor();
+ tx->cursor_set_line(line);
+ tx->end_complex_operation();
+
+ } break;
case EDIT_CLONE_DOWN: {
TextEdit *tx = code_editor->get_text_edit();
@@ -1392,6 +1407,7 @@ ScriptTextEditor::ScriptTextEditor() {
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_down"), EDIT_MOVE_LINE_DOWN);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/clone_down"), EDIT_CLONE_DOWN);
edit_menu->get_popup()->add_separator();
@@ -1466,6 +1482,7 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/select_all", TTR("Select All"), KEY_MASK_CMD | KEY_A);
ED_SHORTCUT("script_text_editor/move_up", TTR("Move Up"), KEY_MASK_ALT | KEY_UP);
ED_SHORTCUT("script_text_editor/move_down", TTR("Move Down"), KEY_MASK_ALT | KEY_DOWN);
+ ED_SHORTCUT("script_text_editor/delete_line", TTR("Delete Line"), KEY_MASK_CTRL | KEY_MASK_SHIFT | KEY_K);
//leave these at zero, same can be accomplished with tab/shift-tab, including selection
//the next/previous in history shortcut in this case makes a lot more sene.
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index e55847832f..c505976223 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -74,6 +74,7 @@ class ScriptTextEditor : public ScriptEditorBase {
EDIT_MOVE_LINE_DOWN,
EDIT_INDENT_RIGHT,
EDIT_INDENT_LEFT,
+ EDIT_DELETE_LINE,
EDIT_CLONE_DOWN,
EDIT_PICK_COLOR,
EDIT_TO_UPPERCASE,
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 5faacf7a67..bca1f254b0 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -1453,8 +1453,12 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
case NAVIGATION_ORBIT: {
Point2i relative = _get_warped_mouse_motion(m);
- cursor.x_rot += relative.y / 80.0;
- cursor.y_rot += relative.x / 80.0;
+
+ real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/orbit_sensitivity");
+ real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
+
+ cursor.x_rot += relative.y * radians_per_pixel;
+ cursor.y_rot += relative.x * radians_per_pixel;
if (cursor.x_rot > Math_PI / 2.0)
cursor.x_rot = Math_PI / 2.0;
if (cursor.x_rot < -Math_PI / 2.0)
@@ -1468,8 +1472,12 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
// It technically works too in ortho, but it's awful for a user due to fov being near zero
if (!orthogonal) {
Point2i relative = _get_warped_mouse_motion(m);
- cursor.x_rot += relative.y / 120.0;
- cursor.y_rot += relative.x / 120.0;
+
+ real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/orbit_sensitivity");
+ real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
+
+ cursor.x_rot += relative.y * radians_per_pixel;
+ cursor.y_rot += relative.x * radians_per_pixel;
if (cursor.x_rot > Math_PI / 2.0)
cursor.x_rot = Math_PI / 2.0;
if (cursor.x_rot < -Math_PI / 2.0)
@@ -2897,7 +2905,7 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) {
si->sbox_instance = VisualServer::get_singleton()->instance_create2(selection_box->get_rid(), sp->get_world()->get_scenario());
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(si->sbox_instance, VS::SHADOW_CASTING_SETTING_OFF);
- if (get_tree()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint())
editor->call("edit_node", sp);
return si;
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index bed4727bb9..8396b4d412 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -294,7 +294,6 @@ TileSetEditorPlugin::TileSetEditorPlugin(EditorNode *p_node) {
p_node->get_viewport()->add_child(tileset_editor);
tileset_editor->set_area_as_parent_rect();
- tileset_editor->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
tileset_editor->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_BEGIN);
tileset_editor->set_end(Point2(0, 22));
tileset_editor->hide();
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index dc0c888eea..608dc9d31a 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -465,7 +465,7 @@ void ProjectManager::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- get_tree()->set_editor_hint(true);
+ Engine::get_singleton()->set_editor_hint(true);
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
@@ -929,10 +929,10 @@ void ProjectManager::_open_project_confirm() {
List<String> args;
- args.push_back("-path");
+ args.push_back("--path");
args.push_back(path);
- args.push_back("-editor");
+ args.push_back("--editor");
String exec = OS::get_singleton()->get_executable_path();
@@ -969,7 +969,6 @@ void ProjectManager::_run_project_confirm() {
return;
}
-
const String &selected = E->key();
String path = EditorSettings::get_singleton()->get("projects/" + selected);
@@ -983,7 +982,7 @@ void ProjectManager::_run_project_confirm() {
List<String> args;
- args.push_back("-path");
+ args.push_back("--path");
args.push_back(path);
String exec = OS::get_singleton()->get_executable_path();
@@ -1220,7 +1219,7 @@ ProjectManager::ProjectManager() {
panel->add_child(vb);
vb->set_area_as_parent_rect(20 * EDSCALE);
vb->set_margin(MARGIN_TOP, 4 * EDSCALE);
- vb->set_margin(MARGIN_BOTTOM, 4 * EDSCALE);
+ vb->set_margin(MARGIN_BOTTOM, -4 * EDSCALE);
vb->add_constant_override("separation", 15 * EDSCALE);
String cp;
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 0ec83d8a36..1bd748a083 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -1939,10 +1939,8 @@ CustomPropertyEditor::CustomPropertyEditor() {
text_edit = memnew(TextEdit);
add_child(text_edit);
- text_edit->set_area_as_parent_rect();
- for (int i = 0; i < 4; i++)
- text_edit->set_margin((Margin)i, 5);
- text_edit->set_margin(MARGIN_BOTTOM, 30);
+ text_edit->set_area_as_parent_rect(5);
+ text_edit->set_margin(MARGIN_BOTTOM, -30);
text_edit->hide();
text_edit->connect("text_changed", this, "_text_edit_changed");
diff --git a/editor/run_settings_dialog.cpp b/editor/run_settings_dialog.cpp
index 4548ae0939..dfb152d40b 100644
--- a/editor/run_settings_dialog.cpp
+++ b/editor/run_settings_dialog.cpp
@@ -88,7 +88,5 @@ RunSettingsDialog::RunSettingsDialog() {
get_ok()->set_text(TTR("Close"));
//get_cancel()->set_text("Close");
- arguments->set_text("-l $scene");
-
set_title(TTR("Scene Run Settings"));
}
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 94ef712c25..2fab78e8c0 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -573,8 +573,10 @@ void SceneTreeEditor::set_selected(Node *p_node, bool p_emit_selected) {
selected = NULL;
_update_tree();
selected = p_node;
- if (p_emit_selected)
- emit_signal("node_selected");
+ }
+
+ if (p_emit_selected) {
+ emit_signal("node_selected");
}
}
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index bcf24b98f6..fee67df9c9 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1090,9 +1090,6 @@ void ScriptEditorDebugger::stop() {
EditorNode::get_singleton()->get_pause_button()->set_pressed(false);
EditorNode::get_singleton()->get_pause_button()->set_disabled(true);
- //avoid confusion when stopped debugging but an object is still edited
- EditorNode::get_singleton()->push_item(NULL);
-
if (hide_on_stop) {
if (is_visible_in_tree())
EditorNode::get_singleton()->hide_bottom_panel();
diff --git a/main/main.cpp b/main/main.cpp
index e00a482bde..e49c66dddf 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -28,6 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "main.h"
+
#include "app_icon.gen.h"
#include "core/register_core_types.h"
#include "drivers/register_driver_types.h"
@@ -110,6 +111,9 @@ static bool force_lowdpi = false;
static int init_screen = -1;
static bool use_vsync = true;
static bool editor = false;
+static bool show_help = false;
+
+static OS::ProcessID allow_focus_steal_pid = 0;
static String unescape_cmdline(const String &p_str) {
@@ -126,63 +130,88 @@ static String unescape_cmdline(const String &p_str) {
void Main::print_help(const char *p_binary) {
- OS::get_singleton()->print(VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur.\n");
- OS::get_singleton()->print("Usage: %s [options] [scene]\n", p_binary);
- OS::get_singleton()->print("Options:\n");
- OS::get_singleton()->print("\t-path [dir] : Path to a game, containing project.godot\n");
-#ifdef TOOLS_ENABLED
- OS::get_singleton()->print("\t-e,-editor : Bring up the editor instead of running the scene.\n");
-#endif
- OS::get_singleton()->print("\t-test [test] : Run a test.\n");
- OS::get_singleton()->print("\t\t(");
- const char **test_names = tests_get_names();
- const char *coma = "";
- while (*test_names) {
+ OS::get_singleton()->print(VERSION_FULL_NAME " - https://godotengine.org\n");
+ OS::get_singleton()->print("(c) 2007-2017 Juan Linietsky, Ariel Manzur.\n");
+ OS::get_singleton()->print("(c) 2014-2017 Godot Engine contributors.\n");
+ OS::get_singleton()->print("\n");
+ OS::get_singleton()->print("Usage: %s [options] [path to scene or 'project.godot' file]\n", p_binary);
+ OS::get_singleton()->print("\n");
- OS::get_singleton()->print("%s%s", coma, *test_names);
- test_names++;
- coma = ", ";
- }
- OS::get_singleton()->print(")\n");
-
- OS::get_singleton()->print("\t-r WIDTHxHEIGHT\t : Request Window Resolution\n");
- OS::get_singleton()->print("\t-p XxY\t : Request Window Position\n");
- OS::get_singleton()->print("\t-f\t\t : Request Fullscreen\n");
- OS::get_singleton()->print("\t-mx\t\t Request Maximized\n");
- OS::get_singleton()->print("\t-w\t\t Request Windowed\n");
- OS::get_singleton()->print("\t-vd DRIVER\t : Video Driver (");
- for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) {
+ OS::get_singleton()->print("General options:\n");
+ OS::get_singleton()->print(" -h, --help Display this help message.\n");
+ OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n");
+ OS::get_singleton()->print(" --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n");
+ OS::get_singleton()->print("\n");
+ OS::get_singleton()->print("Run options:\n");
+#ifdef TOOLS_ENABLED
+ OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n");
+ OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n");
+#endif
+ OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n");
+ OS::get_singleton()->print(" --path <directory> Path to a project (<directory> must contain a 'project.godot' file).\n");
+ OS::get_singleton()->print(" --main-pack <file> Path to a pack (.pck) file to load.\n");
+ OS::get_singleton()->print(" --render-thread <mode> Render thread mode ('unsafe', 'safe', 'separate').\n");
+ OS::get_singleton()->print(" --remote-fs <address> Remote filesystem (<host/IP>[:<port>] address).\n");
+ OS::get_singleton()->print(" --remote-fs-password <password> Password for remote filesystem.\n");
+ OS::get_singleton()->print(" --audio-driver <driver> Audio driver (");
+ for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
if (i != 0)
OS::get_singleton()->print(", ");
- OS::get_singleton()->print("%s", OS::get_singleton()->get_video_driver_name(i));
+ OS::get_singleton()->print("'%s'", OS::get_singleton()->get_audio_driver_name(i));
}
- OS::get_singleton()->print(")\n");
- OS::get_singleton()->print("\t-ldpi\t : Force low-dpi mode (OSX Only)\n");
-
- OS::get_singleton()->print("\t-ad DRIVER\t : Audio Driver (");
- for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
-
+ OS::get_singleton()->print(").\n");
+ OS::get_singleton()->print(" --video-driver <driver> Video driver (");
+ for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) {
if (i != 0)
OS::get_singleton()->print(", ");
- OS::get_singleton()->print("%s", OS::get_singleton()->get_audio_driver_name(i));
+ OS::get_singleton()->print("'%s'", OS::get_singleton()->get_video_driver_name(i));
}
- OS::get_singleton()->print(")\n");
- OS::get_singleton()->print("\t-rthread <mode>\t : Render Thread Mode ('unsafe', 'safe', 'separate').\n");
- OS::get_singleton()->print("\t-s,-script [script] : Run a script.\n");
- OS::get_singleton()->print("\t-d,-debug : Debug (local stdout debugger).\n");
- OS::get_singleton()->print("\t-rdebug ADDRESS : Remote debug (<ip>:<port> host address).\n");
- OS::get_singleton()->print("\t-fdelay [msec]: Simulate high CPU load (delay each frame by [msec]).\n");
- OS::get_singleton()->print("\t-timescale [msec]: Simulate high CPU load (delay each frame by [msec]).\n");
- OS::get_singleton()->print("\t-bp : breakpoint list as source::line comma separated pairs, no spaces (%%20,%%2C,etc instead).\n");
- OS::get_singleton()->print("\t-v : Verbose stdout mode\n");
- OS::get_singleton()->print("\t-lang [locale]: Use a specific locale\n");
- OS::get_singleton()->print("\t-rfs <host/ip>[:<port>] : Remote FileSystem.\n");
- OS::get_singleton()->print("\t-rfs_pass <password> : Password for Remote FileSystem.\n");
+ OS::get_singleton()->print(").\n");
+ OS::get_singleton()->print("\n");
+
+ OS::get_singleton()->print("Display options:\n");
+ OS::get_singleton()->print(" -f, --fullscreen Request fullscreen mode.\n");
+ OS::get_singleton()->print(" -m, --maximized Request a maximized window.\n");
+ OS::get_singleton()->print(" -w, --windowed Request windowed mode.\n");
+ OS::get_singleton()->print(" --resolution <W>x<H> Request window resolution.\n");
+ OS::get_singleton()->print(" --position <X>,<Y> Request window position.\n");
+ OS::get_singleton()->print(" --low-dpi Force low-DPI mode (macOS only).\n");
+ OS::get_singleton()->print(" --no-window Disable window creation (Windows only). Useful together with --script.\n");
+ OS::get_singleton()->print("\n");
+
+ OS::get_singleton()->print("Debug options:\n");
+ OS::get_singleton()->print(" -d, --debug Debug (local stdout debugger).\n");
+ OS::get_singleton()->print(" -b, --breakpoints Breakpoint list as source::line comma-separated pairs, no spaces (use %%20 instead).\n");
+ OS::get_singleton()->print(" --profiling Enable profiling in the script debugger.\n");
+ OS::get_singleton()->print(" --remote-debug <address> Remote debug (<host/IP>:<port> address).\n");
+#ifdef DEBUG_ENABLED
+ OS::get_singleton()->print(" --debug-collisions Show collisions shapes when running the scene.\n");
+ OS::get_singleton()->print(" --debug-navigation Show navigation polygons when running the scene.\n");
+#endif
+ OS::get_singleton()->print(" --frame-delay <ms> Simulate high CPU load (delay each frame by <ms> milliseconds).\n");
+ OS::get_singleton()->print(" --time-scale <scale> Force time scale (higher values are faster, 1.0 is normal speed).\n");
+ OS::get_singleton()->print("\n");
+
+ OS::get_singleton()->print("Standalone tools:\n");
+ OS::get_singleton()->print(" -s, --script <script> Run a script.\n");
#ifdef TOOLS_ENABLED
- OS::get_singleton()->print("\t-doctool FILE: Dump the whole engine api to FILE in XML format. If FILE exists, it will be merged.\n");
- OS::get_singleton()->print("\t-nodocbase: Disallow dump the base types (used with -doctool).\n");
- OS::get_singleton()->print("\t-export [target] Export the project using given export target.\n");
+ OS::get_singleton()->print(" --export <target> Export the project using the given export target.\n");
+ OS::get_singleton()->print(" --export-debug Use together with --export, enables debug mode for the template.\n");
+ OS::get_singleton()->print(" --doctool <file> Dump the whole engine API to <file> in XML format. If <file> exists, it will be merged.\n");
+ OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n");
+#ifdef DEBUG_METHODS_ENABLED
+ OS::get_singleton()->print(" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
+#endif
+ OS::get_singleton()->print(" --test <test> Run a unit test (");
+ const char **test_names = tests_get_names();
+ const char *comma = "";
+ while (*test_names) {
+ OS::get_singleton()->print("%s'%s'", comma, *test_names);
+ test_names++;
+ comma = ", ";
+ }
+ OS::get_singleton()->print(").\n");
#endif
}
@@ -252,15 +281,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
String remotefs;
String remotefs_pass;
- String screen = "";
-
- List<String> pack_list;
Vector<String> breakpoints;
bool use_custom_res = true;
bool force_res = false;
- I = args.front();
-
packed_data = PackedData::get_singleton();
if (!packed_data)
packed_data = memnew(PackedData);
@@ -277,18 +301,17 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
packed_data->add_pack_source(zip_packed_data);
#endif
+ I = args.front();
while (I) {
List<String>::Element *N = I->next();
- if (I->get() == "-noop") {
-
- // no op
- } else if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // resolution
+ if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // display help
+ show_help = true;
goto error;
- } else if (I->get() == "-r") { // resolution
+ } else if (I->get() == "--resolution") { // force resolution
if (I->next()) {
@@ -296,16 +319,16 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (vm.find("x") == -1) { // invalid parameter format
- OS::get_singleton()->print("Invalid -r argument: %s\n", vm.utf8().get_data());
+ OS::get_singleton()->print("Invalid resolution '%s', it should be e.g. '1280x720'.\n", vm.utf8().get_data());
goto error;
}
int w = vm.get_slice("x", 0).to_int();
int h = vm.get_slice("x", 1).to_int();
- if (w == 0 || h == 0) {
+ if (w <= 0 || h <= 0) {
- OS::get_singleton()->print("Invalid -r resolution, x and y must be >0\n");
+ OS::get_singleton()->print("Invalid resolution '%s', width and height must be above 0.\n", vm.utf8().get_data());
goto error;
}
@@ -315,84 +338,86 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
N = I->next()->next();
} else {
- OS::get_singleton()->print("Invalid -p argument, needs resolution\n");
+ OS::get_singleton()->print("Missing resolution argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-p") { // position
+ } else if (I->get() == "--position") { // set window position
if (I->next()) {
String vm = I->next()->get();
- if (vm.find("x") == -1) { // invalid parameter format
+ if (vm.find(",") == -1) { // invalid parameter format
- OS::get_singleton()->print("Invalid -p argument: %s\n", vm.utf8().get_data());
+ OS::get_singleton()->print("Invalid position '%s', it should be e.g. '80,128'.\n", vm.utf8().get_data());
goto error;
}
- int x = vm.get_slice("x", 0).to_int();
- int y = vm.get_slice("x", 1).to_int();
+ int x = vm.get_slice(",", 0).to_int();
+ int y = vm.get_slice(",", 1).to_int();
init_custom_pos = Point2(x, y);
init_use_custom_pos = true;
N = I->next()->next();
} else {
- OS::get_singleton()->print("Invalid -r argument, needs position\n");
+ OS::get_singleton()->print("Missing position argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-mx") { // video driver
+ } else if (I->get() == "-m" || I->get() == "--maximized") { // force maximized window
init_maximized = true;
- } else if (I->get() == "-w") { // video driver
+ } else if (I->get() == "-w" || I->get() == "--windowed") { // force windowed window
init_windowed = true;
- } else if (I->get() == "-profile") { // video driver
+ } else if (I->get() == "--profiling") { // enable profiling
use_debug_profiler = true;
- } else if (I->get() == "-vd") { // video driver
+ } else if (I->get() == "--video-driver") { // force video driver
if (I->next()) {
video_driver = I->next()->get();
N = I->next()->next();
} else {
- OS::get_singleton()->print("Invalid -cd argument, needs driver name\n");
+ OS::get_singleton()->print("Missing video driver argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-lang") { // language
+ } else if (I->get() == "-l" || I->get() == "--language") { // language
if (I->next()) {
locale = I->next()->get();
N = I->next()->next();
} else {
- OS::get_singleton()->print("Invalid -lang argument, needs language code\n");
+ OS::get_singleton()->print("Missing language argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-ldpi") { // language
+ } else if (I->get() == "--low-dpi") { // force low DPI (macOS only)
force_lowdpi = true;
- } else if (I->get() == "-rfs") { // language
+ } else if (I->get() == "--remote-fs") { // remote filesystem
if (I->next()) {
remotefs = I->next()->get();
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing remote filesystem address, aborting.\n");
goto error;
}
- } else if (I->get() == "-rfs_pass") { // language
+ } else if (I->get() == "--remote-fs-password") { // remote filesystem password
if (I->next()) {
remotefs_pass = I->next()->get();
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing remote filesystem password, aborting.\n");
goto error;
}
- } else if (I->get() == "-rthread") { // language
+ } else if (I->get() == "--render-thread") { // render thread mode
if (I->next()) {
@@ -405,35 +430,37 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing render thread mode argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-ad") { // video driver
+ } else if (I->get() == "--audio-driver") { // audio driver
if (I->next()) {
audio_driver = I->next()->get();
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing audio driver argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-f") { // fullscreen
+ } else if (I->get() == "-f" || I->get() == "--fullscreen") { // force fullscreen
//video_mode.fullscreen=false;
init_fullscreen = true;
- } else if (I->get() == "-e" || I->get() == "-editor") { // fonud editor
+ } else if (I->get() == "-e" || I->get() == "--editor") { // starts editor
editor = true;
- } else if (I->get() == "-nowindow") { // fullscreen
+ } else if (I->get() == "--no-window") { // disable window creation, Windows only
OS::get_singleton()->set_no_window_mode(true);
- } else if (I->get() == "-quiet") { // fullscreen
+ } else if (I->get() == "--quiet") { // quieter output
quiet_stdout = true;
- } else if (I->get() == "-v") { // fullscreen
+ } else if (I->get() == "-v" || I->get() == "--verbose") { // verbose output
OS::get_singleton()->_verbose_stdout = true;
- } else if (I->get() == "-path") { // resolution
+ } else if (I->get() == "--path") { // set path of project to start or edit
if (I->next()) {
@@ -445,6 +472,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing relative or absolute path, aborting.\n");
goto error;
}
} else if (I->get().ends_with("project.godot")) {
@@ -464,7 +492,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED
editor = true;
#endif
- } else if (I->get() == "-bp") { // /breakpoints
+ } else if (I->get() == "-b" || I->get() == "--breakpoints") { // add breakpoints
if (I->next()) {
@@ -472,88 +500,72 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
breakpoints = bplist.split(",");
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing list of breakpoints, aborting.\n");
goto error;
}
- } else if (I->get() == "-fdelay") { // resolution
+ } else if (I->get() == "--frame-delay") { // force frame delay
if (I->next()) {
frame_delay = I->next()->get().to_int();
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing frame delay argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-timescale") { // resolution
+ } else if (I->get() == "--time-scale") { // force time scale
if (I->next()) {
Engine::get_singleton()->set_time_scale(I->next()->get().to_double());
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing time scale argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-pack") {
-
- if (I->next()) {
-
- pack_list.push_back(I->next()->get());
- N = I->next()->next();
- } else {
-
- goto error;
- };
-
- } else if (I->get() == "-main_pack") {
+ } else if (I->get() == "--main-pack") {
if (I->next()) {
main_pack = I->next()->get();
N = I->next()->next();
} else {
-
+ OS::get_singleton()->print("Missing path to main pack file, aborting.\n");
goto error;
};
- } else if (I->get() == "-debug" || I->get() == "-d") {
+ } else if (I->get() == "-d" || I->get() == "--debug") {
debug_mode = "local";
#ifdef DEBUG_ENABLED
- } else if (I->get() == "-debugcol" || I->get() == "-dc") {
+ } else if (I->get() == "--debug-collisions") {
debug_collisions = true;
- } else if (I->get() == "-debugnav" || I->get() == "-dn") {
+ } else if (I->get() == "--debug-navigation") {
debug_navigation = true;
#endif
- } else if (I->get() == "-editor_scene") {
-
- if (I->next()) {
-
- ProjectSettings::get_singleton()->set("editor_scene", game_path = I->next()->get());
- } else {
- goto error;
- }
-
- } else if (I->get() == "-rdebug") {
+ } else if (I->get() == "--remote-debug") {
if (I->next()) {
debug_mode = "remote";
debug_host = I->next()->get();
- if (debug_host.find(":") == -1) { //wrong host
- OS::get_singleton()->print("Invalid debug host string\n");
+ if (debug_host.find(":") == -1) { // wrong address
+ OS::get_singleton()->print("Invalid debug host address, it should be of the form <host/IP>:<port>.\n");
goto error;
}
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing remote debug host address, aborting.\n");
goto error;
}
- } else if (I->get() == "-epid") {
+ } else if (I->get() == "--allow_focus_steal_pid") { // not exposed to user
if (I->next()) {
- int editor_pid = I->next()->get().to_int();
- ProjectSettings::get_singleton()->set("editor_pid", editor_pid);
+ allow_focus_steal_pid = I->next()->get().to_int64();
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing editor PID argument, aborting.\n");
goto error;
}
} else {
@@ -617,7 +629,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Error err = file_access_network_client->connect(remotefs, port, remotefs_pass);
if (err) {
- OS::get_singleton()->printerr("Could not connect to remotefs: %s:%i\n", remotefs.utf8().get_data(), port);
+ OS::get_singleton()->printerr("Could not connect to remotefs: %s:%i.\n", remotefs.utf8().get_data(), port);
goto error;
}
@@ -653,14 +665,15 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED
editor = false;
#else
- OS::get_singleton()->print("error: Couldn't load game path '%s'\n", game_path.ascii().get_data());
+ OS::get_singleton()->print("Error: Could not load game path '%s'.\n", game_path.ascii().get_data());
goto error;
#endif
}
if (editor) {
- main_args.push_back("-editor");
+ Engine::get_singleton()->set_editor_hint(true);
+ main_args.push_back("--editor");
init_maximized = true;
use_custom_res = false;
}
@@ -742,11 +755,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->_render_thread_mode = OS::RenderThreadMode(rtm);
}
- /* Determine Video Driver */
-
- if (audio_driver == "") { // specified in project.godot
- audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0));
- }
+ /* Determine audio and video drivers */
for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) {
@@ -764,6 +773,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
//goto error;
}
+ if (audio_driver == "") { // specified in project.godot
+ audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0));
+ }
+
for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
if (audio_driver == OS::get_singleton()->get_audio_driver_name(i)) {
@@ -831,7 +844,8 @@ error:
args.clear();
main_args.clear();
- print_help(execpath);
+ if (show_help)
+ print_help(execpath);
if (performance)
memdelete(performance);
@@ -1000,6 +1014,10 @@ Error Main::setup2() {
#endif
+ if (allow_focus_steal_pid) {
+ OS::get_singleton()->enable_for_stealing_focus(allow_focus_steal_pid);
+ }
+
MAIN_PRINT("Main: Load Scripts, Modules, Drivers");
register_module_types();
@@ -1047,23 +1065,18 @@ bool Main::start() {
String game_path;
String script;
String test;
- String screen;
String _export_preset;
- String _import;
- String _import_script;
- bool noquit = false;
bool export_debug = false;
bool project_manager_request = false;
+
List<String> args = OS::get_singleton()->get_cmdline_args();
for (int i = 0; i < args.size(); i++) {
//parameters that do not have an argument to the right
- if (args[i] == "-nodocbase") {
+ if (args[i] == "--no-docbase") {
doc_base = false;
- } else if (args[i] == "-noquit") {
- noquit = true;
- } else if (args[i] == "-editor" || args[i] == "-e") {
+ } else if (args[i] == "-e" || args[i] == "--editor") {
editor = true;
- } else if (args[i] == "-pm" || args[i] == "-project_manager") {
+ } else if (args[i] == "-p" || args[i] == "--project-manager") {
project_manager_request = true;
} else if (args[i].length() && args[i][0] != '-' && game_path == "") {
game_path = args[i];
@@ -1071,29 +1084,21 @@ bool Main::start() {
//parameters that have an argument to the right
else if (i < (args.size() - 1)) {
bool parsed_pair = true;
- if (args[i] == "-doctool") {
+ if (args[i] == "--doctool") {
doc_tool = args[i + 1];
for (int j = i + 2; j < args.size(); j++)
removal_docs.push_back(args[j]);
- } else if (args[i] == "-script" || args[i] == "-s") {
+ } else if (args[i] == "-s" || args[i] == "--script") {
script = args[i + 1];
- } else if (args[i] == "-level" || args[i] == "-l") {
- Engine::get_singleton()->_custom_level = args[i + 1];
- } else if (args[i] == "-test") {
+ } else if (args[i] == "--test") {
test = args[i + 1];
- } else if (args[i] == "-export") {
+ } else if (args[i] == "--export") {
editor = true; //needs editor
_export_preset = args[i + 1];
- } else if (args[i] == "-export_debug") {
+ } else if (args[i] == "--export-debug") {
editor = true; //needs editor
_export_preset = args[i + 1];
export_debug = true;
- } else if (args[i] == "-import") {
- editor = true; //needs editor
- _import = args[i + 1];
- } else if (args[i] == "-import_script") {
- editor = true; //needs editor
- _import_script = args[i + 1];
} else {
// The parameter does not match anything known, don't skip the next argument
parsed_pair = false;
@@ -1139,7 +1144,7 @@ bool Main::start() {
if (_export_preset != "") {
if (game_path == "") {
String err = "Command line param ";
- err += export_debug ? "-export_debug" : "-export";
+ err += export_debug ? "--export-debug" : "--export";
err += " passed but no destination path given.\n";
err += "Please specify the binary's file path to export to. Aborting export.";
ERR_PRINT(err.utf8().get_data());
@@ -1199,7 +1204,7 @@ bool Main::start() {
if (!main_loop) {
if (!ClassDB::class_exists(main_loop_type)) {
- OS::get_singleton()->alert("godot: error: MainLoop type doesn't exist: " + main_loop_type);
+ OS::get_singleton()->alert("Error: MainLoop type doesn't exist: " + main_loop_type);
return false;
} else {
@@ -1349,19 +1354,8 @@ bool Main::start() {
#ifdef TOOLS_ENABLED
if (editor) {
- if (_import != "") {
-
- //editor_node->import_scene(_import,local_game_path,_import_script);
- if (!noquit)
- sml->quit();
- game_path = ""; //no load anything
- } else {
-
- Error serr = editor_node->load_scene(local_game_path);
- }
+ Error serr = editor_node->load_scene(local_game_path);
OS::get_singleton()->set_context(OS::CONTEXT_EDITOR);
-
- //editor_node->set_edited_scene(game);
}
#endif
}
@@ -1435,7 +1429,6 @@ bool Main::start() {
n->set_name(name);
//defer so references are all valid on _ready()
- //sml->get_root()->add_child(n);
to_add.push_back(n);
if (global_var) {
@@ -1460,7 +1453,6 @@ bool Main::start() {
ERR_EXPLAIN("Failed loading scene: " + local_game_path);
ERR_FAIL_COND_V(!scene, false)
- //sml->get_root()->add_child(scene);
sml->add_current_scene(scene);
String iconpath = GLOBAL_DEF("application/config/icon", "Variant()");
@@ -1474,27 +1466,6 @@ bool Main::start() {
}
#ifdef TOOLS_ENABLED
-
- /*if (_export_platform!="") {
-
- sml->quit();
- }*/
-
- /*
- if (sml->get_root_node()) {
-
- Console *console = memnew( Console );
-
- sml->get_root_node()->cast_to<RootNode>()->set_console(console);
- if (GLOBAL_DEF("console/visible_default",false).operator bool()) {
-
- console->show();
- } else {P
-
- console->hide();
- };
- }
-*/
if (project_manager_request || (script == "" && test == "" && game_path == "" && !editor)) {
ProjectManager *pmanager = memnew(ProjectManager);
@@ -1503,7 +1474,6 @@ bool Main::start() {
sml->get_root()->add_child(pmanager);
OS::get_singleton()->set_context(OS::CONTEXT_PROJECTMAN);
}
-
#endif
}
@@ -1584,10 +1554,6 @@ bool Main::iteration() {
time_accum -= frame_slice;
message_queue->flush();
- /*
- if (AudioServer::get_singleton())
- AudioServer::get_singleton()->update();
- */
fixed_process_ticks = MAX(fixed_process_ticks, OS::get_singleton()->get_ticks_usec() - fixed_begin); // keep the largest one for reference
fixed_process_max = MAX(OS::get_singleton()->get_ticks_usec() - fixed_begin, fixed_process_max);
@@ -1636,7 +1602,6 @@ bool Main::iteration() {
script_debugger->idle_poll();
}
- //x11_delay_usec(10000);
frames++;
Engine::get_singleton()->_idle_frames++;
@@ -1738,7 +1703,6 @@ void Main::cleanup() {
unregister_core_driver_types();
unregister_core_types();
- //PerformanceMetrics::finish();
OS::get_singleton()->clear_last_error();
OS::get_singleton()->finalize_core();
}
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 440cc45479..fc4fc5c10d 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -229,7 +229,7 @@ bool GDNative::initialize() {
godot_gdnative_init_options options;
- options.in_editor = SceneTree::get_singleton()->is_editor_hint();
+ options.in_editor = Engine::get_singleton()->is_editor_hint();
options.core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE);
options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);
options.no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE);
@@ -265,7 +265,7 @@ bool GDNative::terminate() {
// TODO(karroffel): remove this? Should be part of NativeScript, not
// GDNative IMO
godot_gdnative_terminate_options options;
- options.in_editor = SceneTree::get_singleton()->is_editor_hint();
+ options.in_editor = Engine::get_singleton()->is_editor_hint();
library_terminate_pointer(&options);
diff --git a/modules/gdnative/godot/string.h b/modules/gdnative/godot/string.h
index c901ce36e6..7695cd7931 100644
--- a/modules/gdnative/godot/string.h
+++ b/modules/gdnative/godot/string.h
@@ -172,7 +172,7 @@ void GDAPI godot_string_utf8(godot_string *p_self, char *result);
godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8);
godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len);
godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8);
-godot_string GDAPI godot_string_chars_utf8_with_len(const char *p_utf8, godot_int p_len);
+godot_string GDAPI godot_string_chars_to_utf8_with_len(const char *p_utf8, godot_int p_len);
uint32_t GDAPI godot_string_hash(const godot_string *p_self);
uint64_t GDAPI godot_string_hash64(const godot_string *p_self);
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index f8b45af85a..3fa0a38024 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -35,6 +35,7 @@
#ifdef TOOLS_ENABLED
#include "editor/editor_file_system.h"
#include "editor/editor_settings.h"
+#include "engine.h"
#endif
void GDScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const {
@@ -2371,7 +2372,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
String GDScriptLanguage::_get_indentation() const {
#ifdef TOOLS_ENABLED
- if (SceneTree::get_singleton()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
bool use_space_indentation = EDITOR_DEF("text_editor/indent/type", 0);
if (use_space_indentation) {
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 38f58799df..7bb80c2510 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -1203,7 +1203,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
edit_mode = memnew(OptionButton);
edit_mode->set_area_as_parent_rect();
edit_mode->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 24);
- edit_mode->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -14);
+ edit_mode->set_margin(MARGIN_RIGHT, -14);
edit_mode->add_item("Tiles");
edit_mode->add_item("Areas");
hb->add_child(edit_mode);
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index d1cf0f1dce..b4bdbe16b4 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -273,7 +273,7 @@ void VisualScript::_node_ports_changed(int p_id) {
Function &func = functions[function];
Ref<VisualScriptNode> vsn = func.nodes[p_id].node;
- if (OS::get_singleton()->get_main_loop() && OS::get_singleton()->get_main_loop()->cast_to<SceneTree>() && OS::get_singleton()->get_main_loop()->cast_to<SceneTree>()->is_editor_hint()) {
+ if (OS::get_singleton()->get_main_loop() && OS::get_singleton()->get_main_loop()->cast_to<SceneTree>() && Engine::get_singleton()->is_editor_hint()) {
vsn->validate_input_default_values(); //force validate default values when editing on editor
}
@@ -1578,12 +1578,15 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
VisualScriptNodeInstance::StartMode start_mode;
{
- if (p_resuming_yield)
+ if (p_resuming_yield) {
start_mode = VisualScriptNodeInstance::START_MODE_RESUME_YIELD;
- else if (!flow_stack || !(flow_stack[flow_stack_pos] & VisualScriptNodeInstance::FLOW_STACK_PUSHED_BIT)) //if there is a push bit, it means we are continuing a sequence
- start_mode = VisualScriptNodeInstance::START_MODE_BEGIN_SEQUENCE;
- else
+ p_resuming_yield = false; // should resume only the first time
+ } else if (flow_stack && (flow_stack[flow_stack_pos] & VisualScriptNodeInstance::FLOW_STACK_PUSHED_BIT)) {
+ //if there is a push bit, it means we are continuing a sequence
start_mode = VisualScriptNodeInstance::START_MODE_CONTINUE_SEQUENCE;
+ } else {
+ start_mode = VisualScriptNodeInstance::START_MODE_BEGIN_SEQUENCE;
+ }
}
VSDEBUG("STEP - STARTSEQ: " + itos(start_mode));
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 9a1033e954..b9e7a6ffc4 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -3279,7 +3279,6 @@ VisualScriptEditor::VisualScriptEditor() {
select_func_text->set_valign(Label::VALIGN_CENTER);
select_func_text->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(select_func_text);
- graph->set_area_as_parent_rect();
hint_text = memnew(Label);
hint_text->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -100);
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index afdf50027e..e94bb8fba5 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -1164,7 +1164,7 @@ void VisualScriptPropertySet::_update_cache() {
if (!OS::get_singleton()->get_main_loop()->cast_to<SceneTree>())
return;
- if (!OS::get_singleton()->get_main_loop()->cast_to<SceneTree>()->is_editor_hint()) //only update cache if editor exists, it's pointless otherwise
+ if (!Engine::get_singleton()->is_editor_hint()) //only update cache if editor exists, it's pointless otherwise
return;
if (call_mode == CALL_MODE_BASIC_TYPE) {
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 3c52834d92..ee93c29577 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1220,10 +1220,10 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
/*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host");
int port = EditorSettings::get_singleton()->get("filesystem/file_server/post");
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
- cl.push_back("-rfs");
+ cl.push_back("--remote-fs");
cl.push_back(host+":"+itos(port));
if (passwd!="") {
- cl.push_back("-rfs_pass");
+ cl.push_back("--remote-fs-password");
cl.push_back(passwd);
}*/
@@ -1243,10 +1243,10 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
err = save_pack(pf);
memdelete(pf);
- cl.push_back("-use_apk_expansion");
- cl.push_back("-apk_expansion_md5");
+ cl.push_back("--use_apk_expansion");
+ cl.push_back("--apk_expansion_md5");
cl.push_back(FileAccess::get_md5(fullpath));
- cl.push_back("-apk_expansion_key");
+ cl.push_back("--apk_expansion_key");
cl.push_back(apk_expansion_pkey.strip_edges());
} else {
@@ -1262,10 +1262,10 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
}
if (use_32_fb)
- cl.push_back("-use_depth_32");
+ cl.push_back("--use_depth_32");
if (immersive)
- cl.push_back("-use_immersive");
+ cl.push_back("--use_immersive");
if (cl.size()) {
//add comandline
@@ -3330,10 +3330,10 @@ public:
/*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host");
int port = EditorSettings::get_singleton()->get("filesystem/file_server/post");
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
- cl.push_back("-rfs");
+ cl.push_back("--remote-fs");
cl.push_back(host+":"+itos(port));
if (passwd!="") {
- cl.push_back("-rfs_pass");
+ cl.push_back("--remote-fs-password");
cl.push_back(passwd);
}*/
@@ -3350,10 +3350,10 @@ public:
return OK;
}
- cl.push_back("-use_apk_expansion");
- cl.push_back("-apk_expansion_md5");
+ cl.push_back("--use_apk_expansion");
+ cl.push_back("--apk_expansion_md5");
cl.push_back(FileAccess::get_md5(fullpath));
- cl.push_back("-apk_expansion_key");
+ cl.push_back("--apk_expansion_key");
cl.push_back(apk_expansion_pkey.strip_edges());
} else {
@@ -3367,10 +3367,10 @@ public:
}
if (use_32_fb)
- cl.push_back("-use_depth_32");
+ cl.push_back("--use_depth_32");
if (immersive)
- cl.push_back("-use_immersive");
+ cl.push_back("--use_immersive");
if (cl.size()) {
//add comandline
diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp
index 6fbd42d7b3..5933b83d06 100644
--- a/platform/android/godot_android.cpp
+++ b/platform/android/godot_android.cpp
@@ -616,7 +616,6 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) {
//do initialization here, when there's OpenGL! hackish but the only way
engine->os = new OS_Android(_gfx_init, engine);
- //char *args[]={"-test","gui",NULL};
__android_log_print(ANDROID_LOG_INFO, "godot", "pre asdasd setup...");
#if 0
Error err = Main::setup("apk",2,args);
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java
index d620b2b9c4..d444d37c2f 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -387,7 +387,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
new_cmdline = new String[ 2 ];
}
- new_cmdline[cll]="-main_pack";
+ new_cmdline[cll]="--main_pack";
new_cmdline[cll+1]=expansion_pack_path;
command_line=new_cmdline;
}
@@ -452,9 +452,9 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
for(int i=0;i<command_line.length;i++) {
boolean has_extra = i< command_line.length -1;
- if (command_line[i].equals("-use_depth_32")) {
+ if (command_line[i].equals("--use_depth_32")) {
use_32_bits=true;
- } else if (command_line[i].equals("-use_immersive")) {
+ } else if (command_line[i].equals("--use_immersive")) {
use_immersive=true;
if(Build.VERSION.SDK_INT >= 19.0){ // check if the application runs on an android 4.4+
window.getDecorView().setSystemUiVisibility(
@@ -467,12 +467,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
UiChangeListener();
}
- } else if (command_line[i].equals("-use_apk_expansion")) {
+ } else if (command_line[i].equals("--use_apk_expansion")) {
use_apk_expansion=true;
- } else if (has_extra && command_line[i].equals("-apk_expansion_md5")) {
+ } else if (has_extra && command_line[i].equals("--apk_expansion_md5")) {
main_pack_md5=command_line[i+1];
i++;
- } else if (has_extra && command_line[i].equals("-apk_expansion_key")) {
+ } else if (has_extra && command_line[i].equals("--apk_expansion_key")) {
main_pack_key=command_line[i+1];
SharedPreferences prefs = getSharedPreferences("app_data_keys", MODE_PRIVATE);
Editor editor = prefs.edit();
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 683e1cfb22..eb139fb471 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -844,7 +844,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
} else {
//__android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is: %s\n",i,rawString);
- if (strcmp(rawString, "-main_pack") == 0)
+ if (strcmp(rawString, "--main_pack") == 0)
use_apk_expansion = true;
}
@@ -867,7 +867,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
__android_log_print(ANDROID_LOG_INFO, "godot", "**SETUP");
#if 0
- char *args[]={"-test","render",NULL};
+ char *args[]={"--test","render",NULL};
__android_log_print(ANDROID_LOG_INFO,"godot","pre asdasd setup...");
Error err = Main::setup("apk",2,args,false);
#else
diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm
index 574598e1d3..921ef8f607 100644
--- a/platform/iphone/view_controller.mm
+++ b/platform/iphone/view_controller.mm
@@ -42,7 +42,7 @@ int add_path(int p_argc, char **p_args) {
if (!str)
return p_argc;
- p_args[p_argc++] = "-path";
+ p_args[p_argc++] = "--path";
[str retain]; // memory leak lol (maybe make it static here and delete it in ViewController destructor? @todo
p_args[p_argc++] = (char *)[str cString];
p_args[p_argc] = NULL;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 6d8a6eca66..33b1e64dd4 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1514,9 +1514,14 @@ Point2 OS_OSX::get_window_position() const {
void OS_OSX::set_window_position(const Point2 &p_position) {
- Point2 size = p_position;
- size /= display_scale;
- [window_object setFrame:NSMakeRect(size.x, size.y, [window_object frame].size.width, [window_object frame].size.height) display:YES];
+ Size2 scr = get_screen_size();
+ NSPoint pos;
+
+ pos.x = p_position.x / display_scale;
+ // For OS X the y starts at the bottom
+ pos.y = (scr.height - p_position.y) / display_scale;
+
+ [window_object setFrameTopLeftPoint:pos];
_update_window();
};
diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp
index c773c0b746..8824d1c1d0 100644
--- a/platform/uwp/app.cpp
+++ b/platform/uwp/app.cpp
@@ -512,7 +512,7 @@ void App::UpdateWindowSize(Size size) {
char **App::get_command_line(unsigned int *out_argc) {
- static char *fail_cl[] = { "-path", "game", NULL };
+ static char *fail_cl[] = { "--path", "game", NULL };
*out_argc = 2;
FILE *f = _wfopen(L"__cl__.cl", L"rb");
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 39717196aa..68307c4e90 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -1330,7 +1330,7 @@ public:
}
if (!(p_flags & DEBUG_FLAG_DUMB_CLIENT)) {
- cl.push_back("-path");
+ cl.push_back("--path");
cl.push_back("game");
}
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index 1423a804ff..73782e1515 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -1,7 +1,10 @@
#include "audio_stream_player_2d.h"
+
+#include "engine.h"
#include "scene/2d/area_2d.h"
#include "scene/main/viewport.h"
+
void AudioStreamPlayer2D::_mix_audio() {
if (!stream_playback.is_valid()) {
@@ -120,7 +123,7 @@ void AudioStreamPlayer2D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
AudioServer::get_singleton()->add_callback(_mix_audios, this);
- if (autoplay && !get_tree()->is_editor_hint()) {
+ if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
play();
}
}
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 20571abdb9..07c3099a72 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -38,7 +38,7 @@ void Camera2D::_update_scroll() {
if (!is_inside_tree())
return;
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
update(); //will just be drawn
return;
}
@@ -85,7 +85,7 @@ Transform2D Camera2D::get_camera_transform() {
if (anchor_mode == ANCHOR_MODE_DRAG_CENTER) {
- if (h_drag_enabled && !get_tree()->is_editor_hint()) {
+ if (h_drag_enabled && !Engine::get_singleton()->is_editor_hint()) {
camera_pos.x = MIN(camera_pos.x, (new_camera_pos.x + screen_size.x * 0.5 * drag_margin[MARGIN_RIGHT]));
camera_pos.x = MAX(camera_pos.x, (new_camera_pos.x - screen_size.x * 0.5 * drag_margin[MARGIN_LEFT]));
} else {
@@ -97,7 +97,7 @@ Transform2D Camera2D::get_camera_transform() {
}
}
- if (v_drag_enabled && !get_tree()->is_editor_hint()) {
+ if (v_drag_enabled && !Engine::get_singleton()->is_editor_hint()) {
camera_pos.y = MIN(camera_pos.y, (new_camera_pos.y + screen_size.y * 0.5 * drag_margin[MARGIN_BOTTOM]));
camera_pos.y = MAX(camera_pos.y, (new_camera_pos.y - screen_size.y * 0.5 * drag_margin[MARGIN_TOP]));
@@ -136,7 +136,7 @@ Transform2D Camera2D::get_camera_transform() {
camera_pos.y -= screen_rect.position.y - limit[MARGIN_TOP];
}
- if (smoothing_enabled && !get_tree()->is_editor_hint()) {
+ if (smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
float c = smoothing * get_fixed_process_delta_time();
smoothed_camera_pos = ((camera_pos - smoothed_camera_pos) * c) + smoothed_camera_pos;
@@ -240,7 +240,7 @@ void Camera2D::_notification(int p_what) {
add_to_group(group_name);
add_to_group(canvas_group_name);
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
set_fixed_process(false);
}
@@ -262,7 +262,7 @@ void Camera2D::_notification(int p_what) {
} break;
case NOTIFICATION_DRAW: {
- if (!is_inside_tree() || !get_tree()->is_editor_hint())
+ if (!is_inside_tree() || !Engine::get_singleton()->is_editor_hint())
break;
if (screen_drawing_enabled) {
@@ -497,7 +497,7 @@ void Camera2D::align() {
void Camera2D::set_follow_smoothing(float p_speed) {
smoothing = p_speed;
- if (smoothing > 0 && !(is_inside_tree() && get_tree()->is_editor_hint()))
+ if (smoothing > 0 && !(is_inside_tree() && Engine::get_singleton()->is_editor_hint()))
set_fixed_process(true);
else
set_fixed_process(false);
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 3d0b5047ae..cdd8fdf350 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -734,7 +734,7 @@ void CanvasItem::draw_set_transform_matrix(const Transform2D &p_matrix) {
VisualServer::get_singleton()->canvas_item_add_set_transform(canvas_item, p_matrix);
}
-void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture> p_texture, const Ref<Texture> &p_normal_map) {
+void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture> p_texture, const Ref<Texture> &p_normal_map, bool p_antialiased) {
if (!drawing) {
ERR_EXPLAIN("Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
@@ -744,10 +744,10 @@ void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color
RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
RID rid_normal = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- VisualServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, p_colors, p_uvs, rid, rid_normal);
+ VisualServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, p_colors, p_uvs, rid, rid_normal, p_antialiased);
}
-void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs, Ref<Texture> p_texture, const Ref<Texture> &p_normal_map) {
+void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs, Ref<Texture> p_texture, const Ref<Texture> &p_normal_map, bool p_antialiased) {
if (!drawing) {
ERR_EXPLAIN("Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
@@ -759,7 +759,7 @@ void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Colo
RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
RID rid_normal = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- VisualServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, colors, p_uvs, rid, rid_normal);
+ VisualServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, colors, p_uvs, rid, rid_normal, p_antialiased);
}
void CanvasItem::draw_string(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, const Color &p_modulate, int p_clip_w) {
@@ -985,8 +985,8 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true));
ClassDB::bind_method(D_METHOD("draw_style_box", "style_box", "rect"), &CanvasItem::draw_style_box);
ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture", "width", "normal_map"), &CanvasItem::draw_primitive, DEFVAL(Variant()), DEFVAL(1.0), DEFVAL(Variant()));
- ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture", "normal_map"), &CanvasItem::draw_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()));
- ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture", "normal_map"), &CanvasItem::draw_colored_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture", "normal_map", "antialiased"), &CanvasItem::draw_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture", "normal_map", "antialiased"), &CanvasItem::draw_colored_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_string", "font", "pos", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1)), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("draw_char", "font", "pos", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1)));
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 660ddcf930..c6180e07b6 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -251,8 +251,8 @@ public:
void draw_texture_rect_region(const Ref<Texture> &p_texture, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture> &p_normal_map = Ref<Texture>(), bool p_clip_uv = true);
void draw_style_box(const Ref<StyleBox> &p_style_box, const Rect2 &p_rect);
void draw_primitive(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture> p_texture = Ref<Texture>(), float p_width = 1, const Ref<Texture> &p_normal_map = Ref<Texture>());
- void draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture> p_texture = Ref<Texture>(), const Ref<Texture> &p_normal_map = Ref<Texture>());
- void draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture> p_texture = Ref<Texture>(), const Ref<Texture> &p_normal_map = Ref<Texture>());
+ void draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture> p_texture = Ref<Texture>(), const Ref<Texture> &p_normal_map = Ref<Texture>(), bool p_antialiased = false);
+ void draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture> p_texture = Ref<Texture>(), const Ref<Texture> &p_normal_map = Ref<Texture>(), bool p_antialiased = false);
void draw_string(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, const Color &p_modulate = Color(1, 1, 1), int p_clip_w = -1);
float draw_char(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_char, const String &p_next = "", const Color &p_modulate = Color(1, 1, 1));
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index bd669eb4c8..433661e393 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -30,6 +30,7 @@
#include "collision_polygon_2d.h"
#include "collision_object_2d.h"
+#include "engine.h"
#include "scene/resources/concave_polygon_shape_2d.h"
#include "scene/resources/convex_polygon_shape_2d.h"
@@ -134,7 +135,7 @@ void CollisionPolygon2D::_notification(int p_what) {
parent->shape_owner_set_one_way_collision(owner_id, one_way_collision);
}
- /*if (get_tree()->is_editor_hint()) {
+ /*if (Engine::get_singleton()->is_editor_hint()) {
//display above all else
set_z_as_relative(false);
set_z(VS::CANVAS_ITEM_Z_MAX - 1);
@@ -158,7 +159,7 @@ void CollisionPolygon2D::_notification(int p_what) {
case NOTIFICATION_DRAW: {
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
+ if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
break;
}
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index ff4aa245ec..3fda4ab464 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -28,7 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "collision_shape_2d.h"
+
#include "collision_object_2d.h"
+#include "engine.h"
#include "scene/resources/capsule_shape_2d.h"
#include "scene/resources/circle_shape_2d.h"
#include "scene/resources/concave_polygon_shape_2d.h"
@@ -59,7 +61,7 @@ void CollisionShape2D::_notification(int p_what) {
parent->shape_owner_set_one_way_collision(owner_id, one_way_collision);
}
- /*if (get_tree()->is_editor_hint()) {
+ /*if (Engine::get_singleton()->is_editor_hint()) {
//display above all else
set_z_as_relative(false);
set_z(VS::CANVAS_ITEM_Z_MAX - 1);
@@ -90,7 +92,7 @@ void CollisionShape2D::_notification(int p_what) {
} break;*/
case NOTIFICATION_DRAW: {
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
+ if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
break;
}
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index 1bb40a28b5..ee41dca3a6 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "joints_2d.h"
+
+#include "engine.h"
#include "physics_body_2d.h"
#include "servers/physics_2d_server.h"
@@ -152,7 +154,7 @@ void PinJoint2D::_notification(int p_what) {
if (!is_inside_tree())
break;
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
+ if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
break;
}
@@ -227,7 +229,7 @@ void GrooveJoint2D::_notification(int p_what) {
if (!is_inside_tree())
break;
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
+ if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
break;
}
@@ -317,7 +319,7 @@ void DampedSpringJoint2D::_notification(int p_what) {
if (!is_inside_tree())
break;
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
+ if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
break;
}
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index ffe69fa93f..2b11913ddf 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "light_2d.h"
+
+#include "engine.h"
#include "servers/visual_server.h"
void Light2D::edit_set_pivot(const Point2 &p_pivot) {
@@ -70,7 +72,7 @@ void Light2D::_update_light_visibility() {
#ifdef TOOLS_ENABLED
if (editor_only) {
- if (!get_tree()->is_editor_hint()) {
+ if (!Engine::get_singleton()->is_editor_hint()) {
editor_ok = false;
} else {
editor_ok = (get_tree()->get_edited_scene_root() && (this == get_tree()->get_edited_scene_root() || get_owner() == get_tree()->get_edited_scene_root()));
diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp
index a1a8e7d9c4..e926ca0fe1 100644
--- a/scene/2d/light_occluder_2d.cpp
+++ b/scene/2d/light_occluder_2d.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "light_occluder_2d.h"
+#include "engine.h"
+
void OccluderPolygon2D::set_polygon(const PoolVector<Vector2> &p_polygon) {
polygon = p_polygon;
@@ -130,7 +132,7 @@ void LightOccluder2D::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
if (occluder_polygon.is_valid()) {
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp
index 779751c1c5..7515d486c2 100644
--- a/scene/2d/navigation_polygon.cpp
+++ b/scene/2d/navigation_polygon.cpp
@@ -30,6 +30,7 @@
#include "navigation_polygon.h"
#include "core_string_names.h"
+#include "engine.h"
#include "navigation2d.h"
#include "thirdparty/misc/triangulator.h"
@@ -297,7 +298,7 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) {
}
}
- if (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())
+ if (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())
update();
//update_gizmo();
@@ -352,7 +353,7 @@ void NavigationPolygonInstance::_notification(int p_what) {
} break;
case NOTIFICATION_DRAW: {
- if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) {
+ if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) {
PoolVector<Vector2> verts = navpoly->get_vertices();
int vsize = verts.size();
@@ -432,7 +433,7 @@ Ref<NavigationPolygon> NavigationPolygonInstance::get_navigation_polygon() const
void NavigationPolygonInstance::_navpoly_changed() {
- if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()))
+ if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()))
update();
}
diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp
index 0e83b9aaae..a5a59252a9 100644
--- a/scene/2d/parallax_layer.cpp
+++ b/scene/2d/parallax_layer.cpp
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "parallax_layer.h"
+
+#include "engine.h"
#include "parallax_background.h"
void ParallaxLayer::set_motion_scale(const Size2 &p_scale) {
@@ -111,7 +113,7 @@ void ParallaxLayer::set_base_offset_and_scale(const Point2 &p_offset, float p_sc
if (!is_inside_tree())
return;
- if (get_tree()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint())
return;
Point2 new_ofs = ((orig_offset + p_offset) * motion_scale) * p_scale + motion_offset;
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index a2ec33f403..40c16e5062 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "particles_2d.h"
+#include "engine.h"
#include "scene/3d/particles.h"
#include "scene/scene_string_names.h"
@@ -295,7 +296,7 @@ void Particles2D::_notification(int p_what) {
VS::get_singleton()->canvas_item_add_particles(get_canvas_item(), particles, texture_rid, normal_rid, h_frames, v_frames);
#ifdef TOOLS_ENABLED
- if (get_tree()->is_editor_hint() && (this == get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->is_a_parent_of(this))) {
+ if (Engine::get_singleton()->is_editor_hint() && (this == get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->is_a_parent_of(this))) {
draw_rect(visibility_rect, Color(0, 0.7, 0.9, 0.4), false);
}
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index 6b30e97de8..a79f60c96f 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "path_2d.h"
+
+#include "engine.h"
#include "scene/scene_string_names.h"
void Path2D::_notification(int p_what) {
@@ -35,7 +37,7 @@ void Path2D::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW && curve.is_valid()) {
//draw the curve!!
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_navigation_hint()) {
+ if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_navigation_hint()) {
return;
}
@@ -56,7 +58,7 @@ void Path2D::_notification(int p_what) {
void Path2D::_curve_changed() {
- if (is_inside_tree() && get_tree()->is_editor_hint())
+ if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
update();
}
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 6ec1642138..3fd442429d 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "physics_body_2d.h"
+
+#include "engine.h"
#include "scene/scene_string_names.h"
void PhysicsBody2D::_notification(int p_what) {
@@ -802,13 +804,13 @@ void RigidBody2D::_notification(int p_what) {
#ifdef TOOLS_ENABLED
if (p_what == NOTIFICATION_ENTER_TREE) {
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
set_notify_local_transform(true); //used for warnings and only in editor
}
}
if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) {
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
update_configuration_warning();
}
}
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 5c1c953a37..7e2d6d1b5a 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -176,9 +176,10 @@ void Polygon2D::_notification(int p_what) {
}
}
- Vector<int> indices = Geometry::triangulate_polygon(points);
+ // Vector<int> indices = Geometry::triangulate_polygon(points);
+ // VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, texture.is_valid() ? texture->get_rid() : RID());
- VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, texture.is_valid() ? texture->get_rid() : RID());
+ VS::get_singleton()->canvas_item_add_polygon(get_canvas_item(), points, colors, uvs, texture.is_valid() ? texture->get_rid() : RID(), RID(), antialiased);
} break;
}
@@ -294,6 +295,16 @@ bool Polygon2D::get_invert() const {
return invert;
}
+void Polygon2D::set_antialiased(bool p_antialiased) {
+
+ antialiased = p_antialiased;
+ update();
+}
+bool Polygon2D::get_antialiased() const {
+
+ return antialiased;
+}
+
void Polygon2D::set_invert_border(float p_invert_border) {
invert_border = p_invert_border;
@@ -348,6 +359,9 @@ void Polygon2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_invert", "invert"), &Polygon2D::set_invert);
ClassDB::bind_method(D_METHOD("get_invert"), &Polygon2D::get_invert);
+ ClassDB::bind_method(D_METHOD("set_antialiased", "antialiased"), &Polygon2D::set_antialiased);
+ ClassDB::bind_method(D_METHOD("get_antialiased"), &Polygon2D::get_antialiased);
+
ClassDB::bind_method(D_METHOD("set_invert_border", "invert_border"), &Polygon2D::set_invert_border);
ClassDB::bind_method(D_METHOD("get_invert_border"), &Polygon2D::get_invert_border);
@@ -359,6 +373,7 @@ void Polygon2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "vertex_colors"), "set_vertex_colors", "get_vertex_colors");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_offset", "get_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "antialiased"), "set_antialiased", "get_antialiased");
ADD_GROUP("Texture", "");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture");
ADD_GROUP("Texture", "texture_");
@@ -375,6 +390,7 @@ Polygon2D::Polygon2D() {
invert = 0;
invert_border = 100;
+ antialiased = false;
tex_rot = 0;
tex_tile = true;
tex_scale = Vector2(1, 1);
diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h
index 3cc9db28b6..eb47f4d8d1 100644
--- a/scene/2d/polygon_2d.h
+++ b/scene/2d/polygon_2d.h
@@ -47,6 +47,7 @@ class Polygon2D : public Node2D {
float tex_rot;
bool invert;
float invert_border;
+ bool antialiased;
Vector2 offset;
mutable bool rect_cache_dirty;
@@ -87,6 +88,9 @@ public:
void set_invert(bool p_invert);
bool get_invert() const;
+ void set_antialiased(bool p_antialiased);
+ bool get_antialiased() const;
+
void set_invert_border(float p_invert_border);
float get_invert_border() const;
diff --git a/scene/2d/position_2d.cpp b/scene/2d/position_2d.cpp
index 74ad9c17e2..7688faa23b 100644
--- a/scene/2d/position_2d.cpp
+++ b/scene/2d/position_2d.cpp
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "position_2d.h"
+
+#include "engine.h"
#include "scene/resources/texture.h"
void Position2D::_draw_cross() {
@@ -52,7 +54,7 @@ void Position2D::_notification(int p_what) {
case NOTIFICATION_DRAW: {
if (!is_inside_tree())
break;
- if (get_tree()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint())
_draw_cross();
} break;
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index cfb4059714..fbec922a2d 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -28,14 +28,16 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "ray_cast_2d.h"
+
#include "collision_object_2d.h"
+#include "engine.h"
#include "physics_body_2d.h"
#include "servers/physics_2d_server.h"
void RayCast2D::set_cast_to(const Vector2 &p_point) {
cast_to = p_point;
- if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_collisions_hint()))
+ if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_collisions_hint()))
update();
}
@@ -92,7 +94,7 @@ Vector2 RayCast2D::get_collision_normal() const {
void RayCast2D::set_enabled(bool p_enabled) {
enabled = p_enabled;
- if (is_inside_tree() && !get_tree()->is_editor_hint())
+ if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint())
set_fixed_process(p_enabled);
if (!p_enabled)
collided = false;
@@ -132,7 +134,7 @@ void RayCast2D::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
- if (enabled && !get_tree()->is_editor_hint())
+ if (enabled && !Engine::get_singleton()->is_editor_hint())
set_fixed_process(true);
else
set_fixed_process(false);
@@ -153,7 +155,7 @@ void RayCast2D::_notification(int p_what) {
case NOTIFICATION_DRAW: {
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
+ if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
break;
Transform2D xf;
xf.rotate(cast_to.angle());
diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp
index 37139b2b93..e8e5e9411f 100644
--- a/scene/2d/screen_button.cpp
+++ b/scene/2d/screen_button.cpp
@@ -112,7 +112,7 @@ void TouchScreenButton::_notification(int p_what) {
if (!is_inside_tree())
return;
- if (!get_tree()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility == VISIBILITY_TOUCHSCREEN_ONLY)
+ if (!Engine::get_singleton()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility == VISIBILITY_TOUCHSCREEN_ONLY)
return;
if (finger_pressed != -1) {
@@ -129,7 +129,7 @@ void TouchScreenButton::_notification(int p_what) {
if (!shape_visible)
return;
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
+ if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
return;
if (shape.is_valid()) {
Color draw_col = get_tree()->get_debug_collisions_color();
@@ -141,11 +141,11 @@ void TouchScreenButton::_notification(int p_what) {
} break;
case NOTIFICATION_ENTER_TREE: {
- if (!get_tree()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility == VISIBILITY_TOUCHSCREEN_ONLY)
+ if (!Engine::get_singleton()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility == VISIBILITY_TOUCHSCREEN_ONLY)
return;
update();
- if (!get_tree()->is_editor_hint())
+ if (!Engine::get_singleton()->is_editor_hint())
set_process_input(is_visible_in_tree());
} break;
@@ -154,7 +154,7 @@ void TouchScreenButton::_notification(int p_what) {
_release(true);
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
- if (get_tree()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint())
break;
if (is_visible_in_tree()) {
set_process_input(true);
diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp
index fb71b61d45..54861bbe89 100644
--- a/scene/2d/visibility_notifier_2d.cpp
+++ b/scene/2d/visibility_notifier_2d.cpp
@@ -29,20 +29,20 @@
/*************************************************************************/
#include "visibility_notifier_2d.h"
+#include "engine.h"
#include "particles_2d.h"
#include "scene/2d/animated_sprite.h"
#include "scene/2d/physics_body_2d.h"
#include "scene/animation/animation_player.h"
#include "scene/main/viewport.h"
#include "scene/scene_string_names.h"
-#include "scene/scene_string_names.h"
void VisibilityNotifier2D::_enter_viewport(Viewport *p_viewport) {
ERR_FAIL_COND(viewports.has(p_viewport));
viewports.insert(p_viewport);
- if (is_inside_tree() && get_tree()->is_editor_hint())
+ if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
return;
if (viewports.size() == 1) {
@@ -58,7 +58,7 @@ void VisibilityNotifier2D::_exit_viewport(Viewport *p_viewport) {
ERR_FAIL_COND(!viewports.has(p_viewport));
viewports.erase(p_viewport);
- if (is_inside_tree() && get_tree()->is_editor_hint())
+ if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
return;
emit_signal(SceneStringNames::get_singleton()->viewport_exited, p_viewport);
@@ -74,7 +74,7 @@ void VisibilityNotifier2D::set_rect(const Rect2 &p_rect) {
rect = p_rect;
if (is_inside_tree()) {
get_world_2d()->_update_notifier(this, get_global_transform().xform(rect));
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
update();
item_rect_changed();
}
@@ -108,7 +108,7 @@ void VisibilityNotifier2D::_notification(int p_what) {
} break;
case NOTIFICATION_DRAW: {
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
draw_rect(rect, Color(1, 0.5, 1, 0.2));
}
@@ -236,7 +236,7 @@ void VisibilityEnabler2D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- if (get_tree()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint())
return;
Node *from = this;
@@ -254,7 +254,7 @@ void VisibilityEnabler2D::_notification(int p_what) {
if (p_what == NOTIFICATION_EXIT_TREE) {
- if (get_tree()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint())
return;
for (Map<Node *, Variant>::Element *E = nodes.front(); E; E = E->next()) {
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 6abc2caac8..e86a07c60f 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -215,7 +215,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
velocity_tracker->reset(get_global_transform().origin);
AudioServer::get_singleton()->add_callback(_mix_audios, this);
- if (autoplay && !get_tree()->is_editor_hint()) {
+ if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
play();
}
}
diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp
index 36a6660bf9..a481018890 100644
--- a/scene/3d/interpolated_camera.cpp
+++ b/scene/3d/interpolated_camera.cpp
@@ -29,12 +29,14 @@
/*************************************************************************/
#include "interpolated_camera.h"
+#include "engine.h"
+
void InterpolatedCamera::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
- if (get_tree()->is_editor_hint() && enabled)
+ if (Engine::get_singleton()->is_editor_hint() && enabled)
set_fixed_process(false);
} break;
@@ -106,7 +108,7 @@ void InterpolatedCamera::set_interpolation_enabled(bool p_enable) {
return;
enabled = p_enable;
if (p_enable) {
- if (is_inside_tree() && get_tree()->is_editor_hint())
+ if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
return;
set_process(true);
} else
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 977f1f81a7..b4a62138fb 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "light.h"
+#include "engine.h"
#include "project_settings.h"
#include "scene/resources/surface_tool.h"
@@ -106,6 +107,16 @@ Color Light::get_shadow_color() const {
return shadow_color;
}
+void Light::set_shadow_reverse_cull_face(bool p_enable) {
+ reverse_cull = p_enable;
+ VS::get_singleton()->light_set_reverse_cull_face_mode(light, reverse_cull);
+}
+
+bool Light::get_shadow_reverse_cull_face() const {
+
+ return reverse_cull;
+}
+
Rect3 Light::get_aabb() const {
if (type == VisualServer::LIGHT_DIRECTIONAL) {
@@ -140,7 +151,7 @@ void Light::_update_visibility() {
#ifdef TOOLS_ENABLED
if (editor_only) {
- if (!get_tree()->is_editor_hint()) {
+ if (!Engine::get_singleton()->is_editor_hint()) {
editor_ok = false;
} else {
editor_ok = (get_tree()->get_edited_scene_root() && (this == get_tree()->get_edited_scene_root() || get_owner() == get_tree()->get_edited_scene_root()));
@@ -202,6 +213,9 @@ void Light::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_color", "color"), &Light::set_color);
ClassDB::bind_method(D_METHOD("get_color"), &Light::get_color);
+ ClassDB::bind_method(D_METHOD("set_shadow_reverse_cull_face", "enable"), &Light::set_shadow_reverse_cull_face);
+ ClassDB::bind_method(D_METHOD("get_shadow_reverse_cull_face"), &Light::get_shadow_reverse_cull_face);
+
ClassDB::bind_method(D_METHOD("set_shadow_color", "shadow_color"), &Light::set_shadow_color);
ClassDB::bind_method(D_METHOD("get_shadow_color"), &Light::get_shadow_color);
@@ -217,6 +231,7 @@ void Light::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_bias", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_contact", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_CONTACT_SHADOW_SIZE);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_max_distance", PROPERTY_HINT_RANGE, "0,65536,0.1"), "set_param", "get_param", PARAM_SHADOW_MAX_DISTANCE);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shadow_reverse_cull_face"), "set_shadow_reverse_cull_face", "get_shadow_reverse_cull_face");
ADD_GROUP("Editor", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "is_editor_only");
ADD_GROUP("", "");
@@ -244,6 +259,8 @@ Light::Light(VisualServer::LightType p_type) {
light = VisualServer::get_singleton()->light_create(p_type);
VS::get_singleton()->instance_set_base(get_instance(), light);
+ reverse_cull = false;
+
editor_only = false;
set_color(Color(1, 1, 1, 1));
set_shadow(false);
diff --git a/scene/3d/light.h b/scene/3d/light.h
index 22ff5c0763..788e948536 100644
--- a/scene/3d/light.h
+++ b/scene/3d/light.h
@@ -69,6 +69,7 @@ private:
Color shadow_color;
bool shadow;
bool negative;
+ bool reverse_cull;
uint32_t cull_mask;
VS::LightType type;
bool editor_only;
@@ -110,6 +111,9 @@ public:
void set_shadow_color(const Color &p_shadow_color);
Color get_shadow_color() const;
+ void set_shadow_reverse_cull_face(bool p_enable);
+ bool get_shadow_reverse_cull_face() const;
+
virtual Rect3 get_aabb() const;
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp
index f8df21004e..c40f73541e 100644
--- a/scene/3d/path.cpp
+++ b/scene/3d/path.cpp
@@ -28,11 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "path.h"
+
+#include "engine.h"
#include "scene/scene_string_names.h"
void Path::_notification(int p_what) {
#if 0
- if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && get_scene()->is_editor_hint()) {
+ if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && Engine::get_singleton()->is_editor_hint()) {
//draw the curve!!
for(int i=0;i<curve->get_point_count();i++) {
@@ -53,7 +55,7 @@ void Path::_notification(int p_what) {
void Path::_curve_changed() {
- if (is_inside_tree() && get_tree()->is_editor_hint())
+ if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
update_gizmo();
}
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index dc8f72d77e..e1371e9ed6 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "physics_body.h"
+
+#include "engine.h"
#include "method_bind_ext.gen.inc"
#include "scene/scene_string_names.h"
@@ -476,13 +478,13 @@ void RigidBody::_notification(int p_what) {
#ifdef TOOLS_ENABLED
if (p_what == NOTIFICATION_ENTER_TREE) {
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
set_notify_local_transform(true); //used for warnings and only in editor
}
}
if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) {
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
update_configuration_warning();
}
}
diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp
index 67e7fb0e12..b0aab6cc4d 100644
--- a/scene/3d/ray_cast.cpp
+++ b/scene/3d/ray_cast.cpp
@@ -30,12 +30,14 @@
#include "ray_cast.h"
#include "collision_object.h"
+#include "engine.h"
#include "mesh_instance.h"
#include "servers/physics_server.h"
+
void RayCast::set_cast_to(const Vector3 &p_point) {
cast_to = p_point;
- if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_collisions_hint()))
+ if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_collisions_hint()))
update_gizmo();
if (is_inside_tree() && get_tree()->is_debugging_collisions_hint())
_update_debug_shape();
@@ -94,7 +96,7 @@ Vector3 RayCast::get_collision_normal() const {
void RayCast::set_enabled(bool p_enabled) {
enabled = p_enabled;
- if (is_inside_tree() && !get_tree()->is_editor_hint())
+ if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint())
set_fixed_process(p_enabled);
if (!p_enabled)
collided = false;
@@ -118,7 +120,7 @@ void RayCast::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
- if (enabled && !get_tree()->is_editor_hint()) {
+ if (enabled && !Engine::get_singleton()->is_editor_hint()) {
set_fixed_process(true);
if (get_tree()->is_debugging_collisions_hint())
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index 848b08eb8f..6498238e12 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "spatial.h"
+#include "engine.h"
#include "message_queue.h"
#include "scene/main/viewport.h"
#include "scene/scene_string_names.h"
@@ -134,7 +135,7 @@ void Spatial::_notification(int p_what) {
else
data.C = NULL;
- if (data.toplevel && !get_tree()->is_editor_hint()) {
+ if (data.toplevel && !Engine::get_singleton()->is_editor_hint()) {
if (data.parent) {
data.local_transform = data.parent->get_global_transform() * get_transform();
@@ -178,7 +179,7 @@ void Spatial::_notification(int p_what) {
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, NULL, 0);
}
#ifdef TOOLS_ENABLED
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
//get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this);
get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_request_gizmo, this);
@@ -492,7 +493,7 @@ void Spatial::set_as_toplevel(bool p_enabled) {
if (data.toplevel == p_enabled)
return;
- if (is_inside_tree() && !get_tree()->is_editor_hint()) {
+ if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
if (p_enabled)
set_transform(get_global_transform());
diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp
index cc81a4cb56..2fea451fe7 100644
--- a/scene/3d/visibility_notifier.cpp
+++ b/scene/3d/visibility_notifier.cpp
@@ -29,11 +29,11 @@
/*************************************************************************/
#include "visibility_notifier.h"
+#include "engine.h"
#include "scene/3d/camera.h"
#include "scene/3d/physics_body.h"
#include "scene/animation/animation_player.h"
#include "scene/scene_string_names.h"
-#include "scene/scene_string_names.h"
void VisibilityNotifier::_enter_camera(Camera *p_camera) {
@@ -187,7 +187,7 @@ void VisibilityEnabler::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- if (get_tree()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint())
return;
Node *from = this;
@@ -200,7 +200,7 @@ void VisibilityEnabler::_notification(int p_what) {
if (p_what == NOTIFICATION_EXIT_TREE) {
- if (get_tree()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint())
return;
for (Map<Node *, Variant>::Element *E = nodes.front(); E; E = E->next()) {
diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp
index 1a294d016a..7d61006529 100644
--- a/scene/3d/visual_instance.cpp
+++ b/scene/3d/visual_instance.cpp
@@ -231,14 +231,6 @@ void GeometryInstance::_notification(int p_what) {
void GeometryInstance::set_flag(Flags p_flag, bool p_value) {
ERR_FAIL_INDEX(p_flag, FLAG_MAX);
- if (p_flag == FLAG_CAST_SHADOW) {
- if (p_value == true) {
- set_cast_shadows_setting(SHADOW_CASTING_SETTING_ON);
- } else {
- set_cast_shadows_setting(SHADOW_CASTING_SETTING_OFF);
- }
- }
-
if (flags[p_flag] == p_value)
return;
@@ -252,14 +244,6 @@ bool GeometryInstance::get_flag(Flags p_flag) const {
ERR_FAIL_INDEX_V(p_flag, FLAG_MAX, false);
- if (p_flag == FLAG_CAST_SHADOW) {
- if (shadow_casting_setting == SHADOW_CASTING_SETTING_OFF) {
- return false;
- } else {
- return true;
- }
- }
-
return flags[p_flag];
}
@@ -330,7 +314,6 @@ void GeometryInstance::_bind_methods() {
//ADD_SIGNAL( MethodInfo("visibility_changed"));
- BIND_CONSTANT(FLAG_CAST_SHADOW);
BIND_CONSTANT(FLAG_VISIBLE_IN_ALL_ROOMS);
BIND_CONSTANT(FLAG_MAX);
@@ -350,8 +333,6 @@ GeometryInstance::GeometryInstance() {
flags[i] = false;
}
- flags[FLAG_CAST_SHADOW] = true;
-
shadow_casting_setting = SHADOW_CASTING_SETTING_ON;
extra_cull_margin = 0;
//VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0);
diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h
index 9318198e54..694d0c2499 100644
--- a/scene/3d/visual_instance.h
+++ b/scene/3d/visual_instance.h
@@ -84,7 +84,6 @@ class GeometryInstance : public VisualInstance {
public:
enum Flags {
- FLAG_CAST_SHADOW = VS::INSTANCE_FLAG_CAST_SHADOW,
FLAG_VISIBLE_IN_ALL_ROOMS = VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS,
FLAG_USE_BAKED_LIGHT = VS::INSTANCE_FLAG_USE_BAKED_LIGHT,
FLAG_MAX = VS::INSTANCE_FLAG_MAX,
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index e2a0636466..b111fb8812 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "animation_player.h"
+#include "engine.h"
#include "message_queue.h"
#include "scene/scene_string_names.h"
@@ -199,7 +200,7 @@ void AnimationPlayer::_notification(int p_what) {
} break;
case NOTIFICATION_READY: {
- if (!get_tree()->is_editor_hint() && animation_set.has(autoplay)) {
+ if (!Engine::get_singleton()->is_editor_hint() && animation_set.has(autoplay)) {
play(autoplay);
set_autoplay(""); //this line is the fix for autoplay issues with animatio
_animation_process(0);
@@ -344,7 +345,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
ERR_FAIL_COND(p_anim->node_cache.size() != p_anim->animation->get_track_count());
Animation *a = p_anim->animation.operator->();
- bool can_call = is_inside_tree() && !get_tree()->is_editor_hint();
+ bool can_call = is_inside_tree() && !Engine::get_singleton()->is_editor_hint();
for (int i = 0; i < a->get_track_count(); i++) {
@@ -955,7 +956,7 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float
emit_signal(SceneStringNames::get_singleton()->animation_started, c.assigned);
- if (is_inside_tree() && get_tree()->is_editor_hint())
+ if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
return; // no next in this case
StringName next = animation_get_next(p_name);
diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp
index a8ddcbbb45..d4d8f7dbed 100644
--- a/scene/audio/audio_player.cpp
+++ b/scene/audio/audio_player.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "audio_player.h"
+#include "engine.h"
+
void AudioStreamPlayer::_mix_audio() {
if (!stream_playback.is_valid()) {
@@ -100,7 +102,7 @@ void AudioStreamPlayer::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
AudioServer::get_singleton()->add_callback(_mix_audios, this);
- if (autoplay && !get_tree()->is_editor_hint()) {
+ if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
play();
}
}
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 5e110362c8..5257f9df35 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -204,7 +204,7 @@ void ColorPicker::_update_presets() {
}
void ColorPicker::_text_type_toggled() {
- if (!get_tree()->is_editor_hint())
+ if (!Engine::get_singleton()->is_editor_hint())
return;
text_is_constructor = !text_is_constructor;
if (text_is_constructor) {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index c97426ad42..279128725a 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1329,7 +1329,7 @@ void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bo
void Control::_set_anchor(Margin p_margin, float p_anchor) {
#ifdef TOOLS_ENABLED
- if (is_inside_tree() && get_tree()->is_editor_hint()) {
+ if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) {
set_anchor(p_margin, p_anchor, EDITOR_DEF("editors/2d/keep_margins_when_changing_anchors", false));
} else {
set_anchor(p_margin, p_anchor, false);
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index ef8b0adfa9..b911a18312 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -227,11 +227,11 @@ void WindowDialog::_notification(int p_what) {
} break;
#ifdef TOOLS_ENABLED
case NOTIFICATION_POST_POPUP: {
- if (get_tree() && get_tree()->is_editor_hint() && EditorNode::get_singleton())
+ if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton())
EditorNode::get_singleton()->dim_editor(true);
} break;
case NOTIFICATION_POPUP_HIDE: {
- if (get_tree() && get_tree()->is_editor_hint() && EditorNode::get_singleton())
+ if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton())
EditorNode::get_singleton()->dim_editor(false);
} break;
#endif
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index b2afca8766..84074f96a8 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -493,7 +493,10 @@ void Label::regenerate_word_cache() {
minsize.height = (font->get_height() * line_count) + (line_spacing * (line_count - 1));
}
- minimum_size_changed();
+ if (!autowrap || !clip) {
+ //helps speed up some labels that may change a lot, as no resizing is requested. Do not change.
+ minimum_size_changed();
+ }
word_cache_dirty = false;
}
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index e91f8add31..10c3c84c1e 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -534,7 +534,7 @@ void LineEdit::_notification(int p_what) {
switch (p_what) {
#ifdef TOOLS_ENABLED
case NOTIFICATION_ENTER_TREE: {
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false));
cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65));
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index f2ba6bfbc4..a0cd0eca8b 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "popup.h"
+
+#include "engine.h"
#include "os/keyboard.h"
void Popup::_gui_input(Ref<InputEvent> p_event) {
@@ -48,7 +50,7 @@ void Popup::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
//small helper to make editing of these easier in editor
#ifdef TOOLS_ENABLED
- if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
+ if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
set_as_toplevel(false);
}
#endif
@@ -276,9 +278,10 @@ void PopupPanel::set_child_rect(Control *p_child) {
Ref<StyleBox> p = get_stylebox("panel");
p_child->set_area_as_parent_rect();
- for (int i = 0; i < 4; i++) {
- p_child->set_margin(Margin(i), p->get_margin(Margin(i)));
- }
+ p_child->set_margin(MARGIN_LEFT, p->get_margin(MARGIN_LEFT));
+ p_child->set_margin(MARGIN_RIGHT, -p->get_margin(MARGIN_RIGHT));
+ p_child->set_margin(MARGIN_TOP, p->get_margin(MARGIN_TOP));
+ p_child->set_margin(MARGIN_BOTTOM, -p->get_margin(MARGIN_BOTTOM));
}
void PopupPanel::_notification(int p_what) {
diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp
index 400ff299a9..441c3e721b 100644
--- a/scene/gui/reference_rect.cpp
+++ b/scene/gui/reference_rect.cpp
@@ -29,13 +29,15 @@
/*************************************************************************/
#include "reference_rect.h"
+#include "engine.h"
+
void ReferenceRect::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
if (!is_inside_tree())
return;
- if (get_tree()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint())
draw_style_box(get_stylebox("border"), Rect2(Point2(), get_size()));
}
}
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 2ccdbb05a9..6519cde6d3 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -98,7 +98,18 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (ofs < grabber_ofs) {
- set_value(get_value() - get_page());
+ if (scrolling) {
+ target_scroll = target_scroll - get_page();
+ } else {
+ target_scroll = get_value() - get_page();
+ }
+
+ if (smooth_scroll_enabled) {
+ scrolling = true;
+ set_fixed_process(true);
+ } else {
+ set_value(target_scroll);
+ }
return;
}
@@ -111,8 +122,18 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
drag.value_at_click = get_as_ratio();
update();
} else {
+ if (scrolling) {
+ target_scroll = target_scroll + get_page();
+ } else {
+ target_scroll = get_value() + get_page();
+ }
- set_value(get_value() + get_page());
+ if (smooth_scroll_enabled) {
+ scrolling = true;
+ set_fixed_process(true);
+ } else {
+ set_value(target_scroll);
+ }
}
} else {
@@ -311,7 +332,22 @@ void ScrollBar::_notification(int p_what) {
if (p_what == NOTIFICATION_FIXED_PROCESS) {
- if (drag_slave_touching) {
+ if (scrolling) {
+ if (get_value() != target_scroll) {
+ double target = target_scroll - get_value();
+ double dist = sqrt(target * target);
+ double vel = ((target / dist) * 500) * get_fixed_process_delta_time();
+
+ if (vel >= dist) {
+ set_value(target_scroll);
+ } else {
+ set_value(get_value() + vel);
+ }
+ } else {
+ scrolling = false;
+ set_fixed_process(false);
+ }
+ } else if (drag_slave_touching) {
if (drag_slave_touching_deaccel) {
@@ -639,6 +675,14 @@ NodePath ScrollBar::get_drag_slave() const {
return drag_slave_path;
}
+void ScrollBar::set_smooth_scroll_enabled(bool p_enable) {
+ smooth_scroll_enabled = p_enable;
+}
+
+bool ScrollBar::is_smooth_scroll_enabled() const {
+ return smooth_scroll_enabled;
+}
+
#if 0
void ScrollBar::mouse_button(const Point2& p_pos, int b->get_button_index(),bool b->is_pressed(),int p_modifier_mask) {
@@ -795,6 +839,10 @@ ScrollBar::ScrollBar(Orientation p_orientation) {
drag_slave_touching = false;
drag_slave_touching_deaccel = false;
+ scrolling = false;
+ target_scroll = 0;
+ smooth_scroll_enabled = false;
+
if (focus_by_default)
set_focus_mode(FOCUS_ALL);
set_step(0);
diff --git a/scene/gui/scroll_bar.h b/scene/gui/scroll_bar.h
index 8310e12590..e22d4da46d 100644
--- a/scene/gui/scroll_bar.h
+++ b/scene/gui/scroll_bar.h
@@ -83,6 +83,10 @@ class ScrollBar : public Range {
bool drag_slave_touching_deaccel;
bool click_handled;
+ bool scrolling;
+ double target_scroll;
+ bool smooth_scroll_enabled;
+
void _drag_slave_exit();
void _drag_slave_input(const Ref<InputEvent> &p_input);
@@ -100,6 +104,9 @@ public:
void set_drag_slave(const NodePath &p_path);
NodePath get_drag_slave() const;
+ void set_smooth_scroll_enabled(bool p_enable);
+ bool is_smooth_scroll_enabled() const;
+
virtual Size2 get_minimum_size() const;
ScrollBar(Orientation p_orientation = VERTICAL);
~ScrollBar();
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index c5b9df15b9..751edc5a43 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -192,7 +192,7 @@ void SpinBox::_notification(int p_what) {
int w = updown->get_width();
if (w != last_w) {
- line_edit->set_margin(MARGIN_RIGHT, w);
+ line_edit->set_margin(MARGIN_RIGHT, -w);
last_w = w;
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 2b111c50a6..fa51099411 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -338,6 +338,11 @@ void TextEdit::_update_scrollbars() {
v_scroll->show();
v_scroll->set_max(total_rows);
v_scroll->set_page(visible_rows);
+ if (smooth_scroll_enabled) {
+ v_scroll->set_step(0.25);
+ } else {
+ v_scroll->set_step(1);
+ }
if (fabs(v_scroll->get_value() - (double)cursor.line_ofs) >= 1) {
v_scroll->set_value(cursor.line_ofs);
@@ -420,6 +425,24 @@ void TextEdit::_notification(int p_what) {
draw_caret = false;
update();
} break;
+ case NOTIFICATION_FIXED_PROCESS: {
+ if (scrolling && v_scroll->get_value() != target_v_scroll) {
+ double target_y = target_v_scroll - v_scroll->get_value();
+ double dist = sqrt(target_y * target_y);
+ double vel = ((target_y / dist) * v_scroll_speed) * get_fixed_process_delta_time();
+
+ if (vel >= dist) {
+ v_scroll->set_value(target_v_scroll);
+ scrolling = false;
+ set_fixed_process(false);
+ } else {
+ v_scroll->set_value(v_scroll->get_value() + vel);
+ }
+ } else {
+ scrolling = false;
+ set_fixed_process(false);
+ }
+ } break;
case NOTIFICATION_DRAW: {
if ((!has_focus() && !menu->has_focus()) || !window_has_focus) {
@@ -454,6 +477,7 @@ void TextEdit::_notification(int p_what) {
_update_scrollbars();
RID ci = get_canvas_item();
+ VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true);
int xmargin_beg = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width;
int xmargin_end = cache.size.width - cache.style_normal->get_margin(MARGIN_RIGHT);
//let's do it easy for now:
@@ -463,7 +487,7 @@ void TextEdit::_notification(int p_what) {
int ascent = cache.font->get_ascent();
- int visible_rows = get_visible_rows();
+ int visible_rows = get_visible_rows() + 1;
int tab_w = cache.font->get_char_size(' ').width * indent_size;
@@ -674,7 +698,11 @@ void TextEdit::_notification(int p_what) {
int char_margin = xmargin_beg - cursor.x_ofs;
int char_ofs = 0;
- int ofs_y = i * get_row_height() + cache.line_spacing / 2;
+ int ofs_y = (i * get_row_height() + cache.line_spacing / 2);
+ if (smooth_scroll_enabled) {
+ ofs_y -= (v_scroll->get_value() - cursor.line_ofs) * get_row_height();
+ }
+
bool prev_is_char = false;
bool prev_is_number = false;
bool in_keyword = false;
@@ -1500,7 +1528,7 @@ void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) co
float rows = p_mouse.y;
rows -= cache.style_normal->get_margin(MARGIN_TOP);
rows /= get_row_height();
- int row = cursor.line_ofs + rows;
+ int row = cursor.line_ofs + (rows + (v_scroll->get_value() - cursor.line_ofs));
if (row < 0)
row = 0;
@@ -1566,10 +1594,43 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (mb->is_pressed()) {
if (mb->get_button_index() == BUTTON_WHEEL_UP && !mb->get_command()) {
- v_scroll->set_value(v_scroll->get_value() - (3 * mb->get_factor()));
+ if (scrolling) {
+ target_v_scroll = (target_v_scroll - (3 * mb->get_factor()));
+ } else {
+ target_v_scroll = (v_scroll->get_value() - (3 * mb->get_factor()));
+ }
+
+ if (smooth_scroll_enabled) {
+ if (target_v_scroll <= 0) {
+ target_v_scroll = 0;
+ }
+ scrolling = true;
+ set_fixed_process(true);
+ } else {
+ v_scroll->set_value(target_v_scroll);
+ }
}
if (mb->get_button_index() == BUTTON_WHEEL_DOWN && !mb->get_command()) {
- v_scroll->set_value(v_scroll->get_value() + (3 * mb->get_factor()));
+ if (scrolling) {
+ target_v_scroll = (target_v_scroll + (3 * mb->get_factor()));
+ } else {
+ target_v_scroll = (v_scroll->get_value() + (3 * mb->get_factor()));
+ }
+
+ if (smooth_scroll_enabled) {
+ int max_v_scroll = get_line_count() - 1;
+ if (!scroll_past_end_of_file_enabled) {
+ max_v_scroll -= get_visible_rows() - 1;
+ }
+
+ if (target_v_scroll > max_v_scroll) {
+ target_v_scroll = max_v_scroll;
+ }
+ scrolling = true;
+ set_fixed_process(true);
+ } else {
+ v_scroll->set_value(target_v_scroll);
+ }
}
if (mb->get_button_index() == BUTTON_WHEEL_LEFT) {
h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor()));
@@ -3111,7 +3172,7 @@ void TextEdit::adjust_viewport_to_cursor() {
visible_rows -= ((h_scroll->get_combined_minimum_size().height - 1) / get_row_height());
if (cursor.line >= (cursor.line_ofs + visible_rows))
- cursor.line_ofs = cursor.line - visible_rows + 1;
+ cursor.line_ofs = cursor.line - visible_rows;
if (cursor.line < cursor.line_ofs)
cursor.line_ofs = cursor.line;
@@ -4194,6 +4255,23 @@ void TextEdit::set_h_scroll(int p_scroll) {
h_scroll->set_value(p_scroll);
}
+void TextEdit::set_smooth_scroll_enabled(bool p_enable) {
+ v_scroll->set_smooth_scroll_enabled(p_enable);
+ smooth_scroll_enabled = p_enable;
+}
+
+bool TextEdit::is_smooth_scroll_enabled() const {
+ return smooth_scroll_enabled;
+}
+
+void TextEdit::set_v_scroll_speed(float p_speed) {
+ v_scroll_speed = p_speed;
+}
+
+float TextEdit::get_v_scroll_speed() const {
+ return v_scroll_speed;
+}
+
void TextEdit::set_completion(bool p_enabled, const Vector<String> &p_prefixes) {
completion_prefixes.clear();
@@ -4694,6 +4772,11 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_syntax_coloring", "enable"), &TextEdit::set_syntax_coloring);
ClassDB::bind_method(D_METHOD("is_syntax_coloring_enabled"), &TextEdit::is_syntax_coloring_enabled);
+ ClassDB::bind_method(D_METHOD("set_smooth_scroll_enable", "enable"), &TextEdit::set_smooth_scroll_enabled);
+ ClassDB::bind_method(D_METHOD("is_smooth_scroll_enabled"), &TextEdit::is_smooth_scroll_enabled);
+ ClassDB::bind_method(D_METHOD("set_v_scroll_speed", "speed"), &TextEdit::set_v_scroll_speed);
+ ClassDB::bind_method(D_METHOD("get_v_scroll_speed"), &TextEdit::get_v_scroll_speed);
+
ClassDB::bind_method(D_METHOD("add_keyword_color", "keyword", "color"), &TextEdit::add_keyword_color);
ClassDB::bind_method(D_METHOD("add_color_region", "begin_key", "end_key", "color", "line_only"), &TextEdit::add_color_region, DEFVAL(false));
ClassDB::bind_method(D_METHOD("clear_colors"), &TextEdit::clear_colors);
@@ -4703,6 +4786,8 @@ void TextEdit::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "syntax_highlighting"), "set_syntax_coloring", "is_syntax_coloring_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_line_numbers"), "set_show_line_numbers", "is_show_line_numbers_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "highlight_all_occurrences"), "set_highlight_all_occurrences", "is_highlight_all_occurrences_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_scrolling"), "set_smooth_scroll_enable", "is_smooth_scroll_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_scroll_speed"), "set_v_scroll_speed", "get_v_scroll_speed");
ADD_GROUP("Caret", "caret_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret_block_mode"), "cursor_set_block_mode", "cursor_is_block_mode");
@@ -4839,6 +4924,10 @@ TextEdit::TextEdit() {
insert_mode = false;
window_has_focus = true;
select_identifiers_enabled = false;
+ smooth_scroll_enabled = false;
+ scrolling = false;
+ target_v_scroll = 0;
+ v_scroll_speed = 80;
raised_from_completion = false;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 4c17347a5d..d942f521cd 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -256,6 +256,11 @@ class TextEdit : public Control {
bool insert_mode;
bool select_identifiers_enabled;
+ bool smooth_scroll_enabled;
+ bool scrolling;
+ float target_v_scroll;
+ float v_scroll_speed;
+
bool raised_from_completion;
String highlighted_word;
@@ -487,6 +492,12 @@ public:
int get_h_scroll() const;
void set_h_scroll(int p_scroll);
+ void set_smooth_scroll_enabled(bool p_enable);
+ bool is_smooth_scroll_enabled() const;
+
+ void set_v_scroll_speed(float p_speed);
+ float get_v_scroll_speed() const;
+
uint32_t get_version() const;
uint32_t get_saved_version() const;
void tag_saved_version();
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp
index 081c7ddb73..a5ca502f71 100644
--- a/scene/gui/texture_progress.cpp
+++ b/scene/gui/texture_progress.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "texture_progress.h"
+#include "engine.h"
+
void TextureProgress::set_under_texture(const Ref<Texture> &p_texture) {
under = p_texture;
@@ -179,7 +181,7 @@ void TextureProgress::_notification(int p_what) {
}
draw_polygon(points, Vector<Color>(), uvs, progress);
}
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
Point2 p = progress->get_size();
p.x *= get_relative_center().x;
p.y *= get_relative_center().y;
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index 9c018a4e7c..4886b1cc26 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -116,7 +116,7 @@ void VideoPlayer::_notification(int p_notification) {
case NOTIFICATION_ENTER_TREE: {
- if (stream.is_valid() && autoplay && !get_tree()->is_editor_hint()) {
+ if (stream.is_valid() && autoplay && !Engine::get_singleton()->is_editor_hint()) {
play();
}
} break;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 2e67a1feaf..8c0733e8b2 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -382,7 +382,7 @@ bool SceneTree::is_input_handled() {
void SceneTree::input_event(const Ref<InputEvent> &p_event) {
- if (is_editor_hint() && (p_event->cast_to<InputEventJoypadButton>() || p_event->cast_to<InputEventJoypadMotion>()))
+ if (Engine::get_singleton()->is_editor_hint() && (p_event->cast_to<InputEventJoypadButton>() || p_event->cast_to<InputEventJoypadMotion>()))
return; //avoid joy input on editor
root_lock++;
@@ -541,7 +541,7 @@ bool SceneTree::idle(float p_time) {
#ifdef TOOLS_ENABLED
- if (is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
//simple hack to reload fallback environment if it changed from editor
String env_path = ProjectSettings::get_singleton()->get("rendering/environment/default_environment");
env_path = env_path.strip_edges(); //user may have added a space or two
@@ -616,7 +616,7 @@ void SceneTree::_notification(int p_notification) {
get_root()->propagate_notification(p_notification);
} break;
case NOTIFICATION_TRANSLATION_CHANGED: {
- if (!is_editor_hint()) {
+ if (!Engine::get_singleton()->is_editor_hint()) {
get_root()->propagate_notification(Node::NOTIFICATION_TRANSLATION_CHANGED);
}
} break;
@@ -642,19 +642,10 @@ void SceneTree::set_quit_on_go_back(bool p_enable) {
}
#ifdef TOOLS_ENABLED
-void SceneTree::set_editor_hint(bool p_enabled) {
-
- editor_hint = p_enabled;
-}
bool SceneTree::is_node_being_edited(const Node *p_node) const {
- return editor_hint && edited_scene_root && edited_scene_root->is_a_parent_of(p_node);
-}
-
-bool SceneTree::is_editor_hint() const {
-
- return editor_hint;
+ return Engine::get_singleton()->is_editor_hint() && edited_scene_root && edited_scene_root->is_a_parent_of(p_node);
}
#endif
@@ -2114,8 +2105,6 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_auto_accept_quit", "enabled"), &SceneTree::set_auto_accept_quit);
- ClassDB::bind_method(D_METHOD("set_editor_hint", "enable"), &SceneTree::set_editor_hint);
- ClassDB::bind_method(D_METHOD("is_editor_hint"), &SceneTree::is_editor_hint);
ClassDB::bind_method(D_METHOD("set_debug_collisions_hint", "enable"), &SceneTree::set_debug_collisions_hint);
ClassDB::bind_method(D_METHOD("is_debugging_collisions_hint"), &SceneTree::is_debugging_collisions_hint);
ClassDB::bind_method(D_METHOD("set_debug_navigation_hint", "enable"), &SceneTree::set_debug_navigation_hint);
@@ -2240,9 +2229,6 @@ SceneTree::SceneTree() {
accept_quit = true;
quit_on_go_back = true;
initialized = false;
-#ifdef TOOLS_ENABLED
- editor_hint = false;
-#endif
#ifdef DEBUG_ENABLED
debug_collisions_hint = false;
debug_navigation_hint = false;
@@ -2312,7 +2298,7 @@ SceneTree::SceneTree() {
if (env.is_valid()) {
root->get_world()->set_fallback_environment(env);
} else {
- if (is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
//file was erased, clear the field.
ProjectSettings::get_singleton()->set("rendering/environment/default_environment", "");
} else {
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index 3543ebee90..5563bd33be 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -111,9 +111,6 @@ private:
bool quit_on_go_back;
uint32_t last_id;
-#ifdef TOOLS_ENABLED
- bool editor_hint;
-#endif
#ifdef DEBUG_ENABLED
bool debug_collisions_hint;
bool debug_navigation_hint;
@@ -363,14 +360,8 @@ public:
_FORCE_INLINE_ float get_idle_process_time() const { return idle_process_time; }
#ifdef TOOLS_ENABLED
- void set_editor_hint(bool p_enabled);
-
- bool is_editor_hint() const;
bool is_node_being_edited(const Node *p_node) const;
#else
- void set_editor_hint(bool p_enabled) {}
-
- bool is_editor_hint() const { return false; }
bool is_node_being_edited(const Node *p_node) const { return false; }
#endif
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index a61d1100e6..06801ee49d 100755
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "timer.h"
+#include "engine.h"
+
void Timer::_notification(int p_what) {
switch (p_what) {
@@ -37,7 +39,7 @@ void Timer::_notification(int p_what) {
if (autostart) {
#ifdef TOOLS_ENABLED
- if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root() == this || get_tree()->get_edited_scene_root()->is_a_parent_of(this)))
+ if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root() == this || get_tree()->get_edited_scene_root()->is_a_parent_of(this)))
break;
#endif
start();
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index a22d897669..e19e069282 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1354,7 +1354,7 @@ void Viewport::_vp_input(const Ref<InputEvent> &p_ev) {
return;
#ifdef TOOLS_ENABLED
- if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
+ if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
return;
}
#endif
@@ -1374,7 +1374,7 @@ void Viewport::_vp_unhandled_input(const Ref<InputEvent> &p_ev) {
if (disable_input)
return;
#ifdef TOOLS_ENABLED
- if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
+ if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
return;
}
#endif
@@ -1456,6 +1456,10 @@ void Viewport::_gui_show_tooltip() {
gui.tooltip_popup = NULL;
}
+ if (!gui.tooltip) {
+ return;
+ }
+
Control *rp = gui.tooltip->get_root_parent_control();
if (!rp)
return;
diff --git a/scene/resources/color_ramp.cpp b/scene/resources/color_ramp.cpp
index 1825225abd..68f707220f 100644
--- a/scene/resources/color_ramp.cpp
+++ b/scene/resources/color_ramp.cpp
@@ -149,7 +149,7 @@ void Gradient::set_offset(int pos, const float offset) {
}
float Gradient::get_offset(int pos) const {
- if (points.size() > pos)
+ if (points.size() && points.size() > pos)
return points[pos].offset;
return 0; //TODO: Maybe throw some error instead?
}
@@ -164,7 +164,7 @@ void Gradient::set_color(int pos, const Color &color) {
}
Color Gradient::get_color(int pos) const {
- if (points.size() > pos)
+ if (points.size() && points.size() > pos)
return points[pos].color;
return Color(0, 0, 0, 1); //TODO: Maybe throw some error instead?
}
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 67bc5b30ff..d6a730647f 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -463,7 +463,7 @@ bool StyleBoxFlat::is_anti_aliased() const {
}
void StyleBoxFlat::set_aa_size(const int &p_aa_size) {
- aa_size = p_aa_size;
+ aa_size = CLAMP(p_aa_size, 1, 5);
emit_changed();
}
int StyleBoxFlat::get_aa_size() const {
@@ -471,7 +471,7 @@ int StyleBoxFlat::get_aa_size() const {
}
void StyleBoxFlat::set_corner_detail(const int &p_corner_detail) {
- corner_detail = p_corner_detail;
+ corner_detail = CLAMP(p_corner_detail, 1, 128);
emit_changed();
}
int StyleBoxFlat::get_corner_detail() const {
@@ -514,6 +514,7 @@ inline void draw_ring(Vector<Vector2> &verts, Vector<int> &indices, Vector<Color
if (!vert_offset) {
vert_offset = 0;
}
+ int adapted_corner_detail = (corner_radius[0] == 0 && corner_radius[1] == 0 && corner_radius[2] == 0 && corner_radius[3] == 0) ? 1 : corner_detail;
int rings = (border_width[0] == 0 && border_width[1] == 0 && border_width[2] == 0 && border_width[3] == 0) ? 1 : 2;
rings = 2;
@@ -540,7 +541,7 @@ inline void draw_ring(Vector<Vector2> &verts, Vector<int> &indices, Vector<Color
//calculate the vert array
for (int corner_index = 0; corner_index < 4; corner_index++) {
- for (int detail = 0; detail <= corner_detail; detail++) {
+ for (int detail = 0; detail <= adapted_corner_detail; detail++) {
for (int inner_outer = (2 - rings); inner_outer < 2; inner_outer++) {
float radius;
Color color;
@@ -554,8 +555,8 @@ inline void draw_ring(Vector<Vector2> &verts, Vector<int> &indices, Vector<Color
color = *outer_color;
corner_point = outer_points[corner_index];
}
- float x = radius * (float)cos((double)corner_index * Math_PI / 2.0 + (double)detail / (double)corner_detail * Math_PI / 2.0 + Math_PI) + corner_point.x;
- float y = radius * (float)sin((double)corner_index * Math_PI / 2.0 + (double)detail / (double)corner_detail * Math_PI / 2.0 + Math_PI) + corner_point.y;
+ float x = radius * (float)cos((double)corner_index * Math_PI / 2.0 + (double)detail / (double)adapted_corner_detail * Math_PI / 2.0 + Math_PI) + corner_point.x;
+ float y = radius * (float)sin((double)corner_index * Math_PI / 2.0 + (double)detail / (double)adapted_corner_detail * Math_PI / 2.0 + Math_PI) + corner_point.y;
verts.push_back(Vector2(x, y));
colors.push_back(color);
}
@@ -563,7 +564,7 @@ inline void draw_ring(Vector<Vector2> &verts, Vector<int> &indices, Vector<Color
}
if (rings == 2) {
- int vert_count = (corner_detail + 1) * 4 * rings;
+ int vert_count = (adapted_corner_detail + 1) * 4 * rings;
//fill the indices and the colors for the border
for (int i = 0; i < vert_count; i++) {
//poly 1
@@ -776,7 +777,7 @@ void StyleBoxFlat::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::INT, "corner_radius_bottom_right", PROPERTY_HINT_RANGE, "0,1024,1"), "set_corner_radius", "get_corner_radius", CORNER_BOTTOM_RIGHT);
ADD_PROPERTYI(PropertyInfo(Variant::INT, "corner_radius_bottom_left", PROPERTY_HINT_RANGE, "0,1024,1"), "set_corner_radius", "get_corner_radius", CORNER_BOTTOM_LEFT);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "corner_detail"), "set_corner_detail", "get_corner_detail");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "corner_detail", PROPERTY_HINT_RANGE, "1,128,1"), "set_corner_detail", "get_corner_detail");
ADD_GROUP("Expand Margin", "expand_margin_");
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_left", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_LEFT);
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 9405f6e012..3b4ba313e6 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -331,6 +331,7 @@ public:
virtual void light_set_projector(RID p_light, RID p_texture) = 0;
virtual void light_set_negative(RID p_light, bool p_enable) = 0;
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0;
+ virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0;
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) = 0;
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) = 0;
@@ -712,6 +713,7 @@ public:
RID texture;
RID normal_map;
int count;
+ bool antialiased;
CommandPolygon() {
type = TYPE_POLYGON;
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index f8350ce0f8..3e0a1a6f45 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -1931,7 +1931,8 @@ bool ShaderLanguage::_validate_function_call(BlockNode *p_block, OperatorNode *p
}
if (!fail) {
- p_func->return_cache = pfunc->return_type;
+ if (r_ret_type)
+ *r_ret_type = pfunc->return_type;
return true;
}
}
@@ -3150,6 +3151,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
assign->op = OP_ASSIGN;
p_block->statements.push_back(assign);
tk = _get_token();
+
+ if (!_validate_operator(assign)) {
+ _set_error("Invalid assignment of '" + get_datatype_name(n->get_datatype()) + "' to '" + get_datatype_name(type) + "'");
+ return ERR_PARSE_ERROR;
+ }
}
if (tk.type == TK_COMMA) {
diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp
index e4cda5500e..13517fa409 100644
--- a/servers/visual/visual_server_canvas.cpp
+++ b/servers/visual/visual_server_canvas.cpp
@@ -632,7 +632,7 @@ void VisualServerCanvas::canvas_item_add_primitive(RID p_item, const Vector<Poin
canvas_item->commands.push_back(prim);
}
-void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, RID p_normal_map) {
+void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, RID p_normal_map, bool p_antialiased) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -661,6 +661,7 @@ void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2
polygon->colors = p_colors;
polygon->indices = indices;
polygon->count = indices.size();
+ polygon->antialiased = p_antialiased;
canvas_item->rect_dirty = true;
canvas_item->commands.push_back(polygon);
@@ -745,6 +746,7 @@ void VisualServerCanvas::canvas_item_add_particles(RID p_item, RID p_particles,
//take the chance and request processing for them, at least once until they become visible again
VSG::storage->particles_request_process(p_particles);
+ canvas_item->rect_dirty = true;
canvas_item->commands.push_back(part);
}
@@ -758,6 +760,7 @@ void VisualServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p
mm->multimesh = p_mesh;
mm->skeleton = p_skeleton;
+ canvas_item->rect_dirty = true;
canvas_item->commands.push_back(mm);
}
diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h
index 25d4973cb7..b9ad88286d 100644
--- a/servers/visual/visual_server_canvas.h
+++ b/servers/visual/visual_server_canvas.h
@@ -178,7 +178,7 @@ public:
void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), bool p_clip_uv = true);
void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, VS::NinePatchAxisMode p_x_axis_mode = VS::NINE_PATCH_STRETCH, VS::NinePatchAxisMode p_y_axis_mode = VS::NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID());
void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID());
- void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID());
+ void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID(), bool p_antialiased = false);
void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID());
void canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_skeleton = RID());
void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_skeleton = RID());
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 596dd5c10e..fff37a71b3 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -786,6 +786,7 @@ public:
BIND2(light_set_projector, RID, RID)
BIND2(light_set_negative, RID, bool)
BIND2(light_set_cull_mask, RID, uint32_t)
+ BIND2(light_set_reverse_cull_face_mode, RID, bool)
BIND2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
BIND2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
@@ -1059,7 +1060,7 @@ public:
BIND8(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, RID, bool)
BIND11(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID)
BIND7(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID)
- BIND6(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID)
+ BIND7(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, bool)
BIND8(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int, RID)
BIND3(canvas_item_add_mesh, RID, const RID &, RID)
BIND3(canvas_item_add_multimesh, RID, RID, RID)
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 8e21ecc189..fb298e3ed7 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -978,16 +978,6 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance, VS::InstanceF
switch (p_flags) {
- case VS::INSTANCE_FLAG_CAST_SHADOW: {
- if (p_enabled == true) {
- instance->cast_shadows = VS::SHADOW_CASTING_SETTING_ON;
- } else {
- instance->cast_shadows = VS::SHADOW_CASTING_SETTING_OFF;
- }
-
- instance->base_material_changed(); // to actually compute if shadows are visible or not
-
- } break;
case VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS: {
instance->visible_in_all_rooms = p_enabled;
@@ -1001,6 +991,12 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance, VS::InstanceF
}
}
void VisualServerScene::instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting) {
+
+ Instance *instance = instance_owner.get(p_instance);
+ ERR_FAIL_COND(!instance);
+
+ instance->cast_shadows = p_shadow_casting_setting;
+ instance->base_material_changed(); // to actually compute if shadows are visible or not
}
void VisualServerScene::instance_geometry_set_material_override(RID p_instance, RID p_material) {
@@ -1048,7 +1044,7 @@ void VisualServerScene::_update_instance(Instance *p_instance) {
VSG::storage->particles_set_emission_transform(p_instance->base, p_instance->transform);
}
- if (p_instance->aabb.has_no_area()) {
+ if (p_instance->aabb.has_no_surface()) {
return;
}
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 20223f9651..ca040e9355 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -225,6 +225,7 @@ public:
FUNC2(light_set_projector, RID, RID)
FUNC2(light_set_negative, RID, bool)
FUNC2(light_set_cull_mask, RID, uint32_t)
+ FUNC2(light_set_reverse_cull_face_mode, RID, bool)
FUNC2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
FUNC2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
@@ -482,7 +483,7 @@ public:
FUNC8(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, RID, bool)
FUNC11(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID)
FUNC7(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID)
- FUNC6(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID)
+ FUNC7(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, bool)
FUNC8(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int, RID)
FUNC3(canvas_item_add_mesh, RID, const RID &, RID)
FUNC3(canvas_item_add_multimesh, RID, RID, RID)
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index dacf04f8d6..cb1f96c23f 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -298,6 +298,9 @@ RID VisualServer::get_white_texture() {
return white_texture;
}
+#define SMALL_VEC2 Vector2(0.00001, 0.00001)
+#define SMALL_VEC3 Vector3(0.00001, 0.00001, 0.00001)
+
Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, Rect3 &r_aabb, Vector<Rect3> r_bone_aabb) {
PoolVector<uint8_t>::Write vw = r_vertex_array.write();
@@ -339,7 +342,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
if (i == 0) {
- aabb = Rect2(src[i], Vector2(0.00001, 0.00001)); //must have a bit of size
+ aabb = Rect2(src[i], SMALL_VEC2); //must have a bit of size
} else {
aabb.expand_to(src[i]);
@@ -355,7 +358,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
if (i == 0) {
- aabb = Rect2(src[i], Vector2(0.00001, 0.00001)); //must have a bit of size
+ aabb = Rect2(src[i], SMALL_VEC2); //must have a bit of size
} else {
aabb.expand_to(src[i]);
@@ -385,7 +388,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
if (i == 0) {
- aabb = Rect3(src[i], Vector3(0.00001, 0.00001, 0.00001));
+ aabb = Rect3(src[i], SMALL_VEC3);
} else {
aabb.expand_to(src[i]);
@@ -401,7 +404,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
if (i == 0) {
- aabb = Rect3(src[i], Vector3(0.00001, 0.00001, 0.00001));
+ aabb = Rect3(src[i], SMALL_VEC3);
} else {
aabb.expand_to(src[i]);
@@ -733,9 +736,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
if (bptr->size.x < 0) {
//first
- bptr[idx] = Rect3();
- bptr[idx].position = v;
- bptr[idx].size = Vector3(0.00001, 0.00001, 0.00001); //must have at least a bit of size
+ bptr[idx] = Rect3(v, SMALL_VEC3);
any_valid = true;
} else {
bptr[idx].expand_to(v);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index ddf32a9ea1..5e0a390a21 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -371,6 +371,7 @@ public:
virtual void light_set_projector(RID p_light, RID p_texture) = 0;
virtual void light_set_negative(RID p_light, bool p_enable) = 0;
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0;
+ virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0;
// omni light
enum LightOmniShadowMode {
@@ -743,7 +744,6 @@ public:
virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario = RID()) const = 0;
enum InstanceFlags {
- INSTANCE_FLAG_CAST_SHADOW,
INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS,
INSTANCE_FLAG_USE_BAKED_LIGHT,
INSTANCE_FLAG_MAX
@@ -798,7 +798,7 @@ public:
virtual void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), bool p_clip_uv = true) = 0;
virtual void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, NinePatchAxisMode p_x_axis_mode = NINE_PATCH_STRETCH, NinePatchAxisMode p_y_axis_mode = NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID()) = 0;
virtual void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID()) = 0;
- virtual void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID()) = 0;
+ virtual void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID(), bool p_antialiased = false) = 0;
virtual void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID()) = 0;
virtual void canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_skeleton = RID()) = 0;
virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_skeleton = RID()) = 0;