diff options
-rw-r--r-- | core/color_names.inc | 2 | ||||
-rw-r--r-- | core/error_macros.h | 16 | ||||
-rw-r--r-- | core/math/matrix3.cpp | 2 | ||||
-rw-r--r-- | core/object.cpp | 1 | ||||
-rwxr-xr-x | doc/tools/makerst.py | 12 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_storage_gles2.cpp | 1 | ||||
-rw-r--r-- | editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | modules/csg/register_types.cpp | 4 | ||||
-rw-r--r-- | modules/recast/SCsub | 12 | ||||
-rw-r--r-- | modules/recast/navigation_mesh_editor_plugin.cpp (renamed from editor/plugins/navigation_mesh_editor_plugin.cpp) | 5 | ||||
-rw-r--r-- | modules/recast/navigation_mesh_editor_plugin.h (renamed from editor/plugins/navigation_mesh_editor_plugin.h) | 3 | ||||
-rw-r--r-- | modules/recast/navigation_mesh_generator.cpp (renamed from editor/plugins/navigation_mesh_generator.cpp) | 4 | ||||
-rw-r--r-- | modules/recast/navigation_mesh_generator.h (renamed from editor/plugins/navigation_mesh_generator.h) | 9 | ||||
-rw-r--r-- | modules/recast/register_types.cpp | 7 | ||||
-rw-r--r-- | scene/2d/skeleton_2d.cpp | 46 | ||||
-rw-r--r-- | scene/2d/skeleton_2d.h | 3 | ||||
-rw-r--r-- | servers/visual/shader_language.cpp | 12 |
17 files changed, 66 insertions, 75 deletions
diff --git a/core/color_names.inc b/core/color_names.inc index b05684acc6..3ae42648d0 100644 --- a/core/color_names.inc +++ b/core/color_names.inc @@ -3,7 +3,7 @@ static Map<String, Color> _named_colors; static void _populate_named_colors() { - if(!_named_colors.empty()) return; + if (!_named_colors.empty()) return; _named_colors.insert("aliceblue", Color(0.94, 0.97, 1.00)); _named_colors.insert("antiquewhite", Color(0.98, 0.92, 0.84)); _named_colors.insert("aqua", Color(0.00, 1.00, 1.00)); diff --git a/core/error_macros.h b/core/error_macros.h index 168b2e06fe..3587e01d54 100644 --- a/core/error_macros.h +++ b/core/error_macros.h @@ -311,14 +311,14 @@ extern bool _err_error_exists; _err_error_exists = false; \ } -#define WARN_DEPRECATED \ - { \ - static bool warning_shown=false;\ - if (!warning_shown) {\ - _err_print_error(FUNCTION_STR, __FILE__, __LINE__,"This method has been deprecated and will be removed in the future", ERR_HANDLER_WARNING); \ - _err_error_exists = false; \ - warning_shown=true;\ - }\ +#define WARN_DEPRECATED \ + { \ + static bool warning_shown = false; \ + if (!warning_shown) { \ + _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future", ERR_HANDLER_WARNING); \ + _err_error_exists = false; \ + warning_shown = true; \ + } \ } #endif diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp index 8ee8ccb457..202115e2ca 100644 --- a/core/math/matrix3.cpp +++ b/core/math/matrix3.cpp @@ -828,7 +828,7 @@ void Basis::set_diagonal(const Vector3 p_diag) { } Basis Basis::slerp(const Basis &target, const real_t &t) const { - // TODO: implement this directly without using quaternions to make it more efficient +// TODO: implement this directly without using quaternions to make it more efficient #ifdef MATH_CHECKS ERR_FAIL_COND_V(is_rotation() == false, Basis()); ERR_FAIL_COND_V(target.is_rotation() == false, Basis()); diff --git a/core/object.cpp b/core/object.cpp index 239700a4ab..1d2aeb7ba5 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1677,6 +1677,7 @@ void Object::_bind_methods() { #ifdef TOOLS_ENABLED MethodInfo miget("_get", PropertyInfo(Variant::STRING, "property")); miget.return_val.name = "Variant"; + miget.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; BIND_VMETHOD(miget); MethodInfo plget("_get_property_list"); diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index adbd810d11..289e967a93 100755 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -155,9 +155,19 @@ def rstize_text(text, cclass): text = pre_text + "\n\n" + post_text pos += 2 + next_brac_pos = text.find('[') + + # Escape \ character, otherwise it ends up as an escape character in rst + pos = 0 + while True: + pos = text.find('\\', pos, next_brac_pos) + if pos == -1: + break + text = text[:pos] + "\\\\" + text[pos + 1:] + pos += 2 + # Escape * character to avoid interpreting it as emphasis pos = 0 - next_brac_pos = text.find('[') while True: pos = text.find('*', pos, next_brac_pos) if pos == -1: diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 6e7e1793e1..de7359a18b 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -1303,7 +1303,6 @@ Transform2D RasterizerStorageGLES2::skeleton_bone_get_transform_2d(RID p_skeleto } void RasterizerStorageGLES2::skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) { - } void RasterizerStorageGLES2::update_dirty_skeletons() { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 4b068f1000..7e3af2b755 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -88,7 +88,6 @@ #include "editor/plugins/mesh_editor_plugin.h" #include "editor/plugins/mesh_instance_editor_plugin.h" #include "editor/plugins/multimesh_editor_plugin.h" -#include "editor/plugins/navigation_mesh_editor_plugin.h" #include "editor/plugins/navigation_polygon_editor_plugin.h" #include "editor/plugins/particles_2d_editor_plugin.h" #include "editor/plugins/particles_editor_plugin.h" @@ -5365,7 +5364,6 @@ EditorNode::EditorNode() { add_editor_plugin(memnew(TextureEditorPlugin(this))); add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor))); add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor))); - add_editor_plugin(memnew(NavigationMeshEditorPlugin(this))); add_editor_plugin(memnew(SkeletonEditorPlugin(this))); add_editor_plugin(memnew(PhysicalBonePlugin(this))); diff --git a/modules/csg/register_types.cpp b/modules/csg/register_types.cpp index 020724ee59..0dea09808a 100644 --- a/modules/csg/register_types.cpp +++ b/modules/csg/register_types.cpp @@ -30,8 +30,8 @@ #include "register_types.h" -#include "csg_shape.h" #include "csg_gizmos.h" +#include "csg_shape.h" void register_csg_types() { @@ -51,9 +51,7 @@ void register_csg_types() { EditorPlugins::add_by_type<EditorPluginCSG>(); #endif #endif - } void unregister_csg_types() { - } diff --git a/modules/recast/SCsub b/modules/recast/SCsub index 530df9a37c..f56be72b24 100644 --- a/modules/recast/SCsub +++ b/modules/recast/SCsub @@ -1,8 +1,9 @@ #!/usr/bin/env python Import('env') +Import('env_modules') -# Not building in a separate env as core needs it +env_recast = env_modules.Clone() # Thirdparty source files if env['builtin_recast']: @@ -22,13 +23,10 @@ if env['builtin_recast']: ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/Include"]) - - lib = env.add_library("recast_builtin", thirdparty_sources) - env.Append(LIBS=[lib]) + env_recast.add_source_files(env.modules_sources, thirdparty_sources) + env_recast.Append(CPPPATH=[thirdparty_dir + "/Include"]) # Godot source files -env.add_source_files(env.modules_sources, "*.cpp") -env.Append(CCFLAGS=['-DRECAST_ENABLED']) +env_recast.add_source_files(env.modules_sources, "*.cpp") Export('env') diff --git a/editor/plugins/navigation_mesh_editor_plugin.cpp b/modules/recast/navigation_mesh_editor_plugin.cpp index da3c744324..8556b7aa0a 100644 --- a/editor/plugins/navigation_mesh_editor_plugin.cpp +++ b/modules/recast/navigation_mesh_editor_plugin.cpp @@ -29,13 +29,12 @@ /*************************************************************************/ #include "navigation_mesh_editor_plugin.h" + #include "io/marshalls.h" #include "io/resource_saver.h" #include "scene/3d/mesh_instance.h" #include "scene/gui/box_container.h" -#ifdef RECAST_ENABLED - void NavigationMeshEditor::_node_removed(Node *p_node) { if (p_node == node) { @@ -162,5 +161,3 @@ NavigationMeshEditorPlugin::NavigationMeshEditorPlugin(EditorNode *p_node) { NavigationMeshEditorPlugin::~NavigationMeshEditorPlugin() { } - -#endif // RECAST_ENABLED diff --git a/editor/plugins/navigation_mesh_editor_plugin.h b/modules/recast/navigation_mesh_editor_plugin.h index 9382467d85..4f3e222002 100644 --- a/editor/plugins/navigation_mesh_editor_plugin.h +++ b/modules/recast/navigation_mesh_editor_plugin.h @@ -31,8 +31,6 @@ #ifndef NAVIGATION_MESH_GENERATOR_PLUGIN_H #define NAVIGATION_MESH_GENERATOR_PLUGIN_H -#ifdef RECAST_ENABLED - #include "editor/editor_node.h" #include "editor/editor_plugin.h" #include "navigation_mesh_generator.h" @@ -83,5 +81,4 @@ public: ~NavigationMeshEditorPlugin(); }; -#endif // RECAST_ENABLED #endif // NAVIGATION_MESH_GENERATOR_PLUGIN_H diff --git a/editor/plugins/navigation_mesh_generator.cpp b/modules/recast/navigation_mesh_generator.cpp index 0537c5c31f..64c4b85269 100644 --- a/editor/plugins/navigation_mesh_generator.cpp +++ b/modules/recast/navigation_mesh_generator.cpp @@ -30,8 +30,6 @@ #include "navigation_mesh_generator.h" -#ifdef RECAST_ENABLED - void NavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector<float> &p_verticies) { p_verticies.push_back(p_vec3.x); p_verticies.push_back(p_vec3.y); @@ -304,5 +302,3 @@ void NavigationMeshGenerator::clear(Ref<NavigationMesh> p_nav_mesh) { p_nav_mesh->set_vertices(PoolVector<Vector3>()); } } - -#endif //RECAST_ENABLED diff --git a/editor/plugins/navigation_mesh_generator.h b/modules/recast/navigation_mesh_generator.h index d26f541b8d..3588539ef1 100644 --- a/editor/plugins/navigation_mesh_generator.h +++ b/modules/recast/navigation_mesh_generator.h @@ -31,16 +31,11 @@ #ifndef NAVIGATION_MESH_GENERATOR_H #define NAVIGATION_MESH_GENERATOR_H -#ifdef RECAST_ENABLED - #include "editor/editor_node.h" #include "editor/editor_settings.h" - +#include "os/thread.h" #include "scene/3d/mesh_instance.h" - #include "scene/3d/navigation_mesh.h" - -#include "os/thread.h" #include "scene/resources/shape.h" #include <Recast.h> @@ -61,6 +56,4 @@ public: static void clear(Ref<NavigationMesh> p_nav_mesh); }; -#endif // RECAST_ENABLED - #endif // NAVIGATION_MESH_GENERATOR_H diff --git a/modules/recast/register_types.cpp b/modules/recast/register_types.cpp index 913857c591..f2f18fc86f 100644 --- a/modules/recast/register_types.cpp +++ b/modules/recast/register_types.cpp @@ -30,5 +30,10 @@ #include "register_types.h" -void register_recast_types() {} +#include "navigation_mesh_editor_plugin.h" + +void register_recast_types() { + EditorPlugins::add_by_type<NavigationMeshEditorPlugin>(); +} + void unregister_recast_types() {} diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp index 0595cc43b8..8ceffb3c27 100644 --- a/scene/2d/skeleton_2d.cpp +++ b/scene/2d/skeleton_2d.cpp @@ -89,8 +89,8 @@ void Bone2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_default_length", "default_length"), &Bone2D::set_default_length); ClassDB::bind_method(D_METHOD("get_default_length"), &Bone2D::get_default_length); - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D,"rest"),"set_rest","get_rest"); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"default_length",PROPERTY_HINT_RANGE,"1,1024,1"),"set_default_length","get_default_length"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "rest"), "set_rest", "get_rest"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "default_length", PROPERTY_HINT_RANGE, "1,1024,1"), "set_default_length", "get_default_length"); } void Bone2D::set_rest(const Transform2D &p_rest) { @@ -120,8 +120,7 @@ void Bone2D::apply_rest() { void Bone2D::set_default_length(float p_length) { - default_length=p_length; - + default_length = p_length; } float Bone2D::get_default_length() const { @@ -129,7 +128,7 @@ float Bone2D::get_default_length() const { } int Bone2D::get_index_in_skeleton() const { - ERR_FAIL_COND_V(!skeleton,-1); + ERR_FAIL_COND_V(!skeleton, -1); skeleton->_update_bone_setup(); return skeleton_index; } @@ -137,22 +136,21 @@ String Bone2D::get_configuration_warning() const { String warning = Node2D::get_configuration_warning(); if (!skeleton) { - if (warning!=String()) { - warning+="\n"; + if (warning != String()) { + warning += "\n"; } if (parent_bone) { - warning+=TTR("This Bone2D chain should end at a Skeleton2D node."); + warning += TTR("This Bone2D chain should end at a Skeleton2D node."); } else { - warning+=TTR("A Bone2D only works with a Skeleton2D or another Bone2D as parent node."); + warning += TTR("A Bone2D only works with a Skeleton2D or another Bone2D as parent node."); } } - if (rest==Transform2D(0,0,0,0,0,0)) { - if (warning!=String()) { - warning+="\n"; + if (rest == Transform2D(0, 0, 0, 0, 0, 0)) { + if (warning != String()) { + warning += "\n"; } - warning+=TTR("This bone lacks a proper REST pose. Go to the Skeleton2D node and set one."); - + warning += TTR("This bone lacks a proper REST pose. Go to the Skeleton2D node and set one."); } return warning; @@ -161,12 +159,12 @@ String Bone2D::get_configuration_warning() const { Bone2D::Bone2D() { skeleton = NULL; parent_bone = NULL; - skeleton_index=-1; - default_length=16; + skeleton_index = -1; + default_length = 16; set_notify_local_transform(true); //this is a clever hack so the bone knows no rest has been set yet, allowing to show an error. - for(int i=0;i<3;i++) { - rest[i]=Vector2(0,0); + for (int i = 0; i < 3; i++) { + rest[i] = Vector2(0, 0); } } @@ -194,12 +192,12 @@ void Skeleton2D::_update_bone_setup() { for (int i = 0; i < bones.size(); i++) { bones[i].rest_inverse = bones[i].bone->get_skeleton_rest().affine_inverse(); //bind pose - bones[i].bone->skeleton_index=i; + bones[i].bone->skeleton_index = i; Bone2D *parent_bone = Object::cast_to<Bone2D>(bones[i].bone->get_parent()); if (parent_bone) { - bones[i].parent_index=parent_bone->skeleton_index; + bones[i].parent_index = parent_bone->skeleton_index; } else { - bones[i].parent_index=-1; + bones[i].parent_index = -1; } } @@ -230,8 +228,8 @@ void Skeleton2D::_update_transform() { for (int i = 0; i < bones.size(); i++) { - ERR_CONTINUE(bones[i].parent_index>=i); - if (bones[i].parent_index>=0) { + ERR_CONTINUE(bones[i].parent_index >= i); + if (bones[i].parent_index >= 0) { bones[i].accum_transform = bones[bones[i].parent_index].accum_transform * bones[i].bone->get_transform(); } else { bones[i].accum_transform = bones[i].bone->get_transform(); @@ -277,7 +275,7 @@ void Skeleton2D::_notification(int p_what) { } if (p_what == NOTIFICATION_TRANSFORM_CHANGED) { - VS::get_singleton()->skeleton_set_base_transform_2d(skeleton,get_global_transform()); + VS::get_singleton()->skeleton_set_base_transform_2d(skeleton, get_global_transform()); } } diff --git a/scene/2d/skeleton_2d.h b/scene/2d/skeleton_2d.h index b86cf3be81..9d0a061457 100644 --- a/scene/2d/skeleton_2d.h +++ b/scene/2d/skeleton_2d.h @@ -38,12 +38,13 @@ class Skeleton2D; class Bone2D : public Node2D { GDCLASS(Bone2D, Node2D) + friend class Skeleton2D; + Bone2D *parent_bone; Skeleton2D *skeleton; Transform2D rest; float default_length; -friend class Skeleton2D; int skeleton_index; protected: diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index f8661638c3..2069e64c43 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -1625,14 +1625,14 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = { { "smoothstep", TYPE_VEC4, { TYPE_FLOAT, TYPE_FLOAT, TYPE_VEC4, TYPE_VOID } }, { "isnan", TYPE_BOOL, { TYPE_FLOAT, TYPE_VOID } }, - { "isnan", TYPE_BOOL, { TYPE_VEC2, TYPE_VOID } }, - { "isnan", TYPE_BOOL, { TYPE_VEC3, TYPE_VOID } }, - { "isnan", TYPE_BOOL, { TYPE_VEC4, TYPE_VOID } }, + { "isnan", TYPE_BVEC2, { TYPE_VEC2, TYPE_VOID } }, + { "isnan", TYPE_BVEC3, { TYPE_VEC3, TYPE_VOID } }, + { "isnan", TYPE_BVEC4, { TYPE_VEC4, TYPE_VOID } }, { "isinf", TYPE_BOOL, { TYPE_FLOAT, TYPE_VOID } }, - { "isinf", TYPE_BOOL, { TYPE_VEC2, TYPE_VOID } }, - { "isinf", TYPE_BOOL, { TYPE_VEC3, TYPE_VOID } }, - { "isinf", TYPE_BOOL, { TYPE_VEC4, TYPE_VOID } }, + { "isinf", TYPE_BVEC2, { TYPE_VEC2, TYPE_VOID } }, + { "isinf", TYPE_BVEC3, { TYPE_VEC3, TYPE_VOID } }, + { "isinf", TYPE_BVEC4, { TYPE_VEC4, TYPE_VOID } }, { "floatBitsToInt", TYPE_INT, { TYPE_FLOAT, TYPE_VOID } }, { "floatBitsToInt", TYPE_IVEC2, { TYPE_VEC2, TYPE_VOID } }, |