summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct2
-rw-r--r--core/SCsub8
-rw-r--r--core/list.h6
-rw-r--r--core/math/expression.cpp7
-rw-r--r--core/math/expression.h1
-rw-r--r--core/math/rect2.h2
-rw-r--r--doc/classes/@GDScript.xml23
-rw-r--r--doc/classes/BaseButton.xml3
-rw-r--r--doc/classes/VisualServer.xml11
-rw-r--r--drivers/dummy/rasterizer_dummy.h2
-rw-r--r--drivers/gl_context/SCsub2
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp2
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.h26
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp18
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h3
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp17
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h3
-rw-r--r--drivers/png/SCsub4
-rw-r--r--editor/animation_bezier_editor.cpp54
-rw-r--r--editor/animation_track_editor.cpp29
-rw-r--r--editor/editor_settings.cpp1
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp12
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp12
-rw-r--r--editor/project_manager.cpp6
-rw-r--r--editor/script_create_dialog.cpp169
-rw-r--r--editor/script_create_dialog.h1
-rw-r--r--modules/assimp/SCsub26
-rw-r--r--modules/bullet/SCsub2
-rw-r--r--modules/cvtt/SCsub2
-rw-r--r--modules/enet/SCsub2
-rw-r--r--modules/etc/SCsub2
-rw-r--r--modules/freetype/SCsub6
-rw-r--r--modules/gdnative/SCsub4
-rw-r--r--modules/gdnative/videodecoder/SCsub2
-rw-r--r--modules/gdscript/gdscript.h5
-rw-r--r--modules/gdscript/gdscript_editor.cpp11
-rw-r--r--modules/gdscript/gdscript_functions.cpp16
-rw-r--r--modules/gdscript/gdscript_functions.h1
-rw-r--r--modules/gdscript/gdscript_parser.cpp13
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp387
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h43
-rw-r--r--modules/jpg/SCsub2
-rw-r--r--modules/mono/build_scripts/mono_configure.py4
-rw-r--r--modules/mono/glue/Managed/Files/Mathf.cs29
-rw-r--r--modules/mono/glue/Managed/Files/MathfEx.cs10
-rw-r--r--modules/mono/utils/string_utils.cpp3
-rw-r--r--modules/ogg/SCsub2
-rw-r--r--modules/opensimplex/SCsub2
-rw-r--r--modules/opus/SCsub4
-rw-r--r--modules/pvr/SCsub2
-rw-r--r--modules/recast/SCsub2
-rw-r--r--modules/regex/SCsub2
-rw-r--r--modules/squish/SCsub2
-rw-r--r--modules/svg/SCsub4
-rw-r--r--modules/theora/SCsub6
-rw-r--r--modules/tinyexr/SCsub2
-rw-r--r--modules/upnp/SCsub2
-rw-r--r--modules/vhacd/SCsub2
-rw-r--r--modules/vorbis/SCsub4
-rw-r--r--modules/webm/SCsub10
-rw-r--r--modules/webm/libvpx/SCsub4
-rw-r--r--modules/webp/SCsub2
-rw-r--r--modules/webrtc/SCsub3
-rw-r--r--modules/websocket/SCsub6
-rw-r--r--modules/xatlas_unwrap/SCsub2
-rw-r--r--platform/android/detect.py2
-rw-r--r--platform/android/export/export.cpp2
-rw-r--r--platform/haiku/detect.py4
-rw-r--r--platform/iphone/detect.py10
-rw-r--r--platform/iphone/export/export.cpp2
-rw-r--r--platform/javascript/detect.py2
-rw-r--r--platform/osx/detect.py2
-rw-r--r--platform/osx/export/export.cpp1
-rw-r--r--platform/server/detect.py4
-rw-r--r--platform/uwp/detect.py4
-rw-r--r--platform/windows/detect.py6
-rw-r--r--platform/x11/crash_handler_x11.cpp10
-rw-r--r--platform/x11/detect.py4
-rw-r--r--platform/x11/os_x11.cpp72
-rw-r--r--platform/x11/power_x11.cpp2
-rw-r--r--scene/3d/light.cpp1
-rw-r--r--scene/gui/base_button.cpp16
-rw-r--r--scene/gui/base_button.h4
-rw-r--r--scene/gui/popup_menu.cpp8
-rw-r--r--scene/gui/text_edit.cpp61
-rw-r--r--scene/resources/animation.h1
-rw-r--r--scene/resources/font.cpp33
-rw-r--r--scene/resources/font.h1
-rw-r--r--servers/visual/rasterizer.h2
-rw-r--r--servers/visual/visual_server_raster.h1
-rw-r--r--servers/visual/visual_server_scene.cpp6
-rw-r--r--servers/visual/visual_server_wrap_mt.h1
-rw-r--r--servers/visual_server.cpp1
-rw-r--r--servers/visual_server.h1
94 files changed, 852 insertions, 469 deletions
diff --git a/SConstruct b/SConstruct
index e943f8dc04..f32924835d 100644
--- a/SConstruct
+++ b/SConstruct
@@ -189,7 +189,7 @@ Help(opts.GenerateHelpText(env_base)) # generate help
# add default include paths
-env_base.Append(CPPPATH=['#editor', '#'])
+env_base.Prepend(CPPPATH=['#', '#editor'])
# configure ENV for platform
env_base.platform_exporters = platform_exporters
diff --git a/core/SCsub b/core/SCsub
index d5be74a64f..06efc8408d 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -80,9 +80,9 @@ if env['builtin_zlib']:
]
thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
- env_thirdparty.Append(CPPPATH=[thirdparty_zlib_dir])
+ env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
# Needs to be available in main env too
- env.Append(CPPPATH=[thirdparty_zlib_dir])
+ env.Prepend(CPPPATH=[thirdparty_zlib_dir])
env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources)
@@ -128,9 +128,9 @@ if env['builtin_zstd']:
]
thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
- env_thirdparty.Append(CPPPATH=[thirdparty_zstd_dir, thirdparty_zstd_dir + "common"])
+ env_thirdparty.Prepend(CPPPATH=[thirdparty_zstd_dir, thirdparty_zstd_dir + "common"])
env_thirdparty.Append(CPPFLAGS="-DZSTD_STATIC_LINKING_ONLY")
- env.Append(CPPPATH=thirdparty_zstd_dir)
+ env.Prepend(CPPPATH=thirdparty_zstd_dir)
# Also needed in main env includes will trigger warnings
env.Append(CPPFLAGS="-DZSTD_STATIC_LINKING_ONLY")
diff --git a/core/list.h b/core/list.h
index c21c20ba34..103a82a31d 100644
--- a/core/list.h
+++ b/core/list.h
@@ -503,8 +503,7 @@ public:
if (p_I->prev_ptr)
p_I->prev_ptr->next_ptr = p_I->next_ptr;
- if (p_I->next_ptr)
- p_I->next_ptr->prev_ptr = p_I->prev_ptr;
+ p_I->next_ptr->prev_ptr = p_I->prev_ptr;
_data->last->next_ptr = p_I;
p_I->prev_ptr = _data->last;
@@ -538,8 +537,7 @@ public:
if (_data->last == p_I)
_data->last = p_I->prev_ptr;
- if (p_I->prev_ptr)
- p_I->prev_ptr->next_ptr = p_I->next_ptr;
+ p_I->prev_ptr->next_ptr = p_I->next_ptr;
if (p_I->next_ptr)
p_I->next_ptr->prev_ptr = p_I->prev_ptr;
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index 133dcc7ab9..079c9b524f 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -64,6 +64,7 @@ const char *Expression::func_name[Expression::FUNC_MAX] = {
"is_inf",
"ease",
"decimals",
+ "step_decimals",
"stepify",
"lerp",
"inverse_lerp",
@@ -149,6 +150,7 @@ int Expression::get_func_argument_count(BuiltinFunc p_func) {
case MATH_ISNAN:
case MATH_ISINF:
case MATH_DECIMALS:
+ case MATH_STEP_DECIMALS:
case MATH_SEED:
case MATH_RANDSEED:
case MATH_DEG2RAD:
@@ -365,6 +367,11 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
VALIDATE_ARG_NUM(0);
*r_return = Math::step_decimals((double)*p_inputs[0]);
} break;
+ case MATH_STEP_DECIMALS: {
+
+ VALIDATE_ARG_NUM(0);
+ *r_return = Math::step_decimals((double)*p_inputs[0]);
+ } break;
case MATH_STEPIFY: {
VALIDATE_ARG_NUM(0);
diff --git a/core/math/expression.h b/core/math/expression.h
index f9075cb689..f20619f0b6 100644
--- a/core/math/expression.h
+++ b/core/math/expression.h
@@ -62,6 +62,7 @@ public:
MATH_ISINF,
MATH_EASE,
MATH_DECIMALS,
+ MATH_STEP_DECIMALS,
MATH_STEPIFY,
MATH_LERP,
MATH_INVERSE_LERP,
diff --git a/core/math/rect2.h b/core/math/rect2.h
index 3b66617c83..d636aa223f 100644
--- a/core/math/rect2.h
+++ b/core/math/rect2.h
@@ -67,7 +67,7 @@ struct Rect2 {
if (p_point.x < position.x) {
real_t d = position.x - p_point.x;
- dist = inside ? d : MIN(dist, d);
+ dist = d;
inside = false;
}
if (p_point.y < position.y) {
diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml
index 22834a4c81..2f7f05b2e4 100644
--- a/doc/classes/@GDScript.xml
+++ b/doc/classes/@GDScript.xml
@@ -264,11 +264,7 @@
<argument index="0" name="step" type="float">
</argument>
<description>
- Returns the position of the first non-zero digit, after the decimal point.
- [codeblock]
- # n is 2
- n = decimals(0.035)
- [/codeblock]
+ Deprecated alias for "[method step_decimals]".
</description>
</method>
<method name="dectime">
@@ -1023,6 +1019,23 @@
[/codeblock]
</description>
</method>
+ <method name="step_decimals">
+ <return type="float">
+ </return>
+ <argument index="0" name="step" type="float">
+ </argument>
+ <description>
+ Returns the position of the first non-zero digit, after the decimal point.
+ [codeblock]
+ # n is 0
+ n = step_decimals(5)
+ # n is 4
+ n = step_decimals(1.0005)
+ # n is 9
+ n = step_decimals(0.000000005)
+ [/codeblock]
+ </description>
+ </method>
<method name="stepify">
<return type="float">
</return>
diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml
index 08be3ed0f4..c65d545f3e 100644
--- a/doc/classes/BaseButton.xml
+++ b/doc/classes/BaseButton.xml
@@ -69,6 +69,9 @@
<member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode">
If [code]true[/code], the button is in toggle mode. Makes the button flip state between pressed and unpressed each time its area is clicked.
</member>
+ <member name="keep_pressed_outside" type="bool" setter="set_keep_pressed_outside" getter="is_keep_pressed_outside">
+ If [code]true[/code], the button stays pressed when moving the cursor outside the button while pressing it. Default value: [code]false[/code].
+ </member>
</members>
<signals>
<signal name="button_down">
diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml
index 87bf0b79b6..c85a2c4b38 100644
--- a/doc/classes/VisualServer.xml
+++ b/doc/classes/VisualServer.xml
@@ -2003,6 +2003,17 @@
<description>
</description>
</method>
+ <method name="light_set_use_gi">
+ <return type="void">
+ </return>
+ <argument index="0" name="light" type="RID">
+ </argument>
+ <argument index="1" name="enabled" type="bool">
+ </argument>
+ <description>
+ Sets whether GI probes capture light information from this light.
+ </description>
+ </method>
<method name="light_set_color">
<return type="void">
</return>
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h
index c0e07e0b8d..3b31da1dd7 100644
--- a/drivers/dummy/rasterizer_dummy.h
+++ b/drivers/dummy/rasterizer_dummy.h
@@ -484,6 +484,7 @@ public:
void light_set_negative(RID p_light, bool p_enable) {}
void light_set_cull_mask(RID p_light, uint32_t p_mask) {}
void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {}
+ void light_set_use_gi(RID p_light, bool p_enabled) {}
void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {}
void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) {}
@@ -503,6 +504,7 @@ public:
AABB light_get_aabb(RID p_light) const { return AABB(); }
float light_get_param(RID p_light, VS::LightParam p_param) { return 0.0; }
Color light_get_color(RID p_light) { return Color(); }
+ bool light_get_use_gi(RID p_light) { return false; }
uint64_t light_get_version(RID p_light) const { return 0; }
/* PROBE API */
diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub
index efb26a7908..ef5b57a0cc 100644
--- a/drivers/gl_context/SCsub
+++ b/drivers/gl_context/SCsub
@@ -10,7 +10,7 @@ if (env["platform"] in ["haiku", "osx", "windows", "x11"]):
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env.Append(CPPPATH=[thirdparty_dir])
+ env.Prepend(CPPPATH=[thirdparty_dir])
env.Append(CPPFLAGS=['-DGLAD_ENABLED'])
env.Append(CPPFLAGS=['-DGLES_OVER_GL'])
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index 9f1425189c..99eb0665d6 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -2845,7 +2845,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- render_list.sort_by_depth(true);
+ render_list.sort_by_reverse_depth_and_priority(true);
_render_render_list(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, cam_transform, p_cam_projection, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, true, false);
diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h
index f23e45b52f..48672991d1 100644
--- a/drivers/gles2/rasterizer_scene_gles2.h
+++ b/drivers/gles2/rasterizer_scene_gles2.h
@@ -502,7 +502,8 @@ public:
enum {
MAX_LIGHTS = 255,
MAX_REFLECTION_PROBES = 255,
- DEFAULT_MAX_ELEMENTS = 65536
+ DEFAULT_MAX_ELEMENTS = 65536,
+ SORT_KEY_PRIORITY_SHIFT = 56
};
int max_elements;
@@ -598,6 +599,29 @@ public:
}
}
+ struct SortByReverseDepthAndPriority {
+
+ _FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const {
+ uint32_t layer_A = uint32_t(A->sort_key >> SORT_KEY_PRIORITY_SHIFT);
+ uint32_t layer_B = uint32_t(B->sort_key >> SORT_KEY_PRIORITY_SHIFT);
+ if (layer_A == layer_B) {
+ return A->instance->depth > B->instance->depth;
+ } else {
+ return layer_A < layer_B;
+ }
+ }
+ };
+
+ void sort_by_reverse_depth_and_priority(bool p_alpha) { //used for alpha
+
+ SortArray<Element *, SortByReverseDepthAndPriority> sorter;
+ if (p_alpha) {
+ sorter.sort(&elements[max_elements - alpha_element_count], alpha_element_count);
+ } else {
+ sorter.sort(elements, element_count);
+ }
+ }
+
// element adding and stuff
_FORCE_INLINE_ Element *add_element() {
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 1e32d8166f..13fdd1db73 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -3712,6 +3712,7 @@ RID RasterizerStorageGLES2::light_create(VS::LightType p_type) {
light->directional_blend_splits = false;
light->directional_range_mode = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE;
light->reverse_cull = false;
+ light->use_gi = true;
light->version = 0;
return light_owner.make_rid(light);
@@ -3799,6 +3800,16 @@ void RasterizerStorageGLES2::light_set_reverse_cull_face_mode(RID p_light, bool
light->instance_change_notify(true, false);
}
+void RasterizerStorageGLES2::light_set_use_gi(RID p_light, bool p_enabled) {
+ Light *light = light_owner.getornull(p_light);
+ ERR_FAIL_COND(!light);
+
+ light->use_gi = p_enabled;
+
+ light->version++;
+ light->instance_change_notify(true, false);
+}
+
void RasterizerStorageGLES2::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
@@ -3894,6 +3905,13 @@ Color RasterizerStorageGLES2::light_get_color(RID p_light) {
return light->color;
}
+bool RasterizerStorageGLES2::light_get_use_gi(RID p_light) {
+ Light *light = light_owner.getornull(p_light);
+ ERR_FAIL_COND_V(!light, false);
+
+ return light->use_gi;
+}
+
bool RasterizerStorageGLES2::light_has_shadow(RID p_light) const {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND_V(!light, false);
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index 2ac68fa47a..d6130849fb 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -910,6 +910,7 @@ public:
bool shadow;
bool negative;
bool reverse_cull;
+ bool use_gi;
uint32_t cull_mask;
@@ -936,6 +937,7 @@ public:
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_set_use_gi(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);
@@ -955,6 +957,7 @@ public:
virtual VS::LightType light_get_type(RID p_light) const;
virtual float light_get_param(RID p_light, VS::LightParam p_param);
virtual Color light_get_color(RID p_light);
+ virtual bool light_get_use_gi(RID p_light);
virtual AABB light_get_aabb(RID p_light) const;
virtual uint64_t light_get_version(RID p_light) const;
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index be44d62efc..95d4bec611 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -5219,6 +5219,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type) {
light->directional_blend_splits = false;
light->directional_range_mode = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE;
light->reverse_cull = false;
+ light->use_gi = true;
light->version = 0;
return light_owner.make_rid(light);
@@ -5310,6 +5311,15 @@ void RasterizerStorageGLES3::light_set_reverse_cull_face_mode(RID p_light, bool
light->instance_change_notify(true, false);
}
+void RasterizerStorageGLES3::light_set_use_gi(RID p_light, bool p_enabled) {
+ Light *light = light_owner.getornull(p_light);
+ ERR_FAIL_COND(!light);
+
+ light->use_gi = p_enabled;
+
+ light->version++;
+ light->instance_change_notify(true, false);
+}
void RasterizerStorageGLES3::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {
Light *light = light_owner.getornull(p_light);
@@ -5415,6 +5425,13 @@ Color RasterizerStorageGLES3::light_get_color(RID p_light) {
return light->color;
}
+bool RasterizerStorageGLES3::light_get_use_gi(RID p_light) {
+ Light *light = light_owner.getornull(p_light);
+ ERR_FAIL_COND_V(!light, false);
+
+ return light->use_gi;
+}
+
bool RasterizerStorageGLES3::light_has_shadow(RID p_light) const {
const Light *light = light_owner.getornull(p_light);
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 92916ed808..a4cc84ef02 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -930,6 +930,7 @@ public:
bool shadow;
bool negative;
bool reverse_cull;
+ bool use_gi;
uint32_t cull_mask;
VS::LightOmniShadowMode omni_shadow_mode;
VS::LightOmniShadowDetail omni_shadow_detail;
@@ -951,6 +952,7 @@ public:
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_set_use_gi(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);
@@ -970,6 +972,7 @@ public:
virtual VS::LightType light_get_type(RID p_light) const;
virtual float light_get_param(RID p_light, VS::LightParam p_param);
virtual Color light_get_color(RID p_light);
+ virtual bool light_get_use_gi(RID p_light);
virtual AABB light_get_aabb(RID p_light) const;
virtual uint64_t light_get_version(RID p_light) const;
diff --git a/drivers/png/SCsub b/drivers/png/SCsub
index 97ba1de3db..9dc80244ff 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -26,9 +26,9 @@ if env['builtin_libpng']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_png.Append(CPPPATH=[thirdparty_dir])
+ env_png.Prepend(CPPPATH=[thirdparty_dir])
# Needed for drivers includes and in platform/javascript
- env.Append(CPPPATH=[thirdparty_dir])
+ env.Prepend(CPPPATH=[thirdparty_dir])
# Currently .ASM filter_neon.S does not compile on NT.
import os
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index f6d4a2665c..e524dffd43 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -453,6 +453,8 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
ep.point_rect.size = bezier_icon->get_size();
if (selection.has(i)) {
draw_texture(selected_icon, ep.point_rect.position);
+ draw_string(font, ep.point_rect.position + Vector2(8, -font->get_height() - 4), TTR("Time:") + " " + rtos(Math::stepify(offset, 0.001)), accent);
+ draw_string(font, ep.point_rect.position + Vector2(8, -8), TTR("Value:") + " " + rtos(Math::stepify(value, 0.001)), accent);
} else {
draw_texture(bezier_icon, ep.point_rect.position);
}
@@ -518,6 +520,12 @@ void AnimationBezierTrackEdit::set_animation_and_track(const Ref<Animation> &p_a
animation = p_animation;
track = p_track;
+ if (is_connected("select_key", editor, "_key_selected"))
+ disconnect("select_key", editor, "_key_selected");
+ if (is_connected("deselect_key", editor, "_key_deselected"))
+ disconnect("deselect_key", editor, "_key_deselected");
+ connect("select_key", editor, "_key_selected", varray(p_track), CONNECT_DEFERRED);
+ connect("deselect_key", editor, "_key_deselected", varray(p_track), CONNECT_DEFERRED);
update();
}
@@ -536,6 +544,7 @@ void AnimationBezierTrackEdit::set_timeline(AnimationTimelineEdit *p_timeline) {
}
void AnimationBezierTrackEdit::set_editor(AnimationTrackEditor *p_editor) {
editor = p_editor;
+ connect("clear_selection", editor, "_clear_selection");
}
void AnimationBezierTrackEdit::_play_position_draw() {
@@ -578,6 +587,7 @@ String AnimationBezierTrackEdit::get_tooltip(const Point2 &p_pos) const {
void AnimationBezierTrackEdit::_clear_selection() {
selection.clear();
+ emit_signal("clear_selection");
update();
}
@@ -598,6 +608,7 @@ void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int
ERR_FAIL_COND(idx < 0);
selection.insert(idx);
+ emit_signal("select_key", idx, true);
update();
}
@@ -653,20 +664,22 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
menu_insert_key = mb->get_position();
- Vector2 popup_pos = get_global_transform().xform(mb->get_position());
-
- menu->clear();
- menu->add_icon_item(bezier_icon, TTR("Insert Key Here"), MENU_KEY_INSERT);
- if (selection.size()) {
- menu->add_separator();
- menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE);
- menu->add_separator();
- menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE);
- }
+ if (menu_insert_key.x >= timeline->get_name_limit() && menu_insert_key.x <= get_size().width - timeline->get_buttons_width()) {
+ Vector2 popup_pos = get_global_transform().xform(mb->get_position());
+
+ menu->clear();
+ menu->add_icon_item(bezier_icon, TTR("Insert Key Here"), MENU_KEY_INSERT);
+ if (selection.size()) {
+ menu->add_separator();
+ menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE);
+ menu->add_separator();
+ menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE);
+ }
- menu->set_as_minsize();
- menu->set_position(popup_pos);
- menu->popup();
+ menu->set_as_minsize();
+ menu->set_position(popup_pos);
+ menu->popup();
+ }
}
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
@@ -678,6 +691,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
for (Map<int, Rect2>::Element *E = subtracks.front(); E; E = E->next()) {
if (E->get().has_point(mb->get_position())) {
set_animation_and_track(animation, E->key());
+ _clear_selection();
return;
}
}
@@ -850,7 +864,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
// 2- remove overlapped keys
for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
- float newtime = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x;
+ float newtime = editor->snap_time(animation->track_get_key_time(track, E->get()) + moving_selection_offset.x);
int idx = animation->track_find_key(track, newtime, true);
if (idx == -1)
@@ -872,7 +886,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
// 3-move the keys (re insert them)
for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
- float newpos = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x;
+ float newpos = editor->snap_time(animation->track_get_key_time(track, E->get()) + moving_selection_offset.x);
/*
if (newpos<0)
continue; //no add at the beginning
@@ -887,7 +901,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
// 4-(undo) remove inserted keys
for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
- float newpos = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x;
+ float newpos = editor->snap_time(animation->track_get_key_time(track, E->get()) + moving_selection_offset.x);
/*
if (newpos<0)
continue; //no remove what no inserted
@@ -924,7 +938,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
float oldpos = animation->track_get_key_time(track, E->get());
- float newpos = oldpos + moving_selection_offset.x;
+ float newpos = editor->snap_time(oldpos + moving_selection_offset.x);
undo_redo->add_do_method(this, "_select_at_anim", animation, track, newpos);
undo_redo->add_undo_method(this, "_select_at_anim", animation, track, oldpos);
@@ -965,7 +979,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
}
float y = (get_size().height / 2 - mm->get_position().y) * v_zoom + v_scroll;
- float x = ((mm->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value();
+ float x = editor->snap_time(((mm->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value());
moving_selection_offset = Vector2(x - animation->track_get_key_time(track, moving_selection_from_key), y - animation->bezier_track_get_key_value(track, moving_selection_from_key));
update();
@@ -1154,8 +1168,8 @@ void AnimationBezierTrackEdit::_bind_methods() {
ClassDB::bind_method("_play_position_draw", &AnimationBezierTrackEdit::_play_position_draw);
ClassDB::bind_method("_clear_selection", &AnimationBezierTrackEdit::_clear_selection);
- ClassDB::bind_method("_clear_selection_for_anim", &AnimationBezierTrackEdit::_clear_selection);
- ClassDB::bind_method("_select_at_anim", &AnimationBezierTrackEdit::_clear_selection);
+ ClassDB::bind_method("_clear_selection_for_anim", &AnimationBezierTrackEdit::_clear_selection_for_anim);
+ ClassDB::bind_method("_select_at_anim", &AnimationBezierTrackEdit::_select_at_anim);
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
ADD_SIGNAL(MethodInfo("remove_request", PropertyInfo(Variant::INT, "track")));
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 4dff7d5b69..61244ab78c 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -309,8 +309,8 @@ public:
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
Vector2 prev = animation->bezier_track_get_key_in_handle(track, key);
- undo_redo->add_do_method(animation.ptr(), "bezier_track_set_in_handle", track, key, value);
- undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_in_handle", track, key, prev);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev);
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
@@ -325,8 +325,8 @@ public:
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
Vector2 prev = animation->bezier_track_get_key_out_handle(track, key);
- undo_redo->add_do_method(animation.ptr(), "bezier_track_set_out_handle", track, key, value);
- undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_out_handle", track, key, prev);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev);
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
undo_redo->commit_action();
@@ -1274,13 +1274,7 @@ void AnimationTrackEdit::_notification(int p_what) {
} else if (animation->track_get_type(track) == Animation::TYPE_ANIMATION) {
text = TTR("Anim Clips:");
} else {
- Vector<StringName> sn = path.get_subnames();
- for (int i = 0; i < sn.size(); i++) {
- if (i > 0) {
- text += ".";
- }
- text += sn[i];
- }
+ text += path.get_concatenated_subnames();
}
text_color.a *= 0.7;
} else if (node) {
@@ -1294,14 +1288,10 @@ void AnimationTrackEdit::_notification(int p_what) {
draw_texture(icon, Point2(ofs, int(get_size().height - icon->get_height()) / 2));
icon_cache = icon;
- text = node->get_name();
+ text = String() + node->get_name() + ":" + path.get_concatenated_subnames();
ofs += hsep;
ofs += icon->get_width();
- Vector<StringName> sn = path.get_subnames();
- for (int i = 0; i < sn.size(); i++) {
- text += ".";
- text += sn[i];
- }
+
} else {
icon_cache = type_icon;
@@ -3536,7 +3526,10 @@ void AnimationTrackEditor::_animation_changed() {
if (key_edit && key_edit->setting) {
//if editing a key, just update the edited track, makes refresh less costly
if (key_edit->track < track_edits.size()) {
- track_edits[key_edit->track]->update();
+ if (animation->track_get_type(key_edit->track) == Animation::TYPE_BEZIER)
+ bezier_edit->update();
+ else
+ track_edits[key_edit->track]->update();
}
return;
}
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index d2ff65246d..e80d3e1b37 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -407,6 +407,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/theme/color_theme", "Adaptive");
hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Adaptive,Default,Custom");
_initial_set("text_editor/theme/line_spacing", 6);
+ hints["text_editor/theme/line_spacing"] = PropertyInfo(Variant::INT, "text_editor/theme/line_spacing", PROPERTY_HINT_RANGE, "0,50,1");
_load_default_text_editor_theme();
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 41f35c3bed..7c075b5635 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -846,6 +846,12 @@ void AnimationPlayerEditor::_update_player() {
onion_skinning->set_disabled(player == NULL);
pin->set_disabled(player == NULL);
+ if (!player) {
+ AnimationPlayerEditor::singleton->get_track_editor()->update_keying();
+ EditorNode::get_singleton()->update_keying();
+ return;
+ }
+
int active_idx = -1;
for (List<StringName>::Element *E = animlist.front(); E; E = E->next()) {
@@ -858,12 +864,6 @@ void AnimationPlayerEditor::_update_player() {
active_idx = animation->get_item_count() - 1;
}
- if (!player) {
- AnimationPlayerEditor::singleton->get_track_editor()->update_keying();
- EditorNode::get_singleton()->update_keying();
- return;
- }
-
updating = false;
if (active_idx != -1) {
animation->select(active_idx);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 88bb8e38fe..c0f2410636 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -1471,10 +1471,14 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
break;
case DRAG_ANCHOR_ALL:
- if (!use_single_axis || !use_y) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, true);
- if (!use_single_axis || !use_y) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, true);
- if (!use_single_axis || use_y) control->set_anchor(MARGIN_TOP, new_anchor.y, false, true);
- if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, true);
+ if (!use_single_axis || !use_y) {
+ control->set_anchor(MARGIN_LEFT, new_anchor.x, false, true);
+ control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, true);
+ }
+ if (!use_single_axis || use_y) {
+ control->set_anchor(MARGIN_TOP, new_anchor.y, false, true);
+ control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, true);
+ }
break;
default:
break;
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 66766f7ccf..6de4330493 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -765,7 +765,7 @@ public:
set_title(TTR("Install Project:") + " " + zip_title);
get_ok()->set_text(TTR("Install & Edit"));
- name_container->hide();
+ name_container->show();
install_path_container->hide();
rasterizer_container->hide();
project_path->grab_focus();
@@ -997,7 +997,7 @@ void ProjectManager::_update_project_buttons() {
}
}
for (Map<String, String>::Element *E = list_all_projects.front(); E; E = E->next()) {
- String project_name = E->key().replace("::", "/") + "/project.godot";
+ String project_name = E->key().replace(":::", ":/").replace("::", "/") + "/project.godot";
if (!FileAccess::exists(project_name)) {
missing_projects = true;
break;
@@ -1735,7 +1735,7 @@ void ProjectManager::_erase_missing_projects_confirm() {
int deleted_projects = 0;
int remaining_projects = 0;
for (Map<String, String>::Element *E = list_all_projects.front(); E; E = E->next()) {
- String project_name = E->key().replace("::", "/") + "/project.godot";
+ String project_name = E->key().replace(":::", ":/").replace("::", "/") + "/project.godot";
if (!FileAccess::exists(project_name)) {
deleted_projects++;
EditorSettings::get_singleton()->erase("projects/" + E->key());
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 292cb8ddc3..0f851c526d 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -105,8 +105,12 @@ bool ScriptCreateDialog::_validate(const String &p_string) {
if (p_string.length() == 0)
return false;
- String path_chars = "\"res://";
- bool is_val_path = ScriptServer::get_language(language_menu->get_selected())->can_inherit_from_file();
+ if (ScriptServer::get_language(language_menu->get_selected())->can_inherit_from_file() && p_string.is_quoted()) {
+ String p = p_string.substr(1, p_string.length() - 2);
+ if (_validate_path(p, true) == "")
+ return true;
+ }
+
for (int i = 0; i < p_string.length(); i++) {
if (i == 0) {
@@ -114,17 +118,7 @@ bool ScriptCreateDialog::_validate(const String &p_string) {
return false; // no start with number plz
}
- if (i == p_string.length() - 1 && is_val_path)
- return p_string[i] == '\"';
-
- if (is_val_path && i < path_chars.length()) {
- if (p_string[i] != path_chars[i])
- is_val_path = false;
- else
- continue;
- }
-
- bool valid_char = (p_string[i] >= '0' && p_string[i] <= '9') || (p_string[i] >= 'a' && p_string[i] <= 'z') || (p_string[i] >= 'A' && p_string[i] <= 'Z') || p_string[i] == '_' || p_string[i] == '-' || (is_val_path && (p_string[i] == '/' || p_string[i] == '.'));
+ bool valid_char = (p_string[i] >= '0' && p_string[i] <= '9') || (p_string[i] >= 'a' && p_string[i] <= 'z') || (p_string[i] >= 'A' && p_string[i] <= 'Z') || p_string[i] == '_' || p_string[i] == '-';
if (!valid_char)
return false;
@@ -133,6 +127,70 @@ bool ScriptCreateDialog::_validate(const String &p_string) {
return true;
}
+String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must_exist) {
+
+ String p = p_path.strip_edges();
+
+ if (p == "") return TTR("Path is empty.");
+ if (p.get_file().get_basename() == "") return TTR("Filename is empty.");
+
+ p = ProjectSettings::get_singleton()->localize_path(p);
+ if (!p.begins_with("res://")) return TTR("Path is not local.");
+
+ DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ if (d->change_dir(p.get_base_dir()) != OK) {
+ memdelete(d);
+ return TTR("Invalid base path.");
+ }
+ memdelete(d);
+
+ /* Does file already exist */
+ DirAccess *f = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ if (f->dir_exists(p)) {
+ memdelete(f);
+ return TTR("A directory with the same name exists.");
+ } else if (p_file_must_exist && !f->file_exists(p)) {
+ memdelete(f);
+ return TTR("File does not exist.");
+ }
+ memdelete(f);
+
+ /* Check file extension */
+ String extension = p.get_extension();
+ List<String> extensions;
+
+ // get all possible extensions for script
+ for (int l = 0; l < language_menu->get_item_count(); l++) {
+ ScriptServer::get_language(l)->get_recognized_extensions(&extensions);
+ }
+
+ bool found = false;
+ bool match = false;
+ int index = 0;
+ for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
+ if (E->get().nocasecmp_to(extension) == 0) {
+ //FIXME (?) - changing language this way doesn't update controls, needs rework
+ //language_menu->select(index); // change Language option by extension
+ found = true;
+ if (E->get() == ScriptServer::get_language(language_menu->get_selected())->get_extension()) {
+ match = true;
+ }
+ break;
+ }
+ index++;
+ }
+
+ if (!found) return TTR("Invalid extension.");
+ if (!match) return TTR("Wrong extension chosen.");
+
+ /* Let ScriptLanguage do custom validation */
+ String path_error = ScriptServer::get_language(language_menu->get_selected())->validate_path(p);
+ if (path_error != "") return path_error;
+
+ /* All checks passed */
+ return "";
+}
+
void ScriptCreateDialog::_class_name_changed(const String &p_name) {
if (_validate(class_name->get_text())) {
@@ -400,97 +458,22 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
is_path_valid = false;
is_new_script_created = true;
- String p = p_path.strip_edges();
- if (p == "") {
- _msg_path_valid(false, TTR("Path is empty."));
- _update_dialog();
- return;
- }
-
- if (p.get_file().get_basename() == "") {
- _msg_path_valid(false, TTR("Filename is empty."));
- _update_dialog();
- return;
- }
-
- p = ProjectSettings::get_singleton()->localize_path(p);
- if (!p.begins_with("res://")) {
- _msg_path_valid(false, TTR("Path is not local."));
- _update_dialog();
- return;
- }
-
- DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- if (d->change_dir(p.get_base_dir()) != OK) {
- _msg_path_valid(false, TTR("Invalid base path."));
- memdelete(d);
+ String path_error = _validate_path(p_path, false);
+ if (path_error != "") {
+ _msg_path_valid(false, path_error);
_update_dialog();
return;
}
- memdelete(d);
/* Does file already exist */
-
DirAccess *f = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- if (f->dir_exists(p)) {
+ String p = ProjectSettings::get_singleton()->localize_path(p_path.strip_edges());
+ if (f->file_exists(p)) {
is_new_script_created = false;
- is_path_valid = false;
- _msg_path_valid(false, TTR("A directory with the same name exists."));
- } else if (f->file_exists(p)) {
- is_new_script_created = false;
- is_path_valid = true;
_msg_path_valid(true, TTR("File exists, it will be reused."));
}
memdelete(f);
- _update_dialog();
-
- /* Check file extension */
-
- String extension = p.get_extension();
- List<String> extensions;
-
- // get all possible extensions for script
- for (int l = 0; l < language_menu->get_item_count(); l++) {
- ScriptServer::get_language(l)->get_recognized_extensions(&extensions);
- }
-
- bool found = false;
- bool match = false;
- int index = 0;
- for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
- if (E->get().nocasecmp_to(extension) == 0) {
- //FIXME (?) - changing language this way doesn't update controls, needs rework
- //language_menu->select(index); // change Language option by extension
- found = true;
- if (E->get() == ScriptServer::get_language(language_menu->get_selected())->get_extension()) {
- match = true;
- }
- break;
- }
- index++;
- }
-
- if (!found) {
- _msg_path_valid(false, TTR("Invalid extension."));
- _update_dialog();
- return;
- }
-
- if (!match) {
- _msg_path_valid(false, TTR("Wrong extension chosen."));
- _update_dialog();
- return;
- }
-
- String path_error = ScriptServer::get_language(language_menu->get_selected())->validate_path(p);
- if (path_error != "") {
- _msg_path_valid(false, path_error);
- _update_dialog();
- return;
- }
-
- /* All checks passed */
is_path_valid = true;
_update_dialog();
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index f5c335c00a..1a3ba3d371 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -87,6 +87,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
void _lang_changed(int l = 0);
void _built_in_pressed();
bool _validate(const String &p_string);
+ String _validate_path(const String &p_path, bool p_file_must_exist);
void _class_name_changed(const String &p_name);
void _parent_name_changed(const String &p_parent);
void _template_changed(int p_template = 0);
diff --git a/modules/assimp/SCsub b/modules/assimp/SCsub
index 61a357809a..0da7e432e2 100644
--- a/modules/assimp/SCsub
+++ b/modules/assimp/SCsub
@@ -4,19 +4,19 @@ Import('env')
Import('env_modules')
env_assimp = env_modules.Clone()
-env_assimp.Append(CPPPATH=['#thirdparty/assimp'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/include'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/code/Importer/IFC'])
-env_assimp.Append(CPPPATH=['#thirdparty/misc'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/code'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/irrXML/'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/unzip/'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/code/Importer/STEPParser'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/'])
-env_assimp.Append(CPPPATH=['#thirdparty/zlib/'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/openddlparser/include'])
-env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/rapidjson/include'])
-env_assimp.Append(CPPPATH=['.'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/include'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code/Importer/IFC'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/misc'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/irrXML/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/unzip/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code/Importer/STEPParser'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/zlib/'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/openddlparser/include'])
+env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/rapidjson/include'])
+env_assimp.Prepend(CPPPATH=['.'])
#env_assimp.Append(CPPFLAGS=['-DASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_BOOST_WORKAROUND'])
env_assimp.Append(CPPFLAGS=['-DOPENDDLPARSER_BUILD'])
diff --git a/modules/bullet/SCsub b/modules/bullet/SCsub
index e7c2fff54c..16d694c238 100644
--- a/modules/bullet/SCsub
+++ b/modules/bullet/SCsub
@@ -186,7 +186,7 @@ if env['builtin_bullet']:
thirdparty_sources = [thirdparty_dir + file for file in bullet2_src]
- env_bullet.Append(CPPPATH=[thirdparty_dir])
+ env_bullet.Prepend(CPPPATH=[thirdparty_dir])
# if env['target'] == "debug" or env['target'] == "release_debug":
# env_bullet.Append(CPPFLAGS=['-DBT_DEBUG'])
diff --git a/modules/cvtt/SCsub b/modules/cvtt/SCsub
index fcc69d8371..142af0c800 100644
--- a/modules/cvtt/SCsub
+++ b/modules/cvtt/SCsub
@@ -14,7 +14,7 @@ if env['builtin_squish']:
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_cvtt.Append(CPPPATH=[thirdparty_dir])
+ env_cvtt.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_cvtt.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/enet/SCsub b/modules/enet/SCsub
index a57a4b29ea..78d8d43414 100644
--- a/modules/enet/SCsub
+++ b/modules/enet/SCsub
@@ -21,7 +21,7 @@ if env['builtin_enet']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_enet.Append(CPPPATH=[thirdparty_dir])
+ env_enet.Prepend(CPPPATH=[thirdparty_dir])
env_enet.Append(CPPFLAGS=["-DGODOT_ENET"])
env_thirdparty = env_enet.Clone()
diff --git a/modules/etc/SCsub b/modules/etc/SCsub
index eb2738053b..532b97b006 100644
--- a/modules/etc/SCsub
+++ b/modules/etc/SCsub
@@ -27,7 +27,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_etc.Append(CPPPATH=[thirdparty_dir])
+env_etc.Prepend(CPPPATH=[thirdparty_dir])
# upstream uses c++11
if not env.msvc:
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index f2cd9f9a60..0c8b223a9e 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -68,9 +68,9 @@ if env['builtin_freetype']:
sfnt = env_freetype.Object(sfnt, CPPFLAGS=['-U__OPTIMIZE__'])
thirdparty_sources += [sfnt]
- env_freetype.Append(CPPPATH=[thirdparty_dir + "/include"])
+ env_freetype.Prepend(CPPPATH=[thirdparty_dir + "/include"])
# Also needed in main env for scene/
- env.Append(CPPPATH=[thirdparty_dir + "/include"])
+ env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
env_freetype.Append(CPPFLAGS=['-DFT2_BUILD_LIBRARY', '-DFT_CONFIG_OPTION_USE_PNG'])
if (env['target'] != 'release'):
@@ -78,7 +78,7 @@ if env['builtin_freetype']:
# Also requires libpng headers
if env['builtin_libpng']:
- env_freetype.Append(CPPPATH=["#thirdparty/libpng"])
+ env_freetype.Prepend(CPPPATH=["#thirdparty/libpng"])
env_thirdparty = env_freetype.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub
index 235f0b97bb..0cdd585558 100644
--- a/modules/gdnative/SCsub
+++ b/modules/gdnative/SCsub
@@ -12,7 +12,7 @@ env_gdnative.add_source_files(env.modules_sources, "nativescript/*.cpp")
env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp")
env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp")
-env_gdnative.Append(CPPPATH=['#modules/gdnative/include/'])
+env_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/'])
Export('env_gdnative')
@@ -36,7 +36,7 @@ if ARGUMENTS.get('gdnative_wrapper', False):
gensource, = env_gdnative.CommandNoCache('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', run_in_subprocess(gdnative_builders.build_gdnative_wrapper_code))
gd_wrapper_env = env.Clone()
- gd_wrapper_env.Append(CPPPATH=['#modules/gdnative/include/'])
+ gd_wrapper_env.Prepend(CPPPATH=['#modules/gdnative/include/'])
if gd_wrapper_env['use_lto']:
if not env.msvc:
diff --git a/modules/gdnative/videodecoder/SCsub b/modules/gdnative/videodecoder/SCsub
index 8d9c1ff50e..04cc8ed604 100644
--- a/modules/gdnative/videodecoder/SCsub
+++ b/modules/gdnative/videodecoder/SCsub
@@ -5,5 +5,5 @@ Import('env_modules')
env_vsdecoder_gdnative = env_modules.Clone()
-env_vsdecoder_gdnative.Append(CPPPATH=['#modules/gdnative/include/'])
+env_vsdecoder_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/'])
env_vsdecoder_gdnative.add_source_files(env.modules_sources, '*.cpp')
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 1d75d9e2fe..38009b878d 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -407,9 +407,10 @@ public:
csi.resize(_debug_call_stack_pos);
for (int i = 0; i < _debug_call_stack_pos; i++) {
csi.write[_debug_call_stack_pos - i - 1].line = _call_stack[i].line ? *_call_stack[i].line : 0;
- if (_call_stack[i].function)
+ if (_call_stack[i].function) {
csi.write[_debug_call_stack_pos - i - 1].func = _call_stack[i].function->get_name();
- csi.write[_debug_call_stack_pos - i - 1].file = _call_stack[i].function->get_script()->get_path();
+ csi.write[_debug_call_stack_pos - i - 1].file = _call_stack[i].function->get_script()->get_path();
+ }
}
return csi;
}
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 69bf114c8e..bcf3140fa6 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -2178,7 +2178,6 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p
static void _find_call_arguments(const GDScriptCompletionContext &p_context, const GDScriptCompletionIdentifier &p_base, const StringName &p_method, int p_argidx, bool p_static, Set<String> &r_result, String &r_arghint) {
Variant base = p_base.value;
GDScriptParser::DataType base_type = p_base.type;
- bool _static = false;
const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\"";
@@ -2191,12 +2190,10 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con
return;
}
}
- if (!_static) {
- for (int i = 0; i < base_type.class_type->functions.size(); i++) {
- if (base_type.class_type->functions[i]->name == p_method) {
- r_arghint = _make_arguments_hint(base_type.class_type->functions[i], p_argidx);
- return;
- }
+ for (int i = 0; i < base_type.class_type->functions.size(); i++) {
+ if (base_type.class_type->functions[i]->name == p_method) {
+ r_arghint = _make_arguments_hint(base_type.class_type->functions[i], p_argidx);
+ return;
}
}
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 7552bc6bff..5ebcddfd7c 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -72,6 +72,7 @@ const char *GDScriptFunctions::get_func_name(Function p_func) {
"is_zero_approx",
"ease",
"decimals",
+ "step_decimals",
"stepify",
"lerp",
"inverse_lerp",
@@ -339,6 +340,13 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
r_ret = Math::step_decimals((double)*p_args[0]);
+ ERR_EXPLAIN("GDScript method 'decimals' is deprecated and has been renamed to 'step_decimals', please update your code accordingly.");
+ WARN_DEPRECATED
+ } break;
+ case MATH_STEP_DECIMALS: {
+ VALIDATE_ARG_COUNT(1);
+ VALIDATE_ARG_NUM(0);
+ r_ret = Math::step_decimals((double)*p_args[0]);
} break;
case MATH_STEPIFY: {
VALIDATE_ARG_COUNT(2);
@@ -1452,6 +1460,7 @@ bool GDScriptFunctions::is_deterministic(Function p_func) {
case MATH_ISINF:
case MATH_EASE:
case MATH_DECIMALS:
+ case MATH_STEP_DECIMALS:
case MATH_STEPIFY:
case MATH_LERP:
case MATH_INVERSE_LERP:
@@ -1626,7 +1635,12 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
} break;
case MATH_DECIMALS: {
MethodInfo mi("decimals", PropertyInfo(Variant::REAL, "step"));
- mi.return_val.type = Variant::REAL;
+ mi.return_val.type = Variant::INT;
+ return mi;
+ } break;
+ case MATH_STEP_DECIMALS: {
+ MethodInfo mi("step_decimals", PropertyInfo(Variant::REAL, "step"));
+ mi.return_val.type = Variant::INT;
return mi;
} break;
case MATH_STEPIFY: {
diff --git a/modules/gdscript/gdscript_functions.h b/modules/gdscript/gdscript_functions.h
index 0dbd172acf..c594480ff8 100644
--- a/modules/gdscript/gdscript_functions.h
+++ b/modules/gdscript/gdscript_functions.h
@@ -63,6 +63,7 @@ public:
MATH_ISZEROAPPROX,
MATH_EASE,
MATH_DECIMALS,
+ MATH_STEP_DECIMALS,
MATH_STEPIFY,
MATH_LERP,
MATH_INVERSE_LERP,
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 80af094c2c..51ec0c1442 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -282,7 +282,6 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
switch (tokenizer->get_token()) {
case GDScriptTokenizer::TK_CURSOR: {
- completion_cursor = StringName();
completion_type = COMPLETION_GET_NODE;
completion_class = current_class;
completion_function = current_function;
@@ -2870,8 +2869,6 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
lv->assign_op = op;
lv->assign = assigned;
- lv->assign_op = op;
-
if (!_end_statement()) {
_set_error("Expected end of statement (var)");
return;
@@ -6226,8 +6223,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
return DataType();
}
#ifdef DEBUG_ENABLED
- if (var_op == Variant::OP_DIVIDE && argument_a_type.has_type && argument_a_type.kind == DataType::BUILTIN && argument_a_type.builtin_type == Variant::INT &&
- argument_b_type.has_type && argument_b_type.kind == DataType::BUILTIN && argument_b_type.builtin_type == Variant::INT) {
+ if (var_op == Variant::OP_DIVIDE && argument_a_type.kind == DataType::BUILTIN && argument_a_type.builtin_type == Variant::INT &&
+ argument_b_type.kind == DataType::BUILTIN && argument_b_type.builtin_type == Variant::INT) {
_add_warning(GDScriptWarning::INTEGER_DIVISION, op->line);
}
#endif // DEBUG_ENABLED
@@ -6938,10 +6935,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
#ifdef DEBUG_ENABLED
if (current_function && !for_completion && !is_static && p_call->arguments[0]->type == Node::TYPE_SELF && current_function->_static) {
- if (current_function && current_function->_static && p_call->arguments[0]->type == Node::TYPE_SELF) {
- _set_error("Can't call non-static function from a static function.", p_call->line);
- return DataType();
- }
+ _set_error("Can't call non-static function from a static function.", p_call->line);
+ return DataType();
}
if (check_types && !is_static && !is_initializer && base_type.is_meta_type) {
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 17eb6f674c..657aa1f9ce 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -67,9 +67,6 @@ void GridMapEditor::_menu_option(int p_option) {
floor->set_value(floor->get_value() + 1);
} break;
- case MENU_OPTION_CONFIGURE: {
-
- } break;
case MENU_OPTION_LOCK_VIEW: {
int index = options->get_popup()->get_item_index(MENU_OPTION_LOCK_VIEW);
@@ -121,14 +118,15 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_ROTATE_Y: {
Basis r;
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
- r.set_orthogonal_index(selection.duplicate_rot);
+ r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(0, 1, 0), -Math_PI / 2.0);
- selection.duplicate_rot = r.get_orthogonal_index();
- _update_duplicate_indicator();
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
break;
}
+
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0, 1, 0), -Math_PI / 2.0);
cursor_rot = r.get_orthogonal_index();
@@ -137,12 +135,12 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_ROTATE_X: {
Basis r;
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
- r.set_orthogonal_index(selection.duplicate_rot);
+ r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(1, 0, 0), -Math_PI / 2.0);
- selection.duplicate_rot = r.get_orthogonal_index();
- _update_duplicate_indicator();
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
break;
}
@@ -154,12 +152,12 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_ROTATE_Z: {
Basis r;
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
- r.set_orthogonal_index(selection.duplicate_rot);
+ r.set_orthogonal_index(paste_indicator.orientation);
r.rotate(Vector3(0, 0, 1), -Math_PI / 2.0);
- selection.duplicate_rot = r.get_orthogonal_index();
- _update_duplicate_indicator();
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
break;
}
@@ -171,6 +169,15 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_BACK_ROTATE_Y: {
Basis r;
+ if (input_action == INPUT_PASTE) {
+
+ r.set_orthogonal_index(paste_indicator.orientation);
+ r.rotate(Vector3(0, 1, 0), Math_PI / 2.0);
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
+ break;
+ }
+
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0, 1, 0), Math_PI / 2.0);
cursor_rot = r.get_orthogonal_index();
@@ -179,6 +186,15 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_BACK_ROTATE_X: {
Basis r;
+ if (input_action == INPUT_PASTE) {
+
+ r.set_orthogonal_index(paste_indicator.orientation);
+ r.rotate(Vector3(1, 0, 0), Math_PI / 2.0);
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
+ break;
+ }
+
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(1, 0, 0), Math_PI / 2.0);
cursor_rot = r.get_orthogonal_index();
@@ -187,6 +203,15 @@ void GridMapEditor::_menu_option(int p_option) {
case MENU_OPTION_CURSOR_BACK_ROTATE_Z: {
Basis r;
+ if (input_action == INPUT_PASTE) {
+
+ r.set_orthogonal_index(paste_indicator.orientation);
+ r.rotate(Vector3(0, 0, 1), Math_PI / 2.0);
+ paste_indicator.orientation = r.get_orthogonal_index();
+ _update_paste_indicator();
+ break;
+ }
+
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0, 0, 1), Math_PI / 2.0);
cursor_rot = r.get_orthogonal_index();
@@ -194,10 +219,10 @@ void GridMapEditor::_menu_option(int p_option) {
} break;
case MENU_OPTION_CURSOR_CLEAR_ROTATION: {
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
- selection.duplicate_rot = 0;
- _update_duplicate_indicator();
+ paste_indicator.orientation = 0;
+ _update_paste_indicator();
break;
}
@@ -205,28 +230,33 @@ void GridMapEditor::_menu_option(int p_option) {
_update_cursor_transform();
} break;
- case MENU_OPTION_DUPLICATE_SELECTS: {
- int idx = options->get_popup()->get_item_index(MENU_OPTION_DUPLICATE_SELECTS);
+ case MENU_OPTION_PASTE_SELECTS: {
+ int idx = options->get_popup()->get_item_index(MENU_OPTION_PASTE_SELECTS);
options->get_popup()->set_item_checked(idx, !options->get_popup()->is_item_checked(idx));
} break;
- case MENU_OPTION_SELECTION_DUPLICATE:
+
+ case MENU_OPTION_SELECTION_DUPLICATE: // fallthrough
+ case MENU_OPTION_SELECTION_CUT: {
if (!(selection.active && input_action == INPUT_NONE))
- return;
- if (last_mouseover == Vector3(-1, -1, -1)) //nono mouseovering anythin
break;
- last_mouseover = selection.begin;
- VS::get_singleton()->instance_set_transform(grid_instance[edit_axis], Transform(Basis(), grid_ofs));
+ _set_clipboard_data();
- input_action = INPUT_DUPLICATE;
- selection.click = last_mouseover;
- selection.current = last_mouseover;
- selection.duplicate_rot = 0;
- _update_duplicate_indicator();
- break;
+ if (p_option == MENU_OPTION_SELECTION_CUT) {
+ _delete_selection();
+ }
+
+ input_action = INPUT_PASTE;
+ paste_indicator.click = selection.begin;
+ paste_indicator.current = selection.begin;
+ paste_indicator.begin = selection.begin;
+ paste_indicator.end = selection.end;
+ paste_indicator.orientation = 0;
+ _update_paste_indicator();
+ } break;
case MENU_OPTION_SELECTION_CLEAR: {
if (!selection.active)
- return;
+ break;
_delete_selection();
@@ -315,17 +345,28 @@ void GridMapEditor::_validate_selection() {
_update_selection_transform();
}
+void GridMapEditor::_set_selection(bool p_active, const Vector3 p_begin, const Vector3 p_end) {
+
+ selection.active = p_active;
+ selection.begin = p_begin;
+ selection.end = p_end;
+ selection.click = p_begin;
+ selection.current = p_end;
+
+ _update_selection_transform();
+}
+
bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, bool p_click) {
if (!spatial_editor)
return false;
- if (selected_palette < 0 && input_action != INPUT_COPY && input_action != INPUT_SELECT && input_action != INPUT_DUPLICATE)
+ if (selected_palette < 0 && input_action != INPUT_PICK && input_action != INPUT_SELECT && input_action != INPUT_PASTE)
return false;
Ref<MeshLibrary> mesh_library = node->get_mesh_library();
if (mesh_library.is_null())
return false;
- if (input_action != INPUT_COPY && input_action != INPUT_SELECT && input_action != INPUT_DUPLICATE && !mesh_library->has_item(selected_palette))
+ if (input_action != INPUT_PICK && input_action != INPUT_SELECT && input_action != INPUT_PASTE && !mesh_library->has_item(selected_palette))
return false;
Camera *camera = p_camera;
@@ -386,13 +427,17 @@ bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, boo
cursor_origin = (Vector3(cell[0], cell[1], cell[2]) + Vector3(0.5 * node->get_center_x(), 0.5 * node->get_center_y(), 0.5 * node->get_center_z())) * node->get_cell_size();
cursor_visible = true;
+ if (input_action == INPUT_SELECT || input_action == INPUT_PASTE) {
+ cursor_visible = false;
+ }
+
_update_cursor_transform();
}
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
- selection.current = Vector3(cell[0], cell[1], cell[2]);
- _update_duplicate_indicator();
+ paste_indicator.current = Vector3(cell[0], cell[1], cell[2]);
+ _update_paste_indicator();
} else if (input_action == INPUT_SELECT) {
@@ -403,7 +448,7 @@ bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, boo
_validate_selection();
return true;
- } else if (input_action == INPUT_COPY) {
+ } else if (input_action == INPUT_PICK) {
int item = node->get_cell_item(cell[0], cell[1], cell[2]);
if (item >= 0) {
@@ -456,10 +501,9 @@ void GridMapEditor::_delete_selection() {
}
}
}
+ undo_redo->add_do_method(this, "_set_selection", !selection.active, selection.begin, selection.end);
+ undo_redo->add_undo_method(this, "_set_selection", selection.active, selection.begin, selection.end);
undo_redo->commit_action();
-
- selection.active = false;
- _validate_selection();
}
void GridMapEditor::_fill_selection() {
@@ -479,97 +523,124 @@ void GridMapEditor::_fill_selection() {
}
}
}
+ undo_redo->add_do_method(this, "_set_selection", !selection.active, selection.begin, selection.end);
+ undo_redo->add_undo_method(this, "_set_selection", selection.active, selection.begin, selection.end);
undo_redo->commit_action();
+}
- selection.active = false;
- _validate_selection();
+void GridMapEditor::_clear_clipboard_data() {
+
+ for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
+
+ VisualServer::get_singleton()->free(E->get().instance);
+ }
+
+ clipboard_items.clear();
}
-void GridMapEditor::_update_duplicate_indicator() {
+void GridMapEditor::_set_clipboard_data() {
- if (!selection.active || input_action != INPUT_DUPLICATE) {
+ _clear_clipboard_data();
+
+ Ref<MeshLibrary> meshLibrary = node->get_mesh_library();
+
+ for (int i = selection.begin.x; i <= selection.end.x; i++) {
+
+ for (int j = selection.begin.y; j <= selection.end.y; j++) {
+
+ for (int k = selection.begin.z; k <= selection.end.z; k++) {
+
+ int itm = node->get_cell_item(i, j, k);
+ if (itm == GridMap::INVALID_CELL_ITEM)
+ continue;
+
+ Ref<Mesh> mesh = meshLibrary->get_item_mesh(itm);
+
+ ClipboardItem item;
+ item.cell_item = itm;
+ item.grid_offset = Vector3(i, j, k) - selection.begin;
+ item.orientation = node->get_cell_item_orientation(i, j, k);
+ item.instance = VisualServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario());
+
+ clipboard_items.push_back(item);
+ }
+ }
+ }
+}
+
+void GridMapEditor::_update_paste_indicator() {
+
+ if (input_action != INPUT_PASTE) {
Transform xf;
xf.basis.set_zero();
- VisualServer::get_singleton()->instance_set_transform(duplicate_instance, xf);
+ VisualServer::get_singleton()->instance_set_transform(paste_instance, xf);
return;
}
+ Vector3 center = 0.5 * Vector3(node->get_center_x(), node->get_center_y(), node->get_center_z());
+ Vector3 scale = (Vector3(1, 1, 1) + (paste_indicator.end - paste_indicator.begin)) * node->get_cell_size();
Transform xf;
- xf.scale(Vector3(1, 1, 1) * (Vector3(1, 1, 1) + (selection.end - selection.begin)) * node->get_cell_size());
- xf.origin = (selection.begin + (selection.current - selection.click)) * node->get_cell_size();
+ xf.scale(scale);
+ xf.origin = (paste_indicator.begin + (paste_indicator.current - paste_indicator.click) + center) * node->get_cell_size();
Basis rot;
- rot.set_orthogonal_index(selection.duplicate_rot);
+ rot.set_orthogonal_index(paste_indicator.orientation);
xf.basis = rot * xf.basis;
+ xf.translate((-center * node->get_cell_size()) / scale);
- VisualServer::get_singleton()->instance_set_transform(duplicate_instance, node->get_global_transform() * xf);
-}
+ VisualServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf);
-struct __Item {
- Vector3 pos;
- int rot;
- int item;
-};
-void GridMapEditor::_duplicate_paste() {
+ for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
- if (!selection.active)
- return;
+ ClipboardItem &item = E->get();
- int idx = options->get_popup()->get_item_index(MENU_OPTION_DUPLICATE_SELECTS);
- bool reselect = options->get_popup()->is_item_checked(idx);
+ xf = Transform();
+ xf.origin = (paste_indicator.begin + (paste_indicator.current - paste_indicator.click) + center) * node->get_cell_size();
+ xf.basis = rot * xf.basis;
+ xf.translate(item.grid_offset * node->get_cell_size());
+
+ Basis item_rot;
+ item_rot.set_orthogonal_index(item.orientation);
+ xf.basis = item_rot * xf.basis;
+
+ VisualServer::get_singleton()->instance_set_transform(item.instance, node->get_global_transform() * xf);
+ }
+}
- List<__Item> items;
+void GridMapEditor::_do_paste() {
+
+ int idx = options->get_popup()->get_item_index(MENU_OPTION_PASTE_SELECTS);
+ bool reselect = options->get_popup()->is_item_checked(idx);
Basis rot;
- rot.set_orthogonal_index(selection.duplicate_rot);
+ rot.set_orthogonal_index(paste_indicator.orientation);
- for (int i = selection.begin.x; i <= selection.end.x; i++) {
+ Vector3 ofs = paste_indicator.current - paste_indicator.click;
+ undo_redo->create_action(TTR("GridMap Paste Selection"));
- for (int j = selection.begin.y; j <= selection.end.y; j++) {
+ for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
- for (int k = selection.begin.z; k <= selection.end.z; k++) {
+ ClipboardItem &item = E->get();
- int itm = node->get_cell_item(i, j, k);
- if (itm == GridMap::INVALID_CELL_ITEM)
- continue;
- int orientation = node->get_cell_item_orientation(i, j, k);
- __Item item;
- Vector3 rel = Vector3(i, j, k) - selection.begin;
- rel = rot.xform(rel);
-
- Basis orm;
- orm.set_orthogonal_index(orientation);
- orm = rot * orm;
-
- item.pos = selection.begin + rel;
- item.item = itm;
- item.rot = orm.get_orthogonal_index();
- items.push_back(item);
- }
- }
- }
+ Vector3 pos = rot.xform(item.grid_offset) + paste_indicator.begin + ofs;
- Vector3 ofs = selection.current - selection.click;
- if (items.size()) {
- undo_redo->create_action(TTR("GridMap Duplicate Selection"));
- for (List<__Item>::Element *E = items.front(); E; E = E->next()) {
- __Item &it = E->get();
- Vector3 pos = it.pos + ofs;
+ Basis orm;
+ orm.set_orthogonal_index(item.orientation);
+ orm = rot * orm;
- undo_redo->add_do_method(node, "set_cell_item", pos.x, pos.y, pos.z, it.item, it.rot);
- undo_redo->add_undo_method(node, "set_cell_item", pos.x, pos.y, pos.z, node->get_cell_item(pos.x, pos.y, pos.z), node->get_cell_item_orientation(pos.x, pos.y, pos.z));
- }
- undo_redo->commit_action();
+ undo_redo->add_do_method(node, "set_cell_item", pos.x, pos.y, pos.z, item.cell_item, orm.get_orthogonal_index());
+ undo_redo->add_undo_method(node, "set_cell_item", pos.x, pos.y, pos.z, node->get_cell_item(pos.x, pos.y, pos.z), node->get_cell_item_orientation(pos.x, pos.y, pos.z));
}
if (reselect) {
- selection.begin += ofs;
- selection.end += ofs;
- selection.click = selection.begin;
- selection.current = selection.end;
- _validate_selection();
+ undo_redo->add_do_method(this, "_set_selection", true, paste_indicator.begin + ofs, paste_indicator.end + ofs);
+ undo_redo->add_undo_method(this, "_set_selection", selection.active, selection.begin, selection.end);
}
+
+ undo_redo->commit_action();
+
+ _clear_clipboard_data();
}
bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<InputEvent> &p_event) {
@@ -596,28 +667,31 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
if (mb->get_button_index() == BUTTON_LEFT) {
- if (input_action == INPUT_DUPLICATE) {
- //paste
- _duplicate_paste();
+ if (input_action == INPUT_PASTE) {
+ _do_paste();
input_action = INPUT_NONE;
- _update_duplicate_indicator();
+ _update_paste_indicator();
} else if (mb->get_shift()) {
input_action = INPUT_SELECT;
+ last_selection = selection;
} else if (mb->get_command()) {
- input_action = INPUT_COPY;
+ input_action = INPUT_PICK;
} else {
input_action = INPUT_PAINT;
set_items.clear();
}
} else if (mb->get_button_index() == BUTTON_RIGHT) {
- if (input_action == INPUT_DUPLICATE) {
+ if (input_action == INPUT_PASTE) {
+ _clear_clipboard_data();
input_action = INPUT_NONE;
- _update_duplicate_indicator();
- } else if (mb->get_shift()) {
+ _update_paste_indicator();
+ return true;
+ } else if (selection.active) {
+ _set_selection(false);
+ return true;
+ } else {
input_action = INPUT_ERASE;
set_items.clear();
- } else {
- return false;
}
} else {
return false;
@@ -650,13 +724,21 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
return set_items.size() > 0;
}
+ if (mb->get_button_index() == BUTTON_LEFT && input_action == INPUT_SELECT) {
+
+ undo_redo->create_action("GridMap Selection");
+ undo_redo->add_do_method(this, "_set_selection", selection.active, selection.begin, selection.end);
+ undo_redo->add_undo_method(this, "_set_selection", last_selection.active, last_selection.begin, last_selection.end);
+ undo_redo->commit_action();
+ }
+
if (mb->get_button_index() == BUTTON_LEFT && input_action != INPUT_NONE) {
set_items.clear();
input_action = INPUT_NONE;
return true;
}
- if (mb->get_button_index() == BUTTON_RIGHT && (input_action == INPUT_ERASE || input_action == INPUT_DUPLICATE)) {
+ if (mb->get_button_index() == BUTTON_RIGHT && (input_action == INPUT_ERASE || input_action == INPUT_PASTE)) {
input_action = INPUT_NONE;
return true;
}
@@ -670,6 +752,45 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
return do_input_action(p_camera, mm->get_position(), false);
}
+ Ref<InputEventKey> k = p_event;
+
+ if (k.is_valid()) {
+ if (k->is_pressed()) {
+ if (k->get_scancode() == KEY_ESCAPE) {
+
+ if (input_action == INPUT_PASTE) {
+ _clear_clipboard_data();
+ input_action = INPUT_NONE;
+ _update_paste_indicator();
+ return true;
+ } else if (selection.active) {
+ _set_selection(false);
+ return true;
+ } else {
+ selected_palette = -1;
+ mesh_library_palette->unselect_all();
+ update_palette();
+ _update_cursor_instance();
+ return true;
+ }
+ }
+
+ if (k->get_shift() && selection.active && input_action != INPUT_PASTE) {
+
+ if (k->get_scancode() == options->get_popup()->get_item_accelerator(options->get_popup()->get_item_index(MENU_OPTION_PREV_LEVEL))) {
+ selection.click[edit_axis]--;
+ _validate_selection();
+ return true;
+ }
+ if (k->get_scancode() == options->get_popup()->get_item_accelerator(options->get_popup()->get_item_index(MENU_OPTION_NEXT_LEVEL))) {
+ selection.click[edit_axis]++;
+ _validate_selection();
+ return true;
+ }
+ }
+ }
+ }
+
Ref<InputEventPanGesture> pan_gesture = p_event;
if (pan_gesture.is_valid()) {
@@ -818,7 +939,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
input_action = INPUT_NONE;
selection.active = false;
_update_selection_transform();
- _update_duplicate_indicator();
+ _update_paste_indicator();
spatial_editor = Object::cast_to<SpatialEditorPlugin>(editor->get_editor_plugin_screen());
@@ -953,13 +1074,15 @@ void GridMapEditor::_notification(int p_what) {
}
selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario());
- duplicate_instance = VisualServer::get_singleton()->instance_create2(duplicate_mesh, get_tree()->get_root()->get_world()->get_scenario());
+ paste_instance = VisualServer::get_singleton()->instance_create2(paste_mesh, get_tree()->get_root()->get_world()->get_scenario());
_update_selection_transform();
- _update_duplicate_indicator();
+ _update_paste_indicator();
} break;
case NOTIFICATION_EXIT_TREE: {
+ _clear_clipboard_data();
+
for (int i = 0; i < 3; i++) {
VS::get_singleton()->free(grid_instance[i]);
@@ -970,9 +1093,9 @@ void GridMapEditor::_notification(int p_what) {
}
VisualServer::get_singleton()->free(selection_instance);
- VisualServer::get_singleton()->free(duplicate_instance);
+ VisualServer::get_singleton()->free(paste_instance);
selection_instance = RID();
- duplicate_instance = RID();
+ paste_instance = RID();
} break;
case NOTIFICATION_PROCESS: {
@@ -1065,6 +1188,7 @@ void GridMapEditor::_bind_methods() {
ClassDB::bind_method("_configure", &GridMapEditor::_configure);
ClassDB::bind_method("_item_selected_cbk", &GridMapEditor::_item_selected_cbk);
ClassDB::bind_method("_floor_changed", &GridMapEditor::_floor_changed);
+ ClassDB::bind_method("_set_selection", &GridMapEditor::_set_selection);
ClassDB::bind_method(D_METHOD("_set_display_mode", "mode"), &GridMapEditor::_set_display_mode);
}
@@ -1128,15 +1252,12 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
options->get_popup()->add_item(TTR("Cursor Back Rotate Z"), MENU_OPTION_CURSOR_BACK_ROTATE_Z, KEY_MASK_SHIFT + KEY_D);
options->get_popup()->add_item(TTR("Cursor Clear Rotation"), MENU_OPTION_CURSOR_CLEAR_ROTATION, KEY_W);
options->get_popup()->add_separator();
- options->get_popup()->add_check_item("Duplicate Selects", MENU_OPTION_DUPLICATE_SELECTS);
- options->get_popup()->add_separator();
- options->get_popup()->add_item(TTR("Create Area"), MENU_OPTION_SELECTION_MAKE_AREA, KEY_CONTROL + KEY_C);
- options->get_popup()->add_item(TTR("Create Exterior Connector"), MENU_OPTION_SELECTION_MAKE_EXTERIOR_CONNECTOR);
- options->get_popup()->add_item(TTR("Erase Area"), MENU_OPTION_REMOVE_AREA);
+ options->get_popup()->add_check_item("Paste Selects", MENU_OPTION_PASTE_SELECTS);
options->get_popup()->add_separator();
- options->get_popup()->add_item(TTR("Duplicate Selection"), MENU_OPTION_SELECTION_DUPLICATE, KEY_MASK_SHIFT + KEY_C);
- options->get_popup()->add_item(TTR("Clear Selection"), MENU_OPTION_SELECTION_CLEAR, KEY_MASK_SHIFT + KEY_X);
- options->get_popup()->add_item(TTR("Fill Selection"), MENU_OPTION_SELECTION_FILL, KEY_MASK_SHIFT + KEY_F);
+ options->get_popup()->add_item(TTR("Duplicate Selection"), MENU_OPTION_SELECTION_DUPLICATE, KEY_MASK_CTRL + KEY_C);
+ options->get_popup()->add_item(TTR("Cut Selection"), MENU_OPTION_SELECTION_CUT, KEY_MASK_CTRL + KEY_X);
+ options->get_popup()->add_item(TTR("Clear Selection"), MENU_OPTION_SELECTION_CLEAR, KEY_DELETE);
+ options->get_popup()->add_item(TTR("Fill Selection"), MENU_OPTION_SELECTION_FILL, KEY_MASK_CTRL + KEY_F);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Settings"), MENU_OPTION_GRIDMAP_SETTINGS);
@@ -1211,7 +1332,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
last_mouseover = Vector3(-1, -1, -1);
selection_mesh = VisualServer::get_singleton()->mesh_create();
- duplicate_mesh = VisualServer::get_singleton()->mesh_create();
+ paste_mesh = VisualServer::get_singleton()->mesh_create();
{
//selection mesh create
@@ -1319,12 +1440,12 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh, 1, outer_mat->get_rid());
d[VS::ARRAY_VERTEX] = triangles;
- VisualServer::get_singleton()->mesh_add_surface_from_arrays(duplicate_mesh, VS::PRIMITIVE_TRIANGLES, d);
- VisualServer::get_singleton()->mesh_surface_set_material(duplicate_mesh, 0, inner_mat->get_rid());
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, VS::PRIMITIVE_TRIANGLES, d);
+ VisualServer::get_singleton()->mesh_surface_set_material(paste_mesh, 0, inner_mat->get_rid());
d[VS::ARRAY_VERTEX] = lines;
- VisualServer::get_singleton()->mesh_add_surface_from_arrays(duplicate_mesh, VS::PRIMITIVE_LINES, d);
- VisualServer::get_singleton()->mesh_surface_set_material(duplicate_mesh, 1, outer_mat->get_rid());
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, VS::PRIMITIVE_LINES, d);
+ VisualServer::get_singleton()->mesh_surface_set_material(paste_mesh, 1, outer_mat->get_rid());
for (int i = 0; i < 3; i++) {
d[VS::ARRAY_VERTEX] = square[i];
@@ -1341,6 +1462,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
GridMapEditor::~GridMapEditor() {
+ _clear_clipboard_data();
+
for (int i = 0; i < 3; i++) {
if (grid[i].is_valid())
@@ -1359,9 +1482,9 @@ GridMapEditor::~GridMapEditor() {
if (selection_instance.is_valid())
VisualServer::get_singleton()->free(selection_instance);
- VisualServer::get_singleton()->free(duplicate_mesh);
- if (duplicate_instance.is_valid())
- VisualServer::get_singleton()->free(duplicate_instance);
+ VisualServer::get_singleton()->free(paste_mesh);
+ if (paste_instance.is_valid())
+ VisualServer::get_singleton()->free(paste_instance);
}
void GridMapEditorPlugin::_notification(int p_what) {
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 59b8ac13da..8e1948ea7d 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -54,9 +54,9 @@ class GridMapEditor : public VBoxContainer {
INPUT_NONE,
INPUT_PAINT,
INPUT_ERASE,
- INPUT_COPY,
+ INPUT_PICK,
INPUT_SELECT,
- INPUT_DUPLICATE,
+ INPUT_PASTE,
};
enum ClipMode {
@@ -116,8 +116,17 @@ class GridMapEditor : public VBoxContainer {
RID selection_instance;
RID selection_level_mesh[3];
RID selection_level_instance[3];
- RID duplicate_mesh;
- RID duplicate_instance;
+ RID paste_mesh;
+ RID paste_instance;
+
+ struct ClipboardItem {
+ int cell_item;
+ Vector3 grid_offset;
+ int orientation;
+ RID instance;
+ };
+
+ List<ClipboardItem> clipboard_items;
Ref<SpatialMaterial> indicator_mat;
Ref<SpatialMaterial> inner_mat;
@@ -132,9 +141,19 @@ class GridMapEditor : public VBoxContainer {
Vector3 current;
Vector3 begin;
Vector3 end;
- int duplicate_rot;
bool active;
} selection;
+ Selection last_selection;
+
+ struct PasteIndicator {
+
+ Vector3 click;
+ Vector3 current;
+ Vector3 begin;
+ Vector3 end;
+ int orientation;
+ };
+ PasteIndicator paste_indicator;
bool cursor_visible;
Transform cursor_transform;
@@ -148,7 +167,6 @@ class GridMapEditor : public VBoxContainer {
enum Menu {
- MENU_OPTION_CONFIGURE,
MENU_OPTION_NEXT_LEVEL,
MENU_OPTION_PREV_LEVEL,
MENU_OPTION_LOCK_VIEW,
@@ -165,13 +183,11 @@ class GridMapEditor : public VBoxContainer {
MENU_OPTION_CURSOR_BACK_ROTATE_X,
MENU_OPTION_CURSOR_BACK_ROTATE_Z,
MENU_OPTION_CURSOR_CLEAR_ROTATION,
- MENU_OPTION_DUPLICATE_SELECTS,
- MENU_OPTION_SELECTION_MAKE_AREA,
- MENU_OPTION_SELECTION_MAKE_EXTERIOR_CONNECTOR,
+ MENU_OPTION_PASTE_SELECTS,
MENU_OPTION_SELECTION_DUPLICATE,
+ MENU_OPTION_SELECTION_CUT,
MENU_OPTION_SELECTION_CLEAR,
MENU_OPTION_SELECTION_FILL,
- MENU_OPTION_REMOVE_AREA,
MENU_OPTION_GRIDMAP_SETTINGS
};
@@ -200,10 +216,13 @@ class GridMapEditor : public VBoxContainer {
void _icon_size_changed(float p_value);
- void _update_duplicate_indicator();
- void _duplicate_paste();
+ void _clear_clipboard_data();
+ void _set_clipboard_data();
+ void _update_paste_indicator();
+ void _do_paste();
void _update_selection_transform();
void _validate_selection();
+ void _set_selection(bool p_active, const Vector3 p_begin = Vector3(), const Vector3 p_end = Vector3());
void _floor_changed(float p_value);
diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub
index d5f87905eb..96e8e704dd 100644
--- a/modules/jpg/SCsub
+++ b/modules/jpg/SCsub
@@ -13,7 +13,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_jpg.Append(CPPPATH=[thirdparty_dir])
+env_jpg.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_jpg.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/mono/build_scripts/mono_configure.py b/modules/mono/build_scripts/mono_configure.py
index 160580e116..4cfa2a5b93 100644
--- a/modules/mono/build_scripts/mono_configure.py
+++ b/modules/mono/build_scripts/mono_configure.py
@@ -70,7 +70,7 @@ def configure(env, env_mono):
mono_lib_path = os.path.join(mono_root, 'lib')
env.Append(LIBPATH=mono_lib_path)
- env_mono.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
+ env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
if mono_static:
lib_suffix = Environment()['LIBSUFFIX']
@@ -153,7 +153,7 @@ def configure(env, env_mono):
mono_lib_path = os.path.join(mono_root, 'lib')
env.Append(LIBPATH=mono_lib_path)
- env_mono.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
+ env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
mono_lib = find_file_in_dir(mono_lib_path, mono_lib_names, prefix='lib', extension='.a')
diff --git a/modules/mono/glue/Managed/Files/Mathf.cs b/modules/mono/glue/Managed/Files/Mathf.cs
index 947fbb6665..ff26c7fddf 100644
--- a/modules/mono/glue/Managed/Files/Mathf.cs
+++ b/modules/mono/glue/Managed/Files/Mathf.cs
@@ -79,14 +79,27 @@ namespace Godot
return (real_t)Math.Cosh(s);
}
- public static int Decimals(real_t step)
- {
- return Decimals((decimal)step);
- }
-
- public static int Decimals(decimal step)
- {
- return BitConverter.GetBytes(decimal.GetBits(step)[3])[2];
+ public static int StepDecimals(real_t step)
+ {
+ double[] sd = new double[] {
+ 0.9999,
+ 0.09999,
+ 0.009999,
+ 0.0009999,
+ 0.00009999,
+ 0.000009999,
+ 0.0000009999,
+ 0.00000009999,
+ 0.000000009999,
+ };
+ double abs = Mathf.Abs(step);
+ double decs = abs - (int)abs; // Strip away integer part
+ for (int i = 0; i < sd.Length; i++) {
+ if (decs >= sd[i]) {
+ return i;
+ }
+ }
+ return 0;
}
public static real_t Deg2Rad(real_t deg)
diff --git a/modules/mono/glue/Managed/Files/MathfEx.cs b/modules/mono/glue/Managed/Files/MathfEx.cs
index d6eb65b097..b96f01bc2e 100644
--- a/modules/mono/glue/Managed/Files/MathfEx.cs
+++ b/modules/mono/glue/Managed/Files/MathfEx.cs
@@ -21,6 +21,16 @@ namespace Godot
public const real_t Epsilon = 1e-06f;
#endif
+ public static int DecimalCount(real_t s)
+ {
+ return DecimalCount((decimal)s);
+ }
+
+ public static int DecimalCount(decimal s)
+ {
+ return BitConverter.GetBytes(decimal.GetBits(s)[3])[2];
+ }
+
public static int CeilToInt(real_t s)
{
return (int)Math.Ceiling(s);
diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp
index 0ef66577fe..1fdddd3925 100644
--- a/modules/mono/utils/string_utils.cpp
+++ b/modules/mono/utils/string_utils.cpp
@@ -33,6 +33,7 @@
#include "core/os/file_access.h"
#include <stdio.h>
+#include <stdlib.h>
namespace {
@@ -210,7 +211,7 @@ String str_format(const char *p_format, ...) {
#endif
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
-#define vsnprintf vsnprintf_s
+#define vsnprintf(m_buffer, m_count, m_format, m_argptr) vsnprintf_s(m_buffer, m_count, _TRUNCATE, m_format, m_argptr)
#endif
String str_format(const char *p_format, va_list p_list) {
diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub
index 765a9fc11a..6a72a519fe 100644
--- a/modules/ogg/SCsub
+++ b/modules/ogg/SCsub
@@ -14,7 +14,7 @@ if env['builtin_libogg']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_ogg.Append(CPPPATH=[thirdparty_dir])
+ env_ogg.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_ogg.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/opensimplex/SCsub b/modules/opensimplex/SCsub
index 4235f6a0b9..311d33b047 100644
--- a/modules/opensimplex/SCsub
+++ b/modules/opensimplex/SCsub
@@ -12,7 +12,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_opensimplex.Append(CPPPATH=[thirdparty_dir])
+env_opensimplex.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_opensimplex.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/opus/SCsub b/modules/opus/SCsub
index a1325734e2..f3c981dd45 100644
--- a/modules/opus/SCsub
+++ b/modules/opus/SCsub
@@ -206,7 +206,7 @@ if env['builtin_opus']:
# also requires libogg
if env['builtin_libogg']:
- env_opus.Append(CPPPATH=["#thirdparty/libogg"])
+ env_opus.Prepend(CPPPATH=["#thirdparty/libogg"])
env_opus.Append(CPPFLAGS=["-DHAVE_CONFIG_H"])
@@ -218,7 +218,7 @@ if env['builtin_opus']:
"silk/fixed",
"silk/float",
]
- env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
+ env_opus.Prepend(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
if env["platform"] == "android":
if ("android_arch" in env and env["android_arch"] in ["armv6", "armv7"]):
diff --git a/modules/pvr/SCsub b/modules/pvr/SCsub
index 2e4a792a36..18da38fbbd 100644
--- a/modules/pvr/SCsub
+++ b/modules/pvr/SCsub
@@ -17,7 +17,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_pvr.Append(CPPPATH=[thirdparty_dir])
+env_pvr.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_pvr.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/recast/SCsub b/modules/recast/SCsub
index 4a06653968..94d9968164 100644
--- a/modules/recast/SCsub
+++ b/modules/recast/SCsub
@@ -23,7 +23,7 @@ if env['builtin_recast']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_recast.Append(CPPPATH=[thirdparty_dir + "/Include"])
+ env_recast.Prepend(CPPPATH=[thirdparty_dir + "/Include"])
env_thirdparty = env_recast.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/regex/SCsub b/modules/regex/SCsub
index 99c25add45..65f354ffa7 100644
--- a/modules/regex/SCsub
+++ b/modules/regex/SCsub
@@ -46,7 +46,7 @@ if env['builtin_pcre2']:
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_regex.Append(CPPPATH=[thirdparty_dir])
+ env_regex.Prepend(CPPPATH=[thirdparty_dir])
env_regex.Append(CPPFLAGS=thirdparty_flags)
def pcre2_builtin(width):
diff --git a/modules/squish/SCsub b/modules/squish/SCsub
index 3be85a1efa..15320bcd0c 100644
--- a/modules/squish/SCsub
+++ b/modules/squish/SCsub
@@ -22,7 +22,7 @@ if env['builtin_squish']:
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_squish.Append(CPPPATH=[thirdparty_dir])
+ env_squish.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_squish.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/svg/SCsub b/modules/svg/SCsub
index 66d9b3bf75..90bfe22abb 100644
--- a/modules/svg/SCsub
+++ b/modules/svg/SCsub
@@ -12,10 +12,10 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_svg.Append(CPPPATH=[thirdparty_dir])
+env_svg.Prepend(CPPPATH=[thirdparty_dir])
# FIXME: Needed in editor/editor_themes.cpp for now, but ideally there
# shouldn't be a dependency on modules/ and its own 3rd party deps.
-env.Append(CPPPATH=[thirdparty_dir])
+env.Prepend(CPPPATH=[thirdparty_dir])
env.Append(CPPFLAGS=["-DSVG_ENABLED"])
env_thirdparty = env_svg.Clone()
diff --git a/modules/theora/SCsub b/modules/theora/SCsub
index f98db2359c..785eca4c41 100644
--- a/modules/theora/SCsub
+++ b/modules/theora/SCsub
@@ -70,13 +70,13 @@ if env['builtin_libtheora']:
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_theora.Append(CPPPATH=[thirdparty_dir])
+ env_theora.Prepend(CPPPATH=[thirdparty_dir])
# also requires libogg and libvorbis
if env['builtin_libogg']:
- env_theora.Append(CPPPATH=["#thirdparty/libogg"])
+ env_theora.Prepend(CPPPATH=["#thirdparty/libogg"])
if env['builtin_libvorbis']:
- env_theora.Append(CPPPATH=["#thirdparty/libvorbis"])
+ env_theora.Prepend(CPPPATH=["#thirdparty/libvorbis"])
env_thirdparty = env_theora.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/tinyexr/SCsub b/modules/tinyexr/SCsub
index 3e7bda2bca..97f9797b58 100644
--- a/modules/tinyexr/SCsub
+++ b/modules/tinyexr/SCsub
@@ -13,7 +13,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_tinyexr.Append(CPPPATH=[thirdparty_dir])
+env_tinyexr.Prepend(CPPPATH=[thirdparty_dir])
env_thirdparty = env_tinyexr.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/upnp/SCsub b/modules/upnp/SCsub
index 2b15f7aee2..6d669ab73b 100644
--- a/modules/upnp/SCsub
+++ b/modules/upnp/SCsub
@@ -25,7 +25,7 @@ if env['builtin_miniupnpc']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_upnp.Append(CPPPATH=[thirdparty_dir])
+ env_upnp.Prepend(CPPPATH=[thirdparty_dir])
env_upnp.Append(CPPFLAGS=["-DMINIUPNP_STATICLIB"])
env_thirdparty = env_upnp.Clone()
diff --git a/modules/vhacd/SCsub b/modules/vhacd/SCsub
index fdd3ddc1e6..161aed2eb9 100644
--- a/modules/vhacd/SCsub
+++ b/modules/vhacd/SCsub
@@ -24,7 +24,7 @@ thirdparty_sources = [
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_vhacd.Append(CPPPATH=[thirdparty_dir+"/inc"])
+env_vhacd.Prepend(CPPPATH=[thirdparty_dir + "/inc"])
env_vhacd.Append(CPPFLAGS=["-DGODOT_ENET"])
# upstream uses c++11
diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub
index 19587563ab..3824fdd789 100644
--- a/modules/vorbis/SCsub
+++ b/modules/vorbis/SCsub
@@ -40,11 +40,11 @@ if env['builtin_libvorbis']:
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_vorbis.Append(CPPPATH=[thirdparty_dir])
+ env_vorbis.Prepend(CPPPATH=[thirdparty_dir])
# also requires libogg
if env['builtin_libogg']:
- env_vorbis.Append(CPPPATH=["#thirdparty/libogg"])
+ env_vorbis.Prepend(CPPPATH=["#thirdparty/libogg"])
env_thirdparty = env_vorbis.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/webm/SCsub b/modules/webm/SCsub
index dcc9a45044..e57437229f 100644
--- a/modules/webm/SCsub
+++ b/modules/webm/SCsub
@@ -15,7 +15,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_webm.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"])
+env_webm.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"])
# upstream uses c++11
if (not env_webm.msvc):
@@ -23,14 +23,14 @@ if (not env_webm.msvc):
# also requires libogg, libvorbis and libopus
if env['builtin_libogg']:
- env_webm.Append(CPPPATH=["#thirdparty/libogg"])
+ env_webm.Prepend(CPPPATH=["#thirdparty/libogg"])
if env['builtin_libvorbis']:
- env_webm.Append(CPPPATH=["#thirdparty/libvorbis"])
+ env_webm.Prepend(CPPPATH=["#thirdparty/libvorbis"])
if env['builtin_opus']:
- env_webm.Append(CPPPATH=["#thirdparty/opus"])
+ env_webm.Prepend(CPPPATH=["#thirdparty/opus"])
if env['builtin_libvpx']:
- env_webm.Append(CPPPATH=["#thirdparty/libvpx"])
+ env_webm.Prepend(CPPPATH=["#thirdparty/libvpx"])
SConscript("libvpx/SCsub")
env_thirdparty = env_webm.Clone()
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
index 5bf4ea3464..a6be1380a6 100644
--- a/modules/webm/libvpx/SCsub
+++ b/modules/webm/libvpx/SCsub
@@ -256,7 +256,7 @@ libvpx_sources_arm_neon_gas_apple = [libvpx_dir + file for file in libvpx_source
env_libvpx = env_modules.Clone()
env_libvpx.disable_warnings()
-env_libvpx.Append(CPPPATH=[libvpx_dir])
+env_libvpx.Prepend(CPPPATH=[libvpx_dir])
webm_multithread = env["platform"] != 'javascript'
@@ -380,7 +380,7 @@ if webm_cpu_x86:
elif webm_cpu_arm:
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm)
if env["platform"] == 'android':
- env_libvpx.Append(CPPPATH=[libvpx_dir + "third_party/android"])
+ env_libvpx.Prepend(CPPPATH=[libvpx_dir + "third_party/android"])
env_libvpx.add_source_files(env.modules_sources, [libvpx_dir + "third_party/android/cpu-features.c"])
env_libvpx_neon = env_libvpx.Clone()
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
index fa3896c457..666628bb44 100644
--- a/modules/webp/SCsub
+++ b/modules/webp/SCsub
@@ -126,7 +126,7 @@ if env['builtin_libwebp']:
]
thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources]
- env_webp.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"])
+ env_webp.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"])
env_thirdparty = env_webp.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/webrtc/SCsub b/modules/webrtc/SCsub
index 446bd530c2..868553b879 100644
--- a/modules/webrtc/SCsub
+++ b/modules/webrtc/SCsub
@@ -10,7 +10,6 @@ use_gdnative = env_webrtc["module_gdnative_enabled"]
if use_gdnative: # GDNative is retained in Javascript for export compatibility
env_webrtc.Append(CPPDEFINES=['WEBRTC_GDNATIVE_ENABLED'])
- gdnative_includes = ["#modules/gdnative/include/"]
- env_webrtc.Append(CPPPATH=gdnative_includes)
+ env_webrtc.Prepend(CPPPATH=["#modules/gdnative/include/"])
env_webrtc.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/websocket/SCsub b/modules/websocket/SCsub
index 12b4969cf7..2d2de81220 100644
--- a/modules/websocket/SCsub
+++ b/modules/websocket/SCsub
@@ -75,7 +75,7 @@ if env['builtin_libwebsockets'] and not env["platform"] == "javascript": # alrea
else: # Unix socket
thirdparty_sources += Glob(thirdparty_dir + "lib/plat/unix/*.c")
- env_lws.Append(CPPPATH=[thirdparty_dir + 'include/'])
+ env_lws.Prepend(CPPPATH=[thirdparty_dir + 'include/'])
if env['builtin_mbedtls']:
mbedtls_includes = "#thirdparty/mbedtls/include"
@@ -85,14 +85,14 @@ if env['builtin_libwebsockets'] and not env["platform"] == "javascript": # alrea
env_lws.Prepend(CPPPATH=wrapper_includes)
if env["platform"] == "windows" or env["platform"] == "uwp":
- env_lws.Append(CPPPATH=[helper_dir])
+ env_lws.Prepend(CPPPATH=[helper_dir])
if env["platform"] == "uwp":
env_lws.Append(CPPFLAGS=["/DLWS_MINGW_SUPPORT"])
env_thirdparty = env_lws.Clone()
env_thirdparty.disable_warnings()
- env_thirdparty.Append(CPPPATH=[thirdparty_dir + 'lib/'])
+ env_thirdparty.Prepend(CPPPATH=[thirdparty_dir + 'lib/'])
env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
env_lws.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/xatlas_unwrap/SCsub b/modules/xatlas_unwrap/SCsub
index 7a40945f27..50e3cb1551 100644
--- a/modules/xatlas_unwrap/SCsub
+++ b/modules/xatlas_unwrap/SCsub
@@ -13,7 +13,7 @@ if env['builtin_xatlas']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_xatlas_unwrap.Append(CPPPATH=[thirdparty_dir])
+ env_xatlas_unwrap.Prepend(CPPPATH=[thirdparty_dir])
# upstream uses c++11
if (not env.msvc):
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 6c67067db7..8d35617d20 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -299,7 +299,7 @@ def configure(env):
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] +
'/toolchains/' + target_subpath + '/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib'])
- env.Append(CPPPATH=['#platform/android'])
+ env.Prepend(CPPPATH=['#platform/android'])
env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL'])
env.Append(LIBS=['OpenSLES', 'EGL', 'GLESv3', 'android', 'log', 'z', 'dl'])
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 2a3d0843a8..f45644f1eb 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1864,7 +1864,6 @@ public:
return ERR_FILE_NOT_FOUND;
}
- ERR_FAIL_COND_V(!pkg, ERR_CANT_OPEN);
int ret = unzGoToFirstFile(pkg);
zlib_filefunc_def io2 = io;
@@ -2204,7 +2203,6 @@ public:
return ERR_FILE_NOT_FOUND;
}
- ERR_FAIL_COND_V(!tmp_unaligned, ERR_CANT_OPEN);
ret = unzGoToFirstFile(tmp_unaligned);
io2 = io;
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index 874b1ab1fb..f33c77a407 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -137,7 +137,7 @@ def configure(env):
if not env['builtin_miniupnpc']:
# No pkgconfig file so far, hardcode default paths.
- env.Append(CPPPATH=["/system/develop/headers/x86/miniupnpc"])
+ env.Prepend(CPPPATH=["/system/develop/headers/x86/miniupnpc"])
env.Append(LIBS=["miniupnpc"])
# On Linux wchar_t should be 32-bits
@@ -147,7 +147,7 @@ def configure(env):
## Flags
- env.Append(CPPPATH=['#platform/haiku'])
+ env.Prepend(CPPPATH=['#platform/haiku'])
env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED'])
env.Append(CPPFLAGS=['-DMEDIA_KIT_ENABLED'])
# env.Append(CPPFLAGS=['-DFREETYPE_ENABLED'])
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index d56e28a4af..3ed0a4ade7 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -165,12 +165,12 @@ def configure(env):
if env['icloud']:
env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
- env.Append(CPPPATH=['$IPHONESDK/usr/include',
- '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers',
- '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers',
- ])
+ env.Prepend(CPPPATH=['$IPHONESDK/usr/include',
+ '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers',
+ '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers',
+ ])
env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
- env.Append(CPPPATH=['#platform/iphone'])
+ env.Prepend(CPPPATH=['#platform/iphone'])
env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DCOREAUDIO_ENABLED'])
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 85d4b9e847..e1083aeefc 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -920,7 +920,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
EditorNode::add_io_error("Could not open export template (not a zip file?):\n" + src_pkg_name);
return ERR_CANT_OPEN;
}
- ERR_FAIL_COND_V(!src_pkg_zip, ERR_CANT_OPEN);
+
int ret = unzGoToFirstFile(src_pkg_zip);
Vector<uint8_t> project_file_data;
while (ret == UNZ_OK) {
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index c7acbde3f7..145ce8d83d 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -103,7 +103,7 @@ def configure(env):
## Compile flags
- env.Append(CPPPATH=['#platform/javascript'])
+ env.Prepend(CPPPATH=['#platform/javascript'])
env.Append(CPPDEFINES=['JAVASCRIPT_ENABLED', 'UNIX_ENABLED'])
# No multi-threading (SharedArrayBuffer) available yet,
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 8024897195..4c88f91d13 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -126,7 +126,7 @@ def configure(env):
## Flags
- env.Append(CPPPATH=['#platform/osx'])
+ env.Prepend(CPPPATH=['#platform/osx'])
env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED', '-DCOREMIDI_ENABLED'])
env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreMIDI', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback', '-framework', 'CoreVideo'])
env.Append(LIBS=['pthread'])
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 1a63d6ff75..89212b0e5e 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -441,7 +441,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
return ERR_FILE_NOT_FOUND;
}
- ERR_FAIL_COND_V(!src_pkg_zip, ERR_CANT_OPEN);
int ret = unzGoToFirstFile(src_pkg_zip);
String binary_to_use = "godot_osx_" + String(p_debug ? "debug" : "release") + ".64";
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 5306a2bf69..08c2eb6aaf 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -201,7 +201,7 @@ def configure(env):
if not env['builtin_miniupnpc']:
# No pkgconfig file so far, hardcode default paths.
- env.Append(CPPPATH=["/usr/include/miniupnpc"])
+ env.Prepend(CPPPATH=["/usr/include/miniupnpc"])
env.Append(LIBS=["miniupnpc"])
# On Linux wchar_t should be 32-bits
@@ -215,7 +215,7 @@ def configure(env):
if not env['builtin_zlib']:
env.ParseConfig('pkg-config zlib --cflags --libs')
- env.Append(CPPPATH=['#platform/server'])
+ env.Prepend(CPPPATH=['#platform/server'])
env.Append(CPPFLAGS=['-DSERVER_ENABLED', '-DUNIX_ENABLED'])
if (platform.system() == "Darwin"):
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index 17f8242466..00f419f4f0 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -77,7 +77,7 @@ def configure(env):
# ANGLE
angle_root = os.getenv("ANGLE_SRC_PATH")
- env.Append(CPPPATH=[angle_root + '/include'])
+ env.Prepend(CPPPATH=[angle_root + '/include'])
jobs = str(env.GetOption("num_jobs"))
angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="
@@ -137,7 +137,7 @@ def configure(env):
## Compile flags
- env.Append(CPPPATH=['#platform/uwp', '#drivers/windows'])
+ env.Prepend(CPPPATH=['#platform/uwp', '#drivers/windows'])
env.Append(CPPFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND'])
env.Append(CPPFLAGS=['/DGLES_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED'])
winver = "0x0602" # Windows 8 is the minimum target for UWP build
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 5c38eebf04..4b4b507499 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -201,7 +201,7 @@ def configure_msvc(env, manual_msvc_config):
env.AppendUnique(CXXFLAGS=['/TP']) # assume all sources are C++
if manual_msvc_config: # should be automatic if SCons found it
if os.getenv("WindowsSdkDir") is not None:
- env.Append(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"])
+ env.Prepend(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"])
else:
print("Missing environment variable: WindowsSdkDir")
@@ -239,7 +239,7 @@ def configure_msvc(env, manual_msvc_config):
env.AppendUnique(LINKFLAGS=['/LTCG'])
if manual_msvc_config:
- env.Append(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")])
+ env.Prepend(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")])
env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
# Incremental linking fix
@@ -342,7 +342,7 @@ def configure_mingw(env):
def configure(env):
# At this point the env has been set up with basic tools/compilers.
- env.Append(CPPPATH=['#platform/windows'])
+ env.Prepend(CPPPATH=['#platform/windows'])
print("Configuring for Windows: target=%s, bits=%s" % (env['target'], env['bits']))
diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp
index 1e7f393bdd..44d3cf1910 100644
--- a/platform/x11/crash_handler_x11.cpp
+++ b/platform/x11/crash_handler_x11.cpp
@@ -96,12 +96,10 @@ static void handle_crash(int sig) {
String output = "";
// Try to get the file/line number using addr2line
- if (OS::get_singleton()) {
- int ret;
- Error err = OS::get_singleton()->execute(String("addr2line"), args, true, NULL, &output, &ret);
- if (err == OK) {
- output.erase(output.length() - 1, 1);
- }
+ int ret;
+ Error err = OS::get_singleton()->execute(String("addr2line"), args, true, NULL, &output, &ret);
+ if (err == OK) {
+ output.erase(output.length() - 1, 1);
}
fprintf(stderr, "[%ld] %s (%ls)\n", i, fname, output.c_str());
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index f8ae5e9acb..933ee6b72e 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -275,7 +275,7 @@ def configure(env):
if not env['builtin_miniupnpc']:
# No pkgconfig file so far, hardcode default paths.
- env.Append(CPPPATH=["/usr/include/miniupnpc"])
+ env.Prepend(CPPPATH=["/usr/include/miniupnpc"])
env.Append(LIBS=["miniupnpc"])
# On Linux wchar_t should be 32-bits
@@ -316,7 +316,7 @@ def configure(env):
if not env['builtin_zlib']:
env.ParseConfig('pkg-config zlib --cflags --libs')
- env.Append(CPPPATH=['#platform/x11'])
+ env.Prepend(CPPPATH=['#platform/x11'])
env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED'])
env.Append(LIBS=['GL', 'pthread'])
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 267ac08a72..d5ca3742db 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -503,35 +503,33 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
current_cursor = CURSOR_ARROW;
- if (cursor_theme) {
- for (int i = 0; i < CURSOR_MAX; i++) {
-
- static const char *cursor_file[] = {
- "left_ptr",
- "xterm",
- "hand2",
- "cross",
- "watch",
- "left_ptr_watch",
- "fleur",
- "hand1",
- "X_cursor",
- "sb_v_double_arrow",
- "sb_h_double_arrow",
- "size_bdiag",
- "size_fdiag",
- "hand1",
- "sb_v_double_arrow",
- "sb_h_double_arrow",
- "question_arrow"
- };
+ for (int i = 0; i < CURSOR_MAX; i++) {
- img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size);
- if (img[i]) {
- cursors[i] = XcursorImageLoadCursor(x11_display, img[i]);
- } else {
- print_verbose("Failed loading custom cursor: " + String(cursor_file[i]));
- }
+ static const char *cursor_file[] = {
+ "left_ptr",
+ "xterm",
+ "hand2",
+ "cross",
+ "watch",
+ "left_ptr_watch",
+ "fleur",
+ "hand1",
+ "X_cursor",
+ "sb_v_double_arrow",
+ "sb_h_double_arrow",
+ "size_bdiag",
+ "size_fdiag",
+ "hand1",
+ "sb_v_double_arrow",
+ "sb_h_double_arrow",
+ "question_arrow"
+ };
+
+ img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size);
+ if (img[i]) {
+ cursors[i] = XcursorImageLoadCursor(x11_display, img[i]);
+ } else {
+ print_verbose("Failed loading custom cursor: " + String(cursor_file[i]));
}
}
@@ -1192,9 +1190,12 @@ void OS_X11::set_window_position(const Point2 &p_position) {
unsigned long remaining;
unsigned char *data = NULL;
if (XGetWindowProperty(x11_display, x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
- long *extents = (long *)data;
- x = extents[0];
- y = extents[2];
+ if (format == 32 && len == 4) {
+ long *extents = (long *)data;
+ x = extents[0];
+ y = extents[2];
+ }
+ XFree(data);
}
}
XMoveWindow(x11_display, x11_window, p_position.x - x, p_position.y - y);
@@ -1220,9 +1221,12 @@ Size2 OS_X11::get_real_window_size() const {
unsigned long remaining;
unsigned char *data = NULL;
if (XGetWindowProperty(x11_display, x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
- long *extents = (long *)data;
- w += extents[0] + extents[1]; // left, right
- h += extents[2] + extents[3]; // top, bottom
+ if (format == 32 && len == 4) {
+ long *extents = (long *)data;
+ w += extents[0] + extents[1]; // left, right
+ h += extents[2] + extents[3]; // top, bottom
+ }
+ XFree(data);
}
return Size2(w, h);
}
diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp
index 943c2b1383..50da6a4967 100644
--- a/platform/x11/power_x11.cpp
+++ b/platform/x11/power_x11.cpp
@@ -115,7 +115,7 @@ bool PowerX11::make_proc_acpi_key_val(char **_ptr, char **_key, char **_val) {
*(ptr++) = '\0'; /* terminate the key. */
- while ((*ptr == ' ') && (*ptr != '\0')) {
+ while (*ptr == ' ') {
ptr++; /* skip whitespace. */
}
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index ed533ee7a4..2377068ede 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -152,6 +152,7 @@ PoolVector<Face3> Light::get_faces(uint32_t p_usage_flags) const {
void Light::set_bake_mode(BakeMode p_mode) {
bake_mode = p_mode;
+ VS::get_singleton()->light_set_use_gi(light, p_mode != BAKE_DISABLED);
}
Light::BakeMode Light::get_bake_mode() const {
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index f808d6c234..e95781c181 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -376,7 +376,7 @@ BaseButton::DrawMode BaseButton::get_draw_mode() const {
bool pressing;
if (status.press_attempt) {
- pressing = status.pressing_inside;
+ pressing = (status.pressing_inside || keep_pressed_outside);
if (status.pressed)
pressing = !pressing;
} else {
@@ -446,6 +446,16 @@ Control::FocusMode BaseButton::get_enabled_focus_mode() const {
return enabled_focus_mode;
}
+void BaseButton::set_keep_pressed_outside(bool p_on) {
+
+ keep_pressed_outside = p_on;
+}
+
+bool BaseButton::is_keep_pressed_outside() const {
+
+ return keep_pressed_outside;
+}
+
void BaseButton::set_shortcut(const Ref<ShortCut> &p_shortcut) {
if (shortcut.is_null() == p_shortcut.is_null())
@@ -528,6 +538,8 @@ void BaseButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_draw_mode"), &BaseButton::get_draw_mode);
ClassDB::bind_method(D_METHOD("set_enabled_focus_mode", "mode"), &BaseButton::set_enabled_focus_mode);
ClassDB::bind_method(D_METHOD("get_enabled_focus_mode"), &BaseButton::get_enabled_focus_mode);
+ ClassDB::bind_method(D_METHOD("set_keep_pressed_outside", "enabled"), &BaseButton::set_keep_pressed_outside);
+ ClassDB::bind_method(D_METHOD("is_keep_pressed_outside"), &BaseButton::is_keep_pressed_outside);
ClassDB::bind_method(D_METHOD("set_shortcut", "shortcut"), &BaseButton::set_shortcut);
ClassDB::bind_method(D_METHOD("get_shortcut"), &BaseButton::get_shortcut);
@@ -549,6 +561,7 @@ void BaseButton::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "action_mode", PROPERTY_HINT_ENUM, "Button Press,Button Release"), "set_action_mode", "get_action_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "button_mask", PROPERTY_HINT_FLAGS, "Mouse Left, Mouse Right, Mouse Middle"), "set_button_mask", "get_button_mask");
ADD_PROPERTY(PropertyInfo(Variant::INT, "enabled_focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_enabled_focus_mode", "get_enabled_focus_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_pressed_outside"), "set_keep_pressed_outside", "is_keep_pressed_outside");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "ShortCut"), "set_shortcut", "get_shortcut");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "group", PROPERTY_HINT_RESOURCE_TYPE, "ButtonGroup"), "set_button_group", "get_button_group");
@@ -566,6 +579,7 @@ BaseButton::BaseButton() {
toggle_mode = false;
shortcut_in_tooltip = true;
+ keep_pressed_outside = false;
status.pressed = false;
status.press_attempt = false;
status.hovering = false;
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h
index 9a00cc79f2..22a8f6d8fe 100644
--- a/scene/gui/base_button.h
+++ b/scene/gui/base_button.h
@@ -52,6 +52,7 @@ private:
int button_mask;
bool toggle_mode;
bool shortcut_in_tooltip;
+ bool keep_pressed_outside;
FocusMode enabled_focus_mode;
Ref<ShortCut> shortcut;
@@ -110,6 +111,9 @@ public:
void set_action_mode(ActionMode p_mode);
ActionMode get_action_mode() const;
+ void set_keep_pressed_outside(bool p_on);
+ bool is_keep_pressed_outside() const;
+
void set_button_mask(int p_mask);
int get_button_mask() const;
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 8825891807..e77ee8c744 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -93,14 +93,14 @@ Size2 PopupMenu::get_minimum_size() const {
if (items[i].submenu != "")
size.width += get_icon("submenu")->get_width();
- if (has_check)
- size.width += check_w;
- max_w = MAX(max_w, size.width + icon_w);
+ max_w = MAX(max_w, size.width);
minsize.height += size.height;
}
- minsize.width += max_w + accel_max_w;
+ minsize.width += max_w + icon_w + accel_max_w;
+ if (has_check)
+ minsize.width += check_w;
return minsize;
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index fbf6550362..9ab30b1976 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -825,6 +825,9 @@ void TextEdit::_notification(int p_what) {
// get the highlighted words
String highlighted_text = get_selection_text();
+ // check if highlighted words contains only whitespaces (tabs or spaces)
+ bool only_whitespaces_highlighted = highlighted_text.strip_edges() == String();
+
String line_num_padding = line_numbers_zero_padded ? "0" : " ";
int cursor_wrap_index = get_cursor_wrap_index();
@@ -1123,7 +1126,7 @@ void TextEdit::_notification(int p_what) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + char_w + ofs_x - 1, ofs_y), Size2i(1, get_row_height())), border_color);
}
- if (highlight_all_occurrences) {
+ if (highlight_all_occurrences && !only_whitespaces_highlighted) {
if (highlighted_text_col != -1) {
// if we are at the end check for new word on same line
@@ -1557,8 +1560,7 @@ void TextEdit::_consume_pair_symbol(CharType ch) {
}
if ((ch == '\'' || ch == '"') &&
- cursor_get_column() > 0 &&
- _is_text_char(text[cursor.line][cursor_get_column() - 1])) {
+ cursor_get_column() > 0 && _is_text_char(text[cursor.line][cursor_get_column() - 1]) && !_is_pair_right_symbol(text[cursor.line][cursor_get_column()])) {
insert_text_at_cursor(ch_single);
cursor_set_column(cursor_position_to_move);
return;
@@ -2594,6 +2596,15 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
FALLTHROUGH;
}
+#ifdef APPLE_STYLE_KEYS
+ case KEY_B: {
+ if (!k->get_control()) {
+ scancode_handled = false;
+ break;
+ }
+ FALLTHROUGH;
+ }
+#endif
case KEY_LEFT: {
if (k->get_shift())
@@ -2607,9 +2618,22 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
#ifdef APPLE_STYLE_KEYS
if (k->get_command()) {
- cursor_set_column(0);
+ // Start at first column (it's slightly faster that way) and look for the first non-whitespace character.
+ int new_cursor_pos = 0;
+ for (int i = 0; i < text[cursor.line].length(); ++i) {
+ if (!_is_whitespace(text[cursor.line][i])) {
+ new_cursor_pos = i;
+ break;
+ }
+ }
+ if (new_cursor_pos == cursor.column) {
+ // We're already at the first text character, so move to the very beginning of the line.
+ cursor_set_column(0);
+ } else {
+ // We're somewhere to the right of the first text character; move to the first one.
+ cursor_set_column(new_cursor_pos);
+ }
} else if (k->get_alt()) {
-
#else
if (k->get_alt()) {
scancode_handled = false;
@@ -2657,6 +2681,15 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
FALLTHROUGH;
}
+#ifdef APPLE_STYLE_KEYS
+ case KEY_F: {
+ if (!k->get_control()) {
+ scancode_handled = false;
+ break;
+ }
+ FALLTHROUGH;
+ }
+#endif
case KEY_RIGHT: {
if (k->get_shift())
@@ -2718,6 +2751,15 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
FALLTHROUGH;
}
+#ifdef APPLE_STYLE_KEYS
+ case KEY_P: {
+ if (!k->get_control()) {
+ scancode_handled = false;
+ break;
+ }
+ FALLTHROUGH;
+ }
+#endif
case KEY_UP: {
if (k->get_alt()) {
@@ -2771,6 +2813,15 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
FALLTHROUGH;
}
+#ifdef APPLE_STYLE_KEYS
+ case KEY_N: {
+ if (!k->get_control()) {
+ scancode_handled = false;
+ break;
+ }
+ FALLTHROUGH;
+ }
+#endif
case KEY_DOWN: {
if (k->get_alt()) {
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index b66ae184e9..3d38a8902f 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -93,7 +93,6 @@ private:
template <class T>
struct TKey : public Key {
- float time;
T value;
};
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index c72ccc97db..128db3f109 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -96,6 +96,7 @@ void Font::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_height"), &Font::get_height);
ClassDB::bind_method(D_METHOD("is_distance_field_hint"), &Font::is_distance_field_hint);
ClassDB::bind_method(D_METHOD("get_string_size", "string"), &Font::get_string_size);
+ ClassDB::bind_method(D_METHOD("get_wordwrap_string_size", "string", "p_width"), &Font::get_wordwrap_string_size);
ClassDB::bind_method(D_METHOD("has_outline"), &Font::has_outline);
ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "position", "char", "next", "modulate", "outline"), &Font::draw_char, DEFVAL(-1), DEFVAL(Color(1, 1, 1)), DEFVAL(false));
ClassDB::bind_method(D_METHOD("update_changes"), &Font::update_changes);
@@ -495,6 +496,38 @@ Size2 Font::get_string_size(const String &p_string) const {
return Size2(w, get_height());
}
+
+Size2 Font::get_wordwrap_string_size(const String &p_string, float p_width) const {
+
+ ERR_FAIL_COND_V(p_width <= 0, Vector2(0, get_height()));
+
+ int l = p_string.length();
+ if (l == 0)
+ return Size2(p_width, get_height());
+
+ float line_w = 0;
+ float h = 0;
+ float space_w = get_char_size(' ').width;
+ Vector<String> lines = p_string.split("\n");
+ for (int i = 0; i < lines.size(); i++) {
+ h += get_height();
+ String t = lines[i];
+ line_w = 0;
+ Vector<String> words = t.split(" ");
+ for (int j = 0; j < words.size(); j++) {
+ line_w += get_string_size(words[j]).x;
+ if (line_w > p_width) {
+ h += get_height();
+ line_w = get_string_size(words[j]).x;
+ } else {
+ line_w += space_w;
+ }
+ }
+ }
+
+ return Size2(p_width, h);
+}
+
void BitmapFont::set_fallback(const Ref<BitmapFont> &p_fallback) {
ERR_FAIL_COND(p_fallback == this);
diff --git a/scene/resources/font.h b/scene/resources/font.h
index 6bc8d9b792..def2c2285a 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -53,6 +53,7 @@ public:
virtual Size2 get_char_size(CharType p_char, CharType p_next = 0) const = 0;
Size2 get_string_size(const String &p_string) const;
+ Size2 get_wordwrap_string_size(const String &p_string, float p_width) const;
virtual bool is_distance_field_hint() const = 0;
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index b22e26f903..a02f52f034 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -373,6 +373,7 @@ public:
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_set_use_gi(RID p_light, bool p_enable) = 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;
@@ -392,6 +393,7 @@ public:
virtual AABB light_get_aabb(RID p_light) const = 0;
virtual float light_get_param(RID p_light, VS::LightParam p_param) = 0;
virtual Color light_get_color(RID p_light) = 0;
+ virtual bool light_get_use_gi(RID p_light) = 0;
virtual uint64_t light_get_version(RID p_light) const = 0;
/* PROBE API */
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index efe2a99d2e..3ec428d687 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -312,6 +312,7 @@ public:
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_set_use_gi, RID, bool)
BIND2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
BIND2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index af580d6794..bce5eaf7b0 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -3117,6 +3117,9 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
for (List<Instance *>::Element *E = p_gi_probe->scenario->directional_lights.front(); E; E = E->next()) {
+ if (!VSG::storage->light_get_use_gi(E->get()->base))
+ continue;
+
InstanceGIProbeData::LightCache lc;
lc.type = VSG::storage->light_get_type(E->get()->base);
lc.color = VSG::storage->light_get_color(E->get()->base);
@@ -3137,6 +3140,9 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
for (Set<Instance *>::Element *E = probe_data->lights.front(); E; E = E->next()) {
+ if (!VSG::storage->light_get_use_gi(E->get()->base))
+ continue;
+
InstanceGIProbeData::LightCache lc;
lc.type = VSG::storage->light_get_type(E->get()->base);
lc.color = VSG::storage->light_get_color(E->get()->base);
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 3e451511cd..b2753369b8 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -248,6 +248,7 @@ public:
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_set_use_gi, RID, bool)
FUNC2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
FUNC2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 041fb2b84f..b39b400a53 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -1780,6 +1780,7 @@ void VisualServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("light_set_negative", "light", "enable"), &VisualServer::light_set_negative);
ClassDB::bind_method(D_METHOD("light_set_cull_mask", "light", "mask"), &VisualServer::light_set_cull_mask);
ClassDB::bind_method(D_METHOD("light_set_reverse_cull_face_mode", "light", "enabled"), &VisualServer::light_set_reverse_cull_face_mode);
+ ClassDB::bind_method(D_METHOD("light_set_use_gi", "light", "enabled"), &VisualServer::light_set_use_gi);
ClassDB::bind_method(D_METHOD("light_omni_set_shadow_mode", "light", "mode"), &VisualServer::light_omni_set_shadow_mode);
ClassDB::bind_method(D_METHOD("light_omni_set_shadow_detail", "light", "detail"), &VisualServer::light_omni_set_shadow_detail);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 7693faf42b..d40678c003 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -435,6 +435,7 @@ public:
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_set_use_gi(RID p_light, bool p_enable) = 0;
// omni light
enum LightOmniShadowMode {