summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/SCsub2
-rw-r--r--modules/bullet/SCsub10
-rw-r--r--modules/bullet/area_bullet.cpp26
-rw-r--r--modules/bullet/area_bullet.h14
-rw-r--r--modules/bullet/btRayShape.cpp6
-rw-r--r--modules/bullet/bullet_physics_server.cpp20
-rw-r--r--modules/bullet/bullet_physics_server.h4
-rw-r--r--modules/bullet/collision_object_bullet.cpp32
-rw-r--r--modules/bullet/collision_object_bullet.h24
-rw-r--r--modules/bullet/cone_twist_joint_bullet.cpp18
-rw-r--r--modules/bullet/constraint_bullet.cpp5
-rw-r--r--modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml2
-rw-r--r--modules/bullet/doc_classes/BulletPhysicsServer.xml2
-rw-r--r--modules/bullet/generic_6dof_joint_bullet.cpp77
-rw-r--r--modules/bullet/generic_6dof_joint_bullet.h5
-rw-r--r--modules/bullet/godot_collision_configuration.cpp4
-rw-r--r--modules/bullet/godot_collision_dispatcher.cpp4
-rw-r--r--modules/bullet/godot_motion_state.h8
-rw-r--r--modules/bullet/godot_ray_world_algorithm.cpp24
-rw-r--r--modules/bullet/godot_result_callbacks.cpp22
-rw-r--r--modules/bullet/godot_result_callbacks.h84
-rw-r--r--modules/bullet/hinge_joint_bullet.cpp28
-rw-r--r--modules/bullet/joint_bullet.cpp4
-rw-r--r--modules/bullet/pin_joint_bullet.cpp8
-rw-r--r--modules/bullet/rigid_body_bullet.cpp109
-rw-r--r--modules/bullet/rigid_body_bullet.h11
-rw-r--r--modules/bullet/shape_bullet.cpp35
-rw-r--r--modules/bullet/slider_joint_bullet.cpp17
-rw-r--r--modules/bullet/soft_body_bullet.cpp14
-rw-r--r--modules/bullet/space_bullet.cpp298
-rw-r--r--modules/bullet/space_bullet.h24
-rw-r--r--modules/enet/doc_classes/NetworkedMultiplayerENet.xml12
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp8
-rw-r--r--modules/enet/networked_multiplayer_enet.h8
-rw-r--r--modules/etc/SCsub3
-rw-r--r--modules/etc/image_etc.cpp14
-rw-r--r--modules/freetype/SCsub2
-rw-r--r--modules/gdnative/SCsub47
-rw-r--r--modules/gdnative/arvr/arvr_interface_gdnative.cpp4
-rw-r--r--modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml2
-rw-r--r--modules/gdnative/doc_classes/GDNative.xml16
-rw-r--r--modules/gdnative/doc_classes/GDNativeLibrary.xml50
-rw-r--r--modules/gdnative/doc_classes/NativeScript.xml30
-rw-r--r--modules/gdnative/doc_classes/PluginScript.xml2
-rw-r--r--modules/gdnative/gdnative.cpp61
-rw-r--r--modules/gdnative/gdnative.h14
-rw-r--r--modules/gdnative/gdnative/aabb.cpp217
-rw-r--r--modules/gdnative/gdnative/array.cpp11
-rw-r--r--modules/gdnative/gdnative/basis.cpp2
-rw-r--r--modules/gdnative/gdnative/gdnative.cpp36
-rw-r--r--modules/gdnative/gdnative/node_path.cpp4
-rw-r--r--modules/gdnative/gdnative/quat.cpp2
-rw-r--r--modules/gdnative/gdnative/rect3.cpp217
-rw-r--r--modules/gdnative/gdnative/string.cpp5
-rw-r--r--modules/gdnative/gdnative/transform.cpp16
-rw-r--r--modules/gdnative/gdnative/variant.cpp12
-rw-r--r--modules/gdnative/gdnative/vector2.cpp2
-rw-r--r--modules/gdnative/gdnative/vector3.cpp2
-rw-r--r--modules/gdnative/gdnative_api.json197
-rw-r--r--modules/gdnative/include/gdnative/aabb.h117
-rw-r--r--modules/gdnative/include/gdnative/array.h4
-rw-r--r--modules/gdnative/include/gdnative/basis.h2
-rw-r--r--modules/gdnative/include/gdnative/gdnative.h32
-rw-r--r--modules/gdnative/include/gdnative/node_path.h2
-rw-r--r--modules/gdnative/include/gdnative/quat.h2
-rw-r--r--modules/gdnative/include/gdnative/rect3.h117
-rw-r--r--modules/gdnative/include/gdnative/string.h2
-rw-r--r--modules/gdnative/include/gdnative/transform.h4
-rw-r--r--modules/gdnative/include/gdnative/variant.h8
-rw-r--r--modules/gdnative/include/gdnative/vector2.h2
-rw-r--r--modules/gdnative/include/gdnative/vector3.h2
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp2
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp10
-rw-r--r--modules/gdnative/nativescript/nativescript.h12
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.cpp4
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.cpp7
-rw-r--r--modules/gdnative/register_types.cpp116
-rw-r--r--modules/gdscript/SCsub5
-rw-r--r--modules/gdscript/doc_classes/GDScript.xml2
-rw-r--r--modules/gdscript/doc_classes/GDScriptFunctionState.xml2
-rw-r--r--modules/gdscript/doc_classes/GDScriptNativeClass.xml2
-rw-r--r--modules/gdscript/gdscript.cpp27
-rw-r--r--modules/gdscript/gdscript.h8
-rw-r--r--modules/gdscript/gdscript_compiler.cpp27
-rw-r--r--modules/gdscript/gdscript_editor.cpp62
-rw-r--r--modules/gdscript/gdscript_function.cpp10
-rw-r--r--modules/gdscript/gdscript_functions.cpp32
-rw-r--r--modules/gdscript/gdscript_functions.h2
-rw-r--r--modules/gdscript/gdscript_parser.cpp127
-rw-r--r--modules/gdscript/gdscript_tokenizer.cpp10
-rw-r--r--modules/gdscript/register_types.cpp44
-rw-r--r--modules/gridmap/SCsub5
-rw-r--r--modules/gridmap/doc_classes/GridMap.xml4
-rw-r--r--modules/gridmap/grid_map.cpp4
-rw-r--r--modules/gridmap/grid_map.h5
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp12
-rw-r--r--modules/mobile_vr/doc_classes/MobileVRInterface.xml98
-rw-r--r--modules/mobile_vr/mobile_interface.cpp2
-rw-r--r--modules/mono/SCsub21
-rw-r--r--modules/mono/csharp_script.cpp10
-rw-r--r--modules/mono/doc_classes/@C#.xml2
-rw-r--r--modules/mono/doc_classes/CSharpScript.xml2
-rw-r--r--modules/mono/doc_classes/GodotSharp.xml2
-rw-r--r--modules/mono/editor/bindings_generator.cpp8
-rw-r--r--modules/mono/editor/csharp_project.cpp2
-rw-r--r--modules/mono/editor/csharp_project.h2
-rw-r--r--modules/mono/glue/cs_files/AABB.cs (renamed from modules/mono/glue/cs_files/Rect3.cs)74
-rw-r--r--modules/mono/glue/cs_files/Basis.cs92
-rw-r--r--modules/mono/glue/cs_files/Color.cs44
-rw-r--r--modules/mono/glue/cs_files/Error.cs3
-rw-r--r--modules/mono/glue/cs_files/GD.cs56
-rw-r--r--modules/mono/glue/cs_files/Mathf.cs90
-rw-r--r--modules/mono/glue/cs_files/Plane.cs58
-rw-r--r--modules/mono/glue/cs_files/Quat.cs60
-rw-r--r--modules/mono/glue/cs_files/Rect2.cs44
-rw-r--r--modules/mono/glue/cs_files/StringExtensions.cs174
-rw-r--r--modules/mono/glue/cs_files/Transform.cs58
-rw-r--r--modules/mono/glue/cs_files/Transform2D.cs82
-rw-r--r--modules/mono/glue/cs_files/Vector2.cs82
-rw-r--r--modules/mono/glue/cs_files/Vector3.cs86
-rw-r--r--modules/mono/godotsharp_dirs.cpp14
-rw-r--r--modules/mono/godotsharp_dirs.h2
-rw-r--r--modules/mono/mono_gc_handle.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_field.cpp8
-rw-r--r--modules/mono/mono_gd/gd_mono_internals.cpp2
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp18
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h8
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp6
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h4
-rw-r--r--modules/mono/signal_awaiter_utils.cpp6
-rw-r--r--modules/mono/utils/mono_reg_utils.h2
-rw-r--r--modules/mono/utils/string_utils.cpp2
-rw-r--r--modules/openssl/stream_peer_openssl.cpp8
-rw-r--r--modules/opus/audio_stream_opus.cpp2
-rw-r--r--modules/pvr/texture_loader_pvr.cpp6
-rw-r--r--modules/recast/SCsub2
-rw-r--r--modules/regex/doc_classes/RegEx.xml2
-rw-r--r--modules/regex/doc_classes/RegExMatch.xml4
-rw-r--r--modules/squish/image_compress_squish.cpp2
-rw-r--r--modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml13
-rw-r--r--modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml2
-rw-r--r--modules/svg/SCsub3
-rw-r--r--modules/thekla_unwrap/SCsub74
-rw-r--r--modules/thekla_unwrap/config.py7
-rw-r--r--modules/thekla_unwrap/register_types.cpp116
-rw-r--r--modules/thekla_unwrap/register_types.h31
-rw-r--r--modules/theora/doc_classes/ResourceImporterTheora.xml2
-rw-r--r--modules/theora/doc_classes/VideoStreamTheora.xml6
-rw-r--r--modules/tinyexr/image_loader_tinyexr.cpp25
-rw-r--r--modules/visual_script/SCsub5
-rw-r--r--modules/visual_script/doc_classes/VisualScript.xml6
-rw-r--r--modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml30
-rw-r--r--modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml146
-rw-r--r--modules/visual_script/doc_classes/VisualScriptClassConstant.xml30
-rw-r--r--modules/visual_script/doc_classes/VisualScriptComment.xml44
-rw-r--r--modules/visual_script/doc_classes/VisualScriptCondition.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptConstant.xml30
-rw-r--r--modules/visual_script/doc_classes/VisualScriptConstructor.xml26
-rw-r--r--modules/visual_script/doc_classes/VisualScriptCustomNode.xml18
-rw-r--r--modules/visual_script/doc_classes/VisualScriptDeconstruct.xml18
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEditor.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEmitSignal.xml16
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml16
-rw-r--r--modules/visual_script/doc_classes/VisualScriptExpression.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunction.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunctionCall.xml164
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunctionState.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml16
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIndexGet.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIndexSet.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptInputAction.xml38
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIterator.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptLocalVar.xml30
-rw-r--r--modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml30
-rw-r--r--modules/visual_script/doc_classes/VisualScriptMathConstant.xml34
-rw-r--r--modules/visual_script/doc_classes/VisualScriptNode.xml6
-rw-r--r--modules/visual_script/doc_classes/VisualScriptOperator.xml30
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPreload.xml16
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPropertyGet.xml108
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPropertySet.xml146
-rw-r--r--modules/visual_script/doc_classes/VisualScriptResourcePath.xml16
-rw-r--r--modules/visual_script/doc_classes/VisualScriptReturn.xml30
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSceneNode.xml16
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSceneTree.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSelect.xml16
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSelf.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSequence.xml16
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSubCall.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSwitch.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptTypeCast.xml30
-rw-r--r--modules/visual_script/doc_classes/VisualScriptVariableGet.xml16
-rw-r--r--modules/visual_script/doc_classes/VisualScriptVariableSet.xml16
-rw-r--r--modules/visual_script/doc_classes/VisualScriptWhile.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptYield.xml24
-rw-r--r--modules/visual_script/doc_classes/VisualScriptYieldSignal.xml64
-rw-r--r--modules/visual_script/register_types.cpp2
-rw-r--r--modules/visual_script/visual_script.cpp13
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp40
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.h2
-rw-r--r--modules/visual_script/visual_script_editor.cpp12
-rw-r--r--modules/visual_script/visual_script_expression.cpp6
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp6
-rw-r--r--modules/visual_script/visual_script_nodes.cpp12
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp2
-rw-r--r--modules/webm/config.py2
-rw-r--r--modules/webm/doc_classes/ResourceImporterWebm.xml2
-rw-r--r--modules/webm/doc_classes/VideoStreamWebm.xml6
-rw-r--r--modules/webm/video_stream_webm.cpp40
-rw-r--r--modules/webp/SCsub11
209 files changed, 2722 insertions, 3012 deletions
diff --git a/modules/SCsub b/modules/SCsub
index c1cf5a6c1a..e3c535e981 100644
--- a/modules/SCsub
+++ b/modules/SCsub
@@ -17,6 +17,6 @@ for x in env.module_list:
env_modules.Append(CPPFLAGS=["-DMODULE_" + x.upper() + "_ENABLED"])
SConscript(x + "/SCsub")
-lib = env_modules.Library("modules", env.modules_sources)
+lib = env_modules.add_library("modules", env.modules_sources)
env.Prepend(LIBS=[lib])
diff --git a/modules/bullet/SCsub b/modules/bullet/SCsub
index 7a37cca130..0967bca3f2 100644
--- a/modules/bullet/SCsub
+++ b/modules/bullet/SCsub
@@ -1,9 +1,13 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
# build only version 2
# Bullet 2.87
+
+env_bullet = env_modules.Clone()
+
bullet_src__2_x = [
# BulletCollision
"BulletCollision/BroadphaseCollision/btAxisSweep3.cpp"
@@ -181,11 +185,11 @@ thirdparty_src = thirdparty_dir + "src/"
bullet_sources = [thirdparty_src + file for file in bullet_src__2_x]
# include headers
-env.Append(CPPPATH=[thirdparty_src])
+env_bullet.Append(CPPPATH=[thirdparty_src])
-env.add_source_files(env.modules_sources, bullet_sources)
+env_bullet.add_source_files(env.modules_sources, bullet_sources)
# Godot source files
-env.add_source_files(env.modules_sources, "*.cpp")
+env_bullet.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp
index 54024b4f90..fad6f52cea 100644
--- a/modules/bullet/area_bullet.cpp
+++ b/modules/bullet/area_bullet.cpp
@@ -37,19 +37,19 @@
#include "collision_object_bullet.h"
#include "space_bullet.h"
-AreaBullet::AreaBullet()
- : RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_AREA),
- monitorable(true),
- isScratched(false),
- spOv_mode(PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED),
- spOv_gravityPoint(false),
- spOv_gravityPointDistanceScale(0),
- spOv_gravityPointAttenuation(1),
- spOv_gravityVec(0, -1, 0),
- spOv_gravityMag(10),
- spOv_linearDump(0.1),
- spOv_angularDump(1),
- spOv_priority(0) {
+AreaBullet::AreaBullet() :
+ RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_AREA),
+ monitorable(true),
+ isScratched(false),
+ spOv_mode(PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED),
+ spOv_gravityPoint(false),
+ spOv_gravityPointDistanceScale(0),
+ spOv_gravityPointAttenuation(1),
+ spOv_gravityVec(0, -1, 0),
+ spOv_gravityMag(10),
+ spOv_linearDump(0.1),
+ spOv_angularDump(1),
+ spOv_priority(0) {
btGhost = bulletnew(btGhostObject);
btGhost->setCollisionShape(compoundShape);
diff --git a/modules/bullet/area_bullet.h b/modules/bullet/area_bullet.h
index f6e3b7e902..95ce62bfed 100644
--- a/modules/bullet/area_bullet.h
+++ b/modules/bullet/area_bullet.h
@@ -47,8 +47,8 @@ public:
ObjectID event_callback_id;
StringName event_callback_method;
- InOutEventCallback()
- : event_callback_id(0) {}
+ InOutEventCallback() :
+ event_callback_id(0) {}
};
enum OverlapState {
@@ -62,10 +62,12 @@ public:
CollisionObjectBullet *object;
OverlapState state;
- OverlappingObjectData()
- : object(NULL), state(OVERLAP_STATE_ENTER) {}
- OverlappingObjectData(CollisionObjectBullet *p_object, OverlapState p_state)
- : object(p_object), state(p_state) {}
+ OverlappingObjectData() :
+ object(NULL),
+ state(OVERLAP_STATE_ENTER) {}
+ OverlappingObjectData(CollisionObjectBullet *p_object, OverlapState p_state) :
+ object(p_object),
+ state(p_state) {}
OverlappingObjectData(const OverlappingObjectData &other) {
operator=(other);
}
diff --git a/modules/bullet/btRayShape.cpp b/modules/bullet/btRayShape.cpp
index ac95faaac6..bbd2b19677 100644
--- a/modules/bullet/btRayShape.cpp
+++ b/modules/bullet/btRayShape.cpp
@@ -33,9 +33,9 @@
#include "LinearMath/btAabbUtil2.h"
#include "math/math_funcs.h"
-btRayShape::btRayShape(btScalar length)
- : btConvexInternalShape(),
- m_shapeAxis(0, 0, 1) {
+btRayShape::btRayShape(btScalar length) :
+ btConvexInternalShape(),
+ m_shapeAxis(0, 0, 1) {
m_shapeType = CUSTOM_CONVEX_SHAPE_TYPE;
setLength(length);
}
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 7f95d16ba6..b233edc0d4 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -78,10 +78,10 @@ void BulletPhysicsServer::_bind_methods() {
//ClassDB::bind_method(D_METHOD("DoTest"), &BulletPhysicsServer::DoTest);
}
-BulletPhysicsServer::BulletPhysicsServer()
- : PhysicsServer(),
- active(true),
- active_spaces_count(0) {}
+BulletPhysicsServer::BulletPhysicsServer() :
+ PhysicsServer(),
+ active(true),
+ active_spaces_count(0) {}
BulletPhysicsServer::~BulletPhysicsServer() {}
@@ -723,16 +723,16 @@ void BulletPhysicsServer::body_set_axis_velocity(RID p_body, const Vector3 &p_ax
body->set_linear_velocity(v);
}
-void BulletPhysicsServer::body_set_axis_lock(RID p_body, PhysicsServer::BodyAxisLock p_lock) {
+void BulletPhysicsServer::body_set_axis_lock(RID p_body, BodyAxis p_axis, bool p_lock) {
RigidBodyBullet *body = rigid_body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_axis_lock(p_lock);
+ body->set_axis_lock(p_axis, p_lock);
}
-PhysicsServer::BodyAxisLock BulletPhysicsServer::body_get_axis_lock(RID p_body) const {
+bool BulletPhysicsServer::body_is_axis_locked(RID p_body, BodyAxis p_axis) const {
const RigidBodyBullet *body = rigid_body_owner.get(p_body);
- ERR_FAIL_COND_V(!body, BODY_AXIS_LOCK_DISABLED);
- return body->get_axis_lock();
+ ERR_FAIL_COND_V(!body, 0);
+ return body->is_axis_locked(p_axis);
}
void BulletPhysicsServer::body_add_collision_exception(RID p_body, RID p_body_b) {
@@ -798,7 +798,7 @@ bool BulletPhysicsServer::body_is_omitting_force_integration(RID p_body) const {
void BulletPhysicsServer::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) {
RigidBodyBullet *body = rigid_body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_force_integration_callback(p_receiver->get_instance_id(), p_method, p_udata);
+ body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(0), p_method, p_udata);
}
void BulletPhysicsServer::body_set_ray_pickable(RID p_body, bool p_enable) {
diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h
index ad8137ee2f..8a10c87fc6 100644
--- a/modules/bullet/bullet_physics_server.h
+++ b/modules/bullet/bullet_physics_server.h
@@ -226,8 +226,8 @@ public:
virtual void body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse);
virtual void body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity);
- virtual void body_set_axis_lock(RID p_body, BodyAxisLock p_lock);
- virtual BodyAxisLock body_get_axis_lock(RID p_body) const;
+ virtual void body_set_axis_lock(RID p_body, BodyAxis p_axis, bool p_lock);
+ virtual bool body_is_axis_locked(RID p_body, BodyAxis p_axis) const;
virtual void body_add_collision_exception(RID p_body, RID p_body_b);
virtual void body_remove_collision_exception(RID p_body, RID p_body_b);
diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp
index 91a049b1f3..88d4108f82 100644
--- a/modules/bullet/collision_object_bullet.cpp
+++ b/modules/bullet/collision_object_bullet.cpp
@@ -50,8 +50,14 @@ void CollisionObjectBullet::ShapeWrapper::set_transform(const btTransform &p_tra
transform = p_transform;
}
-CollisionObjectBullet::CollisionObjectBullet(Type p_type)
- : RIDBullet(), space(NULL), type(p_type), collisionsEnabled(true), m_isStatic(false), bt_collision_object(NULL), body_scale(1., 1., 1.) {}
+CollisionObjectBullet::CollisionObjectBullet(Type p_type) :
+ RIDBullet(),
+ space(NULL),
+ type(p_type),
+ collisionsEnabled(true),
+ m_isStatic(false),
+ bt_collision_object(NULL),
+ body_scale(1., 1., 1.) {}
CollisionObjectBullet::~CollisionObjectBullet() {
// Remove all overlapping
@@ -70,11 +76,17 @@ bool equal(real_t first, real_t second) {
void CollisionObjectBullet::set_body_scale(const Vector3 &p_new_scale) {
if (!equal(p_new_scale[0], body_scale[0]) || !equal(p_new_scale[1], body_scale[1]) || !equal(p_new_scale[2], body_scale[2])) {
- G_TO_B(p_new_scale, body_scale);
+ body_scale = p_new_scale;
on_body_scale_changed();
}
}
+btVector3 CollisionObjectBullet::get_bt_body_scale() const {
+ btVector3 s;
+ G_TO_B(body_scale, s);
+ return s;
+}
+
void CollisionObjectBullet::on_body_scale_changed() {
}
@@ -154,6 +166,7 @@ void CollisionObjectBullet::set_transform(const Transform &p_global_transform) {
Transform CollisionObjectBullet::get_transform() const {
Transform t;
B_TO_G(get_transform__bullet(), t);
+ t.basis.scale(body_scale);
return t;
}
@@ -165,8 +178,9 @@ const btTransform &CollisionObjectBullet::get_transform__bullet() const {
return bt_collision_object->getWorldTransform();
}
-RigidCollisionObjectBullet::RigidCollisionObjectBullet(Type p_type)
- : CollisionObjectBullet(p_type), compoundShape(bulletnew(btCompoundShape(enableDynamicAabbTree, initialChildCapacity))) {
+RigidCollisionObjectBullet::RigidCollisionObjectBullet(Type p_type) :
+ CollisionObjectBullet(p_type),
+ compoundShape(bulletnew(btCompoundShape(enableDynamicAabbTree, initialChildCapacity))) {
}
RigidCollisionObjectBullet::~RigidCollisionObjectBullet() {
@@ -285,17 +299,17 @@ void RigidCollisionObjectBullet::on_shapes_changed() {
const int size = shapes.size();
for (i = 0; i < size; ++i) {
shpWrapper = &shapes[i];
- if (!shpWrapper->bt_shape) {
- shpWrapper->bt_shape = shpWrapper->shape->create_bt_shape();
- }
if (shpWrapper->active) {
+ if (!shpWrapper->bt_shape) {
+ shpWrapper->bt_shape = shpWrapper->shape->create_bt_shape();
+ }
compoundShape->addChildShape(shpWrapper->transform, shpWrapper->bt_shape);
} else {
compoundShape->addChildShape(shpWrapper->transform, BulletPhysicsServer::get_empty_shape());
}
}
- compoundShape->setLocalScaling(body_scale);
+ compoundShape->setLocalScaling(get_bt_body_scale());
compoundShape->recalculateLocalAabb();
}
diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h
index 153b8ea5bc..7d4659b64e 100644
--- a/modules/bullet/collision_object_bullet.h
+++ b/modules/bullet/collision_object_bullet.h
@@ -70,16 +70,22 @@ public:
btTransform transform;
bool active;
- ShapeWrapper()
- : shape(NULL), bt_shape(NULL), active(true) {}
-
- ShapeWrapper(ShapeBullet *p_shape, const btTransform &p_transform, bool p_active)
- : shape(p_shape), bt_shape(NULL), active(p_active) {
+ ShapeWrapper() :
+ shape(NULL),
+ bt_shape(NULL),
+ active(true) {}
+
+ ShapeWrapper(ShapeBullet *p_shape, const btTransform &p_transform, bool p_active) :
+ shape(p_shape),
+ bt_shape(NULL),
+ active(p_active) {
set_transform(p_transform);
}
- ShapeWrapper(ShapeBullet *p_shape, const Transform &p_transform, bool p_active)
- : shape(p_shape), bt_shape(NULL), active(p_active) {
+ ShapeWrapper(ShapeBullet *p_shape, const Transform &p_transform, bool p_active) :
+ shape(p_shape),
+ bt_shape(NULL),
+ active(p_active) {
set_transform(p_transform);
}
~ShapeWrapper();
@@ -108,7 +114,7 @@ protected:
bool m_isStatic;
bool ray_pickable;
btCollisionObject *bt_collision_object;
- btVector3 body_scale;
+ Vector3 body_scale;
SpaceBullet *space;
VSet<RID> exceptions;
@@ -140,6 +146,8 @@ public:
_FORCE_INLINE_ bool is_ray_pickable() const { return ray_pickable; }
void set_body_scale(const Vector3 &p_new_scale);
+ const Vector3 &get_body_scale() const { return body_scale; }
+ btVector3 get_bt_body_scale() const;
virtual void on_body_scale_changed();
void add_collision_exception(const CollisionObjectBullet *p_ignoreCollisionObject);
diff --git a/modules/bullet/cone_twist_joint_bullet.cpp b/modules/bullet/cone_twist_joint_bullet.cpp
index f6ac40e001..738835b910 100644
--- a/modules/bullet/cone_twist_joint_bullet.cpp
+++ b/modules/bullet/cone_twist_joint_bullet.cpp
@@ -35,13 +35,23 @@
#include "bullet_utilities.h"
#include "rigid_body_bullet.h"
-ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &rbAFrame, const Transform &rbBFrame)
- : JointBullet() {
+ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &rbAFrame, const Transform &rbBFrame) :
+ JointBullet() {
+
+ Transform scaled_AFrame(rbAFrame.scaled(rbA->get_body_scale()));
+ scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis);
+
btTransform btFrameA;
- G_TO_B(rbAFrame, btFrameA);
+ G_TO_B(scaled_AFrame, btFrameA);
+
if (rbB) {
+
+ Transform scaled_BFrame(rbBFrame.scaled(rbB->get_body_scale()));
+ scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis);
+
btTransform btFrameB;
- G_TO_B(rbBFrame, btFrameB);
+ G_TO_B(scaled_BFrame, btFrameB);
+
coneConstraint = bulletnew(btConeTwistConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB));
} else {
coneConstraint = bulletnew(btConeTwistConstraint(*rbA->get_bt_rigid_body(), btFrameA));
diff --git a/modules/bullet/constraint_bullet.cpp b/modules/bullet/constraint_bullet.cpp
index 08fc36f274..505579ce9b 100644
--- a/modules/bullet/constraint_bullet.cpp
+++ b/modules/bullet/constraint_bullet.cpp
@@ -33,8 +33,9 @@
#include "collision_object_bullet.h"
#include "space_bullet.h"
-ConstraintBullet::ConstraintBullet()
- : space(NULL), constraint(NULL) {}
+ConstraintBullet::ConstraintBullet() :
+ space(NULL),
+ constraint(NULL) {}
void ConstraintBullet::setup(btTypedConstraint *p_constraint) {
constraint = p_constraint;
diff --git a/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml
index 831b346942..941a79e8ea 100644
--- a/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml
+++ b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BulletPhysicsDirectBodyState" inherits="PhysicsDirectBodyState" category="Core" version="3.0-alpha">
+<class name="BulletPhysicsDirectBodyState" inherits="PhysicsDirectBodyState" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/bullet/doc_classes/BulletPhysicsServer.xml b/modules/bullet/doc_classes/BulletPhysicsServer.xml
index 4b5c2e6d83..515f0e292e 100644
--- a/modules/bullet/doc_classes/BulletPhysicsServer.xml
+++ b/modules/bullet/doc_classes/BulletPhysicsServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BulletPhysicsServer" inherits="PhysicsServer" category="Core" version="3.0-alpha">
+<class name="BulletPhysicsServer" inherits="PhysicsServer" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp
index 647396c24c..da09d4e12f 100644
--- a/modules/bullet/generic_6dof_joint_bullet.cpp
+++ b/modules/bullet/generic_6dof_joint_bullet.cpp
@@ -35,15 +35,23 @@
#include "bullet_utilities.h"
#include "rigid_body_bullet.h"
-Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA)
- : JointBullet() {
+Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA) :
+ JointBullet() {
+
+ Transform scaled_AFrame(frameInA.scaled(rbA->get_body_scale()));
+
+ scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis);
btTransform btFrameA;
- G_TO_B(frameInA, btFrameA);
+ G_TO_B(scaled_AFrame, btFrameA);
if (rbB) {
+ Transform scaled_BFrame(frameInB.scaled(rbB->get_body_scale()));
+
+ scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis);
+
btTransform btFrameB;
- G_TO_B(frameInB, btFrameB);
+ G_TO_B(scaled_BFrame, btFrameB);
sixDOFConstraint = bulletnew(btGeneric6DofConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB, useLinearReferenceFrameA));
} else {
@@ -109,10 +117,12 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
ERR_FAIL_INDEX(p_axis, 3);
switch (p_param) {
case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT:
- sixDOFConstraint->getTranslationalLimitMotor()->m_lowerLimit[p_axis] = p_value;
+ limits_lower[0][p_axis] = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
- sixDOFConstraint->getTranslationalLimitMotor()->m_upperLimit[p_axis] = p_value;
+ limits_upper[0][p_axis] = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS:
sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness = p_value;
@@ -124,10 +134,12 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
sixDOFConstraint->getTranslationalLimitMotor()->m_damping = p_value;
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_loLimit = p_value;
+ limits_lower[1][p_axis] = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_hiLimit = p_value;
+ limits_upper[1][p_axis] = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS:
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness = p_value;
@@ -159,9 +171,9 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
ERR_FAIL_INDEX_V(p_axis, 3, 0.);
switch (p_param) {
case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT:
- return sixDOFConstraint->getTranslationalLimitMotor()->m_lowerLimit[p_axis];
+ return limits_lower[0][p_axis];
case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
- return sixDOFConstraint->getTranslationalLimitMotor()->m_upperLimit[p_axis];
+ return limits_upper[0][p_axis];
case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS:
return sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness;
case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION:
@@ -169,9 +181,9 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING:
return sixDOFConstraint->getTranslationalLimitMotor()->m_damping;
case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_loLimit;
+ return limits_lower[1][p_axis];
case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_hiLimit;
+ return limits_upper[1][p_axis];
case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS:
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness;
case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING:
@@ -194,48 +206,35 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag, bool p_value) {
ERR_FAIL_INDEX(p_axis, 3);
+
+ flags[p_axis][p_flag] = p_value;
+
switch (p_flag) {
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT:
- if (p_value) {
- if (!get_flag(p_axis, p_flag)) // avoid overwrite, if limited
- sixDOFConstraint->setLimit(p_axis, 0, 0); // Limited
+ if (flags[p_axis][p_flag]) {
+ sixDOFConstraint->setLimit(p_axis, limits_lower[0][p_axis], limits_upper[0][p_axis]);
} else {
- if (get_flag(p_axis, p_flag)) // avoid overwrite, if free
- sixDOFConstraint->setLimit(p_axis, 0, -1); // Free
+ sixDOFConstraint->setLimit(p_axis, 0, -1); // Free
}
break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT: {
- int angularAxis = 3 + p_axis;
- if (p_value) {
- if (!get_flag(p_axis, p_flag)) // avoid overwrite, if Limited
- sixDOFConstraint->setLimit(angularAxis, 0, 0); // Limited
+ case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT:
+ if (flags[p_axis][p_flag]) {
+ sixDOFConstraint->setLimit(p_axis + 3, limits_lower[1][p_axis], limits_upper[1][p_axis]);
} else {
- if (get_flag(p_axis, p_flag)) // avoid overwrite, if free
- sixDOFConstraint->setLimit(angularAxis, 0, -1); // Free
+ sixDOFConstraint->setLimit(p_axis + 3, 0, -1); // Free
}
break;
- }
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR:
- //sixDOFConstraint->getTranslationalLimitMotor()->m_enableMotor[p_axis] = p_value;
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableMotor = p_value;
+ sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableMotor = flags[p_axis][p_flag];
break;
default:
WARN_PRINT("This flag is not supported by Bullet engine");
+ return;
}
}
bool Generic6DOFJointBullet::get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag) const {
ERR_FAIL_INDEX_V(p_axis, 3, false);
- switch (p_flag) {
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT:
- return sixDOFConstraint->getTranslationalLimitMotor()->isLimited(p_axis);
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->isLimited();
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR:
- return //sixDOFConstraint->getTranslationalLimitMotor()->m_enableMotor[p_axis] &&
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableMotor;
- default:
- WARN_PRINT("This flag is not supported by Bullet engine");
- return false;
- }
+
+ return flags[p_axis][p_flag];
}
diff --git a/modules/bullet/generic_6dof_joint_bullet.h b/modules/bullet/generic_6dof_joint_bullet.h
index 0d47b823de..ba0ae08800 100644
--- a/modules/bullet/generic_6dof_joint_bullet.h
+++ b/modules/bullet/generic_6dof_joint_bullet.h
@@ -39,6 +39,11 @@ class RigidBodyBullet;
class Generic6DOFJointBullet : public JointBullet {
class btGeneric6DofConstraint *sixDOFConstraint;
+ // First is linear second is angular
+ Vector3 limits_lower[2];
+ Vector3 limits_upper[2];
+ bool flags[3][PhysicsServer::G6DOF_JOINT_FLAG_MAX];
+
public:
Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA);
diff --git a/modules/bullet/godot_collision_configuration.cpp b/modules/bullet/godot_collision_configuration.cpp
index 4e4228cc48..136fb2ee74 100644
--- a/modules/bullet/godot_collision_configuration.cpp
+++ b/modules/bullet/godot_collision_configuration.cpp
@@ -34,8 +34,8 @@
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
#include "godot_ray_world_algorithm.h"
-GodotCollisionConfiguration::GodotCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo)
- : btDefaultCollisionConfiguration(constructionInfo) {
+GodotCollisionConfiguration::GodotCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) :
+ btDefaultCollisionConfiguration(constructionInfo) {
void *mem = NULL;
diff --git a/modules/bullet/godot_collision_dispatcher.cpp b/modules/bullet/godot_collision_dispatcher.cpp
index ea75e4eef4..e0ca29a8f3 100644
--- a/modules/bullet/godot_collision_dispatcher.cpp
+++ b/modules/bullet/godot_collision_dispatcher.cpp
@@ -34,8 +34,8 @@
const int GodotCollisionDispatcher::CASTED_TYPE_AREA = static_cast<int>(CollisionObjectBullet::TYPE_AREA);
-GodotCollisionDispatcher::GodotCollisionDispatcher(btCollisionConfiguration *collisionConfiguration)
- : btCollisionDispatcher(collisionConfiguration) {}
+GodotCollisionDispatcher::GodotCollisionDispatcher(btCollisionConfiguration *collisionConfiguration) :
+ btCollisionDispatcher(collisionConfiguration) {}
bool GodotCollisionDispatcher::needsCollision(const btCollisionObject *body0, const btCollisionObject *body1) {
if (body0->getUserIndex() == CASTED_TYPE_AREA || body1->getUserIndex() == CASTED_TYPE_AREA) {
diff --git a/modules/bullet/godot_motion_state.h b/modules/bullet/godot_motion_state.h
index 5111807394..62ea472446 100644
--- a/modules/bullet/godot_motion_state.h
+++ b/modules/bullet/godot_motion_state.h
@@ -51,10 +51,10 @@ class GodotMotionState : public btMotionState {
RigidBodyBullet *owner;
public:
- GodotMotionState(RigidBodyBullet *p_owner)
- : bodyKinematicWorldTransf(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)),
- bodyCurrentWorldTransform(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)),
- owner(p_owner) {}
+ GodotMotionState(RigidBodyBullet *p_owner) :
+ bodyKinematicWorldTransf(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)),
+ bodyCurrentWorldTransform(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)),
+ owner(p_owner) {}
/// IMPORTANT DON'T USE THIS FUNCTION TO KNOW THE CURRENT BODY TRANSFORM
/// This class is used internally by Bullet
diff --git a/modules/bullet/godot_ray_world_algorithm.cpp b/modules/bullet/godot_ray_world_algorithm.cpp
index 98daf8398e..ba13903548 100644
--- a/modules/bullet/godot_ray_world_algorithm.cpp
+++ b/modules/bullet/godot_ray_world_algorithm.cpp
@@ -34,18 +34,18 @@
#include "btRayShape.h"
#include "collision_object_bullet.h"
-GodotRayWorldAlgorithm::CreateFunc::CreateFunc(const btDiscreteDynamicsWorld *world)
- : m_world(world) {}
-
-GodotRayWorldAlgorithm::SwappedCreateFunc::SwappedCreateFunc(const btDiscreteDynamicsWorld *world)
- : m_world(world) {}
-
-GodotRayWorldAlgorithm::GodotRayWorldAlgorithm(const btDiscreteDynamicsWorld *world, btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped)
- : btActivatingCollisionAlgorithm(ci, body0Wrap, body1Wrap),
- m_manifoldPtr(mf),
- m_ownManifold(false),
- m_world(world),
- m_isSwapped(isSwapped) {}
+GodotRayWorldAlgorithm::CreateFunc::CreateFunc(const btDiscreteDynamicsWorld *world) :
+ m_world(world) {}
+
+GodotRayWorldAlgorithm::SwappedCreateFunc::SwappedCreateFunc(const btDiscreteDynamicsWorld *world) :
+ m_world(world) {}
+
+GodotRayWorldAlgorithm::GodotRayWorldAlgorithm(const btDiscreteDynamicsWorld *world, btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped) :
+ btActivatingCollisionAlgorithm(ci, body0Wrap, body1Wrap),
+ m_manifoldPtr(mf),
+ m_ownManifold(false),
+ m_world(world),
+ m_isSwapped(isSwapped) {}
GodotRayWorldAlgorithm::~GodotRayWorldAlgorithm() {
if (m_ownManifold && m_manifoldPtr) {
diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp
index bc60c9cb6b..cbf30c8a2e 100644
--- a/modules/bullet/godot_result_callbacks.cpp
+++ b/modules/bullet/godot_result_callbacks.cpp
@@ -77,7 +77,7 @@ btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalCo
PhysicsDirectSpaceState::ShapeResult &result = m_results[count];
- result.shape = convexResult.m_localShapeInfo->m_shapePart;
+ result.shape = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
result.rid = gObj->get_self();
result.collider_id = gObj->get_instance_id();
result.collider = 0 == result.collider_id ? NULL : ObjectDB::get_instance(result.collider_id);
@@ -122,7 +122,7 @@ bool GodotClosestConvexResultCallback::needsCollision(btBroadphaseProxy *proxy0)
btScalar GodotClosestConvexResultCallback::addSingleResult(btCollisionWorld::LocalConvexResult &convexResult, bool normalInWorldSpace) {
btScalar res = btCollisionWorld::ClosestConvexResultCallback::addSingleResult(convexResult, normalInWorldSpace);
- m_shapePart = convexResult.m_localShapeInfo->m_shapePart;
+ m_shapeId = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
return res;
}
@@ -242,3 +242,21 @@ btScalar GodotRestInfoContactResultCallback::addSingleResult(btManifoldPoint &cp
return cp.getDistance();
}
+
+void GodotDeepPenetrationContactResultCallback::addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorldOnB, btScalar depth) {
+
+ if (depth < 0) {
+ // Has penetration
+ if (m_most_penetrated_distance > depth) {
+
+ bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject();
+
+ m_most_penetrated_distance = depth;
+ m_pointCollisionObject = (isSwapped ? m_body0Wrap : m_body1Wrap)->getCollisionObject();
+ m_other_compound_shape_index = isSwapped ? m_index1 : m_index0;
+ m_pointNormalWorld = isSwapped ? normalOnBInWorld * -1 : normalOnBInWorld;
+ m_pointWorld = isSwapped ? (pointInWorldOnB + normalOnBInWorld * depth) : pointInWorldOnB;
+ m_penetration_distance = depth;
+ }
+ }
+}
diff --git a/modules/bullet/godot_result_callbacks.h b/modules/bullet/godot_result_callbacks.h
index 68dff5b12a..9d2fb1fce4 100644
--- a/modules/bullet/godot_result_callbacks.h
+++ b/modules/bullet/godot_result_callbacks.h
@@ -50,12 +50,21 @@ struct GodotFilterCallback : public btOverlapFilterCallback {
struct GodotClosestRayResultCallback : public btCollisionWorld::ClosestRayResultCallback {
const Set<RID> *m_exclude;
bool m_pickRay;
+ int m_shapeId;
public:
- GodotClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, const Set<RID> *p_exclude)
- : btCollisionWorld::ClosestRayResultCallback(rayFromWorld, rayToWorld), m_exclude(p_exclude), m_pickRay(false) {}
+ GodotClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, const Set<RID> *p_exclude) :
+ btCollisionWorld::ClosestRayResultCallback(rayFromWorld, rayToWorld),
+ m_exclude(p_exclude),
+ m_pickRay(false),
+ m_shapeId(0) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
+
+ virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult, bool normalInWorldSpace) {
+ m_shapeId = rayResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
+ return btCollisionWorld::ClosestRayResultCallback::addSingleResult(rayResult, normalInWorldSpace);
+ }
};
// store all colliding object
@@ -66,8 +75,11 @@ public:
int count;
const Set<RID> *m_exclude;
- GodotAllConvexResultCallback(PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude)
- : m_results(p_results), m_exclude(p_exclude), m_resultMax(p_resultMax), count(0) {}
+ GodotAllConvexResultCallback(PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) :
+ m_results(p_results),
+ m_exclude(p_exclude),
+ m_resultMax(p_resultMax),
+ count(0) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
@@ -79,8 +91,10 @@ public:
const RigidBodyBullet *m_self_object;
const bool m_ignore_areas;
- GodotKinClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const RigidBodyBullet *p_self_object, bool p_ignore_areas)
- : btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld), m_self_object(p_self_object), m_ignore_areas(p_ignore_areas) {}
+ GodotKinClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const RigidBodyBullet *p_self_object, bool p_ignore_areas) :
+ btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld),
+ m_self_object(p_self_object),
+ m_ignore_areas(p_ignore_areas) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
};
@@ -88,10 +102,11 @@ public:
struct GodotClosestConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback {
public:
const Set<RID> *m_exclude;
- int m_shapePart;
+ int m_shapeId;
- GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude)
- : btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld), m_exclude(p_exclude) {}
+ GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude) :
+ btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld),
+ m_exclude(p_exclude) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
@@ -106,8 +121,12 @@ public:
int m_count;
const Set<RID> *m_exclude;
- GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude)
- : m_self_object(p_self_object), m_results(p_results), m_exclude(p_exclude), m_resultMax(p_resultMax), m_count(0) {}
+ GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) :
+ m_self_object(p_self_object),
+ m_results(p_results),
+ m_exclude(p_exclude),
+ m_resultMax(p_resultMax),
+ m_count(0) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
@@ -123,8 +142,12 @@ public:
int m_count;
const Set<RID> *m_exclude;
- GodotContactPairContactResultCallback(btCollisionObject *p_self_object, Vector3 *p_results, int p_resultMax, const Set<RID> *p_exclude)
- : m_self_object(p_self_object), m_results(p_results), m_exclude(p_exclude), m_resultMax(p_resultMax), m_count(0) {}
+ GodotContactPairContactResultCallback(btCollisionObject *p_self_object, Vector3 *p_results, int p_resultMax, const Set<RID> *p_exclude) :
+ m_self_object(p_self_object),
+ m_results(p_results),
+ m_exclude(p_exclude),
+ m_resultMax(p_resultMax),
+ m_count(0) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
@@ -141,12 +164,43 @@ public:
btVector3 m_rest_info_bt_point;
const Set<RID> *m_exclude;
- GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeRestInfo *p_result, const Set<RID> *p_exclude)
- : m_self_object(p_self_object), m_result(p_result), m_exclude(p_exclude), m_collided(false), m_min_distance(0) {}
+ GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeRestInfo *p_result, const Set<RID> *p_exclude) :
+ m_self_object(p_self_object),
+ m_result(p_result),
+ m_exclude(p_exclude),
+ m_collided(false),
+ m_min_distance(0) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
virtual btScalar addSingleResult(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1);
};
+struct GodotDeepPenetrationContactResultCallback : public btManifoldResult {
+ btVector3 m_pointNormalWorld;
+ btVector3 m_pointWorld;
+ btScalar m_penetration_distance;
+ int m_other_compound_shape_index;
+ const btCollisionObject *m_pointCollisionObject;
+
+ btScalar m_most_penetrated_distance;
+
+ GodotDeepPenetrationContactResultCallback(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap) :
+ btManifoldResult(body0Wrap, body1Wrap),
+ m_pointCollisionObject(NULL),
+ m_penetration_distance(0),
+ m_other_compound_shape_index(0),
+ m_most_penetrated_distance(1e20) {}
+
+ void reset() {
+ m_pointCollisionObject = NULL;
+ m_most_penetrated_distance = 1e20;
+ }
+
+ bool hasHit() {
+ return m_pointCollisionObject;
+ }
+
+ virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth);
+};
#endif // GODOT_RESULT_CALLBACKS_H
diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp
index bb70babd99..ee0d6707d6 100644
--- a/modules/bullet/hinge_joint_bullet.cpp
+++ b/modules/bullet/hinge_joint_bullet.cpp
@@ -35,14 +35,22 @@
#include "bullet_utilities.h"
#include "rigid_body_bullet.h"
-HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB)
- : JointBullet() {
+HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB) :
+ JointBullet() {
+
+ Transform scaled_AFrame(frameA.scaled(rbA->get_body_scale()));
+ scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis);
+
btTransform btFrameA;
- G_TO_B(frameA, btFrameA);
+ G_TO_B(scaled_AFrame, btFrameA);
if (rbB) {
+
+ Transform scaled_BFrame(frameB.scaled(rbB->get_body_scale()));
+ scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis);
+
btTransform btFrameB;
- G_TO_B(frameB, btFrameB);
+ G_TO_B(scaled_BFrame, btFrameB);
hingeConstraint = bulletnew(btHingeConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB));
} else {
@@ -53,19 +61,19 @@ HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, c
setup(hingeConstraint);
}
-HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB)
- : JointBullet() {
+HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB) :
+ JointBullet() {
btVector3 btPivotA;
btVector3 btAxisA;
- G_TO_B(pivotInA, btPivotA);
- G_TO_B(axisInA, btAxisA);
+ G_TO_B(pivotInA * rbA->get_body_scale(), btPivotA);
+ G_TO_B(axisInA * rbA->get_body_scale(), btAxisA);
if (rbB) {
btVector3 btPivotB;
btVector3 btAxisB;
- G_TO_B(pivotInB, btPivotB);
- G_TO_B(axisInB, btAxisB);
+ G_TO_B(pivotInB * rbB->get_body_scale(), btPivotB);
+ G_TO_B(axisInB * rbB->get_body_scale(), btAxisB);
hingeConstraint = bulletnew(btHingeConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btPivotA, btPivotB, btAxisA, btAxisB));
} else {
diff --git a/modules/bullet/joint_bullet.cpp b/modules/bullet/joint_bullet.cpp
index be544f89bf..c8d91aa257 100644
--- a/modules/bullet/joint_bullet.cpp
+++ b/modules/bullet/joint_bullet.cpp
@@ -32,7 +32,7 @@
#include "joint_bullet.h"
#include "space_bullet.h"
-JointBullet::JointBullet()
- : ConstraintBullet() {}
+JointBullet::JointBullet() :
+ ConstraintBullet() {}
JointBullet::~JointBullet() {}
diff --git a/modules/bullet/pin_joint_bullet.cpp b/modules/bullet/pin_joint_bullet.cpp
index cd9e9a4557..665e825967 100644
--- a/modules/bullet/pin_joint_bullet.cpp
+++ b/modules/bullet/pin_joint_bullet.cpp
@@ -34,14 +34,14 @@
#include "bullet_types_converter.h"
#include "rigid_body_bullet.h"
-PinJointBullet::PinJointBullet(RigidBodyBullet *p_body_a, const Vector3 &p_pos_a, RigidBodyBullet *p_body_b, const Vector3 &p_pos_b)
- : JointBullet() {
+PinJointBullet::PinJointBullet(RigidBodyBullet *p_body_a, const Vector3 &p_pos_a, RigidBodyBullet *p_body_b, const Vector3 &p_pos_b) :
+ JointBullet() {
if (p_body_b) {
btVector3 btPivotA;
btVector3 btPivotB;
- G_TO_B(p_pos_a, btPivotA);
- G_TO_B(p_pos_b, btPivotB);
+ G_TO_B(p_pos_a * p_body_a->get_body_scale(), btPivotA);
+ G_TO_B(p_pos_b * p_body_b->get_body_scale(), btPivotB);
p2pConstraint = bulletnew(btPoint2PointConstraint(*p_body_a->get_bt_rigid_body(),
*p_body_b->get_bt_rigid_body(),
btPivotA,
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp
index 98ae82bc5f..669b2c3f0c 100644
--- a/modules/bullet/rigid_body_bullet.cpp
+++ b/modules/bullet/rigid_body_bullet.cpp
@@ -176,9 +176,9 @@ PhysicsDirectSpaceState *BulletPhysicsDirectBodyState::get_space_state() {
return body->get_space()->get_direct_state();
}
-RigidBodyBullet::KinematicUtilities::KinematicUtilities(RigidBodyBullet *p_owner)
- : owner(p_owner),
- safe_margin(0.001) {
+RigidBodyBullet::KinematicUtilities::KinematicUtilities(RigidBodyBullet *p_owner) :
+ owner(p_owner),
+ safe_margin(0.001) {
}
RigidBodyBullet::KinematicUtilities::~KinematicUtilities() {
@@ -198,6 +198,8 @@ void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() {
const CollisionObjectBullet::ShapeWrapper *shape_wrapper;
+ btVector3 owner_body_scale(owner->get_bt_body_scale());
+
for (int i = shapes_count - 1; 0 <= i; --i) {
shape_wrapper = &shapes_wrappers[i];
if (!shape_wrapper->active) {
@@ -210,28 +212,29 @@ void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() {
switch (shape_wrapper->shape->get_type()) {
case PhysicsServer::SHAPE_SPHERE: {
SphereShapeBullet *sphere = static_cast<SphereShapeBullet *>(shape_wrapper->shape);
- kin_shape_ref = ShapeBullet::create_shape_sphere(sphere->get_radius() * owner->body_scale[0] + safe_margin);
+ kin_shape_ref = ShapeBullet::create_shape_sphere(sphere->get_radius() * owner_body_scale[0] + safe_margin);
break;
}
case PhysicsServer::SHAPE_BOX: {
BoxShapeBullet *box = static_cast<BoxShapeBullet *>(shape_wrapper->shape);
- kin_shape_ref = ShapeBullet::create_shape_box((box->get_half_extents() * owner->body_scale) + btVector3(safe_margin, safe_margin, safe_margin));
+ kin_shape_ref = ShapeBullet::create_shape_box((box->get_half_extents() * owner_body_scale) + btVector3(safe_margin, safe_margin, safe_margin));
break;
}
case PhysicsServer::SHAPE_CAPSULE: {
CapsuleShapeBullet *capsule = static_cast<CapsuleShapeBullet *>(shape_wrapper->shape);
- kin_shape_ref = ShapeBullet::create_shape_capsule(capsule->get_radius() * owner->body_scale[0] + safe_margin, capsule->get_height() * owner->body_scale[1] + safe_margin);
+
+ kin_shape_ref = ShapeBullet::create_shape_capsule(capsule->get_radius() * owner_body_scale[0] + safe_margin, capsule->get_height() * owner_body_scale[1] + safe_margin);
break;
}
case PhysicsServer::SHAPE_CONVEX_POLYGON: {
ConvexPolygonShapeBullet *godot_convex = static_cast<ConvexPolygonShapeBullet *>(shape_wrapper->shape);
kin_shape_ref = ShapeBullet::create_shape_convex(godot_convex->vertices);
- kin_shape_ref->setLocalScaling(owner->body_scale + btVector3(safe_margin, safe_margin, safe_margin));
+ kin_shape_ref->setLocalScaling(owner_body_scale + btVector3(safe_margin, safe_margin, safe_margin));
break;
}
case PhysicsServer::SHAPE_RAY: {
RayShapeBullet *godot_ray = static_cast<RayShapeBullet *>(shape_wrapper->shape);
- kin_shape_ref = ShapeBullet::create_shape_ray(godot_ray->length * owner->body_scale[1] + safe_margin);
+ kin_shape_ref = ShapeBullet::create_shape_ray(godot_ray->length * owner_body_scale[1] + safe_margin);
break;
}
default:
@@ -250,22 +253,23 @@ void RigidBodyBullet::KinematicUtilities::just_delete_shapes(int new_size) {
shapes.resize(new_size);
}
-RigidBodyBullet::RigidBodyBullet()
- : RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_RIGID_BODY),
- kinematic_utilities(NULL),
- gravity_scale(1),
- mass(1),
- linearDamp(0),
- angularDamp(0),
- can_sleep(true),
- force_integration_callback(NULL),
- isTransformChanged(false),
- maxCollisionsDetection(0),
- collisionsCount(0),
- maxAreasWhereIam(10),
- areaWhereIamCount(0),
- countGravityPointSpaces(0),
- isScratchedSpaceOverrideModificator(false) {
+RigidBodyBullet::RigidBodyBullet() :
+ RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_RIGID_BODY),
+ kinematic_utilities(NULL),
+ locked_axis(0),
+ gravity_scale(1),
+ mass(1),
+ linearDamp(0),
+ angularDamp(0),
+ can_sleep(true),
+ force_integration_callback(NULL),
+ isTransformChanged(false),
+ maxCollisionsDetection(0),
+ collisionsCount(0),
+ maxAreasWhereIam(10),
+ areaWhereIamCount(0),
+ countGravityPointSpaces(0),
+ isScratchedSpaceOverrideModificator(false) {
godotMotionState = bulletnew(GodotMotionState(this));
@@ -277,7 +281,7 @@ RigidBodyBullet::RigidBodyBullet()
setupBulletCollisionObject(btBody);
set_mode(PhysicsServer::BODY_MODE_RIGID);
- set_axis_lock(PhysicsServer::BODY_AXIS_LOCK_DISABLED);
+ reload_axis_lock();
areasWhereIam.resize(maxAreasWhereIam);
for (int i = areasWhereIam.size() - 1; 0 <= i; --i) {
@@ -498,25 +502,27 @@ void RigidBodyBullet::set_mode(PhysicsServer::BodyMode p_mode) {
switch (p_mode) {
case PhysicsServer::BODY_MODE_KINEMATIC:
mode = PhysicsServer::BODY_MODE_KINEMATIC;
- set_axis_lock(axis_lock); // Reload axis lock
+ reload_axis_lock();
_internal_set_mass(0);
init_kinematic_utilities();
break;
case PhysicsServer::BODY_MODE_STATIC:
mode = PhysicsServer::BODY_MODE_STATIC;
- set_axis_lock(axis_lock); // Reload axis lock
+ reload_axis_lock();
_internal_set_mass(0);
break;
case PhysicsServer::BODY_MODE_RIGID: {
mode = PhysicsServer::BODY_MODE_RIGID;
- set_axis_lock(axis_lock); // Reload axis lock
+ reload_axis_lock();
_internal_set_mass(0 == mass ? 1 : mass);
+ scratch_space_override_modificator();
break;
}
case PhysicsServer::BODY_MODE_CHARACTER: {
mode = PhysicsServer::BODY_MODE_CHARACTER;
- set_axis_lock(axis_lock); // Reload axis lock
+ reload_axis_lock();
_internal_set_mass(0 == mass ? 1 : mass);
+ scratch_space_override_modificator();
break;
}
}
@@ -653,39 +659,28 @@ Vector3 RigidBodyBullet::get_applied_torque() const {
return gTotTorq;
}
-void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxisLock p_lock) {
- axis_lock = p_lock;
-
- if (PhysicsServer::BODY_AXIS_LOCK_DISABLED == axis_lock) {
- btBody->setLinearFactor(btVector3(1., 1., 1.));
- btBody->setAngularFactor(btVector3(1., 1., 1.));
- } else if (PhysicsServer::BODY_AXIS_LOCK_X == axis_lock) {
- btBody->setLinearFactor(btVector3(0., 1., 1.));
- btBody->setAngularFactor(btVector3(1., 0., 0.));
- } else if (PhysicsServer::BODY_AXIS_LOCK_Y == axis_lock) {
- btBody->setLinearFactor(btVector3(1., 0., 1.));
- btBody->setAngularFactor(btVector3(0., 1., 0.));
- } else if (PhysicsServer::BODY_AXIS_LOCK_Z == axis_lock) {
- btBody->setLinearFactor(btVector3(1., 1., 0.));
- btBody->setAngularFactor(btVector3(0., 0., 1.));
+void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock) {
+ if (lock) {
+ locked_axis |= p_axis;
+ } else {
+ locked_axis &= ~p_axis;
}
- if (PhysicsServer::BODY_MODE_CHARACTER == mode) {
- /// When character lock angular
- btBody->setAngularFactor(btVector3(0., 0., 0.));
- }
+ reload_axis_lock();
+}
+
+bool RigidBodyBullet::is_axis_locked(PhysicsServer::BodyAxis p_axis) const {
+ return locked_axis & p_axis;
}
-PhysicsServer::BodyAxisLock RigidBodyBullet::get_axis_lock() const {
- btVector3 vec = btBody->getLinearFactor();
- if (0. == vec.x()) {
- return PhysicsServer::BODY_AXIS_LOCK_X;
- } else if (0. == vec.y()) {
- return PhysicsServer::BODY_AXIS_LOCK_Y;
- } else if (0. == vec.z()) {
- return PhysicsServer::BODY_AXIS_LOCK_Z;
+void RigidBodyBullet::reload_axis_lock() {
+
+ btBody->setLinearFactor(btVector3(!is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_X), !is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_Y), !is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_Z)));
+ if (PhysicsServer::BODY_MODE_CHARACTER == mode) {
+ /// When character angular is always locked
+ btBody->setAngularFactor(btVector3(0., 0., 0.));
} else {
- return PhysicsServer::BODY_AXIS_LOCK_DISABLED;
+ btBody->setAngularFactor(btVector3(!is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_X), !is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_Y), !is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_Z)));
}
}
diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h
index ab3c3e58b2..c0eb148e24 100644
--- a/modules/bullet/rigid_body_bullet.h
+++ b/modules/bullet/rigid_body_bullet.h
@@ -156,8 +156,8 @@ public:
class btConvexShape *shape;
btTransform transform;
- KinematicShape()
- : shape(NULL) {}
+ KinematicShape() :
+ shape(NULL) {}
const bool is_active() const { return shape; }
};
@@ -184,9 +184,9 @@ private:
KinematicUtilities *kinematic_utilities;
PhysicsServer::BodyMode mode;
- PhysicsServer::BodyAxisLock axis_lock;
GodotMotionState *godotMotionState;
btRigidBody *btBody;
+ uint16_t locked_axis;
real_t mass;
real_t gravity_scale;
real_t linearDamp;
@@ -269,8 +269,9 @@ public:
void set_applied_torque(const Vector3 &p_torque);
Vector3 get_applied_torque() const;
- void set_axis_lock(PhysicsServer::BodyAxisLock p_lock);
- PhysicsServer::BodyAxisLock get_axis_lock() const;
+ void set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock);
+ bool is_axis_locked(PhysicsServer::BodyAxis p_axis) const;
+ void reload_axis_lock();
/// Doc:
/// http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Anti_tunneling_by_Motion_Clamping
diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp
index 49150484d9..572a3b4476 100644
--- a/modules/bullet/shape_bullet.cpp
+++ b/modules/bullet/shape_bullet.cpp
@@ -45,6 +45,7 @@ ShapeBullet::~ShapeBullet() {}
btCollisionShape *ShapeBullet::prepare(btCollisionShape *p_btShape) const {
p_btShape->setUserPointer(const_cast<ShapeBullet *>(this));
+ p_btShape->setMargin(0.);
return p_btShape;
}
@@ -129,8 +130,8 @@ btRayShape *ShapeBullet::create_shape_ray(real_t p_length) {
/* PLANE */
-PlaneShapeBullet::PlaneShapeBullet()
- : ShapeBullet() {}
+PlaneShapeBullet::PlaneShapeBullet() :
+ ShapeBullet() {}
void PlaneShapeBullet::set_data(const Variant &p_data) {
setup(p_data);
@@ -157,8 +158,8 @@ btCollisionShape *PlaneShapeBullet::create_bt_shape() {
/* Sphere */
-SphereShapeBullet::SphereShapeBullet()
- : ShapeBullet() {}
+SphereShapeBullet::SphereShapeBullet() :
+ ShapeBullet() {}
void SphereShapeBullet::set_data(const Variant &p_data) {
setup(p_data);
@@ -182,8 +183,8 @@ btCollisionShape *SphereShapeBullet::create_bt_shape() {
}
/* Box */
-BoxShapeBullet::BoxShapeBullet()
- : ShapeBullet() {}
+BoxShapeBullet::BoxShapeBullet() :
+ ShapeBullet() {}
void BoxShapeBullet::set_data(const Variant &p_data) {
setup(p_data);
@@ -210,8 +211,8 @@ btCollisionShape *BoxShapeBullet::create_bt_shape() {
/* Capsule */
-CapsuleShapeBullet::CapsuleShapeBullet()
- : ShapeBullet() {}
+CapsuleShapeBullet::CapsuleShapeBullet() :
+ ShapeBullet() {}
void CapsuleShapeBullet::set_data(const Variant &p_data) {
Dictionary d = p_data;
@@ -243,8 +244,8 @@ btCollisionShape *CapsuleShapeBullet::create_bt_shape() {
/* Convex polygon */
-ConvexPolygonShapeBullet::ConvexPolygonShapeBullet()
- : ShapeBullet() {}
+ConvexPolygonShapeBullet::ConvexPolygonShapeBullet() :
+ ShapeBullet() {}
void ConvexPolygonShapeBullet::set_data(const Variant &p_data) {
setup(p_data);
@@ -285,8 +286,9 @@ btCollisionShape *ConvexPolygonShapeBullet::create_bt_shape() {
/* Concave polygon */
-ConcavePolygonShapeBullet::ConcavePolygonShapeBullet()
- : ShapeBullet(), meshShape(NULL) {}
+ConcavePolygonShapeBullet::ConcavePolygonShapeBullet() :
+ ShapeBullet(),
+ meshShape(NULL) {}
ConcavePolygonShapeBullet::~ConcavePolygonShapeBullet() {
if (meshShape) {
@@ -358,8 +360,8 @@ btCollisionShape *ConcavePolygonShapeBullet::create_bt_shape() {
/* Height map shape */
-HeightMapShapeBullet::HeightMapShapeBullet()
- : ShapeBullet() {}
+HeightMapShapeBullet::HeightMapShapeBullet() :
+ ShapeBullet() {}
void HeightMapShapeBullet::set_data(const Variant &p_data) {
ERR_FAIL_COND(p_data.get_type() != Variant::DICTIONARY);
@@ -410,8 +412,9 @@ btCollisionShape *HeightMapShapeBullet::create_bt_shape() {
}
/* Ray shape */
-RayShapeBullet::RayShapeBullet()
- : ShapeBullet(), length(1) {}
+RayShapeBullet::RayShapeBullet() :
+ ShapeBullet(),
+ length(1) {}
void RayShapeBullet::set_data(const Variant &p_data) {
setup(p_data);
diff --git a/modules/bullet/slider_joint_bullet.cpp b/modules/bullet/slider_joint_bullet.cpp
index 2da65677f5..cfcd0b57f6 100644
--- a/modules/bullet/slider_joint_bullet.cpp
+++ b/modules/bullet/slider_joint_bullet.cpp
@@ -35,13 +35,22 @@
#include "bullet_utilities.h"
#include "rigid_body_bullet.h"
-SliderJointBullet::SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB)
- : JointBullet() {
+SliderJointBullet::SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB) :
+ JointBullet() {
+
+ Transform scaled_AFrame(frameInA.scaled(rbA->get_body_scale()));
+ scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis);
+
btTransform btFrameA;
- G_TO_B(frameInA, btFrameA);
+ G_TO_B(scaled_AFrame, btFrameA);
+
if (rbB) {
+
+ Transform scaled_BFrame(frameInB.scaled(rbB->get_body_scale()));
+ scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis);
+
btTransform btFrameB;
- G_TO_B(frameInB, btFrameB);
+ G_TO_B(scaled_BFrame, btFrameB);
sliderConstraint = bulletnew(btSliderConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB, true));
} else {
diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp
index 64ef7bfad2..ef5c8cac6f 100644
--- a/modules/bullet/soft_body_bullet.cpp
+++ b/modules/bullet/soft_body_bullet.cpp
@@ -36,8 +36,18 @@
#include "scene/3d/immediate_geometry.h"
-SoftBodyBullet::SoftBodyBullet()
- : CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY), mass(1), simulation_precision(5), stiffness(0.5f), pressure_coefficient(50), damping_coefficient(0.005), drag_coefficient(0.005), bt_soft_body(NULL), soft_shape_type(SOFT_SHAPETYPE_NONE), isScratched(false), soft_body_shape_data(NULL) {
+SoftBodyBullet::SoftBodyBullet() :
+ CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY),
+ mass(1),
+ simulation_precision(5),
+ stiffness(0.5f),
+ pressure_coefficient(50),
+ damping_coefficient(0.005),
+ drag_coefficient(0.005),
+ bt_soft_body(NULL),
+ soft_shape_type(SOFT_SHAPETYPE_NONE),
+ isScratched(false),
+ soft_body_shape_data(NULL) {
test_geometry = memnew(ImmediateGeometry);
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index 9df01aee3e..3ce4b294db 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -50,10 +50,11 @@
#include "ustring.h"
#include <assert.h>
-BulletPhysicsDirectSpaceState::BulletPhysicsDirectSpaceState(SpaceBullet *p_space)
- : PhysicsDirectSpaceState(), space(p_space) {}
+BulletPhysicsDirectSpaceState::BulletPhysicsDirectSpaceState(SpaceBullet *p_space) :
+ PhysicsDirectSpaceState(),
+ space(p_space) {}
-int BulletPhysicsDirectSpaceState::intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
+int BulletPhysicsDirectSpaceState::intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask) {
if (p_result_max <= 0)
return 0;
@@ -68,15 +69,15 @@ int BulletPhysicsDirectSpaceState::intersect_point(const Vector3 &p_point, Shape
// Setup query
GodotAllContactResultCallback btResult(&collision_object_point, r_results, p_result_max, &p_exclude);
- btResult.m_collisionFilterGroup = p_collision_layer;
- btResult.m_collisionFilterMask = p_object_type_mask;
+ btResult.m_collisionFilterGroup = 0;
+ btResult.m_collisionFilterMask = p_collision_mask;
space->dynamicsWorld->contactTest(&collision_object_point, btResult);
// The results is already populated by GodotAllConvexResultCallback
return btResult.m_count;
}
-bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask, bool p_pick_ray) {
+bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_pick_ray) {
btVector3 btVec_from;
btVector3 btVec_to;
@@ -86,8 +87,8 @@ bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const V
// setup query
GodotClosestRayResultCallback btResult(btVec_from, btVec_to, &p_exclude);
- btResult.m_collisionFilterGroup = p_collision_layer;
- btResult.m_collisionFilterMask = p_object_type_mask;
+ btResult.m_collisionFilterGroup = 0;
+ btResult.m_collisionFilterMask = p_collision_mask;
btResult.m_pickRay = p_pick_ray;
space->dynamicsWorld->rayTest(btVec_from, btVec_to, btResult);
@@ -96,7 +97,7 @@ bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const V
B_TO_G(btResult.m_hitNormalWorld.normalize(), r_result.normal);
CollisionObjectBullet *gObj = static_cast<CollisionObjectBullet *>(btResult.m_collisionObject->getUserPointer());
if (gObj) {
- r_result.shape = 0;
+ r_result.shape = btResult.m_shapeId;
r_result.rid = gObj->get_self();
r_result.collider_id = gObj->get_instance_id();
r_result.collider = 0 == r_result.collider_id ? NULL : ObjectDB::get_instance(r_result.collider_id);
@@ -109,18 +110,19 @@ bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const V
}
}
-int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Transform &p_xform, float p_margin, ShapeResult *p_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
+int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Transform &p_xform, float p_margin, ShapeResult *p_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask) {
if (p_result_max <= 0)
return 0;
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape);
- btConvexShape *btConvex = dynamic_cast<btConvexShape *>(shape->create_bt_shape());
- if (!btConvex) {
- bulletdelete(btConvex);
+ btCollisionShape *btShape = shape->create_bt_shape();
+ if (!btShape->isConvex()) {
+ bulletdelete(btShape);
ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type()));
return 0;
}
+ btConvexShape *btConvex = static_cast<btConvexShape *>(btShape);
btVector3 scale_with_margin;
G_TO_B(p_xform.basis.get_scale(), scale_with_margin);
@@ -134,8 +136,8 @@ int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Tra
collision_object.setWorldTransform(bt_xform);
GodotAllContactResultCallback btQuery(&collision_object, p_results, p_result_max, &p_exclude);
- btQuery.m_collisionFilterGroup = p_collision_layer;
- btQuery.m_collisionFilterMask = p_object_type_mask;
+ btQuery.m_collisionFilterGroup = 0;
+ btQuery.m_collisionFilterMask = p_collision_mask;
btQuery.m_closestDistanceThreshold = p_margin;
space->dynamicsWorld->contactTest(&collision_object, btQuery);
@@ -144,15 +146,16 @@ int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Tra
return btQuery.m_count;
}
-bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask, ShapeRestInfo *r_info) {
+bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_collision_mask, ShapeRestInfo *r_info) {
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape);
- btConvexShape *bt_convex_shape = dynamic_cast<btConvexShape *>(shape->create_bt_shape());
- if (!bt_convex_shape) {
- bulletdelete(bt_convex_shape);
+ btCollisionShape *btShape = shape->create_bt_shape();
+ if (!btShape->isConvex()) {
+ bulletdelete(btShape);
ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type()));
return 0;
}
+ btConvexShape *bt_convex_shape = static_cast<btConvexShape *>(btShape);
btVector3 bt_motion;
G_TO_B(p_motion, bt_motion);
@@ -168,22 +171,24 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf
bt_xform_to.getOrigin() += bt_motion;
GodotClosestConvexResultCallback btResult(bt_xform_from.getOrigin(), bt_xform_to.getOrigin(), &p_exclude);
- btResult.m_collisionFilterGroup = p_collision_layer;
- btResult.m_collisionFilterMask = p_object_type_mask;
+ btResult.m_collisionFilterGroup = 0;
+ btResult.m_collisionFilterMask = p_collision_mask;
space->dynamicsWorld->convexSweepTest(bt_convex_shape, bt_xform_from, bt_xform_to, btResult, 0.002);
if (btResult.hasHit()) {
- if (btCollisionObject::CO_RIGID_BODY == btResult.m_hitCollisionObject->getInternalType()) {
- B_TO_G(static_cast<const btRigidBody *>(btResult.m_hitCollisionObject)->getVelocityInLocalPoint(btResult.m_hitPointWorld), r_info->linear_velocity);
- }
- CollisionObjectBullet *collision_object = static_cast<CollisionObjectBullet *>(btResult.m_hitCollisionObject->getUserPointer());
p_closest_safe = p_closest_unsafe = btResult.m_closestHitFraction;
- B_TO_G(btResult.m_hitPointWorld, r_info->point);
- B_TO_G(btResult.m_hitNormalWorld, r_info->normal);
- r_info->rid = collision_object->get_self();
- r_info->collider_id = collision_object->get_instance_id();
- r_info->shape = btResult.m_shapePart;
+ if (r_info) {
+ if (btCollisionObject::CO_RIGID_BODY == btResult.m_hitCollisionObject->getInternalType()) {
+ B_TO_G(static_cast<const btRigidBody *>(btResult.m_hitCollisionObject)->getVelocityInLocalPoint(btResult.m_hitPointWorld), r_info->linear_velocity);
+ }
+ CollisionObjectBullet *collision_object = static_cast<CollisionObjectBullet *>(btResult.m_hitCollisionObject->getUserPointer());
+ B_TO_G(btResult.m_hitPointWorld, r_info->point);
+ B_TO_G(btResult.m_hitNormalWorld, r_info->normal);
+ r_info->rid = collision_object->get_self();
+ r_info->collider_id = collision_object->get_instance_id();
+ r_info->shape = btResult.m_shapeId;
+ }
}
bulletdelete(bt_convex_shape);
@@ -191,18 +196,19 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf
}
/// Returns the list of contacts pairs in this order: Local contact, other body contact
-bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform &p_shape_xform, float p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
+bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform &p_shape_xform, float p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude, uint32_t p_collision_mask) {
if (p_result_max <= 0)
return 0;
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape);
- btConvexShape *btConvex = dynamic_cast<btConvexShape *>(shape->create_bt_shape());
- if (!btConvex) {
- bulletdelete(btConvex);
+ btCollisionShape *btShape = shape->create_bt_shape();
+ if (!btShape->isConvex()) {
+ bulletdelete(btShape);
ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type()));
return 0;
}
+ btConvexShape *btConvex = static_cast<btConvexShape *>(btShape);
btVector3 scale_with_margin;
G_TO_B(p_shape_xform.basis.get_scale(), scale_with_margin);
@@ -216,8 +222,8 @@ bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform &
collision_object.setWorldTransform(bt_xform);
GodotContactPairContactResultCallback btQuery(&collision_object, r_results, p_result_max, &p_exclude);
- btQuery.m_collisionFilterGroup = p_collision_layer;
- btQuery.m_collisionFilterMask = p_object_type_mask;
+ btQuery.m_collisionFilterGroup = 0;
+ btQuery.m_collisionFilterMask = p_collision_mask;
btQuery.m_closestDistanceThreshold = p_margin;
space->dynamicsWorld->contactTest(&collision_object, btQuery);
@@ -227,16 +233,17 @@ bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform &
return btQuery.m_count;
}
-bool BulletPhysicsDirectSpaceState::rest_info(RID p_shape, const Transform &p_shape_xform, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
+bool BulletPhysicsDirectSpaceState::rest_info(RID p_shape, const Transform &p_shape_xform, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_collision_mask) {
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape);
- btConvexShape *btConvex = dynamic_cast<btConvexShape *>(shape->create_bt_shape());
- if (!btConvex) {
- bulletdelete(btConvex);
+ btCollisionShape *btShape = shape->create_bt_shape();
+ if (!btShape->isConvex()) {
+ bulletdelete(btShape);
ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type()));
return 0;
}
+ btConvexShape *btConvex = static_cast<btConvexShape *>(btShape);
btVector3 scale_with_margin;
G_TO_B(p_shape_xform.basis.get_scale() + Vector3(p_margin, p_margin, p_margin), scale_with_margin);
@@ -250,8 +257,8 @@ bool BulletPhysicsDirectSpaceState::rest_info(RID p_shape, const Transform &p_sh
collision_object.setWorldTransform(bt_xform);
GodotRestInfoContactResultCallback btQuery(&collision_object, r_info, &p_exclude);
- btQuery.m_collisionFilterGroup = p_collision_layer;
- btQuery.m_collisionFilterMask = p_object_type_mask;
+ btQuery.m_collisionFilterGroup = 0;
+ btQuery.m_collisionFilterMask = p_collision_mask;
btQuery.m_closestDistanceThreshold = p_margin;
space->dynamicsWorld->contactTest(&collision_object, btQuery);
@@ -324,18 +331,18 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_
}
}
-SpaceBullet::SpaceBullet(bool p_create_soft_world)
- : broadphase(NULL),
- dispatcher(NULL),
- solver(NULL),
- collisionConfiguration(NULL),
- dynamicsWorld(NULL),
- soft_body_world_info(NULL),
- ghostPairCallback(NULL),
- godotFilterCallback(NULL),
- gravityDirection(0, -1, 0),
- gravityMagnitude(10),
- contactDebugCount(0) {
+SpaceBullet::SpaceBullet(bool p_create_soft_world) :
+ broadphase(NULL),
+ dispatcher(NULL),
+ solver(NULL),
+ collisionConfiguration(NULL),
+ dynamicsWorld(NULL),
+ soft_body_world_info(NULL),
+ ghostPairCallback(NULL),
+ godotFilterCallback(NULL),
+ gravityDirection(0, -1, 0),
+ gravityMagnitude(10),
+ contactDebugCount(0) {
create_empty_world(p_create_soft_world);
direct_access = memnew(BulletPhysicsDirectSpaceState(this));
@@ -461,6 +468,7 @@ void SpaceBullet::add_rigid_body(RigidBodyBullet *p_body) {
dynamicsWorld->addCollisionObject(p_body->get_bt_rigid_body(), p_body->get_collision_layer(), p_body->get_collision_mask());
} else {
dynamicsWorld->addRigidBody(p_body->get_bt_rigid_body(), p_body->get_collision_layer(), p_body->get_collision_mask());
+ p_body->scratch_space_override_modificator();
}
}
@@ -777,7 +785,8 @@ void SpaceBullet::check_body_collision() {
void SpaceBullet::update_gravity() {
btVector3 btGravity;
G_TO_B(gravityDirection * gravityMagnitude, btGravity);
- dynamicsWorld->setGravity(btGravity);
+ //dynamicsWorld->setGravity(btGravity);
+ dynamicsWorld->setGravity(btVector3(0, 0, 0));
if (soft_body_world_info) {
soft_body_world_info->m_gravity = btGravity;
}
@@ -877,11 +886,11 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
continue;
}
- btConvexShape *convex_shape_test(dynamic_cast<btConvexShape *>(p_body->get_bt_shape(shIndex)));
- if (!convex_shape_test) {
+ if (!p_body->get_bt_shape(shIndex)->isConvex()) {
// Skip no convex shape
continue;
}
+ btConvexShape *convex_shape_test(static_cast<btConvexShape *>(p_body->get_bt_shape(shIndex)));
btTransform shape_world_from;
G_TO_B(p_body->get_shape_transform(shIndex), shape_world_from);
@@ -910,35 +919,35 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
{ /// Phase three - Recover + contact test with margin
- RecoverResult recover_result;
+ RecoverResult r_recover_result;
- hasPenetration = recover_from_penetration(p_body, body_safe_position, recovered_motion, &recover_result);
+ hasPenetration = recover_from_penetration(p_body, body_safe_position, recovered_motion, &r_recover_result);
if (r_result) {
B_TO_G(recovered_motion + recover_initial_position, r_result->motion);
if (hasPenetration) {
- const btRigidBody *btRigid = static_cast<const btRigidBody *>(recover_result.other_collision_object);
+ const btRigidBody *btRigid = static_cast<const btRigidBody *>(r_recover_result.other_collision_object);
CollisionObjectBullet *collisionObject = static_cast<CollisionObjectBullet *>(btRigid->getUserPointer());
r_result->remainder = p_motion - r_result->motion; // is the remaining movements
- B_TO_G(recover_result.pointWorld, r_result->collision_point);
- B_TO_G(recover_result.pointNormalWorld, r_result->collision_normal);
- B_TO_G(btRigid->getVelocityInLocalPoint(recover_result.pointWorld - btRigid->getWorldTransform().getOrigin()), r_result->collider_velocity); // It calculates velocity at point and assign it using special function Bullet_to_Godot
+ B_TO_G(r_recover_result.pointWorld, r_result->collision_point);
+ B_TO_G(r_recover_result.pointNormalWorld, r_result->collision_normal);
+ B_TO_G(btRigid->getVelocityInLocalPoint(r_recover_result.pointWorld - btRigid->getWorldTransform().getOrigin()), r_result->collider_velocity); // It calculates velocity at point and assign it using special function Bullet_to_Godot
r_result->collider = collisionObject->get_self();
r_result->collider_id = collisionObject->get_instance_id();
- r_result->collider_shape = recover_result.other_compound_shape_index;
- r_result->collision_local_shape = recover_result.local_shape_most_recovered;
-
-//{ /// Add manifold point to manage collisions
-// btPersistentManifold* manifold = dynamicsWorld->getDispatcher()->getNewManifold(p_body->getBtBody(), btRigid);
-// btManifoldPoint manifoldPoint(result_callabck.m_pointWorld, result_callabck.m_pointWorld, result_callabck.m_pointNormalWorld, result_callabck.m_penetration_distance);
-// manifoldPoint.m_index0 = r_result->collision_local_shape;
-// manifoldPoint.m_index1 = r_result->collider_shape;
-// manifold->addManifoldPoint(manifoldPoint);
-// p_body->get_kinematic_utilities()->m_generatedManifold.push_back(manifold);
-//}
+ r_result->collider_shape = r_recover_result.other_compound_shape_index;
+ r_result->collision_local_shape = r_recover_result.local_shape_most_recovered;
+
+ //{ /// Add manifold point to manage collisions
+ // btPersistentManifold* manifold = dynamicsWorld->getDispatcher()->getNewManifold(p_body->getBtBody(), btRigid);
+ // btManifoldPoint manifoldPoint(result_callabck.m_pointWorld, result_callabck.m_pointWorld, result_callabck.m_pointNormalWorld, result_callabck.m_penetration_distance);
+ // manifoldPoint.m_index0 = r_result->collision_local_shape;
+ // manifoldPoint.m_index1 = r_result->collider_shape;
+ // manifold->addManifoldPoint(manifoldPoint);
+ // p_body->get_kinematic_utilities()->m_generatedManifold.push_back(manifold);
+ //}
#if debug_test_motion
Vector3 sup_line2;
@@ -971,10 +980,10 @@ public:
Vector<btCollisionObject *> result_collision_objects;
public:
- RecoverPenetrationBroadPhaseCallback(const btCollisionObject *p_self_collision_object, uint32_t p_collision_layer, uint32_t p_collision_mask)
- : self_collision_object(p_self_collision_object),
- collision_layer(p_collision_layer),
- collision_mask(p_collision_mask) {}
+ RecoverPenetrationBroadPhaseCallback(const btCollisionObject *p_self_collision_object, uint32_t p_collision_layer, uint32_t p_collision_mask) :
+ self_collision_object(p_self_collision_object),
+ collision_layer(p_collision_layer),
+ collision_mask(p_collision_mask) {}
virtual ~RecoverPenetrationBroadPhaseCallback() {}
@@ -995,7 +1004,7 @@ public:
}
};
-bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btVector3 &out_recover_position, RecoverResult *recover_result) {
+bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btVector3 &r_recover_position, RecoverResult *r_recover_result) {
RecoverPenetrationBroadPhaseCallback recover_broad_result(p_body->get_bt_collision_object(), p_body->get_collision_layer(), p_body->get_collision_mask());
@@ -1005,9 +1014,6 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
// Broad phase support
btVector3 minAabb, maxAabb;
- // GJK support
- btGjkPairDetector::ClosestPointInput gjk_input;
-
bool penetration = false;
// For each shape
@@ -1022,7 +1028,7 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
body_shape_position = p_body_position * kin_shape.transform;
body_shape_position_recovered = body_shape_position;
- body_shape_position_recovered.getOrigin() += out_recover_position;
+ body_shape_position_recovered.getOrigin() += r_recover_position;
kin_shape.shape->getAabb(body_shape_position_recovered, minAabb, maxAabb);
dynamicsWorld->getBroadphase()->aabbTest(minAabb, maxAabb, recover_broad_result);
@@ -1032,66 +1038,33 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
if (!p_body->get_bt_collision_object()->checkCollideWith(otherObject) || !otherObject->checkCollideWith(p_body->get_bt_collision_object()))
continue;
- if (otherObject->getCollisionShape()->isCompound()) { /// Execute GJK test against all shapes
+ if (otherObject->getCollisionShape()->isCompound()) {
// Each convex shape
btCompoundShape *cs = static_cast<btCompoundShape *>(otherObject->getCollisionShape());
for (int x = cs->getNumChildShapes() - 1; 0 <= x; --x) {
- if (!cs->getChildShape(x)->isConvex())
- continue;
+ if (cs->getChildShape(x)->isConvex()) {
+ if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(cs->getChildShape(x)), otherObject, x, body_shape_position, otherObject->getWorldTransform() * cs->getChildTransform(x), r_recover_position, r_recover_result)) {
- // Initialize GJK input
- gjk_input.m_transformA = body_shape_position;
- gjk_input.m_transformA.getOrigin() += out_recover_position;
- gjk_input.m_transformB = otherObject->getWorldTransform() * cs->getChildTransform(x);
+ penetration = true;
+ }
+ } else {
+ if (RFP_convex_world_test(kin_shape.shape, cs->getChildShape(x), p_body->get_bt_collision_object(), otherObject, kinIndex, x, body_shape_position, otherObject->getWorldTransform() * cs->getChildTransform(x), r_recover_position, r_recover_result)) {
- // Perform GJK test
- btPointCollector result;
- btGjkPairDetector gjk_pair_detector(kin_shape.shape, static_cast<const btConvexShape *>(cs->getChildShape(x)), gjk_simplex_solver, gjk_epa_pen_solver);
- gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
- if (0 > result.m_distance) {
- // Has penetration
- out_recover_position += result.m_normalOnBInWorld * (result.m_distance * -1);
- penetration = true;
-
- if (recover_result) {
-
- recover_result->hasPenetration = true;
- recover_result->other_collision_object = otherObject;
- recover_result->other_compound_shape_index = x;
- recover_result->penetration_distance = result.m_distance;
- recover_result->pointNormalWorld = result.m_normalOnBInWorld;
- recover_result->pointWorld = result.m_pointInWorld;
+ penetration = true;
}
}
}
-
} else if (otherObject->getCollisionShape()->isConvex()) { /// Execute GJK test against object shape
+ if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(otherObject->getCollisionShape()), otherObject, 0, body_shape_position, otherObject->getWorldTransform(), r_recover_position, r_recover_result)) {
- // Initialize GJK input
- gjk_input.m_transformA = body_shape_position;
- gjk_input.m_transformA.getOrigin() += out_recover_position;
- gjk_input.m_transformB = otherObject->getWorldTransform();
-
- // Perform GJK test
- btPointCollector result;
- btGjkPairDetector gjk_pair_detector(kin_shape.shape, static_cast<const btConvexShape *>(otherObject->getCollisionShape()), gjk_simplex_solver, gjk_epa_pen_solver);
- gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
- if (0 > result.m_distance) {
- // Has penetration
- out_recover_position += result.m_normalOnBInWorld * (result.m_distance * -1);
penetration = true;
+ }
+ } else {
+ if (RFP_convex_world_test(kin_shape.shape, otherObject->getCollisionShape(), p_body->get_bt_collision_object(), otherObject, kinIndex, 0, body_shape_position, otherObject->getWorldTransform(), r_recover_position, r_recover_result)) {
- if (recover_result) {
-
- recover_result->hasPenetration = true;
- recover_result->other_collision_object = otherObject;
- recover_result->other_compound_shape_index = 0;
- recover_result->penetration_distance = result.m_distance;
- recover_result->pointNormalWorld = result.m_normalOnBInWorld;
- recover_result->pointWorld = result.m_pointInWorld;
- }
+ penetration = true;
}
}
}
@@ -1099,3 +1072,70 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
return penetration;
}
+
+bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result) {
+
+ // Initialize GJK input
+ btGjkPairDetector::ClosestPointInput gjk_input;
+ gjk_input.m_transformA = p_transformA;
+ gjk_input.m_transformA.getOrigin() += r_recover_position;
+ gjk_input.m_transformB = p_transformB;
+
+ // Perform GJK test
+ btPointCollector result;
+ btGjkPairDetector gjk_pair_detector(p_shapeA, p_shapeB, gjk_simplex_solver, gjk_epa_pen_solver);
+ gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
+ if (0 > result.m_distance) {
+ // Has penetration
+ r_recover_position += result.m_normalOnBInWorld * (result.m_distance * -1);
+
+ if (r_recover_result) {
+
+ r_recover_result->hasPenetration = true;
+ r_recover_result->other_collision_object = p_objectB;
+ r_recover_result->other_compound_shape_index = p_shapeId_B;
+ r_recover_result->penetration_distance = result.m_distance;
+ r_recover_result->pointNormalWorld = result.m_normalOnBInWorld;
+ r_recover_result->pointWorld = result.m_pointInWorld;
+ }
+ return true;
+ }
+ return false;
+}
+
+bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result) {
+
+ /// Contact test
+
+ btTransform p_recovered_transformA(p_transformA);
+ p_recovered_transformA.getOrigin() += r_recover_position;
+
+ btCollisionObjectWrapper obA(NULL, p_shapeA, p_objectA, p_recovered_transformA, -1, p_shapeId_A);
+ btCollisionObjectWrapper obB(NULL, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B);
+
+ btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CLOSEST_POINT_ALGORITHMS);
+ if (algorithm) {
+ GodotDeepPenetrationContactResultCallback contactPointResult(&obA, &obB);
+ //discrete collision detection query
+ algorithm->processCollision(&obA, &obB, dynamicsWorld->getDispatchInfo(), &contactPointResult);
+
+ algorithm->~btCollisionAlgorithm();
+ dispatcher->freeCollisionAlgorithm(algorithm);
+
+ if (contactPointResult.hasHit()) {
+ r_recover_position += contactPointResult.m_pointNormalWorld * (contactPointResult.m_penetration_distance * -1);
+
+ if (r_recover_result) {
+
+ r_recover_result->hasPenetration = true;
+ r_recover_result->other_collision_object = p_objectB;
+ r_recover_result->other_compound_shape_index = p_shapeId_B;
+ r_recover_result->penetration_distance = contactPointResult.m_penetration_distance;
+ r_recover_result->pointNormalWorld = contactPointResult.m_pointNormalWorld;
+ r_recover_result->pointWorld = contactPointResult.m_pointWorld;
+ }
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h
index d9206f8046..e5267c01a9 100644
--- a/modules/bullet/space_bullet.h
+++ b/modules/bullet/space_bullet.h
@@ -69,13 +69,13 @@ private:
public:
BulletPhysicsDirectSpaceState(SpaceBullet *p_space);
- virtual int intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
- virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, bool p_pick_ray = false);
- virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, float p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
- virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, ShapeRestInfo *r_info = NULL);
+ virtual int intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF);
+ virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_pick_ray = false);
+ virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, float p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF);
+ virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, ShapeRestInfo *r_info = NULL);
/// Returns the list of contacts pairs in this order: Local contact, other body contact
- virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, float p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
- virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
+ virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, float p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF);
+ virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF);
virtual Vector3 get_closest_point_to_object_volume(RID p_object, const Vector3 p_point) const;
};
@@ -185,10 +185,16 @@ private:
const btCollisionObject *other_collision_object;
int local_shape_most_recovered;
- RecoverResult()
- : hasPenetration(false) {}
+ RecoverResult() :
+ hasPenetration(false) {}
};
- bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_from, btVector3 &out_recover_position, RecoverResult *recover_result = NULL);
+ bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_from, btVector3 &r_recover_position, RecoverResult *r_recover_result = NULL);
+ /// This is an API that recover a kinematic object from penetration
+ /// This allow only Convex Convex test and it always use GJK algorithm, With this API we don't benefit of Bullet special accelerated functions
+ bool RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result);
+ /// This is an API that recover a kinematic object from penetration
+ /// Using this we leave Bullet to select the best algorithm, For example GJK in case we have Convex Convex, or a Bullet accelerated algorithm
+ bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result);
};
#endif
diff --git a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
index 70ef6aef20..25d17542ea 100644
--- a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
+++ b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core" version="3.0-alpha">
+<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core" version="3.0-beta">
<brief_description>
PacketPeer implementation using the ENet library.
</brief_description>
@@ -71,15 +71,15 @@
</method>
</methods>
<constants>
- <constant name="COMPRESS_NONE" value="0">
+ <constant name="COMPRESS_NONE" value="0" enum="CompressionMode">
</constant>
- <constant name="COMPRESS_RANGE_CODER" value="1">
+ <constant name="COMPRESS_RANGE_CODER" value="1" enum="CompressionMode">
</constant>
- <constant name="COMPRESS_FASTLZ" value="2">
+ <constant name="COMPRESS_FASTLZ" value="2" enum="CompressionMode">
</constant>
- <constant name="COMPRESS_ZLIB" value="3">
+ <constant name="COMPRESS_ZLIB" value="3" enum="CompressionMode">
</constant>
- <constant name="COMPRESS_ZSTD" value="4">
+ <constant name="COMPRESS_ZSTD" value="4" enum="CompressionMode">
</constant>
</constants>
</class>
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index c50886ad3c..396bebf0ea 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -386,7 +386,7 @@ int NetworkedMultiplayerENet::get_available_packet_count() const {
return incoming_packets.size();
}
-Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const {
+Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
ERR_FAIL_COND_V(incoming_packets.size() == 0, ERR_UNAVAILABLE);
@@ -480,7 +480,7 @@ int NetworkedMultiplayerENet::get_max_packet_size() const {
return 1 << 24; //anything is good
}
-void NetworkedMultiplayerENet::_pop_current_packet() const {
+void NetworkedMultiplayerENet::_pop_current_packet() {
if (current_packet.packet) {
enet_packet_destroy(current_packet.packet);
@@ -505,7 +505,7 @@ uint32_t NetworkedMultiplayerENet::_gen_unique_id() const {
hash = hash_djb2_one_32(
(uint32_t)OS::get_singleton()->get_unix_time(), hash);
hash = hash_djb2_one_32(
- (uint32_t)OS::get_singleton()->get_data_dir().hash64(), hash);
+ (uint32_t)OS::get_singleton()->get_user_data_dir().hash64(), hash);
/*
hash = hash_djb2_one_32(
(uint32_t)OS::get_singleton()->get_unique_id().hash64(), hash );
@@ -585,7 +585,7 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer *
if (enet->dst_compressor_mem.size() < req_size) {
enet->dst_compressor_mem.resize(req_size);
}
- int ret = Compression::compress(enet->dst_compressor_mem.ptr(), enet->src_compressor_mem.ptr(), ofs, mode);
+ int ret = Compression::compress(enet->dst_compressor_mem.ptrw(), enet->src_compressor_mem.ptr(), ofs, mode);
if (ret < 0)
return 0;
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index 81d517147d..d7bc5c7849 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -86,12 +86,12 @@ private:
CompressionMode compression_mode;
- mutable List<Packet> incoming_packets;
+ List<Packet> incoming_packets;
- mutable Packet current_packet;
+ Packet current_packet;
uint32_t _gen_unique_id() const;
- void _pop_current_packet() const;
+ void _pop_current_packet();
Vector<uint8_t> src_compressor_mem;
Vector<uint8_t> dst_compressor_mem;
@@ -123,7 +123,7 @@ public:
virtual bool is_server() const;
virtual int get_available_packet_count() const;
- virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const; ///< buffer is GONE after next get_packet
+ virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size); ///< buffer is GONE after next get_packet
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
virtual int get_max_packet_size() const;
diff --git a/modules/etc/SCsub b/modules/etc/SCsub
index 9c3e703f11..31d8f00ef3 100644
--- a/modules/etc/SCsub
+++ b/modules/etc/SCsub
@@ -34,7 +34,8 @@ env_etc.Append(CPPPATH=[thirdparty_dir])
env_etc.add_source_files(env.modules_sources, "*.cpp")
# upstream uses c++11
-env_etc.Append(CCFLAGS="-std=gnu++11")
+if (not env_etc.msvc):
+ env_etc.Append(CCFLAGS="-std=c++11")
# -ffast-math seems to be incompatible with ec2comp on recent versions of
# GCC and Clang
if '-ffast-math' in env_etc['CCFLAGS']:
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
index dc7d23bbd7..941df41694 100644
--- a/modules/etc/image_etc.cpp
+++ b/modules/etc/image_etc.cpp
@@ -129,7 +129,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
PoolVector<uint8_t>::Read r = img->get_data().read();
int target_size = Image::get_image_data_size(imgw, imgh, etc_format, p_img->has_mipmaps() ? -1 : 0);
- int mmc = p_img->has_mipmaps() ? Image::get_image_required_mipmaps(imgw, imgh, etc_format) : 0;
+ int mmc = 1 + (p_img->has_mipmaps() ? Image::get_image_required_mipmaps(imgw, imgh, etc_format) : 0);
PoolVector<uint8_t> dst_data;
dst_data.resize(target_size);
@@ -155,7 +155,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
print_line("begin encoding, format: " + Image::get_format_name(etc_format));
uint64_t t = OS::get_singleton()->get_ticks_msec();
- for (int i = 0; i < mmc + 1; i++) {
+ for (int i = 0; i < mmc; i++) {
// convert source image to internal etc2comp format (which is equivalent to Image::FORMAT_RGBAF)
// NOTE: We can alternatively add a case to Image::convert to handle Image::FORMAT_RGBAF conversion.
int mipmap_ofs = 0, mipmap_size = 0, mipmap_w = 0, mipmap_h = 0;
@@ -163,9 +163,9 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
const uint8_t *src = &r[mipmap_ofs];
Etc::ColorFloatRGBA *src_rgba_f = new Etc::ColorFloatRGBA[mipmap_w * mipmap_h];
- for (int i = 0; i < mipmap_w * mipmap_h; i++) {
- int si = i * 4; // RGBA8
- src_rgba_f[i] = Etc::ColorFloatRGBA::ConvertFromRGBA8(src[si], src[si + 1], src[si + 2], src[si + 3]);
+ for (int j = 0; j < mipmap_w * mipmap_h; j++) {
+ int si = j * 4; // RGBA8
+ src_rgba_f[j] = Etc::ColorFloatRGBA::ConvertFromRGBA8(src[si], src[si + 1], src[si + 2], src[si + 3]);
}
unsigned char *etc_data = NULL;
@@ -173,15 +173,17 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
unsigned int extended_width = 0, extended_height = 0;
Etc::Encode((float *)src_rgba_f, mipmap_w, mipmap_h, etc2comp_etc_format, error_metric, effort, num_cpus, num_cpus, &etc_data, &etc_data_len, &extended_width, &extended_height, &encoding_time);
+ CRASH_COND(wofs + etc_data_len > target_size);
memcpy(&w[wofs], etc_data, etc_data_len);
wofs += etc_data_len;
delete[] etc_data;
delete[] src_rgba_f;
}
+
print_line("time encoding: " + rtos(OS::get_singleton()->get_ticks_msec() - t));
- p_img->create(imgw, imgh, mmc > 1 ? true : false, etc_format, dst_data);
+ p_img->create(imgw, imgh, p_img->has_mipmaps(), etc_format, dst_data);
}
static void _compress_etc1(Image *p_img, float p_lossy_quality) {
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index 19e384af73..f69b632e76 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -68,7 +68,7 @@ if env['builtin_freetype']:
if env['builtin_libpng']:
env.Append(CPPPATH=["#thirdparty/libpng"])
- lib = env.Library("freetype_builtin", thirdparty_sources)
+ lib = env.add_library("freetype_builtin", thirdparty_sources)
# Needs to be appended to arrive after libscene in the linker call,
# but we don't want it to arrive *after* system libs, so manual hack
# LIBS contains first SCons Library objects ("SCons.Node.FS.File object")
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub
index 66b8d5cbdd..fd11c8d094 100644
--- a/modules/gdnative/SCsub
+++ b/modules/gdnative/SCsub
@@ -19,19 +19,27 @@ def _spaced(e):
return e if e[-1] == '*' else e + ' '
def _build_gdnative_api_struct_header(api):
- ext_wrappers = ''
+ gdnative_api_init_macro = [
+ '\textern const godot_gdnative_core_api_struct *_gdnative_wrapper_api_struct;'
+ ]
for name in api['extensions']:
- ext_wrappers += ' extern const godot_gdnative_ext_' + name + '_api_struct *_gdnative_wrapper_' + name + '_api_struct;'
+ gdnative_api_init_macro.append(
+ '\textern const godot_gdnative_ext_{0}_api_struct *_gdnative_wrapper_{0}_api_struct;'.format(name))
- ext_init = 'for (int i = 0; i < _gdnative_wrapper_api_struct->num_extensions; i++) { '
- ext_init += 'switch (_gdnative_wrapper_api_struct->extensions[i]->type) {'
+ gdnative_api_init_macro.append('\t_gdnative_wrapper_api_struct = options->api_struct;')
+ gdnative_api_init_macro.append('\tfor (int i = 0; i < _gdnative_wrapper_api_struct->num_extensions; i++) { ')
+ gdnative_api_init_macro.append('\t\tswitch (_gdnative_wrapper_api_struct->extensions[i]->type) {')
for name in api['extensions']:
- ext_init += 'case GDNATIVE_EXT_' + api['extensions'][name]['type'] + ': '
- ext_init += '_gdnative_wrapper_' + name + '_api_struct = (' + 'godot_gdnative_ext_' + name + '_api_struct *) _gdnative_wrapper_api_struct->extensions[i]; break;'
-
- ext_init += '}'
+ gdnative_api_init_macro.append(
+ '\t\t\tcase GDNATIVE_EXT_%s:' % api['extensions'][name]['type'])
+ gdnative_api_init_macro.append(
+ '\t\t\t\t_gdnative_wrapper_{0}_api_struct = (godot_gdnative_ext_{0}_api_struct *)'
+ ' _gdnative_wrapper_api_struct->extensions[i];'.format(name))
+ gdnative_api_init_macro.append('\t\t\t\tbreak;')
+ gdnative_api_init_macro.append('\t\t}')
+ gdnative_api_init_macro.append('\t}')
out = [
'/* THIS FILE IS GENERATED DO NOT EDIT */',
@@ -43,25 +51,12 @@ def _build_gdnative_api_struct_header(api):
'#include <nativescript/godot_nativescript.h>',
'#include <pluginscript/godot_pluginscript.h>',
'',
- '#define GDNATIVE_API_INIT(options) do { extern const godot_gdnative_api_struct *_gdnative_wrapper_api_struct;' + ext_wrappers + ' _gdnative_wrapper_api_struct = options->api_struct; ' + ext_init + ' } while (0)',
+ '#define GDNATIVE_API_INIT(options) do { \\\n' + ' \\\n'.join(gdnative_api_init_macro) + ' \\\n } while (0)',
'',
'#ifdef __cplusplus',
'extern "C" {',
'#endif',
'',
- 'typedef struct godot_gdnative_api_version {',
- '\tunsigned int major;',
- '\tunsigned int minor;',
- '} godot_gdnative_api_version;',
- '',
- 'typedef struct godot_gdnative_api_struct godot_gdnative_api_struct;',
- '',
- 'struct godot_gdnative_api_struct {',
- '\tunsigned int type;',
- '\tgodot_gdnative_api_version version;',
- '\tconst godot_gdnative_api_struct *next;',
- '};',
- '',
'enum GDNATIVE_API_TYPES {',
'\tGDNATIVE_' + api['core']['type'] + ','
]
@@ -192,7 +187,7 @@ def _build_gdnative_wrapper_code(api):
]
for name in api['extensions']:
- out.append('godot_gdnative_ext_' + name + '_api_struct *_gdnative_wrapper_' + name + '_api_struct;')
+ out.append('godot_gdnative_ext_' + name + '_api_struct *_gdnative_wrapper_' + name + '_api_struct = 0;')
out += ['']
@@ -250,7 +245,7 @@ if ARGUMENTS.get('gdnative_wrapper', False):
gd_wrapper_env = env.Clone()
gd_wrapper_env.Append(CPPPATH=['#modules/gdnative/include/'])
- # I think this doesn't work on MSVC yet...
- gd_wrapper_env.Append(CCFLAGS=['-fPIC'])
+ if not env.msvc:
+ gd_wrapper_env.Append(CCFLAGS=['-fPIC'])
- gd_wrapper_env.Library("#bin/gdnative_wrapper_code", [gensource])
+ lib = gd_wrapper_env.add_library("#bin/gdnative_wrapper_code", [gensource])
diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.cpp b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
index 02f2ee7424..29e4775e62 100644
--- a/modules/gdnative/arvr/arvr_interface_gdnative.cpp
+++ b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
@@ -219,7 +219,7 @@ extern "C" {
void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface) {
Ref<ARVRInterfaceGDNative> new_interface;
new_interface.instance();
- new_interface->set_interface((godot_arvr_interface_gdnative * const)p_interface);
+ new_interface->set_interface((godot_arvr_interface_gdnative *const)p_interface);
ARVRServer::get_singleton()->add_interface(new_interface);
}
@@ -344,7 +344,7 @@ void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_
tracker->set_orientation(transform->basis);
}
if (p_tracks_position) {
- tracker->set_position(transform->origin);
+ tracker->set_rw_position(transform->origin);
}
}
}
diff --git a/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml
index 10957a3394..e4ffa76d36 100644
--- a/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml
+++ b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ARVRInterfaceGDNative" inherits="ARVRInterface" category="Core" version="3.0-alpha">
+<class name="ARVRInterfaceGDNative" inherits="ARVRInterface" category="Core" version="3.0-beta">
<brief_description>
GDNative wrapper for an ARVR interface
</brief_description>
diff --git a/modules/gdnative/doc_classes/GDNative.xml b/modules/gdnative/doc_classes/GDNative.xml
index 7a36d09aec..83953cef49 100644
--- a/modules/gdnative/doc_classes/GDNative.xml
+++ b/modules/gdnative/doc_classes/GDNative.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDNative" inherits="Reference" category="Core" version="3.0-alpha">
+<class name="GDNative" inherits="Reference" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -21,26 +21,12 @@
<description>
</description>
</method>
- <method name="get_library">
- <return type="GDNativeLibrary">
- </return>
- <description>
- </description>
- </method>
<method name="initialize">
<return type="bool">
</return>
<description>
</description>
</method>
- <method name="set_library">
- <return type="void">
- </return>
- <argument index="0" name="library" type="GDNativeLibrary">
- </argument>
- <description>
- </description>
- </method>
<method name="terminate">
<return type="bool">
</return>
diff --git a/modules/gdnative/doc_classes/GDNativeLibrary.xml b/modules/gdnative/doc_classes/GDNativeLibrary.xml
index e271665fd4..647d27929f 100644
--- a/modules/gdnative/doc_classes/GDNativeLibrary.xml
+++ b/modules/gdnative/doc_classes/GDNativeLibrary.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDNativeLibrary" inherits="Resource" category="Core" version="3.0-alpha">
+<class name="GDNativeLibrary" inherits="Resource" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -27,54 +27,6 @@
<description>
</description>
</method>
- <method name="get_symbol_prefix" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="is_current_library_statically_linked" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- </description>
- </method>
- <method name="is_singleton" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- </description>
- </method>
- <method name="set_load_once">
- <return type="void">
- </return>
- <argument index="0" name="load_once" type="bool">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_singleton">
- <return type="void">
- </return>
- <argument index="0" name="singleton" type="bool">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_symbol_prefix">
- <return type="void">
- </return>
- <argument index="0" name="symbol_prefix" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="should_load_once" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="load_once" type="bool" setter="set_load_once" getter="should_load_once">
diff --git a/modules/gdnative/doc_classes/NativeScript.xml b/modules/gdnative/doc_classes/NativeScript.xml
index eb4e13f748..3f6025d02f 100644
--- a/modules/gdnative/doc_classes/NativeScript.xml
+++ b/modules/gdnative/doc_classes/NativeScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NativeScript" inherits="Script" category="Core" version="3.0-alpha">
+<class name="NativeScript" inherits="Script" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -9,40 +9,12 @@
<demos>
</demos>
<methods>
- <method name="get_class_name" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_library" qualifiers="const">
- <return type="GDNativeLibrary">
- </return>
- <description>
- </description>
- </method>
<method name="new" qualifiers="vararg">
<return type="Object">
</return>
<description>
</description>
</method>
- <method name="set_class_name">
- <return type="void">
- </return>
- <argument index="0" name="class_name" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_library">
- <return type="void">
- </return>
- <argument index="0" name="library" type="GDNativeLibrary">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="class_name" type="String" setter="set_class_name" getter="get_class_name">
diff --git a/modules/gdnative/doc_classes/PluginScript.xml b/modules/gdnative/doc_classes/PluginScript.xml
index a5ab422d3c..1a2141247a 100644
--- a/modules/gdnative/doc_classes/PluginScript.xml
+++ b/modules/gdnative/doc_classes/PluginScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PluginScript" inherits="Script" category="Core" version="3.0-alpha">
+<class name="PluginScript" inherits="Script" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 44d6dffc85..9c0041cbe0 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -64,7 +64,6 @@ void GDNativeLibrary::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_current_library_path"), &GDNativeLibrary::get_current_library_path);
ClassDB::bind_method(D_METHOD("get_current_dependencies"), &GDNativeLibrary::get_current_dependencies);
- ClassDB::bind_method(D_METHOD("is_current_library_statically_linked"), &GDNativeLibrary::is_current_library_statically_linked);
ClassDB::bind_method(D_METHOD("should_load_once"), &GDNativeLibrary::should_load_once);
ClassDB::bind_method(D_METHOD("is_singleton"), &GDNativeLibrary::is_singleton);
@@ -109,6 +108,9 @@ Ref<GDNativeLibrary> GDNative::get_library() {
return library;
}
+extern "C" void _gdnative_report_version_mismatch(const godot_object *p_library, const char *p_ext, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have);
+extern "C" void _gdnative_report_loading_error(const godot_object *p_library, const char *p_what);
+
bool GDNative::initialize() {
if (library.is_null()) {
ERR_PRINT("No library set, can't initialize GDNative object");
@@ -116,12 +118,18 @@ bool GDNative::initialize() {
}
String lib_path = library->get_current_library_path();
- if (lib_path.empty() && !library->is_current_library_statically_linked()) {
+ if (lib_path.empty()) {
ERR_PRINT("No library set for this platform");
return false;
}
#ifdef IPHONE_ENABLED
- String path = lib_path.replace("res://", "dylibs/");
+ // on iOS we use static linking
+ String path = "";
+#elif defined(ANDROID_ENABLED)
+ // On Android dynamic libraries are located separately from resource assets,
+ // we should pass library name to dlopen(). The library name is flattened
+ // during export.
+ String path = lib_path.get_file();
#else
String path = ProjectSettings::get_singleton()->globalize_path(lib_path);
#endif
@@ -136,8 +144,8 @@ bool GDNative::initialize() {
}
}
- Error err = OS::get_singleton()->open_dynamic_library(path, native_handle);
- if (err != OK && !library->is_current_library_statically_linked()) {
+ Error err = OS::get_singleton()->open_dynamic_library(path, native_handle, true);
+ if (err != OK) {
return false;
}
@@ -146,13 +154,12 @@ bool GDNative::initialize() {
// we cheat here a little bit. you saw nothing
initialized = true;
- err = get_symbol(library->get_symbol_prefix() + init_symbol, library_init);
+ err = get_symbol(library->get_symbol_prefix() + init_symbol, library_init, false);
initialized = false;
if (err || !library_init) {
- if (!library->is_current_library_statically_linked())
- OS::get_singleton()->close_dynamic_library(native_handle);
+ OS::get_singleton()->close_dynamic_library(native_handle);
native_handle = NULL;
ERR_PRINT("Failed to obtain godot_gdnative_init symbol");
return false;
@@ -168,6 +175,8 @@ bool GDNative::initialize() {
options.core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE);
options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);
options.no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE);
+ options.report_version_mismatch = &_gdnative_report_version_mismatch;
+ options.report_loading_error = &_gdnative_report_loading_error;
options.gd_native_library = (godot_object *)(get_library().ptr());
options.active_library_path = (godot_string *)&path;
@@ -277,7 +286,7 @@ Variant GDNative::call_native(StringName p_native_call_type, StringName p_proced
return *(Variant *)&result;
}
-Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle) {
+Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle, bool p_optional) {
if (!initialized) {
ERR_PRINT("No valid library handle, can't get symbol from GDNative object");
@@ -288,7 +297,7 @@ Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle) {
native_handle,
p_procedure_name,
r_handle,
- true);
+ p_optional);
return result;
}
@@ -369,40 +378,8 @@ RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_or
}
}
- bool is_statically_linked = false;
- {
-
- List<String> static_linking_keys;
- config->get_section_keys("static_linking", &static_linking_keys);
-
- for (List<String>::Element *E = static_linking_keys.front(); E; E = E->next()) {
- String key = E->get();
-
- Vector<String> tags = key.split(".");
-
- bool skip = false;
-
- for (int i = 0; i < tags.size(); i++) {
- bool has_feature = OS::get_singleton()->has_feature(tags[i]);
-
- if (!has_feature) {
- skip = true;
- break;
- }
- }
-
- if (skip) {
- continue;
- }
-
- is_statically_linked = config->get_value("static_linking", key);
- break;
- }
- }
-
lib->current_library_path = entry_lib_path;
lib->current_dependencies = dependency_paths;
- lib->current_library_statically_linked = is_statically_linked;
return lib;
}
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index 061dff9267..993cd0ece7 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -55,7 +55,6 @@ class GDNativeLibrary : public Resource {
String current_library_path;
Vector<String> current_dependencies;
- bool current_library_statically_linked;
bool singleton;
bool load_once;
@@ -75,9 +74,6 @@ public:
_FORCE_INLINE_ Vector<String> get_current_dependencies() const {
return current_dependencies;
}
- _FORCE_INLINE_ bool is_current_library_statically_linked() const {
- return current_library_statically_linked;
- }
// things that are a property of the library itself, not platform specific
_FORCE_INLINE_ bool should_load_once() const {
@@ -103,17 +99,15 @@ public:
static void _bind_methods();
};
-typedef godot_variant (*native_call_cb)(void *, godot_array *);
-
struct GDNativeCallRegistry {
static GDNativeCallRegistry *singleton;
- inline GDNativeCallRegistry *get_singleton() {
+ inline static GDNativeCallRegistry *get_singleton() {
return singleton;
}
- inline GDNativeCallRegistry()
- : native_calls() {}
+ inline GDNativeCallRegistry() :
+ native_calls() {}
Map<StringName, native_call_cb> native_calls;
@@ -147,7 +141,7 @@ public:
Variant call_native(StringName p_native_call_type, StringName p_procedure_name, Array p_arguments = Array());
- Error get_symbol(StringName p_procedure_name, void *&r_handle);
+ Error get_symbol(StringName p_procedure_name, void *&r_handle, bool p_optional = true);
};
class GDNativeLibraryResourceLoader : public ResourceFormatLoader {
diff --git a/modules/gdnative/gdnative/aabb.cpp b/modules/gdnative/gdnative/aabb.cpp
new file mode 100644
index 0000000000..6c89bcdceb
--- /dev/null
+++ b/modules/gdnative/gdnative/aabb.cpp
@@ -0,0 +1,217 @@
+/*************************************************************************/
+/* aabb.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "gdnative/aabb.h"
+
+#include "core/math/aabb.h"
+#include "core/variant.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
+ const Vector3 *pos = (const Vector3 *)p_pos;
+ const Vector3 *size = (const Vector3 *)p_size;
+ AABB *dest = (AABB *)r_dest;
+ *dest = AABB(*pos, *size);
+}
+
+godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self) {
+ godot_vector3 raw_ret;
+ const AABB *self = (const AABB *)p_self;
+ Vector3 *ret = (Vector3 *)&raw_ret;
+ *ret = self->position;
+ return raw_ret;
+}
+
+void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v) {
+ AABB *self = (AABB *)p_self;
+ const Vector3 *v = (const Vector3 *)p_v;
+ self->position = *v;
+}
+
+godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self) {
+ godot_vector3 raw_ret;
+ const AABB *self = (const AABB *)p_self;
+ Vector3 *ret = (Vector3 *)&raw_ret;
+ *ret = self->size;
+ return raw_ret;
+}
+
+void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v) {
+ AABB *self = (AABB *)p_self;
+ const Vector3 *v = (const Vector3 *)p_v;
+ self->size = *v;
+}
+
+godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self) {
+ godot_string ret;
+ const AABB *self = (const AABB *)p_self;
+ memnew_placement(&ret, String(*self));
+ return ret;
+}
+
+godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->get_area();
+}
+
+godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->has_no_area();
+}
+
+godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->has_no_surface();
+}
+
+godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with) {
+ const AABB *self = (const AABB *)p_self;
+ const AABB *with = (const AABB *)p_with;
+ return self->intersects(*with);
+}
+
+godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with) {
+ const AABB *self = (const AABB *)p_self;
+ const AABB *with = (const AABB *)p_with;
+ return self->encloses(*with);
+}
+
+godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with) {
+ godot_aabb dest;
+ const AABB *self = (const AABB *)p_self;
+ const AABB *with = (const AABB *)p_with;
+ *((AABB *)&dest) = self->merge(*with);
+ return dest;
+}
+
+godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with) {
+ godot_aabb dest;
+ const AABB *self = (const AABB *)p_self;
+ const AABB *with = (const AABB *)p_with;
+ *((AABB *)&dest) = self->intersection(*with);
+ return dest;
+}
+
+godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane) {
+ const AABB *self = (const AABB *)p_self;
+ const Plane *plane = (const Plane *)p_plane;
+ return self->intersects_plane(*plane);
+}
+
+godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) {
+ const AABB *self = (const AABB *)p_self;
+ const Vector3 *from = (const Vector3 *)p_from;
+ const Vector3 *to = (const Vector3 *)p_to;
+ return self->intersects_segment(*from, *to);
+}
+
+godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point) {
+ const AABB *self = (const AABB *)p_self;
+ const Vector3 *point = (const Vector3 *)p_point;
+ return self->has_point(*point);
+}
+
+godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir) {
+ godot_vector3 dest;
+ const AABB *self = (const AABB *)p_self;
+ const Vector3 *dir = (const Vector3 *)p_dir;
+ *((Vector3 *)&dest) = self->get_support(*dir);
+ return dest;
+}
+
+godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self) {
+ godot_vector3 dest;
+ const AABB *self = (const AABB *)p_self;
+ *((Vector3 *)&dest) = self->get_longest_axis();
+ return dest;
+}
+
+godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->get_longest_axis_index();
+}
+
+godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->get_longest_axis_size();
+}
+
+godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self) {
+ godot_vector3 dest;
+ const AABB *self = (const AABB *)p_self;
+ *((Vector3 *)&dest) = self->get_shortest_axis();
+ return dest;
+}
+
+godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->get_shortest_axis_index();
+}
+
+godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->get_shortest_axis_size();
+}
+
+godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point) {
+ godot_aabb dest;
+ const AABB *self = (const AABB *)p_self;
+ const Vector3 *to_point = (const Vector3 *)p_to_point;
+ *((AABB *)&dest) = self->expand(*to_point);
+ return dest;
+}
+
+godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by) {
+ godot_aabb dest;
+ const AABB *self = (const AABB *)p_self;
+
+ *((AABB *)&dest) = self->grow(p_by);
+ return dest;
+}
+
+godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx) {
+ godot_vector3 dest;
+ const AABB *self = (const AABB *)p_self;
+
+ *((Vector3 *)&dest) = self->get_endpoint(p_idx);
+ return dest;
+}
+
+godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b) {
+ const AABB *self = (const AABB *)p_self;
+ const AABB *b = (const AABB *)p_b;
+ return *self == *b;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp
index e0d9514985..8351c43574 100644
--- a/modules/gdnative/gdnative/array.cpp
+++ b/modules/gdnative/gdnative/array.cpp
@@ -302,6 +302,17 @@ void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, con
self->sort_custom((Object *)p_obj, *func);
}
+godot_int GDAPI godot_array_bsearch(godot_array *p_self, const godot_variant *p_value, const godot_bool p_before) {
+ Array *self = (Array *)p_self;
+ return self->bsearch((const Variant *)p_value, p_before);
+}
+
+godot_int GDAPI godot_array_bsearch_custom(godot_array *p_self, const godot_variant *p_value, godot_object *p_obj, const godot_string *p_func, const godot_bool p_before) {
+ Array *self = (Array *)p_self;
+ const String *func = (const String *)p_func;
+ return self->bsearch_custom((const Variant *)p_value, (Object *)p_obj, *func, p_before);
+}
+
void GDAPI godot_array_destroy(godot_array *p_self) {
((Array *)p_self)->~Array();
}
diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp
index 39ca754dc7..7a65996036 100644
--- a/modules/gdnative/gdnative/basis.cpp
+++ b/modules/gdnative/gdnative/basis.cpp
@@ -221,7 +221,7 @@ godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godo
return raw_dest;
}
-godot_basis GDAPI godot_basis_operator_substract(const godot_basis *p_self, const godot_basis *p_b) {
+godot_basis GDAPI godot_basis_operator_subtract(const godot_basis *p_self, const godot_basis *p_b) {
godot_basis raw_dest;
Basis *dest = (Basis *)&raw_dest;
const Basis *self = (const Basis *)p_self;
diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp
index 6dfa7ec20b..8ff67b10b1 100644
--- a/modules/gdnative/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative/gdnative.cpp
@@ -36,6 +36,8 @@
#include "os/os.h"
#include "variant.h"
+#include "modules/gdnative/gdnative.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -50,10 +52,6 @@ godot_object GDAPI *godot_global_get_singleton(char *p_name) {
return (godot_object *)Engine::get_singleton()->get_singleton_object(String(p_name));
} // result shouldn't be freed
-void GDAPI *godot_get_stack_bottom() {
- return OS::get_singleton()->get_stack_bottom();
-}
-
// MethodBind API
godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname) {
@@ -113,6 +111,10 @@ godot_dictionary GDAPI godot_get_global_constants() {
}
// System functions
+void GDAPI godot_register_native_call_type(const char *p_call_type, native_call_cb p_callback) {
+ GDNativeCallRegistry::get_singleton()->register_native_call_type(StringName(p_call_type), p_callback);
+}
+
void GDAPI *godot_alloc(int p_bytes) {
return memalloc(p_bytes);
}
@@ -137,6 +139,32 @@ void GDAPI godot_print(const godot_string *p_message) {
print_line(*(String *)p_message);
}
+void _gdnative_report_version_mismatch(const godot_object *p_library, const char *p_ext, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have) {
+ String message = "Error loading GDNative file ";
+ GDNativeLibrary *library = (GDNativeLibrary *)p_library;
+
+ message += library->get_current_library_path() + ": Extension \"" + p_ext + "\" can't be loaded.\n";
+
+ Dictionary versions;
+ versions["have_major"] = p_have.major;
+ versions["have_minor"] = p_have.minor;
+ versions["want_major"] = p_want.major;
+ versions["want_minor"] = p_want.minor;
+
+ message += String("Got version {have_major}.{have_minor} but needs {want_major}.{want_minor}!").format(versions);
+
+ _err_print_error("gdnative_init", library->get_current_library_path().utf8().ptr(), 0, message.utf8().ptr());
+}
+
+void _gdnative_report_loading_error(const godot_object *p_library, const char *p_what) {
+ String message = "Error loading GDNative file ";
+ GDNativeLibrary *library = (GDNativeLibrary *)p_library;
+
+ message += library->get_current_library_path() + ": " + p_what;
+
+ _err_print_error("gdnative_init", library->get_current_library_path().utf8().ptr(), 0, message.utf8().ptr());
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/modules/gdnative/gdnative/node_path.cpp b/modules/gdnative/gdnative/node_path.cpp
index 2bd278e050..8dfe151f91 100644
--- a/modules/gdnative/gdnative/node_path.cpp
+++ b/modules/gdnative/gdnative/node_path.cpp
@@ -91,10 +91,10 @@ godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_self, co
return dest;
}
-godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_self) {
+godot_string GDAPI godot_node_path_get_concatenated_subnames(const godot_node_path *p_self) {
godot_string dest;
const NodePath *self = (const NodePath *)p_self;
- memnew_placement(&dest, String(self->get_property()));
+ memnew_placement(&dest, String(self->get_concatenated_subnames()));
return dest;
}
diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quat.cpp
index 2d012c069f..c308e5973d 100644
--- a/modules/gdnative/gdnative/quat.cpp
+++ b/modules/gdnative/gdnative/quat.cpp
@@ -181,7 +181,7 @@ godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_q
return raw_dest;
}
-godot_quat GDAPI godot_quat_operator_substract(const godot_quat *p_self, const godot_quat *p_b) {
+godot_quat GDAPI godot_quat_operator_subtract(const godot_quat *p_self, const godot_quat *p_b) {
godot_quat raw_dest;
Quat *dest = (Quat *)&raw_dest;
const Quat *self = (const Quat *)p_self;
diff --git a/modules/gdnative/gdnative/rect3.cpp b/modules/gdnative/gdnative/rect3.cpp
deleted file mode 100644
index 8e088743b4..0000000000
--- a/modules/gdnative/gdnative/rect3.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-/*************************************************************************/
-/* rect3.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#include "gdnative/rect3.h"
-
-#include "core/math/rect3.h"
-#include "core/variant.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
- const Vector3 *pos = (const Vector3 *)p_pos;
- const Vector3 *size = (const Vector3 *)p_size;
- Rect3 *dest = (Rect3 *)r_dest;
- *dest = Rect3(*pos, *size);
-}
-
-godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self) {
- godot_vector3 raw_ret;
- const Rect3 *self = (const Rect3 *)p_self;
- Vector3 *ret = (Vector3 *)&raw_ret;
- *ret = self->position;
- return raw_ret;
-}
-
-void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v) {
- Rect3 *self = (Rect3 *)p_self;
- const Vector3 *v = (const Vector3 *)p_v;
- self->position = *v;
-}
-
-godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self) {
- godot_vector3 raw_ret;
- const Rect3 *self = (const Rect3 *)p_self;
- Vector3 *ret = (Vector3 *)&raw_ret;
- *ret = self->size;
- return raw_ret;
-}
-
-void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v) {
- Rect3 *self = (Rect3 *)p_self;
- const Vector3 *v = (const Vector3 *)p_v;
- self->size = *v;
-}
-
-godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self) {
- godot_string ret;
- const Rect3 *self = (const Rect3 *)p_self;
- memnew_placement(&ret, String(*self));
- return ret;
-}
-
-godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->get_area();
-}
-
-godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->has_no_area();
-}
-
-godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->has_no_surface();
-}
-
-godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Rect3 *with = (const Rect3 *)p_with;
- return self->intersects(*with);
-}
-
-godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Rect3 *with = (const Rect3 *)p_with;
- return self->encloses(*with);
-}
-
-godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with) {
- godot_rect3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- const Rect3 *with = (const Rect3 *)p_with;
- *((Rect3 *)&dest) = self->merge(*with);
- return dest;
-}
-
-godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with) {
- godot_rect3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- const Rect3 *with = (const Rect3 *)p_with;
- *((Rect3 *)&dest) = self->intersection(*with);
- return dest;
-}
-
-godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Plane *plane = (const Plane *)p_plane;
- return self->intersects_plane(*plane);
-}
-
-godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Vector3 *from = (const Vector3 *)p_from;
- const Vector3 *to = (const Vector3 *)p_to;
- return self->intersects_segment(*from, *to);
-}
-
-godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Vector3 *point = (const Vector3 *)p_point;
- return self->has_point(*point);
-}
-
-godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir) {
- godot_vector3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- const Vector3 *dir = (const Vector3 *)p_dir;
- *((Vector3 *)&dest) = self->get_support(*dir);
- return dest;
-}
-
-godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self) {
- godot_vector3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- *((Vector3 *)&dest) = self->get_longest_axis();
- return dest;
-}
-
-godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->get_longest_axis_index();
-}
-
-godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->get_longest_axis_size();
-}
-
-godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self) {
- godot_vector3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- *((Vector3 *)&dest) = self->get_shortest_axis();
- return dest;
-}
-
-godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->get_shortest_axis_index();
-}
-
-godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->get_shortest_axis_size();
-}
-
-godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point) {
- godot_rect3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- const Vector3 *to_point = (const Vector3 *)p_to_point;
- *((Rect3 *)&dest) = self->expand(*to_point);
- return dest;
-}
-
-godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by) {
- godot_rect3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
-
- *((Rect3 *)&dest) = self->grow(p_by);
- return dest;
-}
-
-godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx) {
- godot_vector3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
-
- *((Vector3 *)&dest) = self->get_endpoint(p_idx);
- return dest;
-}
-
-godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Rect3 *b = (const Rect3 *)p_b;
- return *self == *b;
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp
index 781b8754bd..67a037736c 100644
--- a/modules/gdnative/gdnative/string.cpp
+++ b/modules/gdnative/gdnative/string.cpp
@@ -89,11 +89,6 @@ wchar_t GDAPI godot_string_operator_index_const(const godot_string *p_self, cons
return self->operator[](p_idx);
}
-const char GDAPI *godot_string_c_str(const godot_string *p_self) {
- const String *self = (const String *)p_self;
- return self->utf8().get_data();
-}
-
const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self) {
const String *self = (const String *)p_self;
return self->c_str();
diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp
index 96b2ec8a7a..b07fcffcb6 100644
--- a/modules/gdnative/gdnative/transform.cpp
+++ b/modules/gdnative/gdnative/transform.cpp
@@ -198,20 +198,20 @@ godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_s
return raw_dest;
}
-godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v) {
- godot_rect3 raw_dest;
- Rect3 *dest = (Rect3 *)&raw_dest;
+godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v) {
+ godot_aabb raw_dest;
+ AABB *dest = (AABB *)&raw_dest;
const Transform *self = (const Transform *)p_self;
- const Rect3 *v = (const Rect3 *)p_v;
+ const AABB *v = (const AABB *)p_v;
*dest = self->xform(*v);
return raw_dest;
}
-godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v) {
- godot_rect3 raw_dest;
- Rect3 *dest = (Rect3 *)&raw_dest;
+godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v) {
+ godot_aabb raw_dest;
+ AABB *dest = (AABB *)&raw_dest;
const Transform *self = (const Transform *)p_self;
- const Rect3 *v = (const Rect3 *)p_v;
+ const AABB *v = (const AABB *)p_v;
*dest = self->xform_inv(*v);
return raw_dest;
}
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index 0c31bc643c..6483d19d74 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -118,10 +118,10 @@ void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_qua
memnew_placement_custom(dest, Variant, Variant(*quat));
}
-void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3) {
+void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb) {
Variant *dest = (Variant *)r_dest;
- Rect3 *rect3 = (Rect3 *)p_rect3;
- memnew_placement_custom(dest, Variant, Variant(*rect3));
+ AABB *aabb = (AABB *)p_aabb;
+ memnew_placement_custom(dest, Variant, Variant(*aabb));
}
void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis) {
@@ -304,10 +304,10 @@ godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self) {
return raw_dest;
}
-godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self) {
- godot_rect3 raw_dest;
+godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self) {
+ godot_aabb raw_dest;
const Variant *self = (const Variant *)p_self;
- Rect3 *dest = (Rect3 *)&raw_dest;
+ AABB *dest = (AABB *)&raw_dest;
*dest = *self;
return raw_dest;
}
diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp
index 7a5b29e0c4..7be08929b1 100644
--- a/modules/gdnative/gdnative/vector2.cpp
+++ b/modules/gdnative/gdnative/vector2.cpp
@@ -207,7 +207,7 @@ godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, cons
return raw_dest;
}
-godot_vector2 GDAPI godot_vector2_operator_substract(const godot_vector2 *p_self, const godot_vector2 *p_b) {
+godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_self, const godot_vector2 *p_b) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Vector2 *self = (const Vector2 *)p_self;
diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp
index 11ffb3320b..0027d236f2 100644
--- a/modules/gdnative/gdnative/vector3.cpp
+++ b/modules/gdnative/gdnative/vector3.cpp
@@ -224,7 +224,7 @@ godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, cons
return raw_dest;
}
-godot_vector3 GDAPI godot_vector3_operator_substract(const godot_vector3 *p_self, const godot_vector3 *p_b) {
+godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_self, const godot_vector3 *p_b) {
godot_vector3 raw_dest;
Vector3 *dest = (Vector3 *)&raw_dest;
Vector3 *self = (Vector3 *)p_self;
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index 770fb429c7..06c6e9f410 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -387,7 +387,7 @@
]
},
{
- "name": "godot_vector2_operator_substract",
+ "name": "godot_vector2_operator_subtract",
"return_type": "godot_vector2",
"arguments": [
["const godot_vector2 *", "p_self"],
@@ -663,7 +663,7 @@
]
},
{
- "name": "godot_quat_operator_substract",
+ "name": "godot_quat_operator_subtract",
"return_type": "godot_quat",
"arguments": [
["const godot_quat *", "p_self"],
@@ -907,7 +907,7 @@
]
},
{
- "name": "godot_basis_operator_substract",
+ "name": "godot_basis_operator_subtract",
"return_type": "godot_basis",
"arguments": [
["const godot_basis *", "p_self"],
@@ -1142,7 +1142,7 @@
]
},
{
- "name": "godot_vector3_operator_substract",
+ "name": "godot_vector3_operator_subtract",
"return_type": "godot_vector3",
"arguments": [
["const godot_vector3 *", "p_self"],
@@ -2680,6 +2680,26 @@
]
},
{
+ "name": "godot_array_bsearch",
+ "return_type": "godot_int",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_variant *", "p_value"],
+ ["const godot_bool", "p_before"]
+ ]
+ },
+ {
+ "name": "godot_array_bsearch_custom",
+ "return_type": "godot_int",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_variant *", "p_value"],
+ ["godot_object *", "p_obj"],
+ ["const godot_string *", "p_func"],
+ ["const godot_bool", "p_before"]
+ ]
+ },
+ {
"name": "godot_array_destroy",
"return_type": "void",
"arguments": [
@@ -2898,7 +2918,7 @@
]
},
{
- "name": "godot_node_path_get_property",
+ "name": "godot_node_path_get_concatenated_subnames",
"return_type": "godot_string",
"arguments": [
["const godot_node_path *", "p_self"]
@@ -3221,209 +3241,209 @@
]
},
{
- "name": "godot_rect3_new",
+ "name": "godot_aabb_new",
"return_type": "void",
"arguments": [
- ["godot_rect3 *", "r_dest"],
+ ["godot_aabb *", "r_dest"],
["const godot_vector3 *", "p_pos"],
["const godot_vector3 *", "p_size"]
]
},
{
- "name": "godot_rect3_get_position",
+ "name": "godot_aabb_get_position",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_set_position",
+ "name": "godot_aabb_set_position",
"return_type": "void",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_v"]
]
},
{
- "name": "godot_rect3_get_size",
+ "name": "godot_aabb_get_size",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_set_size",
+ "name": "godot_aabb_set_size",
"return_type": "void",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_v"]
]
},
{
- "name": "godot_rect3_as_string",
+ "name": "godot_aabb_as_string",
"return_type": "godot_string",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_area",
+ "name": "godot_aabb_get_area",
"return_type": "godot_real",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_has_no_area",
+ "name": "godot_aabb_has_no_area",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_has_no_surface",
+ "name": "godot_aabb_has_no_surface",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_intersects",
+ "name": "godot_aabb_intersects",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
- ["const godot_rect3 *", "p_with"]
+ ["const godot_aabb *", "p_self"],
+ ["const godot_aabb *", "p_with"]
]
},
{
- "name": "godot_rect3_encloses",
+ "name": "godot_aabb_encloses",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
- ["const godot_rect3 *", "p_with"]
+ ["const godot_aabb *", "p_self"],
+ ["const godot_aabb *", "p_with"]
]
},
{
- "name": "godot_rect3_merge",
- "return_type": "godot_rect3",
+ "name": "godot_aabb_merge",
+ "return_type": "godot_aabb",
"arguments": [
- ["const godot_rect3 *", "p_self"],
- ["const godot_rect3 *", "p_with"]
+ ["const godot_aabb *", "p_self"],
+ ["const godot_aabb *", "p_with"]
]
},
{
- "name": "godot_rect3_intersection",
- "return_type": "godot_rect3",
+ "name": "godot_aabb_intersection",
+ "return_type": "godot_aabb",
"arguments": [
- ["const godot_rect3 *", "p_self"],
- ["const godot_rect3 *", "p_with"]
+ ["const godot_aabb *", "p_self"],
+ ["const godot_aabb *", "p_with"]
]
},
{
- "name": "godot_rect3_intersects_plane",
+ "name": "godot_aabb_intersects_plane",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_plane *", "p_plane"]
]
},
{
- "name": "godot_rect3_intersects_segment",
+ "name": "godot_aabb_intersects_segment",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_from"],
["const godot_vector3 *", "p_to"]
]
},
{
- "name": "godot_rect3_has_point",
+ "name": "godot_aabb_has_point",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_point"]
]
},
{
- "name": "godot_rect3_get_support",
+ "name": "godot_aabb_get_support",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_dir"]
]
},
{
- "name": "godot_rect3_get_longest_axis",
+ "name": "godot_aabb_get_longest_axis",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_longest_axis_index",
+ "name": "godot_aabb_get_longest_axis_index",
"return_type": "godot_int",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_longest_axis_size",
+ "name": "godot_aabb_get_longest_axis_size",
"return_type": "godot_real",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_shortest_axis",
+ "name": "godot_aabb_get_shortest_axis",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_shortest_axis_index",
+ "name": "godot_aabb_get_shortest_axis_index",
"return_type": "godot_int",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_shortest_axis_size",
+ "name": "godot_aabb_get_shortest_axis_size",
"return_type": "godot_real",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_expand",
- "return_type": "godot_rect3",
+ "name": "godot_aabb_expand",
+ "return_type": "godot_aabb",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_to_point"]
]
},
{
- "name": "godot_rect3_grow",
- "return_type": "godot_rect3",
+ "name": "godot_aabb_grow",
+ "return_type": "godot_aabb",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_real", "p_by"]
]
},
{
- "name": "godot_rect3_get_endpoint",
+ "name": "godot_aabb_get_endpoint",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_int", "p_idx"]
]
},
{
- "name": "godot_rect3_operator_equal",
+ "name": "godot_aabb_operator_equal",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
- ["const godot_rect3 *", "p_b"]
+ ["const godot_aabb *", "p_self"],
+ ["const godot_aabb *", "p_b"]
]
},
{
@@ -3632,19 +3652,19 @@
]
},
{
- "name": "godot_transform_xform_rect3",
- "return_type": "godot_rect3",
+ "name": "godot_transform_xform_aabb",
+ "return_type": "godot_aabb",
"arguments": [
["const godot_transform *", "p_self"],
- ["const godot_rect3 *", "p_v"]
+ ["const godot_aabb *", "p_v"]
]
},
{
- "name": "godot_transform_xform_inv_rect3",
- "return_type": "godot_rect3",
+ "name": "godot_transform_xform_inv_aabb",
+ "return_type": "godot_aabb",
"arguments": [
["const godot_transform *", "p_self"],
- ["const godot_rect3 *", "p_v"]
+ ["const godot_aabb *", "p_v"]
]
},
{
@@ -3930,11 +3950,11 @@
]
},
{
- "name": "godot_variant_new_rect3",
+ "name": "godot_variant_new_aabb",
"return_type": "void",
"arguments": [
["godot_variant *", "r_dest"],
- ["const godot_rect3 *", "p_rect3"]
+ ["const godot_aabb *", "p_aabb"]
]
},
{
@@ -4135,8 +4155,8 @@
]
},
{
- "name": "godot_variant_as_rect3",
- "return_type": "godot_rect3",
+ "name": "godot_variant_as_aabb",
+ "return_type": "godot_aabb",
"arguments": [
["const godot_variant *", "p_self"]
]
@@ -4362,13 +4382,6 @@
]
},
{
- "name": "godot_string_c_str",
- "return_type": "const char *",
- "arguments": [
- ["const godot_string *", "p_self"]
- ]
- },
- {
"name": "godot_string_unicode_str",
"return_type": "const wchar_t *",
"arguments": [
@@ -5556,6 +5569,20 @@
]
},
{
+ "name": "godot_get_global_constants",
+ "return_type": "godot_dictionary",
+ "arguments": [
+ ]
+ },
+ {
+ "name": "godot_register_native_call_type",
+ "return_type": "void",
+ "arguments": [
+ ["const char *", "call_type"],
+ ["native_call_cb", "p_callback"]
+ ]
+ },
+ {
"name": "godot_alloc",
"return_type": "void *",
"arguments": [
diff --git a/modules/gdnative/include/gdnative/aabb.h b/modules/gdnative/include/gdnative/aabb.h
new file mode 100644
index 0000000000..34339fa242
--- /dev/null
+++ b/modules/gdnative/include/gdnative/aabb.h
@@ -0,0 +1,117 @@
+/*************************************************************************/
+/* aabb.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GODOT_AABB_H
+#define GODOT_AABB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define GODOT_AABB_SIZE 24
+
+#ifndef GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED
+#define GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED
+typedef struct {
+ uint8_t _dont_touch_that[GODOT_AABB_SIZE];
+} godot_aabb;
+#endif
+
+// reduce extern "C" nesting for VS2013
+#ifdef __cplusplus
+}
+#endif
+
+#include <gdnative/gdnative.h>
+#include <gdnative/plane.h>
+#include <gdnative/vector3.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size);
+
+godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self);
+void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v);
+
+godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self);
+void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v);
+
+godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self);
+
+godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self);
+
+godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self);
+
+godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self);
+
+godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with);
+
+godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with);
+
+godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with);
+
+godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with);
+
+godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane);
+
+godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to);
+
+godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point);
+
+godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir);
+
+godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self);
+
+godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self);
+
+godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self);
+
+godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self);
+
+godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self);
+
+godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self);
+
+godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point);
+
+godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by);
+
+godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx);
+
+godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_AABB_H
diff --git a/modules/gdnative/include/gdnative/array.h b/modules/gdnative/include/gdnative/array.h
index 01ae61e280..484ffd10ba 100644
--- a/modules/gdnative/include/gdnative/array.h
+++ b/modules/gdnative/include/gdnative/array.h
@@ -124,6 +124,10 @@ void GDAPI godot_array_sort(godot_array *p_self);
void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func);
+godot_int GDAPI godot_array_bsearch(godot_array *p_self, const godot_variant *p_value, const godot_bool p_before);
+
+godot_int GDAPI godot_array_bsearch_custom(godot_array *p_self, const godot_variant *p_value, godot_object *p_obj, const godot_string *p_func, const godot_bool p_before);
+
void GDAPI godot_array_destroy(godot_array *p_self);
#ifdef __cplusplus
diff --git a/modules/gdnative/include/gdnative/basis.h b/modules/gdnative/include/gdnative/basis.h
index 49ca765a01..4898eab24c 100644
--- a/modules/gdnative/include/gdnative/basis.h
+++ b/modules/gdnative/include/gdnative/basis.h
@@ -111,7 +111,7 @@ godot_bool GDAPI godot_basis_operator_equal(const godot_basis *p_self, const god
godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godot_basis *p_b);
-godot_basis GDAPI godot_basis_operator_substract(const godot_basis *p_self, const godot_basis *p_b);
+godot_basis GDAPI godot_basis_operator_subtract(const godot_basis *p_self, const godot_basis *p_b);
godot_basis GDAPI godot_basis_operator_multiply_vector(const godot_basis *p_self, const godot_basis *p_b);
diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h
index a479eced16..9d7829a51f 100644
--- a/modules/gdnative/include/gdnative/gdnative.h
+++ b/modules/gdnative/include/gdnative/gdnative.h
@@ -53,7 +53,7 @@ extern "C" {
// This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!!
#ifdef _WIN32
-#define GDN_EXPORT
+#define GDN_EXPORT __declspec(dllexport)
#else
#define GDN_EXPORT
#endif
@@ -115,8 +115,6 @@ typedef enum {
GODOT_ERR_HELP, ///< user requested help!!
GODOT_ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior.
GODOT_ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames
- GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD, ///< shit happens, has never been used, though
- GODOT_ERR_WTF = GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD ///< short version of the above
} godot_error;
////// bool
@@ -169,9 +167,9 @@ typedef void godot_object;
#include <gdnative/quat.h>
-/////// Rect3
+/////// AABB
-#include <gdnative/rect3.h>
+#include <gdnative/aabb.h>
/////// Basis
@@ -214,10 +212,6 @@ void GDAPI godot_object_destroy(godot_object *p_o);
godot_object GDAPI *godot_global_get_singleton(char *p_name); // result shouldn't be freed
-////// OS API
-
-void GDAPI *godot_get_stack_bottom(); // returns stack bottom of the main thread
-
////// MethodBind API
typedef struct {
@@ -229,13 +223,28 @@ void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_obj
godot_variant GDAPI godot_method_bind_call(godot_method_bind *p_method_bind, godot_object *p_instance, const godot_variant **p_args, const int p_arg_count, godot_variant_call_error *p_call_error);
////// Script API
-struct godot_gdnative_api_struct; // Forward declaration
+typedef struct godot_gdnative_api_version {
+ unsigned int major;
+ unsigned int minor;
+} godot_gdnative_api_version;
+
+typedef struct godot_gdnative_api_struct godot_gdnative_api_struct;
+
+struct godot_gdnative_api_struct {
+ unsigned int type;
+ godot_gdnative_api_version version;
+ const godot_gdnative_api_struct *next;
+};
+
+#define GDNATIVE_VERSION_COMPATIBLE(want, have) (want.major == have.major && want.minor <= have.minor)
typedef struct {
godot_bool in_editor;
uint64_t core_api_hash;
uint64_t editor_api_hash;
uint64_t no_api_hash;
+ void (*report_version_mismatch)(const godot_object *p_library, const char *p_what, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have);
+ void (*report_loading_error)(const godot_object *p_library, const char *p_what);
godot_object *gd_native_library; // pointer to GDNativeLibrary that is being initialized
const struct godot_gdnative_core_api_struct *api_struct;
const godot_string *active_library_path;
@@ -259,6 +268,9 @@ typedef godot_variant (*godot_gdnative_procedure_fn)(godot_array *);
////// System Functions
+typedef godot_variant (*native_call_cb)(void *, godot_array *);
+void GDAPI godot_register_native_call_type(const char *p_call_type, native_call_cb p_callback);
+
//using these will help Godot track how much memory is in use in debug mode
void GDAPI *godot_alloc(int p_bytes);
void GDAPI *godot_realloc(void *p_ptr, int p_bytes);
diff --git a/modules/gdnative/include/gdnative/node_path.h b/modules/gdnative/include/gdnative/node_path.h
index 42446175d8..b5a59fd325 100644
--- a/modules/gdnative/include/gdnative/node_path.h
+++ b/modules/gdnative/include/gdnative/node_path.h
@@ -73,7 +73,7 @@ godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_self)
godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_self, const godot_int p_idx);
-godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_self);
+godot_string GDAPI godot_node_path_get_concatenated_subnames(const godot_node_path *p_self);
godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_self);
diff --git a/modules/gdnative/include/gdnative/quat.h b/modules/gdnative/include/gdnative/quat.h
index acae6e3e90..2be9d8849d 100644
--- a/modules/gdnative/include/gdnative/quat.h
+++ b/modules/gdnative/include/gdnative/quat.h
@@ -98,7 +98,7 @@ godot_quat GDAPI godot_quat_operator_multiply(const godot_quat *p_self, const go
godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_quat *p_b);
-godot_quat GDAPI godot_quat_operator_substract(const godot_quat *p_self, const godot_quat *p_b);
+godot_quat GDAPI godot_quat_operator_subtract(const godot_quat *p_self, const godot_quat *p_b);
godot_quat GDAPI godot_quat_operator_divide(const godot_quat *p_self, const godot_real p_b);
diff --git a/modules/gdnative/include/gdnative/rect3.h b/modules/gdnative/include/gdnative/rect3.h
deleted file mode 100644
index f603a9268a..0000000000
--- a/modules/gdnative/include/gdnative/rect3.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*************************************************************************/
-/* rect3.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#ifndef GODOT_RECT3_H
-#define GODOT_RECT3_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#define GODOT_RECT3_SIZE 24
-
-#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
-#define GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
-typedef struct {
- uint8_t _dont_touch_that[GODOT_RECT3_SIZE];
-} godot_rect3;
-#endif
-
-// reduce extern "C" nesting for VS2013
-#ifdef __cplusplus
-}
-#endif
-
-#include <gdnative/gdnative.h>
-#include <gdnative/plane.h>
-#include <gdnative/vector3.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size);
-
-godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self);
-void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v);
-
-godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self);
-void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v);
-
-godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self);
-
-godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self);
-
-godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self);
-
-godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self);
-
-godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with);
-
-godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with);
-
-godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with);
-
-godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with);
-
-godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane);
-
-godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to);
-
-godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point);
-
-godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir);
-
-godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self);
-
-godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self);
-
-godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self);
-
-godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self);
-
-godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self);
-
-godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self);
-
-godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point);
-
-godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by);
-
-godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx);
-
-godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_RECT3_H
diff --git a/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h
index 29510313c9..10358ceade 100644
--- a/modules/gdnative/include/gdnative/string.h
+++ b/modules/gdnative/include/gdnative/string.h
@@ -51,6 +51,7 @@ typedef struct {
}
#endif
+#include <gdnative/array.h>
#include <gdnative/gdnative.h>
#include <gdnative/variant.h>
@@ -67,7 +68,6 @@ void GDAPI godot_string_get_data(const godot_string *p_self, char *p_dest, int *
wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx);
wchar_t GDAPI godot_string_operator_index_const(const godot_string *p_self, const godot_int p_idx);
-const char GDAPI *godot_string_c_str(const godot_string *p_self);
const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self);
godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b);
diff --git a/modules/gdnative/include/gdnative/transform.h b/modules/gdnative/include/gdnative/transform.h
index 8f50b01fb5..3b5c189bdf 100644
--- a/modules/gdnative/include/gdnative/transform.h
+++ b/modules/gdnative/include/gdnative/transform.h
@@ -98,9 +98,9 @@ godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self,
godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v);
-godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v);
+godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v);
-godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v);
+godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v);
#ifdef __cplusplus
}
diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h
index 3d744ef1f2..06cafcfa63 100644
--- a/modules/gdnative/include/gdnative/variant.h
+++ b/modules/gdnative/include/gdnative/variant.h
@@ -62,7 +62,7 @@ typedef enum godot_variant_type {
GODOT_VARIANT_TYPE_TRANSFORM2D,
GODOT_VARIANT_TYPE_PLANE,
GODOT_VARIANT_TYPE_QUAT, // 10
- GODOT_VARIANT_TYPE_RECT3,
+ GODOT_VARIANT_TYPE_AABB,
GODOT_VARIANT_TYPE_BASIS,
GODOT_VARIANT_TYPE_TRANSFORM,
@@ -104,6 +104,7 @@ typedef struct godot_variant_call_error {
}
#endif
+#include <gdnative/aabb.h>
#include <gdnative/array.h>
#include <gdnative/basis.h>
#include <gdnative/color.h>
@@ -113,7 +114,6 @@ typedef struct godot_variant_call_error {
#include <gdnative/pool_arrays.h>
#include <gdnative/quat.h>
#include <gdnative/rect2.h>
-#include <gdnative/rect3.h>
#include <gdnative/rid.h>
#include <gdnative/string.h>
#include <gdnative/transform.h>
@@ -145,7 +145,7 @@ void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3
void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d);
void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane);
void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat);
-void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3);
+void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb);
void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis);
void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans);
void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color);
@@ -173,7 +173,7 @@ godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self);
godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self);
godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self);
godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self);
-godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self);
+godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self);
godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self);
godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self);
godot_color GDAPI godot_variant_as_color(const godot_variant *p_self);
diff --git a/modules/gdnative/include/gdnative/vector2.h b/modules/gdnative/include/gdnative/vector2.h
index 07105abaf2..4d1117e3aa 100644
--- a/modules/gdnative/include/gdnative/vector2.h
+++ b/modules/gdnative/include/gdnative/vector2.h
@@ -106,7 +106,7 @@ godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_self, const god
godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, const godot_vector2 *p_b);
-godot_vector2 GDAPI godot_vector2_operator_substract(const godot_vector2 *p_self, const godot_vector2 *p_b);
+godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_self, const godot_vector2 *p_b);
godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_self, const godot_vector2 *p_b);
diff --git a/modules/gdnative/include/gdnative/vector3.h b/modules/gdnative/include/gdnative/vector3.h
index 3ed23778ec..135a13acc8 100644
--- a/modules/gdnative/include/gdnative/vector3.h
+++ b/modules/gdnative/include/gdnative/vector3.h
@@ -117,7 +117,7 @@ godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_self, const god
godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, const godot_vector3 *p_b);
-godot_vector3 GDAPI godot_vector3_operator_substract(const godot_vector3 *p_self, const godot_vector3 *p_b);
+godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_self, const godot_vector3 *p_b);
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index f9d699fb59..653445c2db 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -468,8 +468,6 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
return source;
}
-//
-
#endif
/*
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index c2c7c27f25..965de062e3 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -437,11 +437,11 @@ NativeScript::~NativeScript() {
#endif
}
-//
-//
-// ScriptInstance stuff
-//
-//
+ //
+ //
+ // ScriptInstance stuff
+ //
+ //
#define GET_SCRIPT_DESC() script->get_script_desc()
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index f0f14e2f30..30fa400cb0 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -76,12 +76,12 @@ struct NativeScriptDesc {
bool is_tool;
- inline NativeScriptDesc()
- : methods(),
- properties(),
- signals_(),
- base(),
- base_native_type() {
+ inline NativeScriptDesc() :
+ methods(),
+ properties(),
+ signals_(),
+ base(),
+ base_native_type() {
zeromem(&create_func, sizeof(godot_instance_create_func));
zeromem(&destroy_func, sizeof(godot_instance_destroy_func));
}
diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp
index 40feb5ae43..e358c2fb69 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_language.cpp
@@ -410,8 +410,8 @@ void PluginScriptLanguage::unlock() {
#endif
}
-PluginScriptLanguage::PluginScriptLanguage(const godot_pluginscript_language_desc *desc)
- : _desc(*desc) {
+PluginScriptLanguage::PluginScriptLanguage(const godot_pluginscript_language_desc *desc) :
+ _desc(*desc) {
_resource_loader = memnew(ResourceFormatLoaderPluginScript(this));
_resource_saver = memnew(ResourceFormatSaverPluginScript(this));
diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp
index 4169b07f63..0b71b3b10d 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_script.cpp
@@ -423,8 +423,11 @@ ScriptInstance::RPCMode PluginScript::get_rset_mode(const StringName &p_variable
}
}
-PluginScript::PluginScript()
- : _data(NULL), _tool(false), _valid(false), _script_list(this) {
+PluginScript::PluginScript() :
+ _data(NULL),
+ _tool(false),
+ _valid(false),
+ _script_list(this) {
}
void PluginScript::init(PluginScriptLanguage *language) {
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 29b0a6719c..1cb35ec006 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -99,20 +99,41 @@ static Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) {
}
static void actual_discoverer_handler() {
+
EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem();
Set<String> file_paths = get_gdnative_singletons(dir);
+ bool changed = false;
+ Array current_files;
+ if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) {
+ current_files = ProjectSettings::get_singleton()->get("gdnative/singletons");
+ }
Array files;
files.resize(file_paths.size());
int i = 0;
for (Set<String>::Element *E = file_paths.front(); E; i++, E = E->next()) {
+ if (!current_files.has(E->get())) {
+ changed = true;
+ }
files.set(i, E->get());
}
- ProjectSettings::get_singleton()->set("gdnative/singletons", files);
+ // Check for removed files
+ if (!changed) {
+ for (int i = 0; i < current_files.size(); i++) {
+ if (!file_paths.has(current_files[i])) {
+ changed = true;
+ break;
+ }
+ }
+ }
- ProjectSettings::get_singleton()->save();
+ if (changed) {
+
+ ProjectSettings::get_singleton()->set("gdnative/singletons", files);
+ ProjectSettings::get_singleton()->save();
+ }
}
static GDNativeSingletonDiscover *discoverer = NULL;
@@ -123,6 +144,11 @@ protected:
virtual void _export_file(const String &p_path, const String &p_type, const Set<String> &p_features);
};
+struct LibrarySymbol {
+ char *name;
+ bool is_required;
+};
+
void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_type, const Set<String> &p_features) {
if (p_type != "GDNativeLibrary") {
return;
@@ -136,7 +162,6 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
Ref<ConfigFile> config = lib->get_config_file();
- String entry_lib_path;
{
List<String> entry_keys;
@@ -161,14 +186,12 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
continue;
}
- entry_lib_path = config->get_value("entry", key);
- break;
+ String entry_lib_path = config->get_value("entry", key);
+ add_shared_object(entry_lib_path, tags);
}
}
- Vector<String> dependency_paths;
{
-
List<String> dependency_keys;
config->get_section_keys("dependencies", &dependency_keys);
@@ -191,47 +214,54 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
continue;
}
- dependency_paths = config->get_value("dependencies", key);
- break;
+ Vector<String> dependency_paths = config->get_value("dependencies", key);
+ for (int i = 0; i < dependency_paths.size(); i++) {
+ add_shared_object(dependency_paths[i], tags);
+ }
}
}
- bool is_statically_linked = false;
- {
-
- List<String> static_linking_keys;
- config->get_section_keys("static_linking", &static_linking_keys);
-
- for (List<String>::Element *E = static_linking_keys.front(); E; E = E->next()) {
- String key = E->get();
-
- Vector<String> tags = key.split(".");
-
- bool skip = false;
-
- for (int i = 0; i < tags.size(); i++) {
- bool has_feature = p_features.has(tags[i]);
-
- if (!has_feature) {
- skip = true;
- break;
+ if (p_features.has("iOS")) {
+ // Register symbols in the "fake" dynamic lookup table, because dlsym does not work well on iOS.
+ LibrarySymbol expected_symbols[] = {
+ { "gdnative_init", true },
+ { "gdnative_terminate", false },
+ { "nativescript_init", false },
+ { "nativescript_frame", false },
+ { "nativescript_thread_enter", false },
+ { "nativescript_thread_exit", false },
+ { "gdnative_singleton", false }
+ };
+ String declare_pattern = "extern \"C\" void $name(void)$weak;\n";
+ String additional_code = "extern void register_dynamic_symbol(char *name, void *address);\n"
+ "extern void add_ios_init_callback(void (*cb)());\n";
+ String linker_flags = "";
+ for (int i = 0; i < sizeof(expected_symbols) / sizeof(expected_symbols[0]); ++i) {
+ String full_name = lib->get_symbol_prefix() + expected_symbols[i].name;
+ String code = declare_pattern.replace("$name", full_name);
+ code = code.replace("$weak", expected_symbols[i].is_required ? "" : " __attribute__((weak))");
+ additional_code += code;
+
+ if (!expected_symbols[i].is_required) {
+ if (linker_flags.length() > 0) {
+ linker_flags += " ";
}
+ linker_flags += "-Wl,-U,_" + full_name;
}
-
- if (skip) {
- continue;
- }
-
- is_statically_linked = config->get_value("static_linking", key);
- break;
}
- }
- if (!is_statically_linked)
- add_shared_object(entry_lib_path);
+ additional_code += String("void $prefixinit() {\n").replace("$prefix", lib->get_symbol_prefix());
+ String register_pattern = " if (&$name) register_dynamic_symbol((char *)\"$name\", (void *)$name);\n";
+ for (int i = 0; i < sizeof(expected_symbols) / sizeof(expected_symbols[0]); ++i) {
+ String full_name = lib->get_symbol_prefix() + expected_symbols[i].name;
+ additional_code += register_pattern.replace("$name", full_name);
+ }
+ additional_code += "}\n";
+ additional_code += String("struct $prefixstruct {$prefixstruct() {add_ios_init_callback($prefixinit);}};\n").replace("$prefix", lib->get_symbol_prefix());
+ additional_code += String("$prefixstruct $prefixstruct_instance;\n").replace("$prefix", lib->get_symbol_prefix());
- for (int i = 0; i < dependency_paths.size(); i++) {
- add_shared_object(dependency_paths[i]);
+ add_ios_cpp_code(additional_code);
+ add_ios_linker_flags(linker_flags);
}
}
@@ -271,9 +301,7 @@ void register_gdnative_types() {
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
- EditorNode::add_init_callback(editor_init_callback);
- }
+ EditorNode::add_init_callback(editor_init_callback);
#endif
ClassDB::register_class<GDNativeLibrary>();
@@ -371,7 +399,7 @@ void unregister_gdnative_types() {
print_line(String("poolarray:\t") + itos(sizeof(PoolByteArray)));
print_line(String("quat:\t") + itos(sizeof(Quat)));
print_line(String("rect2:\t") + itos(sizeof(Rect2)));
- print_line(String("rect3:\t") + itos(sizeof(Rect3)));
+ print_line(String("aabb:\t") + itos(sizeof(AABB)));
print_line(String("rid:\t") + itos(sizeof(RID)));
print_line(String("string:\t") + itos(sizeof(String)));
print_line(String("transform:\t") + itos(sizeof(Transform)));
diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub
index 0882406761..13870170a5 100644
--- a/modules/gdscript/SCsub
+++ b/modules/gdscript/SCsub
@@ -1,7 +1,10 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
-env.add_source_files(env.modules_sources, "*.cpp")
+env_gdscript = env_modules.Clone()
+
+env_gdscript.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/gdscript/doc_classes/GDScript.xml b/modules/gdscript/doc_classes/GDScript.xml
index 13d45aa520..cc617c5c67 100644
--- a/modules/gdscript/doc_classes/GDScript.xml
+++ b/modules/gdscript/doc_classes/GDScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDScript" inherits="Script" category="Core" version="3.0-alpha">
+<class name="GDScript" inherits="Script" category="Core" version="3.0-beta">
<brief_description>
A script implemented in the GDScript programming language.
</brief_description>
diff --git a/modules/gdscript/doc_classes/GDScriptFunctionState.xml b/modules/gdscript/doc_classes/GDScriptFunctionState.xml
index 2df4e7c217..465a4f438b 100644
--- a/modules/gdscript/doc_classes/GDScriptFunctionState.xml
+++ b/modules/gdscript/doc_classes/GDScriptFunctionState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDScriptFunctionState" inherits="Reference" category="Core" version="3.0-alpha">
+<class name="GDScriptFunctionState" inherits="Reference" category="Core" version="3.0-beta">
<brief_description>
State of a function call after yielding.
</brief_description>
diff --git a/modules/gdscript/doc_classes/GDScriptNativeClass.xml b/modules/gdscript/doc_classes/GDScriptNativeClass.xml
index 4514a78469..948254e0ad 100644
--- a/modules/gdscript/doc_classes/GDScriptNativeClass.xml
+++ b/modules/gdscript/doc_classes/GDScriptNativeClass.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDScriptNativeClass" inherits="Reference" category="Core" version="3.0-alpha">
+<class name="GDScriptNativeClass" inherits="Reference" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 55ea8a5f24..b75f670906 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -100,7 +100,7 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
#endif
instance->owner->set_script_instance(instance);
-/* STEP 2, INITIALIZE AND CONSRTUCT */
+ /* STEP 2, INITIALIZE AND CONSRTUCT */
#ifndef NO_THREADS
GDScriptLanguage::singleton->lock->lock();
@@ -615,6 +615,23 @@ ScriptLanguage *GDScript::get_language() const {
return GDScriptLanguage::get_singleton();
}
+void GDScript::get_constants(Map<StringName, Variant> *p_constants) {
+
+ if (p_constants) {
+ for (Map<StringName, Variant>::Element *E = constants.front(); E; E = E->next()) {
+ (*p_constants)[E->key()] = E->value();
+ }
+ }
+}
+
+void GDScript::get_members(Set<StringName> *p_members) {
+ if (p_members) {
+ for (Set<StringName>::Element *E = members.front(); E; E = E->next()) {
+ p_members->insert(E->get());
+ }
+ }
+}
+
Variant GDScript::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
GDScript *top = this;
@@ -721,7 +738,7 @@ Error GDScript::load_byte_code(const String &p_path) {
Error err = fae->open_and_parse(fa, key, FileAccessEncrypted::MODE_READ);
ERR_FAIL_COND_V(err, err);
bytecode.resize(fae->get_len());
- fae->get_buffer(bytecode.ptr(), bytecode.size());
+ fae->get_buffer(bytecode.ptrw(), bytecode.size());
memdelete(fae);
} else {
@@ -859,8 +876,8 @@ void GDScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
#endif
}
-GDScript::GDScript()
- : script_list(this) {
+GDScript::GDScript() :
+ script_list(this) {
_static_ref = this;
valid = false;
@@ -1307,7 +1324,7 @@ void GDScriptLanguage::_add_global(const StringName &p_name, const Variant &p_va
}
globals[p_name] = global_array.size();
global_array.push_back(p_value);
- _global_array = global_array.ptr();
+ _global_array = global_array.ptrw();
}
void GDScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) {
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 3f6f431938..6e5d59ad0e 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -198,6 +198,9 @@ public:
return -1;
}
+ virtual void get_constants(Map<StringName, Variant> *p_constants);
+ virtual void get_members(Set<StringName> *p_members);
+
GDScript();
~GDScript();
};
@@ -219,7 +222,7 @@ class GDScriptInstance : public ScriptInstance {
void _ml_call_reversed(GDScript *sptr, const StringName &p_method, const Variant **p_args, int p_argcount);
public:
- _FORCE_INLINE_ Object *get_owner() { return owner; }
+ virtual Object *get_owner() { return owner; }
virtual bool set(const StringName &p_name, const Variant &p_value);
virtual bool get(const StringName &p_name, Variant &r_ret) const;
@@ -407,7 +410,8 @@ public:
virtual String debug_get_stack_level_source(int p_level) const;
virtual void debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
virtual void debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
- virtual void debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
+ virtual ScriptInstance *debug_get_stack_level_instance(int p_level);
+ virtual void debug_get_globals(List<String> *p_globals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
virtual String debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems = -1, int p_max_depth = -1);
virtual void reload_all_scripts();
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 3121a61436..f9385d7a11 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -806,8 +806,8 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
ERR_FAIL_COND_V(on->arguments.size() != 2, -1);
if (on->arguments[0]->type == GDScriptParser::Node::TYPE_OPERATOR && (static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX || static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED)) {
-//SET (chained) MODE!!
+ // SET (chained) MODE!
#ifdef DEBUG_ENABLED
if (static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED) {
const GDScriptParser::OperatorNode *inon = static_cast<GDScriptParser::OperatorNode *>(on->arguments[0]);
@@ -1686,21 +1686,44 @@ Error GDScriptCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, cons
base_class = p->subclasses[base];
break;
}
+
+ if (p->constants.has(base)) {
+
+ base_class = p->constants[base];
+ if (base_class.is_null()) {
+ _set_error("Constant is not a class: " + base, p_class);
+ return ERR_SCRIPT_FAILED;
+ }
+ break;
+ }
+
p = p->_owner;
}
if (base_class.is_valid()) {
+ String ident = base;
+
for (int i = 1; i < p_class->extends_class.size(); i++) {
String subclass = p_class->extends_class[i];
+ ident += ("." + subclass);
+
if (base_class->subclasses.has(subclass)) {
base_class = base_class->subclasses[subclass];
+ } else if (base_class->constants.has(subclass)) {
+
+ Ref<GDScript> new_base_class = base_class->constants[subclass];
+ if (new_base_class.is_null()) {
+ _set_error("Constant is not a class: " + ident, p_class);
+ return ERR_SCRIPT_FAILED;
+ }
+ base_class = new_base_class;
} else {
- _set_error("Could not find subclass: " + subclass, p_class);
+ _set_error("Could not find subclass: " + ident, p_class);
return ERR_FILE_NOT_FOUND;
}
}
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index a74b8a8483..adf6780278 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -29,11 +29,11 @@
/*************************************************************************/
#include "gdscript.h"
+#include "core/engine.h"
#include "editor/editor_settings.h"
#include "gdscript_compiler.h"
#include "global_constants.h"
#include "os/file_access.h"
-#include "project_settings.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_file_system.h"
@@ -280,10 +280,62 @@ void GDScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *
p_values->push_back(instance->debug_get_member_by_index(E->get().index));
}
}
-void GDScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {
- //no globals are really reachable in gdscript
+ScriptInstance *GDScriptLanguage::debug_get_stack_level_instance(int p_level) {
+
+ ERR_FAIL_COND_V(_debug_parse_err_line >= 0, NULL);
+ ERR_FAIL_INDEX_V(p_level, _debug_call_stack_pos, NULL);
+
+ int l = _debug_call_stack_pos - p_level - 1;
+ ScriptInstance *instance = _call_stack[l].instance;
+
+ return instance;
}
+
+void GDScriptLanguage::debug_get_globals(List<String> *p_globals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {
+
+ const Map<StringName, int> &name_idx = GDScriptLanguage::get_singleton()->get_global_map();
+ const Variant *globals = GDScriptLanguage::get_singleton()->get_global_array();
+
+ List<Pair<String, Variant> > cinfo;
+ get_public_constants(&cinfo);
+
+ for (const Map<StringName, int>::Element *E = name_idx.front(); E; E = E->next()) {
+
+ if (ClassDB::class_exists(E->key()) || Engine::get_singleton()->has_singleton(E->key()))
+ continue;
+
+ bool is_script_constant = false;
+ for (List<Pair<String, Variant> >::Element *CE = cinfo.front(); CE; CE = CE->next()) {
+ if (CE->get().first == E->key()) {
+ is_script_constant = true;
+ break;
+ }
+ }
+ if (is_script_constant)
+ continue;
+
+ const Variant &var = globals[E->value()];
+ if (Object *obj = var) {
+ if (Object::cast_to<GDScriptNativeClass>(obj))
+ continue;
+ }
+
+ bool skip = false;
+ for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) {
+ if (E->key() == GlobalConstants::get_global_constant_name(i)) {
+ skip = true;
+ break;
+ }
+ }
+ if (skip)
+ continue;
+
+ p_globals->push_back(E->key());
+ p_values->push_back(var);
+ }
+}
+
String GDScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) {
if (_debug_parse_err_line >= 0)
@@ -739,7 +791,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &context, const GDS
}
Variant::CallError ce;
- Variant ret = mb->call(baseptr, argptr.ptr(), argptr.size(), ce);
+ Variant ret = mb->call(baseptr, (const Variant **)argptr.ptr(), argptr.size(), ce);
if (ce.error == Variant::CallError::CALL_OK && ret.get_type() != Variant::NIL) {
@@ -1743,8 +1795,8 @@ static void _find_type_arguments(GDScriptCompletionContext &context, const GDScr
}
} else {
-//regular method
+ //regular method
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
if (p_argidx < m->get_argument_count()) {
PropertyInfo pi = m->get_argument_info(p_argidx);
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index 765a76fec4..ee23f0ea0f 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -250,7 +250,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
-//GDScriptLanguage::get_singleton()->calls++;
+ //GDScriptLanguage::get_singleton()->calls++;
#endif
@@ -515,7 +515,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
} else {
v = "of type '" + _get_var_type(index) + "'";
}
- err_text = "Invalid set index " + v + " (on base: '" + _get_var_type(dst) + "').";
+ err_text = "Invalid set index " + v + " (on base: '" + _get_var_type(dst) + "') with value of type '" + _get_var_type(value) + "'";
OPCODE_BREAK;
}
#endif
@@ -574,7 +574,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
if (!valid) {
String err_type;
- err_text = "Invalid set index '" + String(*index) + "' (on base: '" + _get_var_type(dst) + "').";
+ err_text = "Invalid set index '" + String(*index) + "' (on base: '" + _get_var_type(dst) + "') with value of type '" + _get_var_type(value) + "'.";
OPCODE_BREAK;
}
#endif
@@ -1432,8 +1432,8 @@ void GDScriptFunction::debug_get_stack_member_state(int p_line, List<Pair<String
}
}
-GDScriptFunction::GDScriptFunction()
- : function_list(this) {
+GDScriptFunction::GDScriptFunction() :
+ function_list(this) {
_stack_size = 0;
_call_size = 0;
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 467dbf3e56..ca0a9582a7 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -84,6 +84,8 @@ const char *GDScriptFunctions::get_func_name(Function p_func) {
"rad2deg",
"linear2db",
"db2linear",
+ "polar2cartesian",
+ "cartesian2polar",
"wrapi",
"wrapf",
"max",
@@ -408,6 +410,22 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
VALIDATE_ARG_NUM(0);
r_ret = Math::db2linear((double)*p_args[0]);
} break;
+ case MATH_POLAR2CARTESIAN: {
+ VALIDATE_ARG_COUNT(2);
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ double r = *p_args[0];
+ double th = *p_args[1];
+ r_ret = Vector2(r * Math::cos(th), r * Math::sin(th));
+ } break;
+ case MATH_CARTESIAN2POLAR: {
+ VALIDATE_ARG_COUNT(2);
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ double x = *p_args[0];
+ double y = *p_args[1];
+ r_ret = Vector2(Math::sqrt(x * x + y * y), Math::atan2(y, x));
+ } break;
case MATH_WRAP: {
VALIDATE_ARG_COUNT(3);
r_ret = Math::wrapi((int64_t)*p_args[0], (int64_t)*p_args[1], (int64_t)*p_args[2]);
@@ -642,7 +660,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
}
//str+="\n";
- OS::get_singleton()->printerr("%s\n", str.utf8().get_data());
+ print_error(str);
r_ret = Variant();
} break;
@@ -1296,6 +1314,8 @@ bool GDScriptFunctions::is_deterministic(Function p_func) {
case MATH_RAD2DEG:
case MATH_LINEAR2DB:
case MATH_DB2LINEAR:
+ case MATH_POLAR2CARTESIAN:
+ case MATH_CARTESIAN2POLAR:
case MATH_WRAP:
case MATH_WRAPF:
case LOGIC_MAX:
@@ -1526,6 +1546,16 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
mi.return_val.type = Variant::REAL;
return mi;
} break;
+ case MATH_POLAR2CARTESIAN: {
+ MethodInfo mi("polar2cartesian", PropertyInfo(Variant::REAL, "r"), PropertyInfo(Variant::REAL, "th"));
+ mi.return_val.type = Variant::VECTOR2;
+ return mi;
+ } break;
+ case MATH_CARTESIAN2POLAR: {
+ MethodInfo mi("cartesian2polar", PropertyInfo(Variant::REAL, "x"), PropertyInfo(Variant::REAL, "y"));
+ mi.return_val.type = Variant::VECTOR2;
+ return mi;
+ } break;
case MATH_WRAP: {
MethodInfo mi("wrapi", PropertyInfo(Variant::INT, "value"), PropertyInfo(Variant::INT, "min"), PropertyInfo(Variant::INT, "max"));
mi.return_val.type = Variant::INT;
diff --git a/modules/gdscript/gdscript_functions.h b/modules/gdscript/gdscript_functions.h
index ecbede83a8..d1c5815cec 100644
--- a/modules/gdscript/gdscript_functions.h
+++ b/modules/gdscript/gdscript_functions.h
@@ -75,6 +75,8 @@ public:
MATH_RAD2DEG,
MATH_LINEAR2DB,
MATH_DB2LINEAR,
+ MATH_POLAR2CARTESIAN,
+ MATH_CARTESIAN2POLAR,
MATH_WRAP,
MATH_WRAPF,
LOGIC_MAX,
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index afefecbdf3..8c110143b8 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -1164,6 +1164,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
bool unary = false;
bool ternary = false;
bool error = false;
+ bool right_to_left = false;
switch (expression[i].op) {
@@ -1218,11 +1219,13 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
case OperatorNode::OP_TERNARY_IF:
priority = 14;
ternary = true;
+ right_to_left = true;
break;
case OperatorNode::OP_TERNARY_ELSE:
priority = 14;
error = true;
- break; // Errors out when found without IF (since IF would consume it)
+ // Rigth-to-left should be false in this case, otherwise it would always error.
+ break;
case OperatorNode::OP_ASSIGN: priority = 15; break;
case OperatorNode::OP_ASSIGN_ADD: priority = 15; break;
@@ -1242,13 +1245,13 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
}
- if (priority < min_priority) {
+ if (priority < min_priority || (right_to_left && priority == min_priority)) {
+ // < is used for left to right (default)
+ // <= is used for right to left
if (error) {
_set_error("Unexpected operator");
return NULL;
}
- // < is used for left to right (default)
- // <= is used for right to left
next_op = i;
min_priority = priority;
is_unary = unary;
@@ -2995,18 +2998,36 @@ void GDScriptParser::_parse_extends(ClassNode *p_class) {
}
while (true) {
- if (tokenizer->get_token() != GDScriptTokenizer::TK_IDENTIFIER) {
- _set_error("Invalid 'extends' syntax, expected string constant (path) and/or identifier (parent class).");
- return;
- }
+ switch (tokenizer->get_token()) {
- StringName identifier = tokenizer->get_token_identifier();
- p_class->extends_class.push_back(identifier);
+ case GDScriptTokenizer::TK_IDENTIFIER: {
+
+ StringName identifier = tokenizer->get_token_identifier();
+ p_class->extends_class.push_back(identifier);
+ } break;
+
+ case GDScriptTokenizer::TK_PERIOD:
+ break;
+
+ default: {
+
+ _set_error("Invalid 'extends' syntax, expected string constant (path) and/or identifier (parent class).");
+ return;
+ }
+ }
tokenizer->advance(1);
- if (tokenizer->get_token() != GDScriptTokenizer::TK_PERIOD)
- return;
+
+ switch (tokenizer->get_token()) {
+
+ case GDScriptTokenizer::TK_IDENTIFIER:
+ case GDScriptTokenizer::TK_PERIOD:
+ continue;
+
+ default:
+ return;
+ }
}
}
@@ -3395,6 +3416,10 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
_set_error("Can't export null type.");
return;
}
+ if (type == Variant::OBJECT) {
+ _set_error("Can't export raw object type.");
+ return;
+ }
current_export.type = type;
current_export.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
tokenizer->advance();
@@ -3782,22 +3807,82 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
current_export.hint = PROPERTY_HINT_NONE;
}
- } else if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER) {
+ } else {
- String identifier = tokenizer->get_token_identifier();
- if (!ClassDB::is_parent_class(identifier, "Resource")) {
+ parenthesis++;
+ Node *subexpr = _parse_and_reduce_expression(p_class, true, true);
+ if (!subexpr) {
+ if (_recover_from_completion()) {
+ break;
+ }
+ return;
+ }
+ parenthesis--;
+ if (subexpr->type != Node::TYPE_CONSTANT) {
current_export = PropertyInfo();
- _set_error("Export hint not a type or resource.");
+ _set_error("Expected a constant expression.");
}
- current_export.type = Variant::OBJECT;
- current_export.hint = PROPERTY_HINT_RESOURCE_TYPE;
- current_export.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
+ Variant constant = static_cast<ConstantNode *>(subexpr)->value;
- current_export.hint_string = identifier;
+ if (constant.get_type() == Variant::OBJECT) {
+ GDScriptNativeClass *native_class = Object::cast_to<GDScriptNativeClass>(constant);
- tokenizer->advance();
+ if (native_class && ClassDB::is_parent_class(native_class->get_name(), "Resource")) {
+ current_export.type = Variant::OBJECT;
+ current_export.hint = PROPERTY_HINT_RESOURCE_TYPE;
+ current_export.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
+
+ current_export.hint_string = native_class->get_name();
+
+ } else {
+ current_export = PropertyInfo();
+ _set_error("Export hint not a resource type.");
+ }
+ } else if (constant.get_type() == Variant::DICTIONARY) {
+ // Enumeration
+ bool is_flags = false;
+
+ if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
+ tokenizer->advance();
+
+ if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "FLAGS") {
+ is_flags = true;
+ tokenizer->advance();
+ } else {
+ current_export = PropertyInfo();
+ _set_error("Expected 'FLAGS' after comma.");
+ }
+ }
+
+ current_export.type = Variant::INT;
+ current_export.hint = is_flags ? PROPERTY_HINT_FLAGS : PROPERTY_HINT_ENUM;
+ Dictionary enum_values = constant;
+
+ List<Variant> keys;
+ enum_values.get_key_list(&keys);
+
+ bool first = true;
+ for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
+ if (enum_values[E->get()].get_type() == Variant::INT) {
+ if (!first)
+ current_export.hint_string += ",";
+ else
+ first = false;
+
+ current_export.hint_string += E->get().operator String().camelcase_to_underscore(true).capitalize().xml_escape();
+ if (!is_flags) {
+ current_export.hint_string += ":";
+ current_export.hint_string += enum_values[E->get()].operator String().xml_escape();
+ }
+ }
+ }
+ } else {
+ current_export = PropertyInfo();
+ _set_error("Expected type for export.");
+ return;
+ }
}
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp
index 174bb02967..e3a0af8ee6 100644
--- a/modules/gdscript/gdscript_tokenizer.cpp
+++ b/modules/gdscript/gdscript_tokenizer.cpp
@@ -148,7 +148,7 @@ static const _bit _type_list[] = {
{ Variant::RECT2, "Rect2" },
{ Variant::TRANSFORM2D, "Transform2D" },
{ Variant::VECTOR3, "Vector3" },
- { Variant::RECT3, "Rect3" },
+ { Variant::AABB, "AABB" },
{ Variant::PLANE, "Plane" },
{ Variant::QUAT, "Quat" },
{ Variant::BASIS, "Basis" },
@@ -253,9 +253,9 @@ bool GDScriptTokenizer::is_token_literal(int p_offset, bool variable_safe) const
case TK_BUILT_IN_FUNC:
case TK_OP_IN:
- //case TK_OP_NOT:
- //case TK_OP_OR:
- //case TK_OP_AND:
+ //case TK_OP_NOT:
+ //case TK_OP_OR:
+ //case TK_OP_AND:
case TK_PR_CLASS:
case TK_PR_CONST:
@@ -1125,7 +1125,7 @@ void GDScriptTokenizerText::advance(int p_amount) {
_advance();
}
-//////////////////////////////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////////////////////////////////////
#define BYTECODE_VERSION 12
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 1e007ddb0f..e707032ed8 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -30,6 +30,7 @@
#include "register_types.h"
#include "gdscript.h"
+#include "gdscript_tokenizer.h"
#include "io/file_access_encrypted.h"
#include "io/resource_loader.h"
#include "os/file_access.h"
@@ -38,6 +39,45 @@ GDScriptLanguage *script_language_gd = NULL;
ResourceFormatLoaderGDScript *resource_loader_gd = NULL;
ResourceFormatSaverGDScript *resource_saver_gd = NULL;
+#ifdef TOOLS_ENABLED
+
+#include "editor/editor_export.h"
+#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
+
+class EditorExportGDScript : public EditorExportPlugin {
+
+ GDCLASS(EditorExportGDScript, EditorExportPlugin);
+
+public:
+ virtual void _export_file(const String &p_path, const String &p_type, const Set<String> &p_features) {
+
+ if (!p_path.ends_with(".gd"))
+ return;
+
+ Vector<uint8_t> file = FileAccess::get_file_as_array(p_path);
+ if (file.empty())
+ return;
+ String txt;
+ txt.parse_utf8((const char *)file.ptr(), file.size());
+ file = GDScriptTokenizerBuffer::parse_code_string(txt);
+
+ if (file.empty())
+ return;
+
+ add_file(p_path.get_basename() + ".gdc", file, true);
+ }
+};
+
+static void _editor_init() {
+
+ Ref<EditorExportGDScript> gd_export;
+ gd_export.instance();
+ EditorExport::get_singleton()->add_export_plugin(gd_export);
+}
+
+#endif
+
void register_gdscript_types() {
ClassDB::register_class<GDScript>();
@@ -49,6 +89,10 @@ void register_gdscript_types() {
ResourceLoader::add_resource_format_loader(resource_loader_gd);
resource_saver_gd = memnew(ResourceFormatSaverGDScript);
ResourceSaver::add_resource_format_saver(resource_saver_gd);
+
+#ifdef TOOLS_ENABLED
+ EditorNode::add_init_callback(_editor_init);
+#endif
}
void unregister_gdscript_types() {
diff --git a/modules/gridmap/SCsub b/modules/gridmap/SCsub
index 0882406761..2ffe15cd33 100644
--- a/modules/gridmap/SCsub
+++ b/modules/gridmap/SCsub
@@ -1,7 +1,10 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
-env.add_source_files(env.modules_sources, "*.cpp")
+env_gridmap = env_modules.Clone()
+
+env_gridmap.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml
index ee8ecfff66..8c862b52e8 100644
--- a/modules/gridmap/doc_classes/GridMap.xml
+++ b/modules/gridmap/doc_classes/GridMap.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GridMap" inherits="Spatial" category="Core" version="3.0-alpha">
+<class name="GridMap" inherits="Spatial" category="Core" version="3.0-beta">
<brief_description>
Node for 3D tile-based maps.
</brief_description>
@@ -220,7 +220,7 @@
</method>
</methods>
<constants>
- <constant name="INVALID_CELL_ITEM" value="-1" enum="">
+ <constant name="INVALID_CELL_ITEM" value="-1">
Invalid cell item that can be used in [method set_cell_item] to clear cells (or represent an empty cell in [method get_cell_item]).
</constant>
</constants>
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index b3a1947647..bebf8bcf8f 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -469,7 +469,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
nm.xform = xform;
if (navigation) {
- nm.id = navigation->navmesh_create(navmesh, xform, this);
+ nm.id = navigation->navmesh_add(navmesh, xform, this);
} else {
nm.id = -1;
}
@@ -556,7 +556,7 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) {
if (cell_map.has(F->key()) && F->get().id < 0) {
Ref<NavigationMesh> nm = theme->get_item_navmesh(cell_map[F->key()].item);
if (nm.is_valid()) {
- F->get().id = navigation->navmesh_create(nm, F->get().xform, this);
+ F->get().id = navigation->navmesh_add(nm, F->get().xform, this);
}
}
}
diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h
index 5bfdf1dac3..ab66bf123e 100644
--- a/modules/gridmap/grid_map.h
+++ b/modules/gridmap/grid_map.h
@@ -186,6 +186,11 @@ class GridMap : public Spatial {
Vector3 _get_offset() const;
+ struct BakedMesh {
+ Ref<Mesh> mesh;
+ Transform transform;
+ };
+
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index bceb2b7db7..3a5d0fd3fc 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -623,6 +623,16 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
return do_input_action(p_camera, mm->get_position(), false);
}
+ Ref<InputEventPanGesture> pan_gesture = p_event;
+ if (pan_gesture.is_valid()) {
+
+ if (pan_gesture->get_command() || pan_gesture->get_shift()) {
+ const real_t delta = pan_gesture->get_delta().y;
+ floor->set_value(floor->get_value() + SGN(delta));
+ return true;
+ }
+ }
+
return false;
}
@@ -1137,7 +1147,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
for (int i = 0; i < 12; i++) {
- Rect3 base(Vector3(0, 0, 0), Vector3(1, 1, 1));
+ AABB base(Vector3(0, 0, 0), Vector3(1, 1, 1));
Vector3 a, b;
base.get_edge(i, a, b);
lines.push_back(a);
diff --git a/modules/mobile_vr/doc_classes/MobileVRInterface.xml b/modules/mobile_vr/doc_classes/MobileVRInterface.xml
index c99934aea9..5d3da0672e 100644
--- a/modules/mobile_vr/doc_classes/MobileVRInterface.xml
+++ b/modules/mobile_vr/doc_classes/MobileVRInterface.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MobileVRInterface" inherits="ARVRInterface" category="Core" version="3.0-alpha">
+<class name="MobileVRInterface" inherits="ARVRInterface" category="Core" version="3.0-beta">
<brief_description>
Generic mobile VR implementation
</brief_description>
@@ -12,102 +12,6 @@
<demos>
</demos>
<methods>
- <method name="get_display_to_lens" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Returns the distance between the display and the lens.
- </description>
- </method>
- <method name="get_display_width" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Return the width of the LCD screen of the device.
- </description>
- </method>
- <method name="get_iod" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Returns the interocular distance.
- </description>
- </method>
- <method name="get_k1" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Returns the k1 lens constant.
- </description>
- </method>
- <method name="get_k2" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Retuns the k2 lens constant
- </description>
- </method>
- <method name="get_oversample" qualifiers="const">
- <return type="float">
- </return>
- <description>
- Returns the oversampling setting.
- </description>
- </method>
- <method name="set_display_to_lens">
- <return type="void">
- </return>
- <argument index="0" name="display_to_lens" type="float">
- </argument>
- <description>
- Sets the distance between display and the lens.
- </description>
- </method>
- <method name="set_display_width">
- <return type="void">
- </return>
- <argument index="0" name="display_width" type="float">
- </argument>
- <description>
- Sets the width of the LCD screen of the device.
- </description>
- </method>
- <method name="set_iod">
- <return type="void">
- </return>
- <argument index="0" name="iod" type="float">
- </argument>
- <description>
- Sets the interocular distance.
- </description>
- </method>
- <method name="set_k1">
- <return type="void">
- </return>
- <argument index="0" name="k" type="float">
- </argument>
- <description>
- Sets the k1 lens constant.
- </description>
- </method>
- <method name="set_k2">
- <return type="void">
- </return>
- <argument index="0" name="k" type="float">
- </argument>
- <description>
- Sets the k2 lens constant.
- </description>
- </method>
- <method name="set_oversample">
- <return type="void">
- </return>
- <argument index="0" name="oversample" type="float">
- </argument>
- <description>
- Sets the oversampling setting.
- </description>
- </method>
</methods>
<members>
<member name="display_to_lens" type="float" setter="set_display_to_lens" getter="get_display_to_lens">
diff --git a/modules/mobile_vr/mobile_interface.cpp b/modules/mobile_vr/mobile_interface.cpp
index 3a0b83d534..35253d5a77 100644
--- a/modules/mobile_vr/mobile_interface.cpp
+++ b/modules/mobile_vr/mobile_interface.cpp
@@ -461,6 +461,7 @@ MobileVRInterface::MobileVRInterface() {
glGenBuffers(1, &half_screen_quad);
glBindBuffer(GL_ARRAY_BUFFER, half_screen_quad);
{
+ /* clang-format off */
const float qv[16] = {
0, -1,
-1, -1,
@@ -471,6 +472,7 @@ MobileVRInterface::MobileVRInterface() {
1, -1,
1, -1,
};
+ /* clang-format on */
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 16, qv, GL_STATIC_DRAW);
}
diff --git a/modules/mono/SCsub b/modules/mono/SCsub
index 18a20ecac4..320bbe7090 100644
--- a/modules/mono/SCsub
+++ b/modules/mono/SCsub
@@ -1,6 +1,9 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
+
+env_mono = env_modules.Clone()
from compat import byte_to_str
@@ -43,12 +46,12 @@ def make_cs_files_header(src, dst):
header.write('#endif // _CS_FILES_DATA_H')
-env.add_source_files(env.modules_sources, '*.cpp')
-env.add_source_files(env.modules_sources, 'mono_gd/*.cpp')
-env.add_source_files(env.modules_sources, 'utils/*.cpp')
+env_mono.add_source_files(env.modules_sources, '*.cpp')
+env_mono.add_source_files(env.modules_sources, 'mono_gd/*.cpp')
+env_mono.add_source_files(env.modules_sources, 'utils/*.cpp')
if env['tools']:
- env.add_source_files(env.modules_sources, 'editor/*.cpp')
+ env_mono.add_source_files(env.modules_sources, 'editor/*.cpp')
make_cs_files_header('glue/cs_files', 'glue/cs_compressed.gen.h')
vars = Variables()
@@ -58,12 +61,12 @@ vars.Update(env)
# Glue sources
if env['mono_glue']:
- env.add_source_files(env.modules_sources, 'glue/*.cpp')
+ env_mono.add_source_files(env.modules_sources, 'glue/*.cpp')
else:
- env.Append(CPPDEFINES=['MONO_GLUE_DISABLED'])
+ env_mono.Append(CPPDEFINES=['MONO_GLUE_DISABLED'])
if ARGUMENTS.get('yolo_copy', False):
- env.Append(CPPDEFINES=['YOLO_COPY'])
+ env_mono.Append(CPPDEFINES=['YOLO_COPY'])
# Build GodotSharpTools solution
@@ -201,8 +204,8 @@ def mono_build_solution(source, target, env):
mono_sln_builder = Builder(action = mono_build_solution)
-env.Append(BUILDERS={'MonoBuildSolution': mono_sln_builder})
-env.MonoBuildSolution(
+env_mono.Append(BUILDERS={'MonoBuildSolution': mono_sln_builder})
+env_mono.MonoBuildSolution(
os.path.join(Dir('#bin').abspath, 'GodotSharpTools.dll'),
'editor/GodotSharpTools/GodotSharpTools.sln'
)
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 161e130a07..af5a0334c3 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -346,7 +346,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) {
Variant::TRANSFORM2D,
Variant::PLANE,
Variant::QUAT,
- Variant::RECT3,
+ Variant::AABB,
Variant::BASIS,
Variant::TRANSFORM,
Variant::COLOR,
@@ -1332,7 +1332,7 @@ bool CSharpScript::_update_exports() {
while (top && top != native) {
const Vector<GDMonoField *> &fields = top->get_all_fields();
- for (int i = 0; i < fields.size(); i++) {
+ for (int i = fields.size() - 1; i >= 0; i--) {
GDMonoField *field = fields[i];
if (field->is_static()) {
@@ -1382,7 +1382,7 @@ bool CSharpScript::_update_exports() {
PropertyInfo prop_info = PropertyInfo(type, name, hint, hint_string, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE);
member_info[cname] = prop_info;
- exported_members_cache.push_back(prop_info);
+ exported_members_cache.push_front(prop_info);
if (tmp_object) {
exported_members_defval_cache[cname] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object));
@@ -1885,8 +1885,8 @@ StringName CSharpScript::get_script_name() const {
return name;
}
-CSharpScript::CSharpScript()
- : script_list(this) {
+CSharpScript::CSharpScript() :
+ script_list(this) {
_clear();
diff --git a/modules/mono/doc_classes/@C#.xml b/modules/mono/doc_classes/@C#.xml
index 5d27b32200..5fcbf36a2b 100644
--- a/modules/mono/doc_classes/@C#.xml
+++ b/modules/mono/doc_classes/@C#.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="@C#" category="Core" version="3.0-alpha">
+<class name="@C#" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/mono/doc_classes/CSharpScript.xml b/modules/mono/doc_classes/CSharpScript.xml
index ccc24b832c..853ef28731 100644
--- a/modules/mono/doc_classes/CSharpScript.xml
+++ b/modules/mono/doc_classes/CSharpScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSharpScript" inherits="Script" category="Core" version="3.0-alpha">
+<class name="CSharpScript" inherits="Script" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/mono/doc_classes/GodotSharp.xml b/modules/mono/doc_classes/GodotSharp.xml
index 9edbd18fc1..2696a0bb4b 100644
--- a/modules/mono/doc_classes/GodotSharp.xml
+++ b/modules/mono/doc_classes/GodotSharp.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GodotSharp" inherits="Object" category="Core" version="3.0-alpha">
+<class name="GodotSharp" inherits="Object" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index a293cc2c50..fbb9b2ed14 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -370,7 +370,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo
Vector<uint8_t> data;
data.resize(file_data.uncompressed_size);
- Compression::decompress(data.ptr(), file_data.uncompressed_size, file_data.data, file_data.compressed_size, Compression::MODE_DEFLATE);
+ Compression::decompress(data.ptrw(), file_data.uncompressed_size, file_data.data, file_data.compressed_size, Compression::MODE_DEFLATE);
if (file_name.get_basename() == BINDINGS_GLOBAL_SCOPE_CLASS) {
// GD.cs must be formatted to include the generated global constants
@@ -382,7 +382,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo
CharString data_utf8 = data_str.utf8();
data.resize(data_utf8.length());
- copymem(data.ptr(), reinterpret_cast<const uint8_t *>(data_utf8.get_data()), data_utf8.length());
+ copymem(data.ptrw(), reinterpret_cast<const uint8_t *>(data_utf8.get_data()), data_utf8.length());
}
FileAccessRef file = FileAccess::open(output_file, FileAccess::WRITE);
@@ -1721,7 +1721,7 @@ void BindingsGenerator::_default_argument_from_variant(const Variant &p_val, Arg
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
break;
case Variant::PLANE:
- case Variant::RECT3:
+ case Variant::AABB:
case Variant::COLOR:
r_iarg.default_argument = "new Color(1, 1, 1, 1)";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
@@ -1793,7 +1793,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
INSERT_STRUCT_TYPE(Basis, "real_t*")
INSERT_STRUCT_TYPE(Quat, "real_t*")
INSERT_STRUCT_TYPE(Transform, "real_t*")
- INSERT_STRUCT_TYPE(Rect3, "real_t*")
+ INSERT_STRUCT_TYPE(AABB, "real_t*")
INSERT_STRUCT_TYPE(Color, "real_t*")
INSERT_STRUCT_TYPE(Plane, "real_t*")
diff --git a/modules/mono/editor/csharp_project.cpp b/modules/mono/editor/csharp_project.cpp
index bde5f0fd0b..9a1efb4423 100644
--- a/modules/mono/editor/csharp_project.cpp
+++ b/modules/mono/editor/csharp_project.cpp
@@ -117,4 +117,4 @@ void add_item(const String &p_project_path, const String &p_item_type, const Str
ERR_FAIL();
}
}
-} // CSharpProject
+} // namespace CSharpProject
diff --git a/modules/mono/editor/csharp_project.h b/modules/mono/editor/csharp_project.h
index 4832d2251e..44e8325a59 100644
--- a/modules/mono/editor/csharp_project.h
+++ b/modules/mono/editor/csharp_project.h
@@ -39,6 +39,6 @@ String generate_editor_api_project(const String &p_dir, const String &p_core_dll
String generate_game_project(const String &p_dir, const String &p_name, const Vector<String> &p_files = Vector<String>());
void add_item(const String &p_project_path, const String &p_item_type, const String &p_include);
-}
+} // namespace CSharpProject
#endif // CSHARP_PROJECT_H
diff --git a/modules/mono/glue/cs_files/Rect3.cs b/modules/mono/glue/cs_files/AABB.cs
index 617d33e7fd..e6e12f7ba3 100644
--- a/modules/mono/glue/cs_files/Rect3.cs
+++ b/modules/mono/glue/cs_files/AABB.cs
@@ -1,15 +1,15 @@
using System;
-// file: core/math/rect3.h
+// file: core/math/aabb.h
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
-// file: core/math/rect3.cpp
+// file: core/math/aabb.cpp
// commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0
// file: core/variant_call.cpp
// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
namespace Godot
{
- public struct Rect3 : IEquatable<Rect3>
+ public struct AABB : IEquatable<AABB>
{
private Vector3 position;
private Vector3 size;
@@ -38,7 +38,7 @@ namespace Godot
}
}
- public bool encloses(Rect3 with)
+ public bool Encloses(AABB with)
{
Vector3 src_min = position;
Vector3 src_max = position + size;
@@ -53,7 +53,7 @@ namespace Godot
(src_max.z > dst_max.z));
}
- public Rect3 expand(Vector3 to_point)
+ public AABB Expand(Vector3 to_point)
{
Vector3 begin = position;
Vector3 end = position + size;
@@ -72,15 +72,15 @@ namespace Godot
if (to_point.z > end.z)
end.z = to_point.z;
- return new Rect3(begin, end - begin);
+ return new AABB(begin, end - begin);
}
- public float get_area()
+ public float GetArea()
{
return size.x * size.y * size.z;
}
- public Vector3 get_endpoint(int idx)
+ public Vector3 GetEndpoint(int idx)
{
switch (idx)
{
@@ -105,7 +105,7 @@ namespace Godot
}
}
- public Vector3 get_longest_axis()
+ public Vector3 GetLongestAxis()
{
Vector3 axis = new Vector3(1f, 0f, 0f);
float max_size = size.x;
@@ -125,7 +125,7 @@ namespace Godot
return axis;
}
- public Vector3.Axis get_longest_axis_index()
+ public Vector3.Axis GetLongestAxisIndex()
{
Vector3.Axis axis = Vector3.Axis.X;
float max_size = size.x;
@@ -145,7 +145,7 @@ namespace Godot
return axis;
}
- public float get_longest_axis_size()
+ public float GetLongestAxisSize()
{
float max_size = size.x;
@@ -158,7 +158,7 @@ namespace Godot
return max_size;
}
- public Vector3 get_shortest_axis()
+ public Vector3 GetShortestAxis()
{
Vector3 axis = new Vector3(1f, 0f, 0f);
float max_size = size.x;
@@ -178,7 +178,7 @@ namespace Godot
return axis;
}
- public Vector3.Axis get_shortest_axis_index()
+ public Vector3.Axis GetShortestAxisIndex()
{
Vector3.Axis axis = Vector3.Axis.X;
float max_size = size.x;
@@ -198,7 +198,7 @@ namespace Godot
return axis;
}
- public float get_shortest_axis_size()
+ public float GetShortestAxisSize()
{
float max_size = size.x;
@@ -211,7 +211,7 @@ namespace Godot
return max_size;
}
- public Vector3 get_support(Vector3 dir)
+ public Vector3 GetSupport(Vector3 dir)
{
Vector3 half_extents = size * 0.5f;
Vector3 ofs = position + half_extents;
@@ -222,9 +222,9 @@ namespace Godot
(dir.z > 0f) ? -half_extents.z : half_extents.z);
}
- public Rect3 grow(float by)
+ public AABB Grow(float by)
{
- Rect3 res = this;
+ AABB res = this;
res.position.x -= by;
res.position.y -= by;
@@ -236,17 +236,17 @@ namespace Godot
return res;
}
- public bool has_no_area()
+ public bool HasNoArea()
{
return size.x <= 0f || size.y <= 0f || size.z <= 0f;
}
- public bool has_no_surface()
+ public bool HasNoSurface()
{
return size.x <= 0f && size.y <= 0f && size.z <= 0f;
}
- public bool has_point(Vector3 point)
+ public bool HasPoint(Vector3 point)
{
if (point.x < position.x)
return false;
@@ -264,7 +264,7 @@ namespace Godot
return true;
}
- public Rect3 intersection(Rect3 with)
+ public AABB Intersection(AABB with)
{
Vector3 src_min = position;
Vector3 src_max = position + size;
@@ -275,7 +275,7 @@ namespace Godot
if (src_min.x > dst_max.x || src_max.x < dst_min.x)
{
- return new Rect3();
+ return new AABB();
}
else
{
@@ -285,7 +285,7 @@ namespace Godot
if (src_min.y > dst_max.y || src_max.y < dst_min.y)
{
- return new Rect3();
+ return new AABB();
}
else
{
@@ -295,7 +295,7 @@ namespace Godot
if (src_min.z > dst_max.z || src_max.z < dst_min.z)
{
- return new Rect3();
+ return new AABB();
}
else
{
@@ -303,10 +303,10 @@ namespace Godot
max.z = (src_max.z < dst_max.z) ? src_max.z : dst_max.z;
}
- return new Rect3(min, max - min);
+ return new AABB(min, max - min);
}
- public bool intersects(Rect3 with)
+ public bool Intersects(AABB with)
{
if (position.x >= (with.position.x + with.size.x))
return false;
@@ -324,7 +324,7 @@ namespace Godot
return true;
}
- public bool intersects_plane(Plane plane)
+ public bool IntersectsPlane(Plane plane)
{
Vector3[] points =
{
@@ -343,7 +343,7 @@ namespace Godot
for (int i = 0; i < 8; i++)
{
- if (plane.distance_to(points[i]) > 0)
+ if (plane.DistanceTo(points[i]) > 0)
over = true;
else
under = true;
@@ -352,7 +352,7 @@ namespace Godot
return under && over;
}
- public bool intersects_segment(Vector3 from, Vector3 to)
+ public bool IntersectsSegment(Vector3 from, Vector3 to)
{
float min = 0f;
float max = 1f;
@@ -398,7 +398,7 @@ namespace Godot
return true;
}
- public Rect3 merge(Rect3 with)
+ public AABB Merge(AABB with)
{
Vector3 beg_1 = position;
Vector3 beg_2 = with.position;
@@ -417,36 +417,36 @@ namespace Godot
(end_1.z > end_2.z) ? end_1.z : end_2.z
);
- return new Rect3(min, max - min);
+ return new AABB(min, max - min);
}
- public Rect3(Vector3 position, Vector3 size)
+ public AABB(Vector3 position, Vector3 size)
{
this.position = position;
this.size = size;
}
- public static bool operator ==(Rect3 left, Rect3 right)
+ public static bool operator ==(AABB left, AABB right)
{
return left.Equals(right);
}
- public static bool operator !=(Rect3 left, Rect3 right)
+ public static bool operator !=(AABB left, AABB right)
{
return !left.Equals(right);
}
public override bool Equals(object obj)
{
- if (obj is Rect3)
+ if (obj is AABB)
{
- return Equals((Rect3)obj);
+ return Equals((AABB)obj);
}
return false;
}
- public bool Equals(Rect3 other)
+ public bool Equals(AABB other)
{
return position == other.position && size == other.size;
}
diff --git a/modules/mono/glue/cs_files/Basis.cs b/modules/mono/glue/cs_files/Basis.cs
index c50e783349..ea92b1641b 100644
--- a/modules/mono/glue/cs_files/Basis.cs
+++ b/modules/mono/glue/cs_files/Basis.cs
@@ -56,9 +56,9 @@ namespace Godot
{
return new Vector3
(
- new Vector3(this[0, 0], this[1, 0], this[2, 0]).length(),
- new Vector3(this[0, 1], this[1, 1], this[2, 1]).length(),
- new Vector3(this[0, 2], this[1, 2], this[2, 2]).length()
+ new Vector3(this[0, 0], this[1, 0], this[2, 0]).Length(),
+ new Vector3(this[0, 1], this[1, 1], this[2, 1]).Length(),
+ new Vector3(this[0, 2], this[1, 2], this[2, 2]).Length()
);
}
}
@@ -133,7 +133,7 @@ namespace Godot
}
}
- internal static Basis create_from_axes(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis)
+ internal static Basis CreateFromAxes(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis)
{
return new Basis
(
@@ -143,21 +143,21 @@ namespace Godot
);
}
- public float determinant()
+ public float Determinant()
{
return this[0, 0] * (this[1, 1] * this[2, 2] - this[2, 1] * this[1, 2]) -
this[1, 0] * (this[0, 1] * this[2, 2] - this[2, 1] * this[0, 2]) +
this[2, 0] * (this[0, 1] * this[1, 2] - this[1, 1] * this[0, 2]);
}
- public Vector3 get_axis(int axis)
+ public Vector3 GetAxis(int axis)
{
return new Vector3(this[0, axis], this[1, axis], this[2, axis]);
}
- public Vector3 get_euler()
+ public Vector3 GetEuler()
{
- Basis m = this.orthonormalized();
+ Basis m = this.Orthonormalized();
Vector3 euler;
euler.z = 0.0f;
@@ -169,26 +169,26 @@ namespace Godot
{
if (mxy > -1.0f)
{
- euler.x = Mathf.asin(-mxy);
- euler.y = Mathf.atan2(m.x[2], m.z[2]);
- euler.z = Mathf.atan2(m.y[0], m.y[1]);
+ euler.x = Mathf.Asin(-mxy);
+ euler.y = Mathf.Atan2(m.x[2], m.z[2]);
+ euler.z = Mathf.Atan2(m.y[0], m.y[1]);
}
else
{
euler.x = Mathf.PI * 0.5f;
- euler.y = -Mathf.atan2(-m.x[1], m.x[0]);
+ euler.y = -Mathf.Atan2(-m.x[1], m.x[0]);
}
}
else
{
euler.x = -Mathf.PI * 0.5f;
- euler.y = -Mathf.atan2(m.x[1], m.x[0]);
+ euler.y = -Mathf.Atan2(m.x[1], m.x[0]);
}
return euler;
}
- public int get_orthogonal_index()
+ public int GetOrthogonalIndex()
{
Basis orth = this;
@@ -218,7 +218,7 @@ namespace Godot
return 0;
}
- public Basis inverse()
+ public Basis Inverse()
{
Basis inv = this;
@@ -259,27 +259,27 @@ namespace Godot
return inv;
}
- public Basis orthonormalized()
+ public Basis Orthonormalized()
{
- Vector3 xAxis = get_axis(0);
- Vector3 yAxis = get_axis(1);
- Vector3 zAxis = get_axis(2);
+ Vector3 xAxis = GetAxis(0);
+ Vector3 yAxis = GetAxis(1);
+ Vector3 zAxis = GetAxis(2);
- xAxis.normalize();
- yAxis = (yAxis - xAxis * (xAxis.dot(yAxis)));
- yAxis.normalize();
- zAxis = (zAxis - xAxis * (xAxis.dot(zAxis)) - yAxis * (yAxis.dot(zAxis)));
- zAxis.normalize();
+ xAxis.Normalize();
+ yAxis = (yAxis - xAxis * (xAxis.Dot(yAxis)));
+ yAxis.Normalize();
+ zAxis = (zAxis - xAxis * (xAxis.Dot(zAxis)) - yAxis * (yAxis.Dot(zAxis)));
+ zAxis.Normalize();
- return Basis.create_from_axes(xAxis, yAxis, zAxis);
+ return Basis.CreateFromAxes(xAxis, yAxis, zAxis);
}
- public Basis rotated(Vector3 axis, float phi)
+ public Basis Rotated(Vector3 axis, float phi)
{
return new Basis(axis, phi) * this;
}
- public Basis scaled(Vector3 scale)
+ public Basis Scaled(Vector3 scale)
{
Basis m = this;
@@ -296,22 +296,22 @@ namespace Godot
return m;
}
- public float tdotx(Vector3 with)
+ public float Tdotx(Vector3 with)
{
return this[0, 0] * with[0] + this[1, 0] * with[1] + this[2, 0] * with[2];
}
- public float tdoty(Vector3 with)
+ public float Tdoty(Vector3 with)
{
return this[0, 1] * with[0] + this[1, 1] * with[1] + this[2, 1] * with[2];
}
- public float tdotz(Vector3 with)
+ public float Tdotz(Vector3 with)
{
return this[0, 2] * with[0] + this[1, 2] * with[1] + this[2, 2] * with[2];
}
- public Basis transposed()
+ public Basis Transposed()
{
Basis tr = this;
@@ -330,17 +330,17 @@ namespace Godot
return tr;
}
- public Vector3 xform(Vector3 v)
+ public Vector3 Xform(Vector3 v)
{
return new Vector3
(
- this[0].dot(v),
- this[1].dot(v),
- this[2].dot(v)
+ this[0].Dot(v),
+ this[1].Dot(v),
+ this[2].Dot(v)
);
}
- public Vector3 xform_inv(Vector3 v)
+ public Vector3 XformInv(Vector3 v)
{
return new Vector3
(
@@ -354,7 +354,7 @@ namespace Godot
float trace = x[0] + y[1] + z[2];
if (trace > 0.0f) {
- float s = Mathf.sqrt(trace + 1.0f) * 2f;
+ float s = Mathf.Sqrt(trace + 1.0f) * 2f;
float inv_s = 1f / s;
return new Quat(
(z[1] - y[2]) * inv_s,
@@ -363,7 +363,7 @@ namespace Godot
s * 0.25f
);
} else if (x[0] > y[1] && x[0] > z[2]) {
- float s = Mathf.sqrt(x[0] - y[1] - z[2] + 1.0f) * 2f;
+ float s = Mathf.Sqrt(x[0] - y[1] - z[2] + 1.0f) * 2f;
float inv_s = 1f / s;
return new Quat(
s * 0.25f,
@@ -372,7 +372,7 @@ namespace Godot
(z[1] - y[2]) * inv_s
);
} else if (y[1] > z[2]) {
- float s = Mathf.sqrt(-x[0] + y[1] - z[2] + 1.0f) * 2f;
+ float s = Mathf.Sqrt(-x[0] + y[1] - z[2] + 1.0f) * 2f;
float inv_s = 1f / s;
return new Quat(
(x[1] + y[0]) * inv_s,
@@ -381,7 +381,7 @@ namespace Godot
(x[2] - z[0]) * inv_s
);
} else {
- float s = Mathf.sqrt(-x[0] - y[1] + z[2] + 1.0f) * 2f;
+ float s = Mathf.Sqrt(-x[0] - y[1] + z[2] + 1.0f) * 2f;
float inv_s = 1f / s;
return new Quat(
(x[2] + z[0]) * inv_s,
@@ -394,7 +394,7 @@ namespace Godot
public Basis(Quat quat)
{
- float s = 2.0f / quat.length_squared();
+ float s = 2.0f / quat.LengthSquared();
float xs = quat.x * s;
float ys = quat.y * s;
@@ -418,8 +418,8 @@ namespace Godot
{
Vector3 axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z);
- float cosine = Mathf.cos(phi);
- float sine = Mathf.sin(phi);
+ float cosine = Mathf.Cos(phi);
+ float sine = Mathf.Sin(phi);
this.x = new Vector3
(
@@ -461,9 +461,9 @@ namespace Godot
{
return new Basis
(
- right.tdotx(left[0]), right.tdoty(left[0]), right.tdotz(left[0]),
- right.tdotx(left[1]), right.tdoty(left[1]), right.tdotz(left[1]),
- right.tdotx(left[2]), right.tdoty(left[2]), right.tdotz(left[2])
+ right.Tdotx(left[0]), right.Tdoty(left[0]), right.Tdotz(left[0]),
+ right.Tdotx(left[1]), right.Tdoty(left[1]), right.Tdotz(left[1]),
+ right.Tdotx(left[2]), right.Tdoty(left[2]), right.Tdotz(left[2])
);
}
diff --git a/modules/mono/glue/cs_files/Color.cs b/modules/mono/glue/cs_files/Color.cs
index 0a00f83d47..db0e1fb744 100644
--- a/modules/mono/glue/cs_files/Color.cs
+++ b/modules/mono/glue/cs_files/Color.cs
@@ -45,8 +45,8 @@ namespace Godot
{
get
{
- float max = Mathf.max(r, Mathf.max(g, b));
- float min = Mathf.min(r, Mathf.min(g, b));
+ float max = Mathf.Max(r, Mathf.Max(g, b));
+ float min = Mathf.Min(r, Mathf.Min(g, b));
float delta = max - min;
@@ -71,7 +71,7 @@ namespace Godot
}
set
{
- this = from_hsv(value, s, v);
+ this = FromHsv(value, s, v);
}
}
@@ -79,8 +79,8 @@ namespace Godot
{
get
{
- float max = Mathf.max(r, Mathf.max(g, b));
- float min = Mathf.min(r, Mathf.min(g, b));
+ float max = Mathf.Max(r, Mathf.Max(g, b));
+ float min = Mathf.Min(r, Mathf.Min(g, b));
float delta = max - min;
@@ -88,7 +88,7 @@ namespace Godot
}
set
{
- this = from_hsv(h, value, v);
+ this = FromHsv(h, value, v);
}
}
@@ -96,11 +96,11 @@ namespace Godot
{
get
{
- return Mathf.max(r, Mathf.max(g, b));
+ return Mathf.Max(r, Mathf.Max(g, b));
}
set
{
- this = from_hsv(h, s, value);
+ this = FromHsv(h, s, value);
}
}
@@ -154,10 +154,10 @@ namespace Godot
}
}
- public static void to_hsv(Color color, out float hue, out float saturation, out float value)
+ public static void ToHsv(Color color, out float hue, out float saturation, out float value)
{
- int max = Mathf.max(color.r8, Mathf.max(color.g8, color.b8));
- int min = Mathf.min(color.r8, Mathf.min(color.g8, color.b8));
+ int max = Mathf.Max(color.r8, Mathf.Max(color.g8, color.b8));
+ int min = Mathf.Min(color.r8, Mathf.Min(color.g8, color.b8));
float delta = max - min;
@@ -184,7 +184,7 @@ namespace Godot
value = max / 255f;
}
- public static Color from_hsv(float hue, float saturation, float value, float alpha = 1.0f)
+ public static Color FromHsv(float hue, float saturation, float value, float alpha = 1.0f)
{
if (saturation == 0)
{
@@ -221,7 +221,7 @@ namespace Godot
}
}
- public Color blend(Color over)
+ public Color Blend(Color over)
{
Color res;
@@ -242,7 +242,7 @@ namespace Godot
return res;
}
- public Color contrasted()
+ public Color Contrasted()
{
return new Color(
(r + 0.5f) % 1.0f,
@@ -251,12 +251,12 @@ namespace Godot
);
}
- public float gray()
+ public float Gray()
{
return (r + g + b) / 3.0f;
}
- public Color inverted()
+ public Color Inverted()
{
return new Color(
1.0f - r,
@@ -265,7 +265,7 @@ namespace Godot
);
}
- public Color linear_interpolate(Color b, float t)
+ public Color LinearInterpolate(Color b, float t)
{
Color res = this;
@@ -277,7 +277,7 @@ namespace Godot
return res;
}
- public int to_32()
+ public int To32()
{
int c = (byte)(a * 255);
c <<= 8;
@@ -290,7 +290,7 @@ namespace Godot
return c;
}
- public int to_ARGB32()
+ public int ToArgb32()
{
int c = (byte)(a * 255);
c <<= 8;
@@ -303,7 +303,7 @@ namespace Godot
return c;
}
- public string to_html(bool include_alpha = true)
+ public string ToHtml(bool include_alpha = true)
{
String txt = string.Empty;
@@ -375,7 +375,7 @@ namespace Godot
private String _to_hex(float val)
{
- int v = (int)Mathf.clamp(val * 255.0f, 0, 255);
+ int v = (int)Mathf.Clamp(val * 255.0f, 0, 255);
string ret = string.Empty;
@@ -396,7 +396,7 @@ namespace Godot
return ret;
}
- internal static bool html_is_valid(string color)
+ internal static bool HtmlIsValid(string color)
{
if (color.Length == 0)
return false;
diff --git a/modules/mono/glue/cs_files/Error.cs b/modules/mono/glue/cs_files/Error.cs
index 3f4a92603d..dee4b88f74 100644
--- a/modules/mono/glue/cs_files/Error.cs
+++ b/modules/mono/glue/cs_files/Error.cs
@@ -42,7 +42,6 @@ namespace Godot
ERR_CYCLIC_LINK = 40,
ERR_BUSY = 44,
ERR_HELP = 46,
- ERR_BUG = 47,
- ERR_WTF = 49
+ ERR_BUG = 47
}
}
diff --git a/modules/mono/glue/cs_files/GD.cs b/modules/mono/glue/cs_files/GD.cs
index 40a42d23b4..99fc289161 100644
--- a/modules/mono/glue/cs_files/GD.cs
+++ b/modules/mono/glue/cs_files/GD.cs
@@ -6,32 +6,32 @@ namespace Godot
{
/*{GodotGlobalConstants}*/
- public static object bytes2var(byte[] bytes)
+ public static object Bytes2Var(byte[] bytes)
{
return NativeCalls.godot_icall_Godot_bytes2var(bytes);
}
- public static object convert(object what, int type)
+ public static object Convert(object what, int type)
{
return NativeCalls.godot_icall_Godot_convert(what, type);
}
- public static float db2linear(float db)
+ public static float Db2Linear(float db)
{
return (float)Math.Exp(db * 0.11512925464970228420089957273422);
}
- public static float dectime(float value, float amount, float step)
+ public static float Dectime(float value, float amount, float step)
{
float sgn = value < 0 ? -1.0f : 1.0f;
- float val = Mathf.abs(value);
+ float val = Mathf.Abs(value);
val -= amount * step;
if (val < 0.0f)
val = 0.0f;
return val * sgn;
}
- public static FuncRef funcref(Object instance, string funcname)
+ public static FuncRef Funcref(Object instance, string funcname)
{
var ret = new FuncRef();
ret.SetInstance(instance);
@@ -39,57 +39,57 @@ namespace Godot
return ret;
}
- public static int hash(object var)
+ public static int Hash(object var)
{
return NativeCalls.godot_icall_Godot_hash(var);
}
- public static Object instance_from_id(int instance_id)
+ public static Object InstanceFromId(int instanceId)
{
- return NativeCalls.godot_icall_Godot_instance_from_id(instance_id);
+ return NativeCalls.godot_icall_Godot_instance_from_id(instanceId);
}
- public static double linear2db(double linear)
+ public static double Linear2Db(double linear)
{
return Math.Log(linear) * 8.6858896380650365530225783783321;
}
- public static Resource load(string path)
+ public static Resource Load(string path)
{
return ResourceLoader.Load(path);
}
- public static void print(params object[] what)
+ public static void Print(params object[] what)
{
NativeCalls.godot_icall_Godot_print(what);
}
- public static void print_stack()
+ public static void PrintStack()
{
- print(System.Environment.StackTrace);
+ Print(System.Environment.StackTrace);
}
- public static void printerr(params object[] what)
+ public static void Printerr(params object[] what)
{
NativeCalls.godot_icall_Godot_printerr(what);
}
- public static void printraw(params object[] what)
+ public static void Printraw(params object[] what)
{
NativeCalls.godot_icall_Godot_printraw(what);
}
- public static void prints(params object[] what)
+ public static void Prints(params object[] what)
{
NativeCalls.godot_icall_Godot_prints(what);
}
- public static void printt(params object[] what)
+ public static void Printt(params object[] what)
{
NativeCalls.godot_icall_Godot_printt(what);
}
- public static int[] range(int length)
+ public static int[] Range(int length)
{
int[] ret = new int[length];
@@ -101,7 +101,7 @@ namespace Godot
return ret;
}
- public static int[] range(int from, int to)
+ public static int[] Range(int from, int to)
{
if (to < from)
return new int[0];
@@ -116,7 +116,7 @@ namespace Godot
return ret;
}
- public static int[] range(int from, int to, int increment)
+ public static int[] Range(int from, int to, int increment)
{
if (to < from && increment > 0)
return new int[0];
@@ -153,37 +153,37 @@ namespace Godot
return ret;
}
- public static void seed(int seed)
+ public static void Seed(int seed)
{
NativeCalls.godot_icall_Godot_seed(seed);
}
- public static string str(params object[] what)
+ public static string Str(params object[] what)
{
return NativeCalls.godot_icall_Godot_str(what);
}
- public static object str2var(string str)
+ public static object Str2Var(string str)
{
return NativeCalls.godot_icall_Godot_str2var(str);
}
- public static bool type_exists(string type)
+ public static bool TypeExists(string type)
{
return NativeCalls.godot_icall_Godot_type_exists(type);
}
- public static byte[] var2bytes(object var)
+ public static byte[] Var2Bytes(object var)
{
return NativeCalls.godot_icall_Godot_var2bytes(var);
}
- public static string var2str(object var)
+ public static string Var2Str(object var)
{
return NativeCalls.godot_icall_Godot_var2str(var);
}
- public static WeakRef weakref(Object obj)
+ public static WeakRef Weakref(Object obj)
{
return NativeCalls.godot_icall_Godot_weakref(Object.GetPtr(obj));
}
diff --git a/modules/mono/glue/cs_files/Mathf.cs b/modules/mono/glue/cs_files/Mathf.cs
index cb0eb1acdd..6951ace4fc 100644
--- a/modules/mono/glue/cs_files/Mathf.cs
+++ b/modules/mono/glue/cs_files/Mathf.cs
@@ -10,37 +10,42 @@ namespace Godot
private const float Deg2RadConst = 0.0174532924f;
private const float Rad2DegConst = 57.29578f;
- public static float abs(float s)
+ public static float Abs(float s)
{
return Math.Abs(s);
}
- public static float acos(float s)
+ public static float Acos(float s)
{
return (float)Math.Acos(s);
}
- public static float asin(float s)
+ public static float Asin(float s)
{
return (float)Math.Asin(s);
}
- public static float atan(float s)
+ public static float Atan(float s)
{
return (float)Math.Atan(s);
}
- public static float atan2(float x, float y)
+ public static float Atan2(float x, float y)
{
return (float)Math.Atan2(x, y);
}
- public static float ceil(float s)
+ public static Vector2 Cartesian2Polar(float x, float y)
+ {
+ return new Vector2(Sqrt(x * x + y * y), Atan2(y, x));
+ }
+
+ public static float Ceil(float s)
{
return (float)Math.Ceiling(s);
}
- public static float clamp(float val, float min, float max)
+ public static float Clamp(float val, float min, float max)
{
if (val < min)
{
@@ -54,32 +59,32 @@ namespace Godot
return val;
}
- public static float cos(float s)
+ public static float Cos(float s)
{
return (float)Math.Cos(s);
}
- public static float cosh(float s)
+ public static float Cosh(float s)
{
return (float)Math.Cosh(s);
}
- public static int decimals(float step)
+ public static int Decimals(float step)
{
- return decimals(step);
+ return Decimals(step);
}
- public static int decimals(decimal step)
+ public static int Decimals(decimal step)
{
return BitConverter.GetBytes(decimal.GetBits(step)[3])[2];
}
- public static float deg2rad(float deg)
+ public static float Deg2Rad(float deg)
{
return deg * Deg2RadConst;
}
- public static float ease(float s, float curve)
+ public static float Ease(float s, float curve)
{
if (s < 0f)
{
@@ -94,35 +99,35 @@ namespace Godot
{
if (curve < 1.0f)
{
- return 1.0f - pow(1.0f - s, 1.0f / curve);
+ return 1.0f - Pow(1.0f - s, 1.0f / curve);
}
- return pow(s, curve);
+ return Pow(s, curve);
}
else if (curve < 0f)
{
if (s < 0.5f)
{
- return pow(s * 2.0f, -curve) * 0.5f;
+ return Pow(s * 2.0f, -curve) * 0.5f;
}
- return (1.0f - pow(1.0f - (s - 0.5f) * 2.0f, -curve)) * 0.5f + 0.5f;
+ return (1.0f - Pow(1.0f - (s - 0.5f) * 2.0f, -curve)) * 0.5f + 0.5f;
}
return 0f;
}
- public static float exp(float s)
+ public static float Exp(float s)
{
return (float)Math.Exp(s);
}
- public static float floor(float s)
+ public static float Floor(float s)
{
return (float)Math.Floor(s);
}
- public static float fposmod(float x, float y)
+ public static float Fposmod(float x, float y)
{
if (x >= 0f)
{
@@ -134,37 +139,37 @@ namespace Godot
}
}
- public static float lerp(float from, float to, float weight)
+ public static float Lerp(float from, float to, float weight)
{
- return from + (to - from) * clamp(weight, 0f, 1f);
+ return from + (to - from) * Clamp(weight, 0f, 1f);
}
- public static float log(float s)
+ public static float Log(float s)
{
return (float)Math.Log(s);
}
- public static int max(int a, int b)
+ public static int Max(int a, int b)
{
return (a > b) ? a : b;
}
- public static float max(float a, float b)
+ public static float Max(float a, float b)
{
return (a > b) ? a : b;
}
- public static int min(int a, int b)
+ public static int Min(int a, int b)
{
return (a < b) ? a : b;
}
- public static float min(float a, float b)
+ public static float Min(float a, float b)
{
return (a < b) ? a : b;
}
- public static int nearest_po2(int val)
+ public static int NearestPo2(int val)
{
val--;
val |= val >> 1;
@@ -176,57 +181,62 @@ namespace Godot
return val;
}
- public static float pow(float x, float y)
+ public static Vector2 Polar2Cartesian(float r, float th)
+ {
+ return new Vector2(r * Cos(th), r * Sin(th));
+ }
+
+ public static float Pow(float x, float y)
{
return (float)Math.Pow(x, y);
}
- public static float rad2deg(float rad)
+ public static float Rad2Deg(float rad)
{
return rad * Rad2DegConst;
}
- public static float round(float s)
+ public static float Round(float s)
{
return (float)Math.Round(s);
}
- public static float sign(float s)
+ public static float Sign(float s)
{
return (s < 0f) ? -1f : 1f;
}
- public static float sin(float s)
+ public static float Sin(float s)
{
return (float)Math.Sin(s);
}
- public static float sinh(float s)
+ public static float Sinh(float s)
{
return (float)Math.Sinh(s);
}
- public static float sqrt(float s)
+ public static float Sqrt(float s)
{
return (float)Math.Sqrt(s);
}
- public static float stepify(float s, float step)
+ public static float Stepify(float s, float step)
{
if (step != 0f)
{
- s = floor(s / step + 0.5f) * step;
+ s = Floor(s / step + 0.5f) * step;
}
return s;
}
- public static float tan(float s)
+ public static float Tan(float s)
{
return (float)Math.Tan(s);
}
- public static float tanh(float s)
+ public static float Tanh(float s)
{
return (float)Math.Tanh(s);
}
diff --git a/modules/mono/glue/cs_files/Plane.cs b/modules/mono/glue/cs_files/Plane.cs
index 37f70aca1e..6365e71826 100644
--- a/modules/mono/glue/cs_files/Plane.cs
+++ b/modules/mono/glue/cs_files/Plane.cs
@@ -52,44 +52,44 @@ namespace Godot
}
}
- public float distance_to(Vector3 point)
+ public float DistanceTo(Vector3 point)
{
- return normal.dot(point) - d;
+ return normal.Dot(point) - d;
}
- public Vector3 get_any_point()
+ public Vector3 GetAnyPoint()
{
return normal * d;
}
- public bool has_point(Vector3 point, float epsilon = Mathf.Epsilon)
+ public bool HasPoint(Vector3 point, float epsilon = Mathf.Epsilon)
{
- float dist = normal.dot(point) - d;
- return Mathf.abs(dist) <= epsilon;
+ float dist = normal.Dot(point) - d;
+ return Mathf.Abs(dist) <= epsilon;
}
- public Vector3 intersect_3(Plane b, Plane c)
+ public Vector3 Intersect3(Plane b, Plane c)
{
- float denom = normal.cross(b.normal).dot(c.normal);
+ float denom = normal.Cross(b.normal).Dot(c.normal);
- if (Mathf.abs(denom) <= Mathf.Epsilon)
+ if (Mathf.Abs(denom) <= Mathf.Epsilon)
return new Vector3();
- Vector3 result = (b.normal.cross(c.normal) * this.d) +
- (c.normal.cross(normal) * b.d) +
- (normal.cross(b.normal) * c.d);
+ Vector3 result = (b.normal.Cross(c.normal) * this.d) +
+ (c.normal.Cross(normal) * b.d) +
+ (normal.Cross(b.normal) * c.d);
return result / denom;
}
- public Vector3 intersect_ray(Vector3 from, Vector3 dir)
+ public Vector3 IntersectRay(Vector3 from, Vector3 dir)
{
- float den = normal.dot(dir);
+ float den = normal.Dot(dir);
- if (Mathf.abs(den) <= Mathf.Epsilon)
+ if (Mathf.Abs(den) <= Mathf.Epsilon)
return new Vector3();
- float dist = (normal.dot(from) - d) / den;
+ float dist = (normal.Dot(from) - d) / den;
// This is a ray, before the emiting pos (from) does not exist
if (dist > Mathf.Epsilon)
@@ -98,15 +98,15 @@ namespace Godot
return from + dir * -dist;
}
- public Vector3 intersect_segment(Vector3 begin, Vector3 end)
+ public Vector3 IntersectSegment(Vector3 begin, Vector3 end)
{
Vector3 segment = begin - end;
- float den = normal.dot(segment);
+ float den = normal.Dot(segment);
- if (Mathf.abs(den) <= Mathf.Epsilon)
+ if (Mathf.Abs(den) <= Mathf.Epsilon)
return new Vector3();
- float dist = (normal.dot(begin) - d) / den;
+ float dist = (normal.Dot(begin) - d) / den;
if (dist < -Mathf.Epsilon || dist > (1.0f + Mathf.Epsilon))
return new Vector3();
@@ -114,14 +114,14 @@ namespace Godot
return begin + segment * -dist;
}
- public bool is_point_over(Vector3 point)
+ public bool IsPointOver(Vector3 point)
{
- return normal.dot(point) > d;
+ return normal.Dot(point) > d;
}
- public Plane normalized()
+ public Plane Normalized()
{
- float len = normal.length();
+ float len = normal.Length();
if (len == 0)
return new Plane(0, 0, 0, 0);
@@ -129,9 +129,9 @@ namespace Godot
return new Plane(normal / len, d / len);
}
- public Vector3 project(Vector3 point)
+ public Vector3 Project(Vector3 point)
{
- return point - normal * distance_to(point);
+ return point - normal * DistanceTo(point);
}
public Plane(float a, float b, float c, float d)
@@ -148,9 +148,9 @@ namespace Godot
public Plane(Vector3 v1, Vector3 v2, Vector3 v3)
{
- normal = (v1 - v3).cross(v1 - v2);
- normal.normalize();
- d = normal.dot(v1);
+ normal = (v1 - v3).Cross(v1 - v2);
+ normal.Normalize();
+ d = normal.Dot(v1);
}
public static Plane operator -(Plane plane)
diff --git a/modules/mono/glue/cs_files/Quat.cs b/modules/mono/glue/cs_files/Quat.cs
index 9b4b7fb297..c0ac41c5d7 100644
--- a/modules/mono/glue/cs_files/Quat.cs
+++ b/modules/mono/glue/cs_files/Quat.cs
@@ -58,40 +58,40 @@ namespace Godot
}
}
- public Quat cubic_slerp(Quat b, Quat preA, Quat postB, float t)
+ public Quat CubicSlerp(Quat b, Quat preA, Quat postB, float t)
{
float t2 = (1.0f - t) * t * 2f;
- Quat sp = slerp(b, t);
- Quat sq = preA.slerpni(postB, t);
- return sp.slerpni(sq, t2);
+ Quat sp = Slerp(b, t);
+ Quat sq = preA.Slerpni(postB, t);
+ return sp.Slerpni(sq, t2);
}
- public float dot(Quat b)
+ public float Dot(Quat b)
{
return x * b.x + y * b.y + z * b.z + w * b.w;
}
- public Quat inverse()
+ public Quat Inverse()
{
return new Quat(-x, -y, -z, w);
}
- public float length()
+ public float Length()
{
- return Mathf.sqrt(length_squared());
+ return Mathf.Sqrt(LengthSquared());
}
- public float length_squared()
+ public float LengthSquared()
{
- return dot(this);
+ return Dot(this);
}
- public Quat normalized()
+ public Quat Normalized()
{
- return this / length();
+ return this / Length();
}
- public void set(float x, float y, float z, float w)
+ public void Set(float x, float y, float z, float w)
{
this.x = x;
this.y = y;
@@ -99,7 +99,7 @@ namespace Godot
this.w = w;
}
- public Quat slerp(Quat b, float t)
+ public Quat Slerp(Quat b, float t)
{
// Calculate cosine
float cosom = x * b.x + y * b.y + z * b.z + w * b.w;
@@ -128,10 +128,10 @@ namespace Godot
if ((1.0 - cosom) > Mathf.Epsilon)
{
// Standard case (Slerp)
- float omega = Mathf.acos(cosom);
- sinom = Mathf.sin(omega);
- scale0 = Mathf.sin((1.0f - t) * omega) / sinom;
- scale1 = Mathf.sin(t * omega) / sinom;
+ float omega = Mathf.Acos(cosom);
+ sinom = Mathf.Sin(omega);
+ scale0 = Mathf.Sin((1.0f - t) * omega) / sinom;
+ scale1 = Mathf.Sin(t * omega) / sinom;
}
else
{
@@ -150,19 +150,19 @@ namespace Godot
);
}
- public Quat slerpni(Quat b, float t)
+ public Quat Slerpni(Quat b, float t)
{
- float dot = this.dot(b);
+ float dot = this.Dot(b);
- if (Mathf.abs(dot) > 0.9999f)
+ if (Mathf.Abs(dot) > 0.9999f)
{
return this;
}
- float theta = Mathf.acos(dot);
- float sinT = 1.0f / Mathf.sin(theta);
- float newFactor = Mathf.sin(t * theta) * sinT;
- float invFactor = Mathf.sin((1.0f - t) * theta) * sinT;
+ float theta = Mathf.Acos(dot);
+ float sinT = 1.0f / Mathf.Sin(theta);
+ float newFactor = Mathf.Sin(t * theta) * sinT;
+ float invFactor = Mathf.Sin((1.0f - t) * theta) * sinT;
return new Quat
(
@@ -173,10 +173,10 @@ namespace Godot
);
}
- public Vector3 xform(Vector3 v)
+ public Vector3 Xform(Vector3 v)
{
Quat q = this * v;
- q *= this.inverse();
+ q *= this.Inverse();
return new Vector3(q.x, q.y, q.z);
}
@@ -190,7 +190,7 @@ namespace Godot
public Quat(Vector3 axis, float angle)
{
- float d = axis.length();
+ float d = axis.Length();
if (d == 0f)
{
@@ -201,12 +201,12 @@ namespace Godot
}
else
{
- float s = Mathf.sin(angle * 0.5f) / d;
+ float s = Mathf.Sin(angle * 0.5f) / d;
x = axis.x * s;
y = axis.y * s;
z = axis.z * s;
- w = Mathf.cos(angle * 0.5f);
+ w = Mathf.Cos(angle * 0.5f);
}
}
diff --git a/modules/mono/glue/cs_files/Rect2.cs b/modules/mono/glue/cs_files/Rect2.cs
index 019342134a..f2718d7b7a 100644
--- a/modules/mono/glue/cs_files/Rect2.cs
+++ b/modules/mono/glue/cs_files/Rect2.cs
@@ -28,36 +28,36 @@ namespace Godot
public float Area
{
- get { return get_area(); }
+ get { return GetArea(); }
}
- public Rect2 clip(Rect2 b)
+ public Rect2 Clip(Rect2 b)
{
Rect2 newRect = b;
- if (!intersects(newRect))
+ if (!Intersects(newRect))
return new Rect2();
- newRect.position.x = Mathf.max(b.position.x, position.x);
- newRect.position.y = Mathf.max(b.position.y, position.y);
+ newRect.position.x = Mathf.Max(b.position.x, position.x);
+ newRect.position.y = Mathf.Max(b.position.y, position.y);
Vector2 bEnd = b.position + b.size;
Vector2 end = position + size;
- newRect.size.x = Mathf.min(bEnd.x, end.x) - newRect.position.x;
- newRect.size.y = Mathf.min(bEnd.y, end.y) - newRect.position.y;
+ newRect.size.x = Mathf.Min(bEnd.x, end.x) - newRect.position.x;
+ newRect.size.y = Mathf.Min(bEnd.y, end.y) - newRect.position.y;
return newRect;
}
- public bool encloses(Rect2 b)
+ public bool Encloses(Rect2 b)
{
return (b.position.x >= position.x) && (b.position.y >= position.y) &&
((b.position.x + b.size.x) < (position.x + size.x)) &&
((b.position.y + b.size.y) < (position.y + size.y));
}
- public Rect2 expand(Vector2 to)
+ public Rect2 Expand(Vector2 to)
{
Rect2 expanded = this;
@@ -80,12 +80,12 @@ namespace Godot
return expanded;
}
- public float get_area()
+ public float GetArea()
{
return size.x * size.y;
}
- public Rect2 grow(float by)
+ public Rect2 Grow(float by)
{
Rect2 g = this;
@@ -97,7 +97,7 @@ namespace Godot
return g;
}
- public Rect2 grow_individual(float left, float top, float right, float bottom)
+ public Rect2 GrowIndividual(float left, float top, float right, float bottom)
{
Rect2 g = this;
@@ -109,11 +109,11 @@ namespace Godot
return g;
}
- public Rect2 grow_margin(int margin, float by)
+ public Rect2 GrowMargin(int margin, float by)
{
Rect2 g = this;
- g.grow_individual((GD.MARGIN_LEFT == margin) ? by : 0,
+ g.GrowIndividual((GD.MARGIN_LEFT == margin) ? by : 0,
(GD.MARGIN_TOP == margin) ? by : 0,
(GD.MARGIN_RIGHT == margin) ? by : 0,
(GD.MARGIN_BOTTOM == margin) ? by : 0);
@@ -121,12 +121,12 @@ namespace Godot
return g;
}
- public bool has_no_area()
+ public bool HasNoArea()
{
return size.x <= 0 || size.y <= 0;
}
- public bool has_point(Vector2 point)
+ public bool HasPoint(Vector2 point)
{
if (point.x < position.x)
return false;
@@ -141,7 +141,7 @@ namespace Godot
return true;
}
- public bool intersects(Rect2 b)
+ public bool Intersects(Rect2 b)
{
if (position.x > (b.position.x + b.size.x))
return false;
@@ -155,15 +155,15 @@ namespace Godot
return true;
}
- public Rect2 merge(Rect2 b)
+ public Rect2 Merge(Rect2 b)
{
Rect2 newRect;
- newRect.position.x = Mathf.min(b.position.x, position.x);
- newRect.position.y = Mathf.min(b.position.y, position.y);
+ newRect.position.x = Mathf.Min(b.position.x, position.x);
+ newRect.position.y = Mathf.Min(b.position.y, position.y);
- newRect.size.x = Mathf.max(b.position.x + b.size.x, position.x + size.x);
- newRect.size.y = Mathf.max(b.position.y + b.size.y, position.y + size.y);
+ newRect.size.x = Mathf.Max(b.position.x + b.size.x, position.x + size.x);
+ newRect.size.y = Mathf.Max(b.position.y + b.size.y, position.y + size.y);
newRect.size = newRect.size - newRect.position; // Make relative again
diff --git a/modules/mono/glue/cs_files/StringExtensions.cs b/modules/mono/glue/cs_files/StringExtensions.cs
index 96041827aa..5c3ceff97d 100644
--- a/modules/mono/glue/cs_files/StringExtensions.cs
+++ b/modules/mono/glue/cs_files/StringExtensions.cs
@@ -10,15 +10,15 @@ namespace Godot
{
public static class StringExtensions
{
- private static int get_slice_count(this string instance, string splitter)
+ private static int GetSliceCount(this string instance, string splitter)
{
- if (instance.empty() || splitter.empty())
+ if (instance.Empty() || splitter.Empty())
return 0;
int pos = 0;
int slices = 1;
- while ((pos = instance.find(splitter, pos)) >= 0)
+ while ((pos = instance.Find(splitter, pos)) >= 0)
{
slices++;
pos += splitter.Length;
@@ -27,9 +27,9 @@ namespace Godot
return slices;
}
- private static string get_slicec(this string instance, char splitter, int slice)
+ private static string GetSlicec(this string instance, char splitter, int slice)
{
- if (!instance.empty() && slice >= 0)
+ if (!instance.Empty() && slice >= 0)
{
int i = 0;
int prev = 0;
@@ -60,7 +60,7 @@ namespace Godot
// <summary>
// If the string is a path to a file, return the path to the file without the extension.
// </summary>
- public static string basename(this string instance)
+ public static string Basename(this string instance)
{
int index = instance.LastIndexOf('.');
@@ -73,7 +73,7 @@ namespace Godot
// <summary>
// Return true if the strings begins with the given string.
// </summary>
- public static bool begins_with(this string instance, string text)
+ public static bool BeginsWith(this string instance, string text)
{
return instance.StartsWith(text);
}
@@ -81,7 +81,7 @@ namespace Godot
// <summary>
// Return the bigrams (pairs of consecutive letters) of this string.
// </summary>
- public static string[] bigrams(this string instance)
+ public static string[] Bigrams(this string instance)
{
string[] b = new string[instance.Length - 1];
@@ -96,7 +96,7 @@ namespace Godot
// <summary>
// Return a copy of the string with special characters escaped using the C language standard.
// </summary>
- public static string c_escape(this string instance)
+ public static string CEscape(this string instance)
{
StringBuilder sb = new StringBuilder(string.Copy(instance));
@@ -118,7 +118,7 @@ namespace Godot
// <summary>
// Return a copy of the string with escaped characters replaced by their meanings according to the C language standard.
// </summary>
- public static string c_unescape(this string instance)
+ public static string CUnescape(this string instance)
{
StringBuilder sb = new StringBuilder(string.Copy(instance));
@@ -140,14 +140,14 @@ namespace Godot
// <summary>
// Change the case of some letters. Replace underscores with spaces, convert all letters to lowercase then capitalize first and every letter following the space character. For [code]capitalize camelCase mixed_with_underscores[/code] it will return [code]Capitalize Camelcase Mixed With Underscores[/code].
// </summary>
- public static string capitalize(this string instance)
+ public static string Capitalize(this string instance)
{
string aux = instance.Replace("_", " ").ToLower();
string cap = string.Empty;
- for (int i = 0; i < aux.get_slice_count(" "); i++)
+ for (int i = 0; i < aux.GetSliceCount(" "); i++)
{
- string slice = aux.get_slicec(' ', i);
+ string slice = aux.GetSlicec(' ', i);
if (slice.Length > 0)
{
slice = char.ToUpper(slice[0]) + slice.Substring(1);
@@ -163,12 +163,12 @@ namespace Godot
// <summary>
// Perform a case-sensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater.
// </summary>
- public static int casecmp_to(this string instance, string to)
+ public static int CasecmpTo(this string instance, string to)
{
- if (instance.empty())
- return to.empty() ? 0 : -1;
+ if (instance.Empty())
+ return to.Empty() ? 0 : -1;
- if (to.empty())
+ if (to.Empty())
return 1;
int instance_idx = 0;
@@ -195,7 +195,7 @@ namespace Godot
// <summary>
// Return true if the string is empty.
// </summary>
- public static bool empty(this string instance)
+ public static bool Empty(this string instance)
{
return string.IsNullOrEmpty(instance);
}
@@ -203,7 +203,7 @@ namespace Godot
// <summary>
// Return true if the strings ends with the given string.
// </summary>
- public static bool ends_with(this string instance, string text)
+ public static bool EndsWith(this string instance, string text)
{
return instance.EndsWith(text);
}
@@ -211,7 +211,7 @@ namespace Godot
// <summary>
// Erase [code]chars[/code] characters from the string starting from [code]pos[/code].
// </summary>
- public static void erase(this StringBuilder instance, int pos, int chars)
+ public static void Erase(this StringBuilder instance, int pos, int chars)
{
instance.Remove(pos, chars);
}
@@ -219,9 +219,9 @@ namespace Godot
// <summary>
// If the string is a path to a file, return the extension.
// </summary>
- public static string extension(this string instance)
+ public static string Extension(this string instance)
{
- int pos = instance.find_last(".");
+ int pos = instance.FindLast(".");
if (pos < 0)
return instance;
@@ -232,7 +232,7 @@ namespace Godot
// <summary>
// Find the first occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
// </summary>
- public static int find(this string instance, string what, int from = 0)
+ public static int Find(this string instance, string what, int from = 0)
{
return instance.IndexOf(what, StringComparison.OrdinalIgnoreCase);
}
@@ -240,7 +240,7 @@ namespace Godot
// <summary>
// Find the last occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
// </summary>
- public static int find_last(this string instance, string what)
+ public static int FindLast(this string instance, string what)
{
return instance.LastIndexOf(what, StringComparison.OrdinalIgnoreCase);
}
@@ -248,7 +248,7 @@ namespace Godot
// <summary>
// Find the first occurrence of a substring but search as case-insensitive, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
// </summary>
- public static int findn(this string instance, string what, int from = 0)
+ public static int FindN(this string instance, string what, int from = 0)
{
return instance.IndexOf(what, StringComparison.Ordinal);
}
@@ -256,9 +256,9 @@ namespace Godot
// <summary>
// If the string is a path to a file, return the base directory.
// </summary>
- public static string get_base_dir(this string instance)
+ public static string GetBaseDir(this string instance)
{
- int basepos = instance.find("://");
+ int basepos = instance.Find("://");
string rs = string.Empty;
string @base = string.Empty;
@@ -271,7 +271,7 @@ namespace Godot
}
else
{
- if (instance.begins_with("/"))
+ if (instance.BeginsWith("/"))
{
rs = instance.Substring(1, instance.Length);
@base = "/";
@@ -282,7 +282,7 @@ namespace Godot
}
}
- int sep = Mathf.max(rs.find_last("/"), rs.find_last("\\"));
+ int sep = Mathf.Max(rs.FindLast("/"), rs.FindLast("\\"));
if (sep == -1)
return @base;
@@ -293,9 +293,9 @@ namespace Godot
// <summary>
// If the string is a path to a file, return the file and ignore the base directory.
// </summary>
- public static string get_file(this string instance)
+ public static string GetFile(this string instance)
{
- int sep = Mathf.max(instance.find_last("/"), instance.find_last("\\"));
+ int sep = Mathf.Max(instance.FindLast("/"), instance.FindLast("\\"));
if (sep == -1)
return instance;
@@ -306,7 +306,7 @@ namespace Godot
// <summary>
// Hash the string and return a 32 bits integer.
// </summary>
- public static int hash(this string instance)
+ public static int Hash(this string instance)
{
int index = 0;
int hashv = 5381;
@@ -321,7 +321,7 @@ namespace Godot
// <summary>
// Convert a string containing an hexadecimal number into an int.
// </summary>
- public static int hex_to_int(this string instance)
+ public static int HexToInt(this string instance)
{
int sign = 1;
@@ -340,7 +340,7 @@ namespace Godot
// <summary>
// Insert a substring at a given position.
// </summary>
- public static string insert(this string instance, int pos, string what)
+ public static string Insert(this string instance, int pos, string what)
{
return instance.Insert(pos, what);
}
@@ -348,7 +348,7 @@ namespace Godot
// <summary>
// If the string is a path to a file or directory, return true if the path is absolute.
// </summary>
- public static bool is_abs_path(this string instance)
+ public static bool IsAbsPath(this string instance)
{
return System.IO.Path.IsPathRooted(instance);
}
@@ -356,7 +356,7 @@ namespace Godot
// <summary>
// If the string is a path to a file or directory, return true if the path is relative.
// </summary>
- public static bool is_rel_path(this string instance)
+ public static bool IsRelPath(this string instance)
{
return !System.IO.Path.IsPathRooted(instance);
}
@@ -364,7 +364,7 @@ namespace Godot
// <summary>
// Check whether this string is a subsequence of the given string.
// </summary>
- public static bool is_subsequence_of(this string instance, string text, bool case_insensitive)
+ public static bool IsSubsequenceOf(this string instance, string text, bool case_insensitive)
{
int len = instance.Length;
@@ -407,23 +407,23 @@ namespace Godot
// <summary>
// Check whether this string is a subsequence of the given string, considering case.
// </summary>
- public static bool is_subsequence_of(this string instance, string text)
+ public static bool IsSubsequenceOf(this string instance, string text)
{
- return instance.is_subsequence_of(text, false);
+ return instance.IsSubsequenceOf(text, false);
}
// <summary>
// Check whether this string is a subsequence of the given string, without considering case.
// </summary>
- public static bool is_subsequence_ofi(this string instance, string text)
+ public static bool IsSubsequenceOfI(this string instance, string text)
{
- return instance.is_subsequence_of(text, true);
+ return instance.IsSubsequenceOf(text, true);
}
// <summary>
// Check whether the string contains a valid float.
// </summary>
- public static bool is_valid_float(this string instance)
+ public static bool IsValidFloat(this string instance)
{
float f;
return float.TryParse(instance, out f);
@@ -432,15 +432,15 @@ namespace Godot
// <summary>
// Check whether the string contains a valid color in HTML notation.
// </summary>
- public static bool is_valid_html_color(this string instance)
+ public static bool IsValidHtmlColor(this string instance)
{
- return Color.html_is_valid(instance);
+ return Color.HtmlIsValid(instance);
}
// <summary>
// Check whether the string is a valid identifier. As is common in programming languages, a valid identifier may contain only letters, digits and underscores (_) and the first character may not be a digit.
// </summary>
- public static bool is_valid_identifier(this string instance)
+ public static bool IsValidIdentifier(this string instance)
{
int len = instance.Length;
@@ -467,7 +467,7 @@ namespace Godot
// <summary>
// Check whether the string contains a valid integer.
// </summary>
- public static bool is_valid_integer(this string instance)
+ public static bool IsValidInteger(this string instance)
{
int f;
return int.TryParse(instance, out f);
@@ -476,7 +476,7 @@ namespace Godot
// <summary>
// Check whether the string contains a valid IP address.
// </summary>
- public static bool is_valid_ip_address(this string instance)
+ public static bool IsValidIpAddress(this string instance)
{
string[] ip = instance.split(".");
@@ -486,7 +486,7 @@ namespace Godot
for (int i = 0; i < ip.Length; i++)
{
string n = ip[i];
- if (!n.is_valid_integer())
+ if (!n.IsValidInteger())
return false;
int val = n.to_int();
@@ -500,7 +500,7 @@ namespace Godot
// <summary>
// Return a copy of the string with special characters escaped using the JSON standard.
// </summary>
- public static string json_escape(this string instance)
+ public static string JsonEscape(this string instance)
{
StringBuilder sb = new StringBuilder(string.Copy(instance));
@@ -519,7 +519,7 @@ namespace Godot
// <summary>
// Return an amount of characters from the left of the string.
// </summary>
- public static string left(this string instance, int pos)
+ public static string Left(this string instance, int pos)
{
if (pos <= 0)
return string.Empty;
@@ -533,7 +533,7 @@ namespace Godot
/// <summary>
/// Return the length of the string in characters.
/// </summary>
- public static int length(this string instance)
+ public static int Length(this string instance)
{
return instance.Length;
}
@@ -541,7 +541,7 @@ namespace Godot
// <summary>
// Do a simple expression match, where '*' matches zero or more arbitrary characters and '?' matches any single character except '.'.
// </summary>
- public static bool expr_match(this string instance, string expr, bool case_sensitive)
+ public static bool ExprMatch(this string instance, string expr, bool caseSensitive)
{
if (expr.Length == 0 || instance.Length == 0)
return false;
@@ -551,21 +551,21 @@ namespace Godot
case '\0':
return instance[0] == 0;
case '*':
- return expr_match(expr + 1, instance, case_sensitive) || (instance[0] != 0 && expr_match(expr, instance + 1, case_sensitive));
+ return ExprMatch(expr + 1, instance, caseSensitive) || (instance[0] != 0 && ExprMatch(expr, instance + 1, caseSensitive));
case '?':
- return instance[0] != 0 && instance[0] != '.' && expr_match(expr + 1, instance + 1, case_sensitive);
+ return instance[0] != 0 && instance[0] != '.' && ExprMatch(expr + 1, instance + 1, caseSensitive);
default:
- return (case_sensitive ? instance[0] == expr[0] : char.ToUpper(instance[0]) == char.ToUpper(expr[0])) &&
- expr_match(expr + 1, instance + 1, case_sensitive);
+ return (caseSensitive ? instance[0] == expr[0] : char.ToUpper(instance[0]) == char.ToUpper(expr[0])) &&
+ ExprMatch(expr + 1, instance + 1, caseSensitive);
}
}
// <summary>
// Do a simple case sensitive expression match, using ? and * wildcards (see [method expr_match]).
// </summary>
- public static bool match(this string instance, string expr)
+ public static bool Match(this string instance, string expr)
{
- return instance.expr_match(expr, true);
+ return instance.ExprMatch(expr, true);
}
// <summary>
@@ -573,13 +573,13 @@ namespace Godot
// </summary>
public static bool matchn(this string instance, string expr)
{
- return instance.expr_match(expr, false);
+ return instance.ExprMatch(expr, false);
}
// <summary>
// Return the MD5 hash of the string as an array of bytes.
// </summary>
- public static byte[] md5_buffer(this string instance)
+ public static byte[] Md5Buffer(this string instance)
{
return NativeCalls.godot_icall_String_md5_buffer(instance);
}
@@ -587,7 +587,7 @@ namespace Godot
// <summary>
// Return the MD5 hash of the string as a string.
// </summary>
- public static string md5_text(this string instance)
+ public static string Md5Text(this string instance)
{
return NativeCalls.godot_icall_String_md5_text(instance);
}
@@ -595,12 +595,12 @@ namespace Godot
// <summary>
// Perform a case-insensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater.
// </summary>
- public static int nocasecmp_to(this string instance, string to)
+ public static int NocasecmpTo(this string instance, string to)
{
- if (instance.empty())
- return to.empty() ? 0 : -1;
+ if (instance.Empty())
+ return to.Empty() ? 0 : -1;
- if (to.empty())
+ if (to.Empty())
return 1;
int instance_idx = 0;
@@ -627,7 +627,7 @@ namespace Godot
// <summary>
// Return the character code at position [code]at[/code].
// </summary>
- public static int ord_at(this string instance, int at)
+ public static int OrdAt(this string instance, int at)
{
return instance[at];
}
@@ -635,9 +635,9 @@ namespace Godot
// <summary>
// Format a number to have an exact number of [code]digits[/code] after the decimal point.
// </summary>
- public static string pad_decimals(this string instance, int digits)
+ public static string PadDecimals(this string instance, int digits)
{
- int c = instance.find(".");
+ int c = instance.Find(".");
if (c == -1)
{
@@ -671,10 +671,10 @@ namespace Godot
// <summary>
// Format a number to have an exact number of [code]digits[/code] before the decimal point.
// </summary>
- public static string pad_zeros(this string instance, int digits)
+ public static string PadZeros(this string instance, int digits)
{
string s = instance;
- int end = s.find(".");
+ int end = s.Find(".");
if (end == -1)
end = s.Length;
@@ -704,7 +704,7 @@ namespace Godot
// <summary>
// Decode a percent-encoded string. See [method percent_encode].
// </summary>
- public static string percent_decode(this string instance)
+ public static string PercentDecode(this string instance)
{
return Uri.UnescapeDataString(instance);
}
@@ -712,7 +712,7 @@ namespace Godot
// <summary>
// Percent-encode a string. This is meant to encode parameters in a URL when sending a HTTP GET request and bodies of form-urlencoded POST request.
// </summary>
- public static string percent_encode(this string instance)
+ public static string PercentEncode(this string instance)
{
return Uri.EscapeDataString(instance);
}
@@ -720,7 +720,7 @@ namespace Godot
// <summary>
// If the string is a path, this concatenates [code]file[/code] at the end of the string as a subpath. E.g. [code]"this/is".plus_file("path") == "this/is/path"[/code].
// </summary>
- public static string plus_file(this string instance, string file)
+ public static string PlusFile(this string instance, string file)
{
if (instance.Length > 0 && instance[instance.Length - 1] == '/')
return instance + file;
@@ -731,7 +731,7 @@ namespace Godot
// <summary>
// Replace occurrences of a substring for different ones inside the string.
// </summary>
- public static string replace(this string instance, string what, string forwhat)
+ public static string Replace(this string instance, string what, string forwhat)
{
return instance.Replace(what, forwhat);
}
@@ -739,7 +739,7 @@ namespace Godot
// <summary>
// Replace occurrences of a substring for different ones inside the string, but search case-insensitive.
// </summary>
- public static string replacen(this string instance, string what, string forwhat)
+ public static string Replacen(this string instance, string what, string forwhat)
{
return Regex.Replace(instance, what, forwhat, RegexOptions.IgnoreCase);
}
@@ -747,7 +747,7 @@ namespace Godot
// <summary>
// Perform a search for a substring, but start from the end of the string instead of the beginning.
// </summary>
- public static int rfind(this string instance, string what, int from = -1)
+ public static int Rfind(this string instance, string what, int from = -1)
{
return NativeCalls.godot_icall_String_rfind(instance, what, from);
}
@@ -755,7 +755,7 @@ namespace Godot
// <summary>
// Perform a search for a substring, but start from the end of the string instead of the beginning. Also search case-insensitive.
// </summary>
- public static int rfindn(this string instance, string what, int from = -1)
+ public static int Rfindn(this string instance, string what, int from = -1)
{
return NativeCalls.godot_icall_String_rfindn(instance, what, from);
}
@@ -763,7 +763,7 @@ namespace Godot
// <summary>
// Return the right side of the string from a given position.
// </summary>
- public static string right(this string instance, int pos)
+ public static string Right(this string instance, int pos)
{
if (pos >= instance.Length)
return instance;
@@ -774,7 +774,7 @@ namespace Godot
return instance.Substring(pos, (instance.Length - pos));
}
- public static byte[] sha256_buffer(this string instance)
+ public static byte[] Sha256Buffer(this string instance)
{
return NativeCalls.godot_icall_String_sha256_buffer(instance);
}
@@ -782,7 +782,7 @@ namespace Godot
// <summary>
// Return the SHA-256 hash of the string as a string.
// </summary>
- public static string sha256_text(this string instance)
+ public static string Sha256Text(this string instance)
{
return NativeCalls.godot_icall_String_sha256_text(instance);
}
@@ -790,7 +790,7 @@ namespace Godot
// <summary>
// Return the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar.
// </summary>
- public static float similarity(this string instance, string text)
+ public static float Similarity(this string instance, string text)
{
if (instance == text)
{
@@ -803,11 +803,11 @@ namespace Godot
return 0.0f;
}
- string[] src_bigrams = instance.bigrams();
- string[] tgt_bigrams = text.bigrams();
+ string[] srcBigrams = instance.Bigrams();
+ string[] tgtBigrams = text.Bigrams();
- int src_size = src_bigrams.Length;
- int tgt_size = tgt_bigrams.Length;
+ int src_size = srcBigrams.Length;
+ int tgt_size = tgtBigrams.Length;
float sum = src_size + tgt_size;
float inter = 0;
@@ -816,7 +816,7 @@ namespace Godot
{
for (int j = 0; j < tgt_size; j++)
{
- if (src_bigrams[i] == tgt_bigrams[j])
+ if (srcBigrams[i] == tgtBigrams[j])
{
inter++;
break;
@@ -846,7 +846,7 @@ namespace Godot
while (true)
{
- int end = instance.find(divisor, from);
+ int end = instance.Find(divisor, from);
if (end < 0)
end = len;
if (allow_empty || (end > from))
diff --git a/modules/mono/glue/cs_files/Transform.cs b/modules/mono/glue/cs_files/Transform.cs
index 74271e758b..5214100d36 100644
--- a/modules/mono/glue/cs_files/Transform.cs
+++ b/modules/mono/glue/cs_files/Transform.cs
@@ -9,38 +9,38 @@ namespace Godot
public Basis basis;
public Vector3 origin;
- public Transform affine_inverse()
+ public Transform AffineInverse()
{
- Basis basisInv = basis.inverse();
- return new Transform(basisInv, basisInv.xform(-origin));
+ Basis basisInv = basis.Inverse();
+ return new Transform(basisInv, basisInv.Xform(-origin));
}
- public Transform inverse()
+ public Transform Inverse()
{
- Basis basisTr = basis.transposed();
- return new Transform(basisTr, basisTr.xform(-origin));
+ Basis basisTr = basis.Transposed();
+ return new Transform(basisTr, basisTr.Xform(-origin));
}
- public Transform looking_at(Vector3 target, Vector3 up)
+ public Transform LookingAt(Vector3 target, Vector3 up)
{
Transform t = this;
t.set_look_at(origin, target, up);
return t;
}
- public Transform orthonormalized()
+ public Transform Orthonormalized()
{
- return new Transform(basis.orthonormalized(), origin);
+ return new Transform(basis.Orthonormalized(), origin);
}
- public Transform rotated(Vector3 axis, float phi)
+ public Transform Rotated(Vector3 axis, float phi)
{
return new Transform(new Basis(axis, phi), new Vector3()) * this;
}
- public Transform scaled(Vector3 scale)
+ public Transform Scaled(Vector3 scale)
{
- return new Transform(basis.scaled(scale), origin * scale);
+ return new Transform(basis.Scaled(scale), origin * scale);
}
public void set_look_at(Vector3 eye, Vector3 target, Vector3 up)
@@ -49,44 +49,44 @@ namespace Godot
// Z vector
Vector3 zAxis = eye - target;
- zAxis.normalize();
+ zAxis.Normalize();
Vector3 yAxis = up;
- Vector3 xAxis = yAxis.cross(zAxis);
+ Vector3 xAxis = yAxis.Cross(zAxis);
// Recompute Y = Z cross X
- yAxis = zAxis.cross(xAxis);
+ yAxis = zAxis.Cross(xAxis);
- xAxis.normalize();
- yAxis.normalize();
+ xAxis.Normalize();
+ yAxis.Normalize();
- basis = Basis.create_from_axes(xAxis, yAxis, zAxis);
+ basis = Basis.CreateFromAxes(xAxis, yAxis, zAxis);
origin = eye;
}
- public Transform translated(Vector3 ofs)
+ public Transform Translated(Vector3 ofs)
{
return new Transform(basis, new Vector3
(
- origin[0] += basis[0].dot(ofs),
- origin[1] += basis[1].dot(ofs),
- origin[2] += basis[2].dot(ofs)
+ origin[0] += basis[0].Dot(ofs),
+ origin[1] += basis[1].Dot(ofs),
+ origin[2] += basis[2].Dot(ofs)
));
}
- public Vector3 xform(Vector3 v)
+ public Vector3 Xform(Vector3 v)
{
return new Vector3
(
- basis[0].dot(v) + origin.x,
- basis[1].dot(v) + origin.y,
- basis[2].dot(v) + origin.z
+ basis[0].Dot(v) + origin.x,
+ basis[1].Dot(v) + origin.y,
+ basis[2].Dot(v) + origin.z
);
}
- public Vector3 xform_inv(Vector3 v)
+ public Vector3 XformInv(Vector3 v)
{
Vector3 vInv = v - origin;
@@ -100,7 +100,7 @@ namespace Godot
public Transform(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 origin)
{
- this.basis = Basis.create_from_axes(xAxis, yAxis, zAxis);
+ this.basis = Basis.CreateFromAxes(xAxis, yAxis, zAxis);
this.origin = origin;
}
@@ -118,7 +118,7 @@ namespace Godot
public static Transform operator *(Transform left, Transform right)
{
- left.origin = left.xform(right.origin);
+ left.origin = left.Xform(right.origin);
left.basis *= right.basis;
return left;
}
diff --git a/modules/mono/glue/cs_files/Transform2D.cs b/modules/mono/glue/cs_files/Transform2D.cs
index 526dc767c6..fe7c5b5706 100644
--- a/modules/mono/glue/cs_files/Transform2D.cs
+++ b/modules/mono/glue/cs_files/Transform2D.cs
@@ -29,12 +29,12 @@ namespace Godot
public float Rotation
{
- get { return Mathf.atan2(y.x, o.y); }
+ get { return Mathf.Atan2(y.x, o.y); }
}
public Vector2 Scale
{
- get { return new Vector2(x.length(), y.length()); }
+ get { return new Vector2(x.Length(), y.Length()); }
}
public Vector2 this[int index]
@@ -103,7 +103,7 @@ namespace Godot
}
}
- public Transform2D affine_inverse()
+ public Transform2D AffineInverse()
{
Transform2D inv = this;
@@ -128,22 +128,22 @@ namespace Godot
this[0] *= new Vector2(idet, -idet);
this[1] *= new Vector2(-idet, idet);
- this[2] = basis_xform(-this[2]);
+ this[2] = BasisXform(-this[2]);
return inv;
}
- public Vector2 basis_xform(Vector2 v)
+ public Vector2 BasisXform(Vector2 v)
{
- return new Vector2(tdotx(v), tdoty(v));
+ return new Vector2(Tdotx(v), Tdoty(v));
}
- public Vector2 basis_xform_inv(Vector2 v)
+ public Vector2 BasisXformInv(Vector2 v)
{
- return new Vector2(x.dot(v), y.dot(v));
+ return new Vector2(x.Dot(v), y.Dot(v));
}
- public Transform2D interpolate_with(Transform2D m, float c)
+ public Transform2D InterpolateWith(Transform2D m, float c)
{
float r1 = Rotation;
float r2 = m.Rotation;
@@ -152,10 +152,10 @@ namespace Godot
Vector2 s2 = m.Scale;
// Slerp rotation
- Vector2 v1 = new Vector2(Mathf.cos(r1), Mathf.sin(r1));
- Vector2 v2 = new Vector2(Mathf.cos(r2), Mathf.sin(r2));
+ Vector2 v1 = new Vector2(Mathf.Cos(r1), Mathf.Sin(r1));
+ Vector2 v2 = new Vector2(Mathf.Cos(r2), Mathf.Sin(r2));
- float dot = v1.dot(v2);
+ float dot = v1.Dot(v2);
// Clamp dot to [-1, 1]
dot = (dot < -1.0f) ? -1.0f : ((dot > 1.0f) ? 1.0f : dot);
@@ -165,13 +165,13 @@ namespace Godot
if (dot > 0.9995f)
{
// Linearly interpolate to avoid numerical precision issues
- v = v1.linear_interpolate(v2, c).normalized();
+ v = v1.LinearInterpolate(v2, c).Normalized();
}
else
{
- float angle = c * Mathf.acos(dot);
- Vector2 v3 = (v2 - v1 * dot).normalized();
- v = v1 * Mathf.cos(angle) + v3 * Mathf.sin(angle);
+ float angle = c * Mathf.Acos(dot);
+ Vector2 v3 = (v2 - v1 * dot).Normalized();
+ v = v1 * Mathf.Cos(angle) + v3 * Mathf.Sin(angle);
}
// Extract parameters
@@ -179,15 +179,15 @@ namespace Godot
Vector2 p2 = m.Origin;
// Construct matrix
- Transform2D res = new Transform2D(Mathf.atan2(v.y, v.x), p1.linear_interpolate(p2, c));
- Vector2 scale = s1.linear_interpolate(s2, c);
+ Transform2D res = new Transform2D(Mathf.Atan2(v.y, v.x), p1.LinearInterpolate(p2, c));
+ Vector2 scale = s1.LinearInterpolate(s2, c);
res.x *= scale;
res.y *= scale;
return res;
}
- public Transform2D inverse()
+ public Transform2D Inverse()
{
Transform2D inv = this;
@@ -196,21 +196,21 @@ namespace Godot
inv.x.y = inv.y.x;
inv.y.x = temp;
- inv.o = inv.basis_xform(-inv.o);
+ inv.o = inv.BasisXform(-inv.o);
return inv;
}
- public Transform2D orthonormalized()
+ public Transform2D Orthonormalized()
{
Transform2D on = this;
Vector2 onX = on.x;
Vector2 onY = on.y;
- onX.normalize();
- onY = onY - onX * (onX.dot(onY));
- onY.normalize();
+ onX.Normalize();
+ onY = onY - onX * (onX.Dot(onY));
+ onY.Normalize();
on.x = onX;
on.y = onY;
@@ -218,12 +218,12 @@ namespace Godot
return on;
}
- public Transform2D rotated(float phi)
+ public Transform2D Rotated(float phi)
{
return this * new Transform2D(phi, new Vector2());
}
- public Transform2D scaled(Vector2 scale)
+ public Transform2D Scaled(Vector2 scale)
{
Transform2D copy = this;
copy.x *= scale;
@@ -232,32 +232,32 @@ namespace Godot
return copy;
}
- private float tdotx(Vector2 with)
+ private float Tdotx(Vector2 with)
{
return this[0, 0] * with[0] + this[1, 0] * with[1];
}
- private float tdoty(Vector2 with)
+ private float Tdoty(Vector2 with)
{
return this[0, 1] * with[0] + this[1, 1] * with[1];
}
- public Transform2D translated(Vector2 offset)
+ public Transform2D Translated(Vector2 offset)
{
Transform2D copy = this;
- copy.o += copy.basis_xform(offset);
+ copy.o += copy.BasisXform(offset);
return copy;
}
- public Vector2 xform(Vector2 v)
+ public Vector2 Xform(Vector2 v)
{
- return new Vector2(tdotx(v), tdoty(v)) + o;
+ return new Vector2(Tdotx(v), Tdoty(v)) + o;
}
- public Vector2 xform_inv(Vector2 v)
+ public Vector2 XformInv(Vector2 v)
{
Vector2 vInv = v - o;
- return new Vector2(x.dot(vInv), y.dot(vInv));
+ return new Vector2(x.Dot(vInv), y.Dot(vInv));
}
public Transform2D(Vector2 xAxis, Vector2 yAxis, Vector2 origin)
@@ -275,8 +275,8 @@ namespace Godot
public Transform2D(float rot, Vector2 pos)
{
- float cr = Mathf.cos(rot);
- float sr = Mathf.sin(rot);
+ float cr = Mathf.Cos(rot);
+ float sr = Mathf.Sin(rot);
x.x = cr;
y.y = cr;
x.y = -sr;
@@ -286,14 +286,14 @@ namespace Godot
public static Transform2D operator *(Transform2D left, Transform2D right)
{
- left.o = left.xform(right.o);
+ left.o = left.Xform(right.o);
float x0, x1, y0, y1;
- x0 = left.tdotx(right.x);
- x1 = left.tdoty(right.x);
- y0 = left.tdotx(right.y);
- y1 = left.tdoty(right.y);
+ x0 = left.Tdotx(right.x);
+ x1 = left.Tdoty(right.x);
+ y0 = left.Tdotx(right.y);
+ y1 = left.Tdoty(right.y);
left.x.x = x0;
left.x.y = x1;
diff --git a/modules/mono/glue/cs_files/Vector2.cs b/modules/mono/glue/cs_files/Vector2.cs
index 28fedc365b..238775bda2 100644
--- a/modules/mono/glue/cs_files/Vector2.cs
+++ b/modules/mono/glue/cs_files/Vector2.cs
@@ -46,57 +46,57 @@ namespace Godot
}
}
- internal void normalize()
+ internal void Normalize()
{
float length = x * x + y * y;
if (length != 0f)
{
- length = Mathf.sqrt(length);
+ length = Mathf.Sqrt(length);
x /= length;
y /= length;
}
}
- private float cross(Vector2 b)
+ private float Cross(Vector2 b)
{
return x * b.y - y * b.x;
}
- public Vector2 abs()
+ public Vector2 Abs()
{
- return new Vector2(Mathf.abs(x), Mathf.abs(y));
+ return new Vector2(Mathf.Abs(x), Mathf.Abs(y));
}
- public float angle()
+ public float Angle()
{
- return Mathf.atan2(y, x);
+ return Mathf.Atan2(y, x);
}
- public float angle_to(Vector2 to)
+ public float AngleTo(Vector2 to)
{
- return Mathf.atan2(cross(to), dot(to));
+ return Mathf.Atan2(Cross(to), Dot(to));
}
- public float angle_to_point(Vector2 to)
+ public float AngleToPoint(Vector2 to)
{
- return Mathf.atan2(x - to.x, y - to.y);
+ return Mathf.Atan2(x - to.x, y - to.y);
}
- public float aspect()
+ public float Aspect()
{
return x / y;
}
- public Vector2 bounce(Vector2 n)
+ public Vector2 Bounce(Vector2 n)
{
- return -reflect(n);
+ return -Reflect(n);
}
- public Vector2 clamped(float length)
+ public Vector2 Clamped(float length)
{
Vector2 v = this;
- float l = this.length();
+ float l = this.Length();
if (l > 0 && length < l)
{
@@ -107,7 +107,7 @@ namespace Godot
return v;
}
- public Vector2 cubic_interpolate(Vector2 b, Vector2 preA, Vector2 postB, float t)
+ public Vector2 CubicInterpolate(Vector2 b, Vector2 preA, Vector2 postB, float t)
{
Vector2 p0 = preA;
Vector2 p1 = this;
@@ -123,42 +123,42 @@ namespace Godot
(-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3);
}
- public float distance_squared_to(Vector2 to)
+ public float DistanceSquaredTo(Vector2 to)
{
return (x - to.x) * (x - to.x) + (y - to.y) * (y - to.y);
}
- public float distance_to(Vector2 to)
+ public float DistanceTo(Vector2 to)
{
- return Mathf.sqrt((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y));
+ return Mathf.Sqrt((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y));
}
- public float dot(Vector2 with)
+ public float Dot(Vector2 with)
{
return x * with.x + y * with.y;
}
- public Vector2 floor()
+ public Vector2 Floor()
{
- return new Vector2(Mathf.floor(x), Mathf.floor(y));
+ return new Vector2(Mathf.Floor(x), Mathf.Floor(y));
}
- public bool is_normalized()
+ public bool IsNormalized()
{
- return Mathf.abs(length_squared() - 1.0f) < Mathf.Epsilon;
+ return Mathf.Abs(LengthSquared() - 1.0f) < Mathf.Epsilon;
}
- public float length()
+ public float Length()
{
- return Mathf.sqrt(x * x + y * y);
+ return Mathf.Sqrt(x * x + y * y);
}
- public float length_squared()
+ public float LengthSquared()
{
return x * x + y * y;
}
- public Vector2 linear_interpolate(Vector2 b, float t)
+ public Vector2 LinearInterpolate(Vector2 b, float t)
{
Vector2 res = this;
@@ -168,35 +168,35 @@ namespace Godot
return res;
}
- public Vector2 normalized()
+ public Vector2 Normalized()
{
Vector2 result = this;
- result.normalize();
+ result.Normalize();
return result;
}
- public Vector2 reflect(Vector2 n)
+ public Vector2 Reflect(Vector2 n)
{
- return 2.0f * n * dot(n) - this;
+ return 2.0f * n * Dot(n) - this;
}
- public Vector2 rotated(float phi)
+ public Vector2 Rotated(float phi)
{
- float rads = angle() + phi;
- return new Vector2(Mathf.cos(rads), Mathf.sin(rads)) * length();
+ float rads = Angle() + phi;
+ return new Vector2(Mathf.Cos(rads), Mathf.Sin(rads)) * Length();
}
- public Vector2 slide(Vector2 n)
+ public Vector2 Slide(Vector2 n)
{
- return this - n * dot(n);
+ return this - n * Dot(n);
}
- public Vector2 snapped(Vector2 by)
+ public Vector2 Snapped(Vector2 by)
{
- return new Vector2(Mathf.stepify(x, by.x), Mathf.stepify(y, by.y));
+ return new Vector2(Mathf.Stepify(x, by.x), Mathf.Stepify(y, by.y));
}
- public Vector2 tangent()
+ public Vector2 Tangent()
{
return new Vector2(y, -x);
}
diff --git a/modules/mono/glue/cs_files/Vector3.cs b/modules/mono/glue/cs_files/Vector3.cs
index c023cd83cf..190caa4b53 100644
--- a/modules/mono/glue/cs_files/Vector3.cs
+++ b/modules/mono/glue/cs_files/Vector3.cs
@@ -59,9 +59,9 @@ namespace Godot
}
}
- internal void normalize()
+ internal void Normalize()
{
- float length = this.length();
+ float length = this.Length();
if (length == 0f)
{
@@ -75,27 +75,27 @@ namespace Godot
}
}
- public Vector3 abs()
+ public Vector3 Abs()
{
- return new Vector3(Mathf.abs(x), Mathf.abs(y), Mathf.abs(z));
+ return new Vector3(Mathf.Abs(x), Mathf.Abs(y), Mathf.Abs(z));
}
- public float angle_to(Vector3 to)
+ public float AngleTo(Vector3 to)
{
- return Mathf.atan2(cross(to).length(), dot(to));
+ return Mathf.Atan2(Cross(to).Length(), Dot(to));
}
- public Vector3 bounce(Vector3 n)
+ public Vector3 Bounce(Vector3 n)
{
- return -reflect(n);
+ return -Reflect(n);
}
- public Vector3 ceil()
+ public Vector3 Ceil()
{
- return new Vector3(Mathf.ceil(x), Mathf.ceil(y), Mathf.ceil(z));
+ return new Vector3(Mathf.Ceil(x), Mathf.Ceil(y), Mathf.Ceil(z));
}
- public Vector3 cross(Vector3 b)
+ public Vector3 Cross(Vector3 b)
{
return new Vector3
(
@@ -105,7 +105,7 @@ namespace Godot
);
}
- public Vector3 cubic_interpolate(Vector3 b, Vector3 preA, Vector3 postB, float t)
+ public Vector3 CubicInterpolate(Vector3 b, Vector3 preA, Vector3 postB, float t)
{
Vector3 p0 = preA;
Vector3 p1 = this;
@@ -122,46 +122,46 @@ namespace Godot
);
}
- public float distance_squared_to(Vector3 b)
+ public float DistanceSquaredTo(Vector3 b)
{
- return (b - this).length_squared();
+ return (b - this).LengthSquared();
}
- public float distance_to(Vector3 b)
+ public float DistanceTo(Vector3 b)
{
- return (b - this).length();
+ return (b - this).Length();
}
- public float dot(Vector3 b)
+ public float Dot(Vector3 b)
{
return x * b.x + y * b.y + z * b.z;
}
- public Vector3 floor()
+ public Vector3 Floor()
{
- return new Vector3(Mathf.floor(x), Mathf.floor(y), Mathf.floor(z));
+ return new Vector3(Mathf.Floor(x), Mathf.Floor(y), Mathf.Floor(z));
}
- public Vector3 inverse()
+ public Vector3 Inverse()
{
return new Vector3(1.0f / x, 1.0f / y, 1.0f / z);
}
- public bool is_normalized()
+ public bool IsNormalized()
{
- return Mathf.abs(length_squared() - 1.0f) < Mathf.Epsilon;
+ return Mathf.Abs(LengthSquared() - 1.0f) < Mathf.Epsilon;
}
- public float length()
+ public float Length()
{
float x2 = x * x;
float y2 = y * y;
float z2 = z * z;
- return Mathf.sqrt(x2 + y2 + z2);
+ return Mathf.Sqrt(x2 + y2 + z2);
}
- public float length_squared()
+ public float LengthSquared()
{
float x2 = x * x;
float y2 = y * y;
@@ -170,7 +170,7 @@ namespace Godot
return x2 + y2 + z2;
}
- public Vector3 linear_interpolate(Vector3 b, float t)
+ public Vector3 LinearInterpolate(Vector3 b, float t)
{
return new Vector3
(
@@ -180,24 +180,24 @@ namespace Godot
);
}
- public Axis max_axis()
+ public Axis MaxAxis()
{
return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X);
}
- public Axis min_axis()
+ public Axis MinAxis()
{
return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z);
}
- public Vector3 normalized()
+ public Vector3 Normalized()
{
Vector3 v = this;
- v.normalize();
+ v.Normalize();
return v;
}
- public Basis outer(Vector3 b)
+ public Basis Outer(Vector3 b)
{
return new Basis(
new Vector3(x * b.x, x * b.y, x * b.z),
@@ -206,36 +206,36 @@ namespace Godot
);
}
- public Vector3 reflect(Vector3 n)
+ public Vector3 Reflect(Vector3 n)
{
#if DEBUG
- if (!n.is_normalized())
+ if (!n.IsNormalized())
throw new ArgumentException(String.Format("{0} is not normalized", n), nameof(n));
#endif
- return 2.0f * n * dot(n) - this;
+ return 2.0f * n * Dot(n) - this;
}
- public Vector3 rotated(Vector3 axis, float phi)
+ public Vector3 Rotated(Vector3 axis, float phi)
{
- return new Basis(axis, phi).xform(this);
+ return new Basis(axis, phi).Xform(this);
}
- public Vector3 slide(Vector3 n)
+ public Vector3 Slide(Vector3 n)
{
- return this - n * dot(n);
+ return this - n * Dot(n);
}
- public Vector3 snapped(Vector3 by)
+ public Vector3 Snapped(Vector3 by)
{
return new Vector3
(
- Mathf.stepify(x, by.x),
- Mathf.stepify(y, by.y),
- Mathf.stepify(z, by.z)
+ Mathf.Stepify(x, by.x),
+ Mathf.Stepify(y, by.y),
+ Mathf.Stepify(z, by.z)
);
}
- public Basis to_diagonal_matrix()
+ public Basis ToDiagonalMatrix()
{
return new Basis(
x, 0f, 0f,
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp
index 7cc2168b70..0f6245a37c 100644
--- a/modules/mono/godotsharp_dirs.cpp
+++ b/modules/mono/godotsharp_dirs.cpp
@@ -57,7 +57,7 @@ String _get_expected_build_config() {
String _get_mono_user_dir() {
#ifdef TOOLS_ENABLED
if (EditorSettings::get_singleton()) {
- return EditorSettings::get_singleton()->get_settings_path().plus_file("mono");
+ return EditorSettings::get_singleton()->get_data_dir().plus_file("mono");
} else {
String settings_path;
@@ -68,19 +68,13 @@ String _get_mono_user_dir() {
// contain yourself
settings_path = exe_dir.plus_file("editor_data");
} else {
- if (OS::get_singleton()->has_environment("APPDATA")) {
- String app_data = OS::get_singleton()->get_environment("APPDATA").replace("\\", "/");
- settings_path = app_data.plus_file(String(_MKSTR(VERSION_SHORT_NAME)).capitalize());
- } else if (OS::get_singleton()->has_environment("HOME")) {
- String home = OS::get_singleton()->get_environment("HOME");
- settings_path = home.plus_file("." + String(_MKSTR(VERSION_SHORT_NAME)).to_lower());
- }
+ settings_path = OS::get_singleton()->get_data_path().plus_file(OS::get_singleton()->get_godot_dir_name());
}
return settings_path.plus_file("mono");
}
#else
- return OS::get_singleton()->get_data_dir().plus_file("mono");
+ return OS::get_singleton()->get_user_data_dir().plus_file("mono");
#endif
}
@@ -198,4 +192,4 @@ String get_project_csproj_path() {
return _GodotSharpDirs::get_singleton().csproj_filepath;
}
#endif
-}
+} // namespace GodotSharpDirs
diff --git a/modules/mono/godotsharp_dirs.h b/modules/mono/godotsharp_dirs.h
index ba2c065210..914df40629 100644
--- a/modules/mono/godotsharp_dirs.h
+++ b/modules/mono/godotsharp_dirs.h
@@ -53,6 +53,6 @@ String get_custom_project_settings_dir();
String get_project_sln_path();
String get_project_csproj_path();
-}
+} // namespace GodotSharpDirs
#endif // GODOTSHARP_DIRS_H
diff --git a/modules/mono/mono_gc_handle.cpp b/modules/mono/mono_gc_handle.cpp
index e10e06df0e..121392b3f8 100644
--- a/modules/mono/mono_gc_handle.cpp
+++ b/modules/mono/mono_gc_handle.cpp
@@ -36,7 +36,7 @@ uint32_t MonoGCHandle::make_strong_handle(MonoObject *p_object) {
return mono_gchandle_new(
p_object,
false /* do not pin the object */
- );
+ );
}
uint32_t MonoGCHandle::make_weak_handle(MonoObject *p_object) {
@@ -44,7 +44,7 @@ uint32_t MonoGCHandle::make_weak_handle(MonoObject *p_object) {
return mono_gchandle_new_weakref(
p_object,
true /* track_resurrection: allows us to invoke _notification(NOTIFICATION_PREDELETE) while disposing */
- );
+ );
}
Ref<MonoGCHandle> MonoGCHandle::create_strong(MonoObject *p_object) {
diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp
index 1643f8cfc5..eb34f9dd3f 100644
--- a/modules/mono/mono_gd/gd_mono_field.cpp
+++ b/modules/mono/mono_gd/gd_mono_field.cpp
@@ -41,7 +41,7 @@ void GDMonoField::set_value_raw(MonoObject *p_object, void *p_ptr) {
void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
#define SET_FROM_STRUCT_AND_BREAK(m_type) \
{ \
- const m_type &val = p_value.operator m_type(); \
+ const m_type &val = p_value.operator ::m_type(); \
MARSHALLED_OUT(m_type, val, raw); \
mono_field_set_value(p_object, mono_field, raw); \
break; \
@@ -129,8 +129,8 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
if (tclass == CACHED_CLASS(Transform))
SET_FROM_STRUCT_AND_BREAK(Transform);
- if (tclass == CACHED_CLASS(Rect3))
- SET_FROM_STRUCT_AND_BREAK(Rect3);
+ if (tclass == CACHED_CLASS(AABB))
+ SET_FROM_STRUCT_AND_BREAK(AABB);
if (tclass == CACHED_CLASS(Color))
SET_FROM_STRUCT_AND_BREAK(Color);
@@ -229,7 +229,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
case Variant::TRANSFORM2D: SET_FROM_STRUCT_AND_BREAK(Transform2D);
case Variant::PLANE: SET_FROM_STRUCT_AND_BREAK(Plane);
case Variant::QUAT: SET_FROM_STRUCT_AND_BREAK(Quat);
- case Variant::RECT3: SET_FROM_STRUCT_AND_BREAK(Rect3);
+ case Variant::AABB: SET_FROM_STRUCT_AND_BREAK(AABB);
case Variant::BASIS: SET_FROM_STRUCT_AND_BREAK(Basis);
case Variant::TRANSFORM: SET_FROM_STRUCT_AND_BREAK(Transform);
case Variant::COLOR: SET_FROM_STRUCT_AND_BREAK(Color);
diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp
index cfe2148b80..56e8a01567 100644
--- a/modules/mono/mono_gd/gd_mono_internals.cpp
+++ b/modules/mono/mono_gd/gd_mono_internals.cpp
@@ -63,4 +63,4 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
return;
}
-}
+} // namespace GDMonoInternals
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index 01392447f3..8bc2bb5096 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -36,7 +36,7 @@ namespace GDMonoMarshal {
#define RETURN_BOXED_STRUCT(m_t, m_var_in) \
{ \
- const m_t &m_in = m_var_in->operator m_t(); \
+ const m_t &m_in = m_var_in->operator ::m_t(); \
MARSHALLED_OUT(m_t, m_in, raw); \
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(m_t), raw); \
}
@@ -104,8 +104,8 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) {
if (tclass == CACHED_CLASS(Transform))
return Variant::TRANSFORM;
- if (tclass == CACHED_CLASS(Rect3))
- return Variant::RECT3;
+ if (tclass == CACHED_CLASS(AABB))
+ return Variant::AABB;
if (tclass == CACHED_CLASS(Color))
return Variant::COLOR;
@@ -297,8 +297,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
if (tclass == CACHED_CLASS(Transform))
RETURN_BOXED_STRUCT(Transform, p_var);
- if (tclass == CACHED_CLASS(Rect3))
- RETURN_BOXED_STRUCT(Rect3, p_var);
+ if (tclass == CACHED_CLASS(AABB))
+ RETURN_BOXED_STRUCT(AABB, p_var);
if (tclass == CACHED_CLASS(Color))
RETURN_BOXED_STRUCT(Color, p_var);
@@ -394,8 +394,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
RETURN_BOXED_STRUCT(Plane, p_var);
case Variant::QUAT:
RETURN_BOXED_STRUCT(Quat, p_var);
- case Variant::RECT3:
- RETURN_BOXED_STRUCT(Rect3, p_var);
+ case Variant::AABB:
+ RETURN_BOXED_STRUCT(AABB, p_var);
case Variant::BASIS:
RETURN_BOXED_STRUCT(Basis, p_var);
case Variant::TRANSFORM:
@@ -518,8 +518,8 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) {
if (tclass == CACHED_CLASS(Transform))
RETURN_UNBOXED_STRUCT(Transform, p_obj);
- if (tclass == CACHED_CLASS(Rect3))
- RETURN_UNBOXED_STRUCT(Rect3, p_obj);
+ if (tclass == CACHED_CLASS(AABB))
+ RETURN_UNBOXED_STRUCT(AABB, p_obj);
if (tclass == CACHED_CLASS(Color))
RETURN_UNBOXED_STRUCT(Color, p_obj);
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index 9f403b787f..443e947fb5 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -197,10 +197,10 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict);
Basis(m_in[0], m_in[1], m_in[2], m_in[3], m_in[4], m_in[5], m_in[6], m_in[7], m_in[8]), \
Vector3(m_in[9], m_in[10], m_in[11]));
-// Rect3
+// AABB
-#define MARSHALLED_OUT_Rect3(m_in, m_out) real_t m_out[6] = { m_in.position.x, m_in.position.y, m_in.position.z, m_in.size.x, m_in.size.y, m_in.size.z };
-#define MARSHALLED_IN_Rect3(m_in, m_out) Rect3 m_out(Vector3(m_in[0], m_in[1], m_in[2]), Vector3(m_in[3], m_in[4], m_in[5]));
+#define MARSHALLED_OUT_AABB(m_in, m_out) real_t m_out[6] = { m_in.position.x, m_in.position.y, m_in.position.z, m_in.size.x, m_in.size.y, m_in.size.z };
+#define MARSHALLED_IN_AABB(m_in, m_out) AABB m_out(Vector3(m_in[0], m_in[1], m_in[2]), Vector3(m_in[3], m_in[4], m_in[5]));
// Color
@@ -214,6 +214,6 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict);
#endif
-} // GDMonoMarshal
+} // namespace GDMonoMarshal
#endif // GDMONOMARSHAL_H
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index 53e45002c4..1cccd0ad9d 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -80,7 +80,7 @@ void MonoCache::clear_members() {
class_Basis = NULL;
class_Quat = NULL;
class_Transform = NULL;
- class_Rect3 = NULL;
+ class_AABB = NULL;
class_Color = NULL;
class_Plane = NULL;
class_NodePath = NULL;
@@ -147,7 +147,7 @@ void update_godot_api_cache() {
CACHE_CLASS_AND_CHECK(Basis, GODOT_API_CLASS(Basis));
CACHE_CLASS_AND_CHECK(Quat, GODOT_API_CLASS(Quat));
CACHE_CLASS_AND_CHECK(Transform, GODOT_API_CLASS(Transform));
- CACHE_CLASS_AND_CHECK(Rect3, GODOT_API_CLASS(Rect3));
+ CACHE_CLASS_AND_CHECK(AABB, GODOT_API_CLASS(AABB));
CACHE_CLASS_AND_CHECK(Color, GODOT_API_CLASS(Color));
CACHE_CLASS_AND_CHECK(Plane, GODOT_API_CLASS(Plane));
CACHE_CLASS_AND_CHECK(NodePath, GODOT_API_CLASS(NodePath));
@@ -364,4 +364,4 @@ String get_exception_name_and_message(MonoObject *p_ex) {
return res;
}
-}
+} // namespace GDMonoUtils
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index ebb5d28e4d..c38f8c5af5 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -82,7 +82,7 @@ struct MonoCache {
GDMonoClass *class_Basis;
GDMonoClass *class_Quat;
GDMonoClass *class_Transform;
- GDMonoClass *class_Rect3;
+ GDMonoClass *class_AABB;
GDMonoClass *class_Color;
GDMonoClass *class_Plane;
GDMonoClass *class_NodePath;
@@ -166,7 +166,7 @@ MonoDomain *create_domain(const String &p_friendly_name);
String get_exception_name_and_message(MonoObject *p_ex);
-} // GDMonoUtils
+} // namespace GDMonoUtils
#define NATIVE_GDMONOCLASS_NAME(m_class) (GDMonoMarshal::mono_string_to_godot((MonoString *)m_class->get_field(BINDINGS_NATIVE_NAME_FIELD)->get_value(NULL)))
diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp
index 7e99df29a1..47cc11cc0a 100644
--- a/modules/mono/signal_awaiter_utils.cpp
+++ b/modules/mono/signal_awaiter_utils.cpp
@@ -62,7 +62,7 @@ Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p
return err;
}
-}
+} // namespace SignalAwaiterUtils
Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
@@ -116,8 +116,8 @@ void SignalAwaiterHandle::_bind_methods() {
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &SignalAwaiterHandle::_signal_callback, MethodInfo("_signal_callback"));
}
-SignalAwaiterHandle::SignalAwaiterHandle(uint32_t p_managed_handle)
- : MonoGCHandle(p_managed_handle) {
+SignalAwaiterHandle::SignalAwaiterHandle(uint32_t p_managed_handle) :
+ MonoGCHandle(p_managed_handle) {
#ifdef DEBUG_ENABLED
conn_target_id = 0;
diff --git a/modules/mono/utils/mono_reg_utils.h b/modules/mono/utils/mono_reg_utils.h
index 4cc4965acb..599828aa80 100644
--- a/modules/mono/utils/mono_reg_utils.h
+++ b/modules/mono/utils/mono_reg_utils.h
@@ -47,7 +47,7 @@ namespace MonoRegUtils {
MonoRegInfo find_mono();
String find_msbuild_tools_path();
-} // MonoRegUtils
+} // namespace MonoRegUtils
#endif // WINDOWS_ENABLED
diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp
index f26663ea11..8f817771ac 100644
--- a/modules/mono/utils/string_utils.cpp
+++ b/modules/mono/utils/string_utils.cpp
@@ -78,7 +78,7 @@ int sfind(const String &p_text, int p_from) {
return -1;
}
-}
+} // namespace
String sformat(const String &p_text, const Variant &p1, const Variant &p2, const Variant &p3, const Variant &p4, const Variant &p5) {
if (p_text.length() < 2)
diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp
index 6d1d5485f3..7e8b308cf8 100644
--- a/modules/openssl/stream_peer_openssl.cpp
+++ b/modules/openssl/stream_peer_openssl.cpp
@@ -412,8 +412,12 @@ void StreamPeerOpenSSL::_print_error(int err) {
err = SSL_get_error(ssl, err);
switch (err) {
- case SSL_ERROR_NONE: ERR_PRINT("NO ERROR: The TLS/SSL I/O operation completed"); break;
- case SSL_ERROR_ZERO_RETURN: ERR_PRINT("The TLS/SSL connection has been closed.");
+ case SSL_ERROR_NONE:
+ ERR_PRINT("NO ERROR: The TLS/SSL I/O operation completed");
+ break;
+ case SSL_ERROR_ZERO_RETURN:
+ ERR_PRINT("The TLS/SSL connection has been closed.");
+ break;
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE:
ERR_PRINT("The operation did not complete.");
diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp
index 06eab4c94d..5742102dae 100644
--- a/modules/opus/audio_stream_opus.cpp
+++ b/modules/opus/audio_stream_opus.cpp
@@ -62,7 +62,7 @@ int AudioStreamPlaybackOpus::_op_seek_func(void *_stream, opus_int64 _offset, in
fa->seek_end(_offset);
} break;
default: {
- ERR_PRINT("BUG, wtf was whence set to?\n");
+ ERR_PRINT("Opus seek function failure: Unexpected value in _whence\n");
}
}
int ret = fa->eof_reached() ? -1 : 0;
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 03592047ad..4415c888a4 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -239,11 +239,11 @@ ResourceFormatPVR::ResourceFormatPVR() {
Image::_image_compress_pvrtc2_func = _compress_pvrtc4;
}
-/////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////
-//PVRTC decompressor, Based on PVRTC decompressor by IMGTEC.
+ //PVRTC decompressor, Based on PVRTC decompressor by IMGTEC.
-/////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////
#define PT_INDEX 2
#define BLK_Y_SIZE 4
diff --git a/modules/recast/SCsub b/modules/recast/SCsub
index 500c0ec055..530df9a37c 100644
--- a/modules/recast/SCsub
+++ b/modules/recast/SCsub
@@ -24,7 +24,7 @@ if env['builtin_recast']:
env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/Include"])
- lib = env.Library("recast_builtin", thirdparty_sources)
+ lib = env.add_library("recast_builtin", thirdparty_sources)
env.Append(LIBS=[lib])
# Godot source files
diff --git a/modules/regex/doc_classes/RegEx.xml b/modules/regex/doc_classes/RegEx.xml
index 4cf272fe8c..8cd163b0c8 100644
--- a/modules/regex/doc_classes/RegEx.xml
+++ b/modules/regex/doc_classes/RegEx.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RegEx" inherits="Reference" category="Core" version="3.0-alpha">
+<class name="RegEx" inherits="Reference" category="Core" version="3.0-beta">
<brief_description>
Class for searching text for patterns using regular expressions.
</brief_description>
diff --git a/modules/regex/doc_classes/RegExMatch.xml b/modules/regex/doc_classes/RegExMatch.xml
index 354febf89a..0217099ce6 100644
--- a/modules/regex/doc_classes/RegExMatch.xml
+++ b/modules/regex/doc_classes/RegExMatch.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RegExMatch" inherits="Reference" category="Core" version="3.0-alpha">
+<class name="RegExMatch" inherits="Reference" category="Core" version="3.0-beta">
<brief_description>
Contains the results of a regex search.
</brief_description>
<description>
- Contains the results of a single regex match returned by [method RegEx.search] and [method.RegEx.search_all]. It can be used to find the position and range of the match and its capturing groups, and it can extract its sub-string for you.
+ Contains the results of a single regex match returned by [method RegEx.search] and [method RegEx.search_all]. It can be used to find the position and range of the match and its capturing groups, and it can extract its sub-string for you.
</description>
<tutorials>
</tutorials>
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index 072f18b990..ac436c3c26 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -64,7 +64,7 @@ void image_decompress_squish(Image *p_image) {
} else if (p_image->get_format() == Image::FORMAT_RGTC_RG) {
squish_flags = squish::kBc5;
} else {
- print_line("wtf askd to decompress.. " + itos(p_image->get_format()));
+ print_line("Can't decompress unknown format: " + itos(p_image->get_format()));
ERR_FAIL_COND(true);
return;
}
diff --git a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml
index ee6c28c36a..4533d59cae 100644
--- a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml
+++ b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioStreamOGGVorbis" inherits="AudioStream" category="Core" version="3.0-alpha">
+<class name="AudioStreamOGGVorbis" inherits="AudioStream" category="Core" version="3.0-beta">
<brief_description>
OGG Vorbis audio stream driver.
</brief_description>
@@ -54,17 +54,6 @@
</description>
</method>
</methods>
- <members>
- <member name="data" type="PoolByteArray" setter="set_data" getter="get_data">
- Raw audio data.
- </member>
- <member name="loop" type="bool" setter="set_loop" getter="has_loop">
- If [code]true[/code], audio will loop continuously. Default value: [code]false[/code].
- </member>
- <member name="loop_offset" type="float" setter="set_loop_offset" getter="get_loop_offset">
- If loop is [code]true[/code], loop starts from this position, in seconds.
- </member>
- </members>
<constants>
</constants>
</class>
diff --git a/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml b/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml
index ce16632d6e..9d541cda58 100644
--- a/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml
+++ b/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceImporterOGGVorbis" inherits="ResourceImporter" category="Core" version="3.0-alpha">
+<class name="ResourceImporterOGGVorbis" inherits="ResourceImporter" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/svg/SCsub b/modules/svg/SCsub
index 5be9367808..e12abac8c1 100644
--- a/modules/svg/SCsub
+++ b/modules/svg/SCsub
@@ -12,7 +12,8 @@ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
# env.add_source_files(env.modules_sources, thirdparty_sources)
-lib = env.Library("svg_builtin", thirdparty_sources)
+lib = env.add_library("svg_builtin", thirdparty_sources)
+
# Needs to be appended to arrive after libscene in the linker call,
# but we don't want it to arrive *after* system libs, so manual hack
# LIBS contains first SCons Library objects ("SCons.Node.FS.File object")
diff --git a/modules/thekla_unwrap/SCsub b/modules/thekla_unwrap/SCsub
new file mode 100644
index 0000000000..c57bf326ea
--- /dev/null
+++ b/modules/thekla_unwrap/SCsub
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+
+Import('env')
+Import('env_modules')
+
+env_thekla_unwrap = env_modules.Clone()
+
+# Thirdparty source files
+if env['builtin_thekla_atlas']:
+ thirdparty_dir = "#thirdparty/thekla_atlas/"
+ thirdparty_sources = [
+ "nvcore/Memory.cpp",
+ "nvcore/Debug.cpp",
+ "nvcore/StrLib.cpp",
+ "nvcore/FileSystem.cpp",
+ "nvcore/RadixSort.cpp",
+ "nvmath/Basis.cpp",
+ "nvmath/ConvexHull.cpp",
+ "nvmath/Fitting.cpp",
+ "nvmath/Plane.cpp",
+ "nvmath/ProximityGrid.cpp",
+ "nvmath/Random.cpp",
+ "nvmath/Solver.cpp",
+ "nvmath/Sparse.cpp",
+ "nvmath/TypeSerialization.cpp",
+ "poshlib/posh.c",
+ "nvimage/BitMap.cpp",
+ "nvimage/Image.cpp",
+ "nvmesh/BaseMesh.cpp",
+ "nvmesh/MeshBuilder.cpp",
+ "nvmesh/TriMesh.cpp",
+ "nvmesh/QuadTriMesh.cpp",
+ "nvmesh/MeshTopology.cpp",
+ "nvmesh/halfedge/Edge.cpp",
+ "nvmesh/halfedge/Mesh.cpp",
+ "nvmesh/halfedge/Face.cpp",
+ "nvmesh/halfedge/Vertex.cpp",
+ "nvmesh/geometry/Bounds.cpp",
+ "nvmesh/geometry/Measurements.cpp",
+ "nvmesh/raster/Raster.cpp",
+ "nvmesh/param/Atlas.cpp",
+ "nvmesh/param/AtlasBuilder.cpp",
+ "nvmesh/param/AtlasPacker.cpp",
+ "nvmesh/param/LeastSquaresConformalMap.cpp",
+ "nvmesh/param/OrthogonalProjectionMap.cpp",
+ "nvmesh/param/ParameterizationQuality.cpp",
+ "nvmesh/param/SingleFaceMap.cpp",
+ "nvmesh/param/Util.cpp",
+ "nvmesh/weld/VertexWeld.cpp",
+ "nvmesh/weld/Snap.cpp",
+ "thekla/thekla_atlas.cpp"
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_thekla_unwrap.add_source_files(env.modules_sources, thirdparty_sources)
+ env_thekla_unwrap.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/poshlib", thirdparty_dir + "/nvcore", thirdparty_dir + "/nvmesh"])
+
+ # upstream uses c++11
+ if (not env_thekla_unwrap.msvc):
+ env_thekla_unwrap.Append(CXXFLAGS="-std=c++11")
+
+ if env["platform"] == 'x11':
+ env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_LINUX", "-DPOSH_COMPILER_GCC"])
+ elif env["platform"] == 'osx':
+ env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_DARWIN", "-DPOSH_COMPILER_GCC"])
+ elif env["platform"] == 'windows':
+ if env.msvc:
+ env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_WIN32", "-DNV_CC_MSVC", "-DPOSH_COMPILER_MSVC" ])
+ else:
+ env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_MINGW", "-DNV_CC_GNUC", "-DPOSH_COMPILER_GCC", "-U__STRICT_ANSI__"])
+ env.Append(LIBS=["dbghelp"])
+
+# Godot source files
+env_thekla_unwrap.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/thekla_unwrap/config.py b/modules/thekla_unwrap/config.py
new file mode 100644
index 0000000000..b1ce7d4b91
--- /dev/null
+++ b/modules/thekla_unwrap/config.py
@@ -0,0 +1,7 @@
+def can_build(platform):
+ return platform != "android" and platform != "ios"
+
+def configure(env):
+ if not env['tools']:
+ env['builtin_thekla_atlas'] = False
+ env.disabled_modules.append("thekla_unwrap")
diff --git a/modules/thekla_unwrap/register_types.cpp b/modules/thekla_unwrap/register_types.cpp
new file mode 100644
index 0000000000..ab3203068f
--- /dev/null
+++ b/modules/thekla_unwrap/register_types.cpp
@@ -0,0 +1,116 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+#include "thirdparty/thekla_atlas/thekla/thekla_atlas.h"
+#include <stdio.h>
+#include <stdlib.h>
+extern bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y);
+
+bool thekla_mesh_lightmap_unwrap_callback(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) {
+
+ //set up input mesh
+ Thekla::Atlas_Input_Mesh input_mesh;
+ input_mesh.face_array = new Thekla::Atlas_Input_Face[p_index_count / 3];
+ for (int i = 0; i < p_index_count / 3; i++) {
+ input_mesh.face_array[i].vertex_index[0] = p_indices[i * 3 + 0];
+ input_mesh.face_array[i].vertex_index[1] = p_indices[i * 3 + 1];
+ input_mesh.face_array[i].vertex_index[2] = p_indices[i * 3 + 2];
+ //printf("face %i - %i, %i, %i - mat %i\n", i, input_mesh.face_array[i].vertex_index[0], input_mesh.face_array[i].vertex_index[1], input_mesh.face_array[i].vertex_index[2], p_face_materials[i]);
+ input_mesh.face_array[i].material_index = p_face_materials[i];
+ }
+ input_mesh.vertex_array = new Thekla::Atlas_Input_Vertex[p_vertex_count];
+ for (int i = 0; i < p_vertex_count; i++) {
+ input_mesh.vertex_array[i].first_colocal = i; //wtf
+ for (int j = 0; j < 3; j++) {
+ input_mesh.vertex_array[i].position[j] = p_vertices[i * 3 + j];
+ input_mesh.vertex_array[i].normal[j] = p_normals[i * 3 + j];
+ }
+ input_mesh.vertex_array[i].uv[0] = 0;
+ input_mesh.vertex_array[i].uv[1] = 0;
+ //printf("vertex %i - %f, %f, %f\n", i, input_mesh.vertex_array[i].position[0], input_mesh.vertex_array[i].position[1], input_mesh.vertex_array[i].position[2]);
+ //printf("normal %i - %f, %f, %f\n", i, input_mesh.vertex_array[i].normal[0], input_mesh.vertex_array[i].normal[1], input_mesh.vertex_array[i].normal[2]);
+ }
+ input_mesh.face_count = p_index_count / 3;
+ input_mesh.vertex_count = p_vertex_count;
+
+ //set up options
+ Thekla::Atlas_Options options;
+ Thekla::atlas_set_default_options(&options);
+ options.packer_options.witness.packing_quality = 1;
+ options.packer_options.witness.texel_area = 1.0 / p_texel_size;
+ options.packer_options.witness.conservative = true;
+
+ //generate
+ Thekla::Atlas_Error err;
+ Thekla::Atlas_Output_Mesh *output = atlas_generate(&input_mesh, &options, &err);
+
+ delete[] input_mesh.face_array;
+ delete[] input_mesh.vertex_array;
+
+ if (err != Thekla::Atlas_Error_Success) {
+ printf("error with atlas\n");
+ } else {
+ *r_vertex = (int *)malloc(sizeof(int) * output->vertex_count);
+ *r_uv = (float *)malloc(sizeof(float) * output->vertex_count * 3);
+ *r_index = (int *)malloc(sizeof(int) * output->index_count);
+
+ // printf("w: %i, h: %i\n", output->atlas_width, output->atlas_height);
+ for (int i = 0; i < output->vertex_count; i++) {
+ (*r_vertex)[i] = output->vertex_array[i].xref;
+ (*r_uv)[i * 2 + 0] = output->vertex_array[i].uv[0] / output->atlas_width;
+ (*r_uv)[i * 2 + 1] = output->vertex_array[i].uv[1] / output->atlas_height;
+ // printf("uv: %f,%f\n", (*r_uv)[i * 2 + 0], (*r_uv)[i * 2 + 1]);
+ }
+ *r_vertex_count = output->vertex_count;
+
+ for (int i = 0; i < output->index_count; i++) {
+ (*r_index)[i] = output->index_array[i];
+ }
+
+ *r_index_count = output->index_count;
+
+ *r_size_hint_x = output->atlas_height;
+ *r_size_hint_y = output->atlas_width;
+ }
+
+ if (output) {
+ atlas_free(output);
+ }
+
+ return err == Thekla::Atlas_Error_Success;
+}
+
+void register_thekla_unwrap_types() {
+
+ array_mesh_lightmap_unwrap_callback = thekla_mesh_lightmap_unwrap_callback;
+}
+
+void unregister_thekla_unwrap_types() {
+}
diff --git a/modules/thekla_unwrap/register_types.h b/modules/thekla_unwrap/register_types.h
new file mode 100644
index 0000000000..2bc3d16c64
--- /dev/null
+++ b/modules/thekla_unwrap/register_types.h
@@ -0,0 +1,31 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_thekla_unwrap_types();
+void unregister_thekla_unwrap_types();
diff --git a/modules/theora/doc_classes/ResourceImporterTheora.xml b/modules/theora/doc_classes/ResourceImporterTheora.xml
index 497c938826..85c7c6bf89 100644
--- a/modules/theora/doc_classes/ResourceImporterTheora.xml
+++ b/modules/theora/doc_classes/ResourceImporterTheora.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceImporterTheora" inherits="ResourceImporter" category="Core" version="3.0-alpha">
+<class name="ResourceImporterTheora" inherits="ResourceImporter" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/theora/doc_classes/VideoStreamTheora.xml b/modules/theora/doc_classes/VideoStreamTheora.xml
index 8f155b786f..6c8806ed72 100644
--- a/modules/theora/doc_classes/VideoStreamTheora.xml
+++ b/modules/theora/doc_classes/VideoStreamTheora.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VideoStreamTheora" inherits="VideoStream" category="Core" version="3.0-alpha">
+<class name="VideoStreamTheora" inherits="VideoStream" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -24,10 +24,6 @@
</description>
</method>
</methods>
- <members>
- <member name="file" type="String" setter="set_file" getter="get_file">
- </member>
- </members>
<constants>
</constants>
</class>
diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp
index 49a4db237a..c88662454c 100644
--- a/modules/tinyexr/image_loader_tinyexr.cpp
+++ b/modules/tinyexr/image_loader_tinyexr.cpp
@@ -47,6 +47,11 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
f->close();
+ // Re-implementation of tinyexr's LoadEXRFromMemory using Godot types to store the Image data
+ // and Godot's error codes.
+ // When debugging after updating the thirdparty library, check that we're still in sync with
+ // their API usage in LoadEXRFromMemory.
+
EXRVersion exr_version;
EXRImage exr_image;
EXRHeader exr_header;
@@ -68,6 +73,13 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
return ERR_FILE_CORRUPT;
}
+ // Read HALF channel as FLOAT. (GH-13490)
+ for (int i = 0; i < exr_header.num_channels; i++) {
+ if (exr_header.pixel_types[i] == TINYEXR_PIXELTYPE_HALF) {
+ exr_header.requested_pixel_types[i] = TINYEXR_PIXELTYPE_FLOAT;
+ }
+ }
+
InitEXRImage(&exr_image);
ret = LoadEXRImageFromMemory(&exr_image, &exr_header, w.ptr(), src_image_len, &err);
if (ret != TINYEXR_SUCCESS) {
@@ -95,23 +107,25 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
}
if (idxR == -1) {
- ERR_PRINT("R channel not found");
+ ERR_PRINT("TinyEXR: R channel not found.");
// @todo { free exr_image }
return ERR_FILE_CORRUPT;
}
if (idxG == -1) {
- ERR_PRINT("G channel not found\n")
+ ERR_PRINT("TinyEXR: G channel not found.")
// @todo { free exr_image }
return ERR_FILE_CORRUPT;
}
if (idxB == -1) {
- ERR_PRINT("B channel not found\n")
+ ERR_PRINT("TinyEXR: B channel not found.")
// @todo { free exr_image }
return ERR_FILE_CORRUPT;
}
+ // EXR image data loaded, now parse it into Godot-friendly image data
+
PoolVector<uint8_t> imgdata;
Image::Format format;
@@ -126,7 +140,6 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
}
{
-
PoolVector<uint8_t>::Write wd = imgdata.write();
uint16_t *iw = (uint16_t *)wd.ptr();
@@ -151,11 +164,13 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
}
}
- print_line("EXR w: " + itos(exr_image.width) + " h:" + itos(exr_image.height) + " format " + Image::get_format_name(format));
p_image->create(exr_image.width, exr_image.height, false, format, imgdata);
w = PoolVector<uint8_t>::Write();
+ FreeEXRHeader(&exr_header);
+ FreeEXRImage(&exr_image);
+
return OK;
}
diff --git a/modules/visual_script/SCsub b/modules/visual_script/SCsub
index 0882406761..96ee911ba0 100644
--- a/modules/visual_script/SCsub
+++ b/modules/visual_script/SCsub
@@ -1,7 +1,10 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
-env.add_source_files(env.modules_sources, "*.cpp")
+env_vs = env_modules.Clone()
+
+env_vs.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/visual_script/doc_classes/VisualScript.xml b/modules/visual_script/doc_classes/VisualScript.xml
index 80b1ed86d7..46bd35dd73 100644
--- a/modules/visual_script/doc_classes/VisualScript.xml
+++ b/modules/visual_script/doc_classes/VisualScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScript" inherits="Script" category="Core" version="3.0-alpha">
+<class name="VisualScript" inherits="Script" category="Core" version="3.0-beta">
<brief_description>
A script implemented in the Visual Script programming environment.
</brief_description>
@@ -495,10 +495,6 @@
</description>
</method>
</methods>
- <members>
- <member name="data" type="Dictionary" setter="_set_data" getter="_get_data">
- </member>
- </members>
<signals>
<signal name="node_ports_changed">
<argument index="0" name="function" type="String">
diff --git a/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml
index 6c028e5f28..e602214a66 100644
--- a/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml
+++ b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
A Visual Script node representing a constant from the base types.
</brief_description>
@@ -11,34 +11,6 @@
<demos>
</demos>
<methods>
- <method name="get_basic_type" qualifiers="const">
- <return type="int" enum="Variant.Type">
- </return>
- <description>
- </description>
- </method>
- <method name="get_basic_type_constant" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_basic_type">
- <return type="void">
- </return>
- <argument index="0" name="name" type="int" enum="Variant.Type">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_basic_type_constant">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="basic_type" type="int" setter="set_basic_type" getter="get_basic_type" enum="Variant.Type">
diff --git a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
index 27231574d7..9f7d38e957 100644
--- a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
+++ b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
A Visual Script node used to call built-in functions.
</brief_description>
@@ -12,20 +12,6 @@
<demos>
</demos>
<methods>
- <method name="get_func">
- <return type="int" enum="VisualScriptBuiltinFunc.BuiltinFunc">
- </return>
- <description>
- </description>
- </method>
- <method name="set_func">
- <return type="void">
- </return>
- <argument index="0" name="which" type="int" enum="VisualScriptBuiltinFunc.BuiltinFunc">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="function" type="int" setter="set_func" getter="get_func" enum="VisualScriptBuiltinFunc.BuiltinFunc">
@@ -33,186 +19,192 @@
</member>
</members>
<constants>
- <constant name="MATH_SIN" value="0">
+ <constant name="MATH_SIN" value="0" enum="BuiltinFunc">
Return the sine of the input.
</constant>
- <constant name="MATH_COS" value="1">
+ <constant name="MATH_COS" value="1" enum="BuiltinFunc">
Return the cosine of the input.
</constant>
- <constant name="MATH_TAN" value="2">
+ <constant name="MATH_TAN" value="2" enum="BuiltinFunc">
Return the tangent of the input.
</constant>
- <constant name="MATH_SINH" value="3">
+ <constant name="MATH_SINH" value="3" enum="BuiltinFunc">
Return the hyperbolic sine of the input.
</constant>
- <constant name="MATH_COSH" value="4">
+ <constant name="MATH_COSH" value="4" enum="BuiltinFunc">
Return the hyperbolic cosine of the input.
</constant>
- <constant name="MATH_TANH" value="5">
+ <constant name="MATH_TANH" value="5" enum="BuiltinFunc">
Return the hyperbolic tangent of the input.
</constant>
- <constant name="MATH_ASIN" value="6">
+ <constant name="MATH_ASIN" value="6" enum="BuiltinFunc">
Return the arc sine of the input.
</constant>
- <constant name="MATH_ACOS" value="7">
+ <constant name="MATH_ACOS" value="7" enum="BuiltinFunc">
Return the arc cosine of the input.
</constant>
- <constant name="MATH_ATAN" value="8">
+ <constant name="MATH_ATAN" value="8" enum="BuiltinFunc">
Return the arc tangent of the input.
</constant>
- <constant name="MATH_ATAN2" value="9">
+ <constant name="MATH_ATAN2" value="9" enum="BuiltinFunc">
Return the arc tangent of the input, using the signs of both parameters to determine the exact angle.
</constant>
- <constant name="MATH_SQRT" value="10">
+ <constant name="MATH_SQRT" value="10" enum="BuiltinFunc">
Return the square root of the input.
</constant>
- <constant name="MATH_FMOD" value="11">
+ <constant name="MATH_FMOD" value="11" enum="BuiltinFunc">
Return the remainder of one input divided by the other, using floating-point numbers.
</constant>
- <constant name="MATH_FPOSMOD" value="12">
+ <constant name="MATH_FPOSMOD" value="12" enum="BuiltinFunc">
Return the positive remainder of one input divided by the other, using floating-point numbers.
</constant>
- <constant name="MATH_FLOOR" value="13">
+ <constant name="MATH_FLOOR" value="13" enum="BuiltinFunc">
Return the input rounded down.
</constant>
- <constant name="MATH_CEIL" value="14">
+ <constant name="MATH_CEIL" value="14" enum="BuiltinFunc">
Return the input rounded up.
</constant>
- <constant name="MATH_ROUND" value="15">
+ <constant name="MATH_ROUND" value="15" enum="BuiltinFunc">
Return the input rounded to the nearest integer.
</constant>
- <constant name="MATH_ABS" value="16">
+ <constant name="MATH_ABS" value="16" enum="BuiltinFunc">
Return the absolute value of the input.
</constant>
- <constant name="MATH_SIGN" value="17">
+ <constant name="MATH_SIGN" value="17" enum="BuiltinFunc">
Return the sign of the input, turning it into 1, -1, or 0. Useful to determine if the input is positive or negative.
</constant>
- <constant name="MATH_POW" value="18">
+ <constant name="MATH_POW" value="18" enum="BuiltinFunc">
Return the input raised to a given power.
</constant>
- <constant name="MATH_LOG" value="19">
+ <constant name="MATH_LOG" value="19" enum="BuiltinFunc">
Return the natural logarithm of the input. Note that this is not the typical base-10 logarithm function calculators use.
</constant>
- <constant name="MATH_EXP" value="20">
+ <constant name="MATH_EXP" value="20" enum="BuiltinFunc">
Return [b]e[/b] raised to the power of the input. [b]e[/b] sometimes called "Euler's number" is a mathematical constant whose value is approximately 2.71828.
</constant>
- <constant name="MATH_ISNAN" value="21">
+ <constant name="MATH_ISNAN" value="21" enum="BuiltinFunc">
Return whether the input is NaN (Not a Number) or not. NaN is usually produced by dividing 0 by 0, though other ways exist.
</constant>
- <constant name="MATH_ISINF" value="22">
+ <constant name="MATH_ISINF" value="22" enum="BuiltinFunc">
Return whether the input is an infinite floating-point number or not. Infinity is usually produced by dividing a number by 0, though other ways exist.
</constant>
- <constant name="MATH_EASE" value="23">
+ <constant name="MATH_EASE" value="23" enum="BuiltinFunc">
Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in.
</constant>
- <constant name="MATH_DECIMALS" value="24">
+ <constant name="MATH_DECIMALS" value="24" enum="BuiltinFunc">
Return the number of digit places after the decimal that the first non-zero digit occurs.
</constant>
- <constant name="MATH_STEPIFY" value="25">
+ <constant name="MATH_STEPIFY" value="25" enum="BuiltinFunc">
Return the input snapped to a given step.
</constant>
- <constant name="MATH_LERP" value="26">
+ <constant name="MATH_LERP" value="26" enum="BuiltinFunc">
Return a number linearly interpolated between the first two inputs, based on the third input. Uses the formula [code]a + (a - b) * t[/code].
</constant>
- <constant name="MATH_INVERSE_LERP" value="27">
+ <constant name="MATH_INVERSE_LERP" value="27" enum="BuiltinFunc">
</constant>
- <constant name="MATH_RANGE_LERP" value="28">
+ <constant name="MATH_RANGE_LERP" value="28" enum="BuiltinFunc">
</constant>
- <constant name="MATH_DECTIME" value="29">
+ <constant name="MATH_DECTIME" value="29" enum="BuiltinFunc">
Return the result of 'value' decreased by 'step' * 'amount'.
</constant>
- <constant name="MATH_RANDOMIZE" value="30">
+ <constant name="MATH_RANDOMIZE" value="30" enum="BuiltinFunc">
Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
</constant>
- <constant name="MATH_RAND" value="31">
+ <constant name="MATH_RAND" value="31" enum="BuiltinFunc">
Return a random 32 bits integer value. To obtain a random value between 0 to N (where N is smaller than 2^32 - 1), you can use it with the remainder function.
</constant>
- <constant name="MATH_RANDF" value="32">
+ <constant name="MATH_RANDF" value="32" enum="BuiltinFunc">
Return a random floating-point value between 0 and 1. To obtain a random value between 0 to N, you can use it with multiplication.
</constant>
- <constant name="MATH_RANDOM" value="33">
+ <constant name="MATH_RANDOM" value="33" enum="BuiltinFunc">
Return a random floating-point value between the two inputs.
</constant>
- <constant name="MATH_SEED" value="34">
+ <constant name="MATH_SEED" value="34" enum="BuiltinFunc">
Set the seed for the random number generator.
</constant>
- <constant name="MATH_RANDSEED" value="35">
+ <constant name="MATH_RANDSEED" value="35" enum="BuiltinFunc">
Return a random value from the given seed, along with the new seed.
</constant>
- <constant name="MATH_DEG2RAD" value="36">
+ <constant name="MATH_DEG2RAD" value="36" enum="BuiltinFunc">
Convert the input from degrees to radians.
</constant>
- <constant name="MATH_RAD2DEG" value="37">
+ <constant name="MATH_RAD2DEG" value="37" enum="BuiltinFunc">
Convert the input from radians to degrees.
</constant>
- <constant name="MATH_LINEAR2DB" value="38">
+ <constant name="MATH_LINEAR2DB" value="38" enum="BuiltinFunc">
Convert the input from linear volume to decibel volume.
</constant>
- <constant name="MATH_DB2LINEAR" value="39">
+ <constant name="MATH_DB2LINEAR" value="39" enum="BuiltinFunc">
Convert the input from decibel volume to linear volume.
</constant>
- <constant name="MATH_WRAP" value="40">
+ <constant name="MATH_POLAR2CARTESIAN" value="40" enum="BuiltinFunc">
+ Converts a 2D point expressed in the polar coordinate system (a distance from the origin [code]r[/code] and an angle [code]th[/code]) to the cartesian coordinate system (x and y axis).
</constant>
- <constant name="MATH_WRAPF" value="41">
+ <constant name="MATH_CARTESIAN2POLAR" value="41" enum="BuiltinFunc">
+ Converts a 2D point expressed in the cartesian coordinate system (x and y axis) to the polar coordinate system (a distance from the origin and an angle).
</constant>
- <constant name="LOGIC_MAX" value="42">
+ <constant name="MATH_WRAP" value="42" enum="BuiltinFunc">
+ </constant>
+ <constant name="MATH_WRAPF" value="43" enum="BuiltinFunc">
+ </constant>
+ <constant name="LOGIC_MAX" value="44" enum="BuiltinFunc">
Return the greater of the two numbers, also known as their maximum.
</constant>
- <constant name="LOGIC_MIN" value="43">
+ <constant name="LOGIC_MIN" value="45" enum="BuiltinFunc">
Return the lesser of the two numbers, also known as their minimum.
</constant>
- <constant name="LOGIC_CLAMP" value="44">
+ <constant name="LOGIC_CLAMP" value="46" enum="BuiltinFunc">
Return the input clamped inside the given range, ensuring the result is never outside it. Equivalent to `min(max(input, range_low), range_high)`
</constant>
- <constant name="LOGIC_NEAREST_PO2" value="45">
+ <constant name="LOGIC_NEAREST_PO2" value="47" enum="BuiltinFunc">
Return the nearest power of 2 to the input.
</constant>
- <constant name="OBJ_WEAKREF" value="46">
+ <constant name="OBJ_WEAKREF" value="48" enum="BuiltinFunc">
Create a [WeakRef] from the input.
</constant>
- <constant name="FUNC_FUNCREF" value="47">
+ <constant name="FUNC_FUNCREF" value="49" enum="BuiltinFunc">
Create a [FuncRef] from the input.
</constant>
- <constant name="TYPE_CONVERT" value="48">
+ <constant name="TYPE_CONVERT" value="50" enum="BuiltinFunc">
Convert between types.
</constant>
- <constant name="TYPE_OF" value="49">
+ <constant name="TYPE_OF" value="51" enum="BuiltinFunc">
Return the type of the input as an integer. Check [enum Variant.Type] for the integers that might be returned.
</constant>
- <constant name="TYPE_EXISTS" value="50">
+ <constant name="TYPE_EXISTS" value="52" enum="BuiltinFunc">
Checks if a type is registered in the [ClassDB].
</constant>
- <constant name="TEXT_CHAR" value="51">
+ <constant name="TEXT_CHAR" value="53" enum="BuiltinFunc">
Return a character with the given ascii value.
</constant>
- <constant name="TEXT_STR" value="52">
+ <constant name="TEXT_STR" value="54" enum="BuiltinFunc">
Convert the input to a string.
</constant>
- <constant name="TEXT_PRINT" value="53">
+ <constant name="TEXT_PRINT" value="55" enum="BuiltinFunc">
Print the given string to the output window.
</constant>
- <constant name="TEXT_PRINTERR" value="54">
+ <constant name="TEXT_PRINTERR" value="56" enum="BuiltinFunc">
Print the given string to the standard error output.
</constant>
- <constant name="TEXT_PRINTRAW" value="55">
+ <constant name="TEXT_PRINTRAW" value="57" enum="BuiltinFunc">
Print the given string to the standard output, without adding a newline.
</constant>
- <constant name="VAR_TO_STR" value="56">
+ <constant name="VAR_TO_STR" value="58" enum="BuiltinFunc">
Serialize a [Variant] to a string.
</constant>
- <constant name="STR_TO_VAR" value="57">
+ <constant name="STR_TO_VAR" value="59" enum="BuiltinFunc">
Deserialize a [Variant] from a string serialized using [VAR_TO_STR].
</constant>
- <constant name="VAR_TO_BYTES" value="58">
+ <constant name="VAR_TO_BYTES" value="60" enum="BuiltinFunc">
Serialize a [Variant] to a [PoolByteArray].
</constant>
- <constant name="BYTES_TO_VAR" value="59">
+ <constant name="BYTES_TO_VAR" value="61" enum="BuiltinFunc">
Deserialize a [Variant] from a [PoolByteArray] serialized using [VAR_TO_BYTES].
</constant>
- <constant name="COLORN" value="60">
+ <constant name="COLORN" value="62" enum="BuiltinFunc">
Return the [Color] with the given name and alpha ranging from 0 to 1. Note: names are defined in color_names.inc.
</constant>
- <constant name="FUNC_MAX" value="61">
+ <constant name="FUNC_MAX" value="63" enum="BuiltinFunc">
The maximum value the [member function] property can have.
</constant>
</constants>
diff --git a/modules/visual_script/doc_classes/VisualScriptClassConstant.xml b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml
index e6498e92ad..78757843cd 100644
--- a/modules/visual_script/doc_classes/VisualScriptClassConstant.xml
+++ b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Gets a constant from a given class.
</brief_description>
@@ -15,34 +15,6 @@
<demos>
</demos>
<methods>
- <method name="get_base_type">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_class_constant">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_base_type">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_class_constant">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="base_type" type="String" setter="set_base_type" getter="get_base_type">
diff --git a/modules/visual_script/doc_classes/VisualScriptComment.xml b/modules/visual_script/doc_classes/VisualScriptComment.xml
index ea4545f8ef..c21a082362 100644
--- a/modules/visual_script/doc_classes/VisualScriptComment.xml
+++ b/modules/visual_script/doc_classes/VisualScriptComment.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptComment" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptComment" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
A Visual Script node used to annotate the script.
</brief_description>
@@ -12,48 +12,6 @@
<demos>
</demos>
<methods>
- <method name="get_description" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_size" qualifiers="const">
- <return type="Vector2">
- </return>
- <description>
- </description>
- </method>
- <method name="get_title" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_description">
- <return type="void">
- </return>
- <argument index="0" name="description" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_size">
- <return type="void">
- </return>
- <argument index="0" name="size" type="Vector2">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_title">
- <return type="void">
- </return>
- <argument index="0" name="title" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="description" type="String" setter="set_description" getter="get_description">
diff --git a/modules/visual_script/doc_classes/VisualScriptCondition.xml b/modules/visual_script/doc_classes/VisualScriptCondition.xml
index 2a30c604a5..f1f87c010d 100644
--- a/modules/visual_script/doc_classes/VisualScriptCondition.xml
+++ b/modules/visual_script/doc_classes/VisualScriptCondition.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptCondition" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptCondition" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
A Visual Script node which branches the flow.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptConstant.xml b/modules/visual_script/doc_classes/VisualScriptConstant.xml
index 51c6d19238..39a1e5eba8 100644
--- a/modules/visual_script/doc_classes/VisualScriptConstant.xml
+++ b/modules/visual_script/doc_classes/VisualScriptConstant.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptConstant" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Gets a contant's value.
</brief_description>
@@ -15,34 +15,6 @@
<demos>
</demos>
<methods>
- <method name="get_constant_type" qualifiers="const">
- <return type="int" enum="Variant.Type">
- </return>
- <description>
- </description>
- </method>
- <method name="get_constant_value" qualifiers="const">
- <return type="Variant">
- </return>
- <description>
- </description>
- </method>
- <method name="set_constant_type">
- <return type="void">
- </return>
- <argument index="0" name="type" type="int" enum="Variant.Type">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_constant_value">
- <return type="void">
- </return>
- <argument index="0" name="value" type="Variant">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="type" type="int" setter="set_constant_type" getter="get_constant_type" enum="Variant.Type">
diff --git a/modules/visual_script/doc_classes/VisualScriptConstructor.xml b/modules/visual_script/doc_classes/VisualScriptConstructor.xml
index 91df52e893..cbe8c6c096 100644
--- a/modules/visual_script/doc_classes/VisualScriptConstructor.xml
+++ b/modules/visual_script/doc_classes/VisualScriptConstructor.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptConstructor" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptConstructor" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
A Visual Script node which calls a base type constructor.
</brief_description>
@@ -40,30 +40,6 @@
</description>
</method>
</methods>
- <members>
- <member name="constructor" type="Dictionary" setter="set_constructor" getter="get_constructor">
- The constructor function's method info. Has roughly the following structure:
- [codeblock]
- {
- name = "string",
- args = [{
- name = "string"
- class_name = "string"
- type = TYPE_*
- hint = PROPERTY_HINT_*
- hint_string = "string"
- }]
- default_args = [] # Array of variants
- flags = METHOD_FLAG_*
- id = 0
- return = {type = TYPE_*}
- }
- [/codeblock]
- </member>
- <member name="type" type="int" setter="set_constructor_type" getter="get_constructor_type" enum="Variant.Type">
- The type to be constructed.
- </member>
- </members>
<constants>
</constants>
</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptCustomNode.xml b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml
index 38c325cfb7..c321c616af 100644
--- a/modules/visual_script/doc_classes/VisualScriptCustomNode.xml
+++ b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptCustomNode" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptCustomNode" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
A scripted Visual Script node.
</brief_description>
@@ -136,28 +136,28 @@
</method>
</methods>
<constants>
- <constant name="START_MODE_BEGIN_SEQUENCE" value="0">
+ <constant name="START_MODE_BEGIN_SEQUENCE" value="0" enum="StartMode">
The start mode used the first time when [method _step] is called.
</constant>
- <constant name="START_MODE_CONTINUE_SEQUENCE" value="1">
+ <constant name="START_MODE_CONTINUE_SEQUENCE" value="1" enum="StartMode">
The start mode used when [method _step] is called after coming back from a STEP_PUSH_STACK_BIT.
</constant>
- <constant name="START_MODE_RESUME_YIELD" value="2">
+ <constant name="START_MODE_RESUME_YIELD" value="2" enum="StartMode">
The start mode used when [method _step] is called after resuming from STEP_YIELD_BIT.
</constant>
- <constant name="STEP_PUSH_STACK_BIT" value="16777216" enum="">
+ <constant name="STEP_PUSH_STACK_BIT" value="16777216">
Hint used by [method _step] to tell that control should return to it when there is no other node left to execute.
This is used by [VisualScriptCondition] to redirect the sequence to the "Done" port after the true/false branch has finished execution.
</constant>
- <constant name="STEP_GO_BACK_BIT" value="33554432" enum="">
+ <constant name="STEP_GO_BACK_BIT" value="33554432">
Hint used by [method _step] to tell that control should return back, either hitting a previous STEP_PUSH_STACK_BIT or exiting the function.
</constant>
- <constant name="STEP_NO_ADVANCE_BIT" value="67108864" enum="">
+ <constant name="STEP_NO_ADVANCE_BIT" value="67108864">
</constant>
- <constant name="STEP_EXIT_FUNCTION_BIT" value="134217728" enum="">
+ <constant name="STEP_EXIT_FUNCTION_BIT" value="134217728">
Hint used by [method _step] to tell that control should stop and exit the function.
</constant>
- <constant name="STEP_YIELD_BIT" value="268435456" enum="">
+ <constant name="STEP_YIELD_BIT" value="268435456">
Hint used by [method _step] to tell that the function should be yielded.
Using this requires you to have at least one working memory slot, which is used for the [VisualScriptFunctionState].
</constant>
diff --git a/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
index cbed3ba22c..0f396564e2 100644
--- a/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
+++ b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
A Visual Script node which deconstructs a base type instance into its parts.
</brief_description>
@@ -11,24 +11,8 @@
<demos>
</demos>
<methods>
- <method name="get_deconstruct_type" qualifiers="const">
- <return type="int" enum="Variant.Type">
- </return>
- <description>
- </description>
- </method>
- <method name="set_deconstruct_type">
- <return type="void">
- </return>
- <argument index="0" name="type" type="int" enum="Variant.Type">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
- <member name="elem_cache" type="Array" setter="_set_elem_cache" getter="_get_elem_cache">
- </member>
<member name="type" type="int" setter="set_deconstruct_type" getter="get_deconstruct_type" enum="Variant.Type">
The type to deconstruct.
</member>
diff --git a/modules/visual_script/doc_classes/VisualScriptEditor.xml b/modules/visual_script/doc_classes/VisualScriptEditor.xml
index 70d52b2bd7..b433f132c1 100644
--- a/modules/visual_script/doc_classes/VisualScriptEditor.xml
+++ b/modules/visual_script/doc_classes/VisualScriptEditor.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptEditor" inherits="Object" category="Core" version="3.0.alpha.custom_build">
+<class name="VisualScriptEditor" inherits="Object" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml
index 669276f0d0..71e8c7d93c 100644
--- a/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml
+++ b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Emits a specified signal.
</brief_description>
@@ -15,20 +15,6 @@
<demos>
</demos>
<methods>
- <method name="get_signal" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_signal">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="signal" type="String" setter="set_signal" getter="get_signal">
diff --git a/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml
index 6703ff4eda..b9f356412d 100644
--- a/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml
+++ b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
A Visual Script node returning a singleton from [@GlobalScope]
</brief_description>
@@ -11,20 +11,6 @@
<demos>
</demos>
<methods>
- <method name="get_singleton">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_singleton">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="constant" type="String" setter="set_singleton" getter="get_singleton">
diff --git a/modules/visual_script/doc_classes/VisualScriptExpression.xml b/modules/visual_script/doc_classes/VisualScriptExpression.xml
index fb3b6ef19d..91c107e069 100644
--- a/modules/visual_script/doc_classes/VisualScriptExpression.xml
+++ b/modules/visual_script/doc_classes/VisualScriptExpression.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptExpression" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptExpression" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptFunction.xml b/modules/visual_script/doc_classes/VisualScriptFunction.xml
index d77169679b..2c63b98b22 100644
--- a/modules/visual_script/doc_classes/VisualScriptFunction.xml
+++ b/modules/visual_script/doc_classes/VisualScriptFunction.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptFunction" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptFunction" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
index 7a0a7c9f55..03c47dca7c 100644
--- a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
+++ b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptFunctionCall" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptFunctionCall" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -9,150 +9,8 @@
<demos>
</demos>
<methods>
- <method name="get_base_path" qualifiers="const">
- <return type="NodePath">
- </return>
- <description>
- </description>
- </method>
- <method name="get_base_script" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_base_type" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_basic_type" qualifiers="const">
- <return type="int" enum="Variant.Type">
- </return>
- <description>
- </description>
- </method>
- <method name="get_call_mode" qualifiers="const">
- <return type="int" enum="VisualScriptFunctionCall.CallMode">
- </return>
- <description>
- </description>
- </method>
- <method name="get_function" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_rpc_call_mode" qualifiers="const">
- <return type="int" enum="VisualScriptFunctionCall.RPCCallMode">
- </return>
- <description>
- </description>
- </method>
- <method name="get_singleton" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_use_default_args" qualifiers="const">
- <return type="int">
- </return>
- <description>
- </description>
- </method>
- <method name="get_validate" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- </description>
- </method>
- <method name="set_base_path">
- <return type="void">
- </return>
- <argument index="0" name="base_path" type="NodePath">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_base_script">
- <return type="void">
- </return>
- <argument index="0" name="base_script" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_base_type">
- <return type="void">
- </return>
- <argument index="0" name="base_type" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_basic_type">
- <return type="void">
- </return>
- <argument index="0" name="basic_type" type="int" enum="Variant.Type">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_call_mode">
- <return type="void">
- </return>
- <argument index="0" name="mode" type="int" enum="VisualScriptFunctionCall.CallMode">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_function">
- <return type="void">
- </return>
- <argument index="0" name="function" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_rpc_call_mode">
- <return type="void">
- </return>
- <argument index="0" name="mode" type="int" enum="VisualScriptFunctionCall.RPCCallMode">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_singleton">
- <return type="void">
- </return>
- <argument index="0" name="singleton" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_use_default_args">
- <return type="void">
- </return>
- <argument index="0" name="amount" type="int">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_validate">
- <return type="void">
- </return>
- <argument index="0" name="enable" type="bool">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
- <member name="argument_cache" type="Dictionary" setter="_set_argument_cache" getter="_get_argument_cache">
- </member>
<member name="base_script" type="String" setter="set_base_script" getter="get_base_script">
</member>
<member name="base_type" type="String" setter="set_base_type" getter="get_base_type">
@@ -175,25 +33,25 @@
</member>
</members>
<constants>
- <constant name="CALL_MODE_SELF" value="0">
+ <constant name="CALL_MODE_SELF" value="0" enum="CallMode">
</constant>
- <constant name="CALL_MODE_NODE_PATH" value="1">
+ <constant name="CALL_MODE_NODE_PATH" value="1" enum="CallMode">
</constant>
- <constant name="CALL_MODE_INSTANCE" value="2">
+ <constant name="CALL_MODE_INSTANCE" value="2" enum="CallMode">
</constant>
- <constant name="CALL_MODE_BASIC_TYPE" value="3">
+ <constant name="CALL_MODE_BASIC_TYPE" value="3" enum="CallMode">
</constant>
- <constant name="CALL_MODE_SINGLETON" value="4">
+ <constant name="CALL_MODE_SINGLETON" value="4" enum="CallMode">
</constant>
- <constant name="RPC_DISABLED" value="0">
+ <constant name="RPC_DISABLED" value="0" enum="RPCCallMode">
</constant>
- <constant name="RPC_RELIABLE" value="1">
+ <constant name="RPC_RELIABLE" value="1" enum="RPCCallMode">
</constant>
- <constant name="RPC_UNRELIABLE" value="2">
+ <constant name="RPC_UNRELIABLE" value="2" enum="RPCCallMode">
</constant>
- <constant name="RPC_RELIABLE_TO_ID" value="3">
+ <constant name="RPC_RELIABLE_TO_ID" value="3" enum="RPCCallMode">
</constant>
- <constant name="RPC_UNRELIABLE_TO_ID" value="4">
+ <constant name="RPC_UNRELIABLE_TO_ID" value="4" enum="RPCCallMode">
</constant>
</constants>
</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml
index 9b30f62236..90ec85e4f4 100644
--- a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml
+++ b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptFunctionState" inherits="Reference" category="Core" version="3.0-alpha">
+<class name="VisualScriptFunctionState" inherits="Reference" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml
index 961244fe88..4417c8a533 100644
--- a/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml
+++ b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptGlobalConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptGlobalConstant" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -9,20 +9,6 @@
<demos>
</demos>
<methods>
- <method name="get_global_constant">
- <return type="int">
- </return>
- <description>
- </description>
- </method>
- <method name="set_global_constant">
- <return type="void">
- </return>
- <argument index="0" name="index" type="int">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="constant" type="int" setter="set_global_constant" getter="get_global_constant">
diff --git a/modules/visual_script/doc_classes/VisualScriptIndexGet.xml b/modules/visual_script/doc_classes/VisualScriptIndexGet.xml
index c5229f7678..c0a83f186a 100644
--- a/modules/visual_script/doc_classes/VisualScriptIndexGet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptIndexGet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptIndexGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptIndexGet" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptIndexSet.xml b/modules/visual_script/doc_classes/VisualScriptIndexSet.xml
index 27646b4a5f..8661341919 100644
--- a/modules/visual_script/doc_classes/VisualScriptIndexSet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptIndexSet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptIndexSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptIndexSet" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptInputAction.xml b/modules/visual_script/doc_classes/VisualScriptInputAction.xml
index 7f6d13264e..afe72ba564 100644
--- a/modules/visual_script/doc_classes/VisualScriptInputAction.xml
+++ b/modules/visual_script/doc_classes/VisualScriptInputAction.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptInputAction" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptInputAction" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -9,34 +9,6 @@
<demos>
</demos>
<methods>
- <method name="get_action_mode" qualifiers="const">
- <return type="int" enum="VisualScriptInputAction.Mode">
- </return>
- <description>
- </description>
- </method>
- <method name="get_action_name" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_action_mode">
- <return type="void">
- </return>
- <argument index="0" name="mode" type="int" enum="VisualScriptInputAction.Mode">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_action_name">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="action" type="String" setter="set_action_name" getter="get_action_name">
@@ -45,13 +17,13 @@
</member>
</members>
<constants>
- <constant name="MODE_PRESSED" value="0">
+ <constant name="MODE_PRESSED" value="0" enum="Mode">
</constant>
- <constant name="MODE_RELEASED" value="1">
+ <constant name="MODE_RELEASED" value="1" enum="Mode">
</constant>
- <constant name="MODE_JUST_PRESSED" value="2">
+ <constant name="MODE_JUST_PRESSED" value="2" enum="Mode">
</constant>
- <constant name="MODE_JUST_RELEASED" value="3">
+ <constant name="MODE_JUST_RELEASED" value="3" enum="Mode">
</constant>
</constants>
</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptIterator.xml b/modules/visual_script/doc_classes/VisualScriptIterator.xml
index fc905d6c39..08dfad5acb 100644
--- a/modules/visual_script/doc_classes/VisualScriptIterator.xml
+++ b/modules/visual_script/doc_classes/VisualScriptIterator.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptIterator" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptIterator" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Steps through items in a given input.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVar.xml b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml
index ff77dfac0d..a4293adaae 100644
--- a/modules/visual_script/doc_classes/VisualScriptLocalVar.xml
+++ b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptLocalVar" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptLocalVar" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Gets a local variable's value.
</brief_description>
@@ -15,34 +15,6 @@
<demos>
</demos>
<methods>
- <method name="get_var_name" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_var_type" qualifiers="const">
- <return type="int" enum="Variant.Type">
- </return>
- <description>
- </description>
- </method>
- <method name="set_var_name">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_var_type">
- <return type="void">
- </return>
- <argument index="0" name="type" type="int" enum="Variant.Type">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="type" type="int" setter="set_var_type" getter="get_var_type" enum="Variant.Type">
diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml
index 07b01d4576..c1a279bdb2 100644
--- a/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Changes a local variable's value.
</brief_description>
@@ -17,34 +17,6 @@
<demos>
</demos>
<methods>
- <method name="get_var_name" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_var_type" qualifiers="const">
- <return type="int" enum="Variant.Type">
- </return>
- <description>
- </description>
- </method>
- <method name="set_var_name">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_var_type">
- <return type="void">
- </return>
- <argument index="0" name="type" type="int" enum="Variant.Type">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="type" type="int" setter="set_var_type" getter="get_var_type" enum="Variant.Type">
diff --git a/modules/visual_script/doc_classes/VisualScriptMathConstant.xml b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml
index 817bcb5ce2..2cb053ee5f 100644
--- a/modules/visual_script/doc_classes/VisualScriptMathConstant.xml
+++ b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptMathConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptMathConstant" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Commonly used mathematical constants.
</brief_description>
@@ -15,20 +15,6 @@
<demos>
</demos>
<methods>
- <method name="get_math_constant">
- <return type="int" enum="VisualScriptMathConstant.MathConstant">
- </return>
- <description>
- </description>
- </method>
- <method name="set_math_constant">
- <return type="void">
- </return>
- <argument index="0" name="which" type="int" enum="VisualScriptMathConstant.MathConstant">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="constant" type="int" setter="set_math_constant" getter="get_math_constant" enum="VisualScriptMathConstant.MathConstant">
@@ -36,31 +22,31 @@
</member>
</members>
<constants>
- <constant name="MATH_CONSTANT_ONE" value="0">
+ <constant name="MATH_CONSTANT_ONE" value="0" enum="MathConstant">
Unity: [code]1[/code]
</constant>
- <constant name="MATH_CONSTANT_PI" value="1">
+ <constant name="MATH_CONSTANT_PI" value="1" enum="MathConstant">
Pi: [code]3.141593[/code]
</constant>
- <constant name="MATH_CONSTANT_HALF_PI" value="2">
+ <constant name="MATH_CONSTANT_HALF_PI" value="2" enum="MathConstant">
Pi divided by two: [code]1.570796[/code]
</constant>
- <constant name="MATH_CONSTANT_TAU" value="3">
+ <constant name="MATH_CONSTANT_TAU" value="3" enum="MathConstant">
Tau: [code]6.283185[/code]
</constant>
- <constant name="MATH_CONSTANT_E" value="4">
+ <constant name="MATH_CONSTANT_E" value="4" enum="MathConstant">
Natural log: [code]2.718282[/code]
</constant>
- <constant name="MATH_CONSTANT_SQRT2" value="5">
+ <constant name="MATH_CONSTANT_SQRT2" value="5" enum="MathConstant">
Square root of two: [code]1.414214[/code]
</constant>
- <constant name="MATH_CONSTANT_INF" value="6">
+ <constant name="MATH_CONSTANT_INF" value="6" enum="MathConstant">
Infinity: [code]inf[/code]
</constant>
- <constant name="MATH_CONSTANT_NAN" value="7">
+ <constant name="MATH_CONSTANT_NAN" value="7" enum="MathConstant">
Not a number: [code]nan[/code]
</constant>
- <constant name="MATH_CONSTANT_MAX" value="8">
+ <constant name="MATH_CONSTANT_MAX" value="8" enum="MathConstant">
</constant>
</constants>
</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptNode.xml b/modules/visual_script/doc_classes/VisualScriptNode.xml
index f6f2867172..ef7cf7c3b8 100644
--- a/modules/visual_script/doc_classes/VisualScriptNode.xml
+++ b/modules/visual_script/doc_classes/VisualScriptNode.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptNode" inherits="Resource" category="Core" version="3.0-alpha">
+<class name="VisualScriptNode" inherits="Resource" category="Core" version="3.0-beta">
<brief_description>
A node which is part of a [VisualScript].
</brief_description>
@@ -46,10 +46,6 @@
</description>
</method>
</methods>
- <members>
- <member name="_default_input_values" type="Array" setter="_set_default_input_values" getter="_get_default_input_values">
- </member>
- </members>
<signals>
<signal name="ports_changed">
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptOperator.xml b/modules/visual_script/doc_classes/VisualScriptOperator.xml
index bf4032c09c..b7819592d9 100644
--- a/modules/visual_script/doc_classes/VisualScriptOperator.xml
+++ b/modules/visual_script/doc_classes/VisualScriptOperator.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptOperator" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptOperator" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -14,34 +14,6 @@
<demos>
</demos>
<methods>
- <method name="get_operator" qualifiers="const">
- <return type="int" enum="Variant.Operator">
- </return>
- <description>
- </description>
- </method>
- <method name="get_typed" qualifiers="const">
- <return type="int" enum="Variant.Type">
- </return>
- <description>
- </description>
- </method>
- <method name="set_operator">
- <return type="void">
- </return>
- <argument index="0" name="op" type="int" enum="Variant.Operator">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_typed">
- <return type="void">
- </return>
- <argument index="0" name="type" type="int" enum="Variant.Type">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="operator" type="int" setter="set_operator" getter="get_operator" enum="Variant.Operator">
diff --git a/modules/visual_script/doc_classes/VisualScriptPreload.xml b/modules/visual_script/doc_classes/VisualScriptPreload.xml
index 4a71e23809..712ec99fdb 100644
--- a/modules/visual_script/doc_classes/VisualScriptPreload.xml
+++ b/modules/visual_script/doc_classes/VisualScriptPreload.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptPreload" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptPreload" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Creates a new [Resource] or loads one from the filesystem.
</brief_description>
@@ -15,20 +15,6 @@
<demos>
</demos>
<methods>
- <method name="get_preload" qualifiers="const">
- <return type="Resource">
- </return>
- <description>
- </description>
- </method>
- <method name="set_preload">
- <return type="void">
- </return>
- <argument index="0" name="resource" type="Resource">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="resource" type="Resource" setter="set_preload" getter="get_preload">
diff --git a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
index eb5c52f4be..11c50f2b97 100644
--- a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptPropertyGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptPropertyGet" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -9,104 +9,6 @@
<demos>
</demos>
<methods>
- <method name="get_base_path" qualifiers="const">
- <return type="NodePath">
- </return>
- <description>
- </description>
- </method>
- <method name="get_base_script" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_base_type" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_basic_type" qualifiers="const">
- <return type="int" enum="Variant.Type">
- </return>
- <description>
- </description>
- </method>
- <method name="get_call_mode" qualifiers="const">
- <return type="int" enum="VisualScriptPropertyGet.CallMode">
- </return>
- <description>
- </description>
- </method>
- <method name="get_index" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_property" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_base_path">
- <return type="void">
- </return>
- <argument index="0" name="base_path" type="NodePath">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_base_script">
- <return type="void">
- </return>
- <argument index="0" name="base_script" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_base_type">
- <return type="void">
- </return>
- <argument index="0" name="base_type" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_basic_type">
- <return type="void">
- </return>
- <argument index="0" name="basic_type" type="int" enum="Variant.Type">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_call_mode">
- <return type="void">
- </return>
- <argument index="0" name="mode" type="int" enum="VisualScriptPropertyGet.CallMode">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_index">
- <return type="void">
- </return>
- <argument index="0" name="index" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_property">
- <return type="void">
- </return>
- <argument index="0" name="property" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="base_script" type="String" setter="set_base_script" getter="get_base_script">
@@ -123,15 +25,13 @@
</member>
<member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertyGet.CallMode">
</member>
- <member name="type_cache" type="int" setter="_set_type_cache" getter="_get_type_cache" enum="Variant.Type">
- </member>
</members>
<constants>
- <constant name="CALL_MODE_SELF" value="0">
+ <constant name="CALL_MODE_SELF" value="0" enum="CallMode">
</constant>
- <constant name="CALL_MODE_NODE_PATH" value="1">
+ <constant name="CALL_MODE_NODE_PATH" value="1" enum="CallMode">
</constant>
- <constant name="CALL_MODE_INSTANCE" value="2">
+ <constant name="CALL_MODE_INSTANCE" value="2" enum="CallMode">
</constant>
</constants>
</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
index 794caa2518..2e96ccc1f6 100644
--- a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptPropertySet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptPropertySet" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -9,118 +9,6 @@
<demos>
</demos>
<methods>
- <method name="get_assign_op" qualifiers="const">
- <return type="int" enum="VisualScriptPropertySet.AssignOp">
- </return>
- <description>
- </description>
- </method>
- <method name="get_base_path" qualifiers="const">
- <return type="NodePath">
- </return>
- <description>
- </description>
- </method>
- <method name="get_base_script" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_base_type" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_basic_type" qualifiers="const">
- <return type="int" enum="Variant.Type">
- </return>
- <description>
- </description>
- </method>
- <method name="get_call_mode" qualifiers="const">
- <return type="int" enum="VisualScriptPropertySet.CallMode">
- </return>
- <description>
- </description>
- </method>
- <method name="get_index" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_property" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_assign_op">
- <return type="void">
- </return>
- <argument index="0" name="assign_op" type="int" enum="VisualScriptPropertySet.AssignOp">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_base_path">
- <return type="void">
- </return>
- <argument index="0" name="base_path" type="NodePath">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_base_script">
- <return type="void">
- </return>
- <argument index="0" name="base_script" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_base_type">
- <return type="void">
- </return>
- <argument index="0" name="base_type" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_basic_type">
- <return type="void">
- </return>
- <argument index="0" name="basic_type" type="int" enum="Variant.Type">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_call_mode">
- <return type="void">
- </return>
- <argument index="0" name="mode" type="int" enum="VisualScriptPropertySet.CallMode">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_index">
- <return type="void">
- </return>
- <argument index="0" name="index" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_property">
- <return type="void">
- </return>
- <argument index="0" name="property" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="assign_op" type="int" setter="set_assign_op" getter="get_assign_op" enum="VisualScriptPropertySet.AssignOp">
@@ -139,39 +27,37 @@
</member>
<member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertySet.CallMode">
</member>
- <member name="type_cache" type="Dictionary" setter="_set_type_cache" getter="_get_type_cache">
- </member>
</members>
<constants>
- <constant name="CALL_MODE_SELF" value="0">
+ <constant name="CALL_MODE_SELF" value="0" enum="CallMode">
</constant>
- <constant name="CALL_MODE_NODE_PATH" value="1">
+ <constant name="CALL_MODE_NODE_PATH" value="1" enum="CallMode">
</constant>
- <constant name="CALL_MODE_INSTANCE" value="2">
+ <constant name="CALL_MODE_INSTANCE" value="2" enum="CallMode">
</constant>
- <constant name="CALL_MODE_BASIC_TYPE" value="3">
+ <constant name="CALL_MODE_BASIC_TYPE" value="3" enum="CallMode">
</constant>
- <constant name="ASSIGN_OP_NONE" value="0">
+ <constant name="ASSIGN_OP_NONE" value="0" enum="AssignOp">
</constant>
- <constant name="ASSIGN_OP_ADD" value="1">
+ <constant name="ASSIGN_OP_ADD" value="1" enum="AssignOp">
</constant>
- <constant name="ASSIGN_OP_SUB" value="2">
+ <constant name="ASSIGN_OP_SUB" value="2" enum="AssignOp">
</constant>
- <constant name="ASSIGN_OP_MUL" value="3">
+ <constant name="ASSIGN_OP_MUL" value="3" enum="AssignOp">
</constant>
- <constant name="ASSIGN_OP_DIV" value="4">
+ <constant name="ASSIGN_OP_DIV" value="4" enum="AssignOp">
</constant>
- <constant name="ASSIGN_OP_MOD" value="5">
+ <constant name="ASSIGN_OP_MOD" value="5" enum="AssignOp">
</constant>
- <constant name="ASSIGN_OP_SHIFT_LEFT" value="6">
+ <constant name="ASSIGN_OP_SHIFT_LEFT" value="6" enum="AssignOp">
</constant>
- <constant name="ASSIGN_OP_SHIFT_RIGHT" value="7">
+ <constant name="ASSIGN_OP_SHIFT_RIGHT" value="7" enum="AssignOp">
</constant>
- <constant name="ASSIGN_OP_BIT_AND" value="8">
+ <constant name="ASSIGN_OP_BIT_AND" value="8" enum="AssignOp">
</constant>
- <constant name="ASSIGN_OP_BIT_OR" value="9">
+ <constant name="ASSIGN_OP_BIT_OR" value="9" enum="AssignOp">
</constant>
- <constant name="ASSIGN_OP_BIT_XOR" value="10">
+ <constant name="ASSIGN_OP_BIT_XOR" value="10" enum="AssignOp">
</constant>
</constants>
</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptResourcePath.xml b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml
index 274a852c3e..36bcf2a460 100644
--- a/modules/visual_script/doc_classes/VisualScriptResourcePath.xml
+++ b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptResourcePath" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptResourcePath" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -9,20 +9,6 @@
<demos>
</demos>
<methods>
- <method name="get_resource_path">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_resource_path">
- <return type="void">
- </return>
- <argument index="0" name="path" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="path" type="String" setter="set_resource_path" getter="get_resource_path">
diff --git a/modules/visual_script/doc_classes/VisualScriptReturn.xml b/modules/visual_script/doc_classes/VisualScriptReturn.xml
index 4ac586a02c..a05c1076a4 100644
--- a/modules/visual_script/doc_classes/VisualScriptReturn.xml
+++ b/modules/visual_script/doc_classes/VisualScriptReturn.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptReturn" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptReturn" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Exits a function and returns an optional value.
</brief_description>
@@ -16,34 +16,6 @@
<demos>
</demos>
<methods>
- <method name="get_return_type" qualifiers="const">
- <return type="int" enum="Variant.Type">
- </return>
- <description>
- </description>
- </method>
- <method name="is_return_value_enabled" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- </description>
- </method>
- <method name="set_enable_return_value">
- <return type="void">
- </return>
- <argument index="0" name="enable" type="bool">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_return_type">
- <return type="void">
- </return>
- <argument index="0" name="type" type="int" enum="Variant.Type">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="return_enabled" type="bool" setter="set_enable_return_value" getter="is_return_value_enabled">
diff --git a/modules/visual_script/doc_classes/VisualScriptSceneNode.xml b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml
index e8fdb69c6a..1a73faaf67 100644
--- a/modules/visual_script/doc_classes/VisualScriptSceneNode.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSceneNode" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptSceneNode" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Node reference.
</brief_description>
@@ -15,20 +15,6 @@
<demos>
</demos>
<methods>
- <method name="get_node_path">
- <return type="NodePath">
- </return>
- <description>
- </description>
- </method>
- <method name="set_node_path">
- <return type="void">
- </return>
- <argument index="0" name="path" type="NodePath">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="node_path" type="NodePath" setter="set_node_path" getter="get_node_path">
diff --git a/modules/visual_script/doc_classes/VisualScriptSceneTree.xml b/modules/visual_script/doc_classes/VisualScriptSceneTree.xml
index e74c330623..25ae9c26ac 100644
--- a/modules/visual_script/doc_classes/VisualScriptSceneTree.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSceneTree.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSceneTree" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptSceneTree" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptSelect.xml b/modules/visual_script/doc_classes/VisualScriptSelect.xml
index 6a62e364f3..45ac505110 100644
--- a/modules/visual_script/doc_classes/VisualScriptSelect.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSelect.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSelect" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptSelect" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Chooses between two input values.
</brief_description>
@@ -17,20 +17,6 @@
<demos>
</demos>
<methods>
- <method name="get_typed" qualifiers="const">
- <return type="int" enum="Variant.Type">
- </return>
- <description>
- </description>
- </method>
- <method name="set_typed">
- <return type="void">
- </return>
- <argument index="0" name="type" type="int" enum="Variant.Type">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="type" type="int" setter="set_typed" getter="get_typed" enum="Variant.Type">
diff --git a/modules/visual_script/doc_classes/VisualScriptSelf.xml b/modules/visual_script/doc_classes/VisualScriptSelf.xml
index f39a02bf84..2b0c46a4bb 100644
--- a/modules/visual_script/doc_classes/VisualScriptSelf.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSelf.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSelf" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptSelf" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Outputs a reference to the current instance.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptSequence.xml b/modules/visual_script/doc_classes/VisualScriptSequence.xml
index 51238070d5..624663b0d3 100644
--- a/modules/visual_script/doc_classes/VisualScriptSequence.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSequence.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSequence" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptSequence" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Executes a series of Sequence ports.
</brief_description>
@@ -17,20 +17,6 @@
<demos>
</demos>
<methods>
- <method name="get_steps" qualifiers="const">
- <return type="int">
- </return>
- <description>
- </description>
- </method>
- <method name="set_steps">
- <return type="void">
- </return>
- <argument index="0" name="steps" type="int">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="steps" type="int" setter="set_steps" getter="get_steps">
diff --git a/modules/visual_script/doc_classes/VisualScriptSubCall.xml b/modules/visual_script/doc_classes/VisualScriptSubCall.xml
index 381095f49b..b7dc5ad65f 100644
--- a/modules/visual_script/doc_classes/VisualScriptSubCall.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSubCall.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSubCall" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptSubCall" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptSwitch.xml b/modules/visual_script/doc_classes/VisualScriptSwitch.xml
index 3c8a79f686..a34754b596 100644
--- a/modules/visual_script/doc_classes/VisualScriptSwitch.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSwitch.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSwitch" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptSwitch" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Branches program flow based on a given input's value.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptTypeCast.xml b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml
index 417c0a5159..e61e81c397 100644
--- a/modules/visual_script/doc_classes/VisualScriptTypeCast.xml
+++ b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptTypeCast" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptTypeCast" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -9,34 +9,6 @@
<demos>
</demos>
<methods>
- <method name="get_base_script" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_base_type" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_base_script">
- <return type="void">
- </return>
- <argument index="0" name="path" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_base_type">
- <return type="void">
- </return>
- <argument index="0" name="type" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="base_script" type="String" setter="set_base_script" getter="get_base_script">
diff --git a/modules/visual_script/doc_classes/VisualScriptVariableGet.xml b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml
index 1cad4480a6..7122d2d3f6 100644
--- a/modules/visual_script/doc_classes/VisualScriptVariableGet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptVariableGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptVariableGet" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Gets a variable's value.
</brief_description>
@@ -15,20 +15,6 @@
<demos>
</demos>
<methods>
- <method name="get_variable" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_variable">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="var_name" type="String" setter="set_variable" getter="get_variable">
diff --git a/modules/visual_script/doc_classes/VisualScriptVariableSet.xml b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml
index fa3befa21d..3c39da0a8d 100644
--- a/modules/visual_script/doc_classes/VisualScriptVariableSet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptVariableSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptVariableSet" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Changes a variable's value.
</brief_description>
@@ -16,20 +16,6 @@
<demos>
</demos>
<methods>
- <method name="get_variable" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_variable">
- <return type="void">
- </return>
- <argument index="0" name="name" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="var_name" type="String" setter="set_variable" getter="get_variable">
diff --git a/modules/visual_script/doc_classes/VisualScriptWhile.xml b/modules/visual_script/doc_classes/VisualScriptWhile.xml
index f948660997..d8e59a7576 100644
--- a/modules/visual_script/doc_classes/VisualScriptWhile.xml
+++ b/modules/visual_script/doc_classes/VisualScriptWhile.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptWhile" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptWhile" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
Conditional loop.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptYield.xml b/modules/visual_script/doc_classes/VisualScriptYield.xml
index 5474ee8b78..72ef586c1f 100644
--- a/modules/visual_script/doc_classes/VisualScriptYield.xml
+++ b/modules/visual_script/doc_classes/VisualScriptYield.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptYield" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptYield" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -9,26 +9,12 @@
<demos>
</demos>
<methods>
- <method name="get_wait_time">
- <return type="float">
- </return>
- <description>
- </description>
- </method>
<method name="get_yield_mode">
<return type="int" enum="VisualScriptYield.YieldMode">
</return>
<description>
</description>
</method>
- <method name="set_wait_time">
- <return type="void">
- </return>
- <argument index="0" name="sec" type="float">
- </argument>
- <description>
- </description>
- </method>
<method name="set_yield_mode">
<return type="void">
</return>
@@ -39,17 +25,15 @@
</method>
</methods>
<members>
- <member name="mode" type="int" setter="set_yield_mode" getter="get_yield_mode" enum="VisualScriptYield.YieldMode">
- </member>
<member name="wait_time" type="float" setter="set_wait_time" getter="get_wait_time">
</member>
</members>
<constants>
- <constant name="YIELD_FRAME" value="1">
+ <constant name="YIELD_FRAME" value="1" enum="YieldMode">
</constant>
- <constant name="YIELD_PHYSICS_FRAME" value="2">
+ <constant name="YIELD_PHYSICS_FRAME" value="2" enum="YieldMode">
</constant>
- <constant name="YIELD_WAIT" value="3">
+ <constant name="YIELD_WAIT" value="3" enum="YieldMode">
</constant>
</constants>
</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml
index a3b6982075..f69043a685 100644
--- a/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml
+++ b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptYieldSignal" inherits="VisualScriptNode" category="Core" version="3.0-alpha">
+<class name="VisualScriptYieldSignal" inherits="VisualScriptNode" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -9,62 +9,6 @@
<demos>
</demos>
<methods>
- <method name="get_base_path" qualifiers="const">
- <return type="NodePath">
- </return>
- <description>
- </description>
- </method>
- <method name="get_base_type" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="get_call_mode" qualifiers="const">
- <return type="int" enum="VisualScriptYieldSignal.CallMode">
- </return>
- <description>
- </description>
- </method>
- <method name="get_signal" qualifiers="const">
- <return type="String">
- </return>
- <description>
- </description>
- </method>
- <method name="set_base_path">
- <return type="void">
- </return>
- <argument index="0" name="base_path" type="NodePath">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_base_type">
- <return type="void">
- </return>
- <argument index="0" name="base_type" type="String">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_call_mode">
- <return type="void">
- </return>
- <argument index="0" name="mode" type="int" enum="VisualScriptYieldSignal.CallMode">
- </argument>
- <description>
- </description>
- </method>
- <method name="set_signal">
- <return type="void">
- </return>
- <argument index="0" name="signal" type="String">
- </argument>
- <description>
- </description>
- </method>
</methods>
<members>
<member name="base_type" type="String" setter="set_base_type" getter="get_base_type">
@@ -77,11 +21,11 @@
</member>
</members>
<constants>
- <constant name="CALL_MODE_SELF" value="0">
+ <constant name="CALL_MODE_SELF" value="0" enum="CallMode">
</constant>
- <constant name="CALL_MODE_NODE_PATH" value="1">
+ <constant name="CALL_MODE_NODE_PATH" value="1" enum="CallMode">
</constant>
- <constant name="CALL_MODE_INSTANCE" value="2">
+ <constant name="CALL_MODE_INSTANCE" value="2" enum="CallMode">
</constant>
</constants>
</class>
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index b6ce10381d..ecdca7eb42 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -53,7 +53,7 @@ void register_visual_script_types() {
ClassDB::register_class<VisualScript>();
ClassDB::register_virtual_class<VisualScriptNode>();
- ClassDB::register_virtual_class<VisualScriptFunctionState>();
+ ClassDB::register_class<VisualScriptFunctionState>();
ClassDB::register_class<VisualScriptFunction>();
ClassDB::register_class<VisualScriptOperator>();
ClassDB::register_class<VisualScriptVariableSet>();
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 0834bc81d9..53d93798d9 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -1434,7 +1434,7 @@ void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int
if (!node->dependencies.empty()) {
int dc = node->dependencies.size();
- VisualScriptNodeInstance **deps = node->dependencies.ptr();
+ VisualScriptNodeInstance **deps = node->dependencies.ptrw();
for (int i = 0; i < dc; i++) {
@@ -1526,7 +1526,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
if (!node->dependencies.empty()) {
int dc = node->dependencies.size();
- VisualScriptNodeInstance **deps = node->dependencies.ptr();
+ VisualScriptNodeInstance **deps = node->dependencies.ptrw();
for (int i = 0; i < dc; i++) {
@@ -1626,7 +1626,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
state->flow_stack_pos = flow_stack_pos;
state->stack.resize(p_stack_size);
state->pass = p_pass;
- copymem(state->stack.ptr(), p_stack, p_stack_size);
+ copymem(state->stack.ptrw(), p_stack, p_stack_size);
//step 2, run away, return directly
r_error.error = Variant::CallError::CALL_OK;
@@ -2047,6 +2047,7 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
function.argument_count = func_node->get_argument_count();
function.max_stack += function.argument_count;
function.flow_stack_size = func_node->is_stack_less() ? 0 : func_node->get_stack_size();
+ max_input_args = MAX(max_input_args, function.argument_count);
}
//multiple passes are required to set up this complex thing..
@@ -2277,7 +2278,7 @@ Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int
*working_mem = args; //arguments go to working mem.
- Variant ret = instance->_call_internal(function, stack.ptr(), stack.size(), node, flow_stack_pos, pass, true, r_error);
+ Variant ret = instance->_call_internal(function, stack.ptrw(), stack.size(), node, flow_stack_pos, pass, true, r_error);
function = StringName(); //invalidate
return ret;
}
@@ -2289,7 +2290,7 @@ void VisualScriptFunctionState::connect_to_signal(Object *p_obj, const String &p
binds.push_back(p_binds[i]);
}
binds.push_back(Ref<VisualScriptFunctionState>(this)); //add myself on the back to avoid dying from unreferencing
- p_obj->connect(p_signal, this, "_signal_callback", binds);
+ p_obj->connect(p_signal, this, "_signal_callback", binds, CONNECT_ONESHOT);
}
bool VisualScriptFunctionState::is_valid() const {
@@ -2319,7 +2320,7 @@ Variant VisualScriptFunctionState::resume(Array p_args) {
*working_mem = p_args; //arguments go to working mem.
- Variant ret = instance->_call_internal(function, stack.ptr(), stack.size(), node, flow_stack_pos, pass, true, r_error);
+ Variant ret = instance->_call_internal(function, stack.ptrw(), stack.size(), node, flow_stack_pos, pass, true, r_error);
function = StringName(); //invalidate
return ret;
}
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 7c9d306831..32f7519125 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -78,6 +78,8 @@ const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX
"rad2deg",
"linear2db",
"db2linear",
+ "polar2cartesian",
+ "cartesian2polar",
"wrapi",
"wrapf",
"max",
@@ -191,6 +193,8 @@ int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) {
case MATH_EASE:
case MATH_STEPIFY:
case MATH_RANDOM:
+ case MATH_POLAR2CARTESIAN:
+ case MATH_CARTESIAN2POLAR:
case LOGIC_MAX:
case LOGIC_MIN:
case FUNC_FUNCREF:
@@ -368,6 +372,18 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
case MATH_DB2LINEAR: {
return PropertyInfo(Variant::REAL, "db");
} break;
+ case MATH_POLAR2CARTESIAN: {
+ if (p_idx == 0)
+ return PropertyInfo(Variant::REAL, "r");
+ else
+ return PropertyInfo(Variant::REAL, "th");
+ } break;
+ case MATH_CARTESIAN2POLAR: {
+ if (p_idx == 0)
+ return PropertyInfo(Variant::REAL, "x");
+ else
+ return PropertyInfo(Variant::REAL, "y");
+ } break;
case MATH_WRAP: {
if (p_idx == 0)
return PropertyInfo(Variant::INT, "value");
@@ -573,6 +589,10 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons
case MATH_DB2LINEAR: {
t = Variant::REAL;
} break;
+ case MATH_POLAR2CARTESIAN:
+ case MATH_CARTESIAN2POLAR: {
+ t = Variant::VECTOR2;
+ } break;
case MATH_WRAP: {
t = Variant::INT;
} break;
@@ -922,6 +942,20 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
VALIDATE_ARG_NUM(0);
*r_return = Math::db2linear((double)*p_inputs[0]);
} break;
+ case VisualScriptBuiltinFunc::MATH_POLAR2CARTESIAN: {
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ double r = *p_inputs[0];
+ double th = *p_inputs[1];
+ *r_return = Vector2(r * Math::cos(th), r * Math::sin(th));
+ } break;
+ case VisualScriptBuiltinFunc::MATH_CARTESIAN2POLAR: {
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ double x = *p_inputs[0];
+ double y = *p_inputs[1];
+ *r_return = Vector2(Math::sqrt(x * x + y * y), Math::atan2(y, x));
+ } break;
case VisualScriptBuiltinFunc::MATH_WRAP: {
VALIDATE_ARG_NUM(0);
VALIDATE_ARG_NUM(1);
@@ -1109,7 +1143,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
String str = *p_inputs[0];
//str+="\n";
- OS::get_singleton()->printerr("%s\n", str.utf8().get_data());
+ print_error(str);
} break;
case VisualScriptBuiltinFunc::TEXT_PRINTRAW: {
@@ -1294,6 +1328,8 @@ void VisualScriptBuiltinFunc::_bind_methods() {
BIND_ENUM_CONSTANT(MATH_RAD2DEG);
BIND_ENUM_CONSTANT(MATH_LINEAR2DB);
BIND_ENUM_CONSTANT(MATH_DB2LINEAR);
+ BIND_ENUM_CONSTANT(MATH_POLAR2CARTESIAN);
+ BIND_ENUM_CONSTANT(MATH_CARTESIAN2POLAR);
BIND_ENUM_CONSTANT(MATH_WRAP);
BIND_ENUM_CONSTANT(MATH_WRAPF);
BIND_ENUM_CONSTANT(LOGIC_MAX);
@@ -1381,6 +1417,8 @@ void register_visual_script_builtin_func_node() {
VisualScriptLanguage::singleton->add_register_func("functions/built_in/rad2deg", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_RAD2DEG>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/linear2db", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_LINEAR2DB>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/db2linear", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_DB2LINEAR>);
+ VisualScriptLanguage::singleton->add_register_func("functions/built_in/polar2cartesian", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_POLAR2CARTESIAN>);
+ VisualScriptLanguage::singleton->add_register_func("functions/built_in/cartesian2polar", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_CARTESIAN2POLAR>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/wrapi", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_WRAP>);
VisualScriptLanguage::singleton->add_register_func("functions/built_in/wrapf", create_builtin_func_node<VisualScriptBuiltinFunc::MATH_WRAPF>);
diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h
index 34a2825938..54dc997b38 100644
--- a/modules/visual_script/visual_script_builtin_funcs.h
+++ b/modules/visual_script/visual_script_builtin_funcs.h
@@ -77,6 +77,8 @@ public:
MATH_RAD2DEG,
MATH_LINEAR2DB,
MATH_DB2LINEAR,
+ MATH_POLAR2CARTESIAN,
+ MATH_CARTESIAN2POLAR,
MATH_WRAP,
MATH_WRAPF,
LOGIC_MAX,
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 86cf5b27e6..6c58de8a5a 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -349,7 +349,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
case Variant::TRANSFORM2D: color = Color::html("#c4ec69"); break;
case Variant::PLANE: color = Color::html("#f77070"); break;
case Variant::QUAT: color = Color::html("#ec69a3"); break;
- case Variant::RECT3: color = Color::html("#ee7991"); break;
+ case Variant::AABB: color = Color::html("#ee7991"); break;
case Variant::BASIS: color = Color::html("#e3ec69"); break;
case Variant::TRANSFORM: color = Color::html("#f6a86e"); break;
@@ -386,7 +386,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
case Variant::TRANSFORM2D: color = Color::html("#96ce1a"); break;
case Variant::PLANE: color = Color::html("#f77070"); break;
case Variant::QUAT: color = Color::html("#ec69a3"); break;
- case Variant::RECT3: color = Color::html("#ee7991"); break;
+ case Variant::AABB: color = Color::html("#ee7991"); break;
case Variant::BASIS: color = Color::html("#b2bb19"); break;
case Variant::TRANSFORM: color = Color::html("#f49047"); break;
@@ -1389,7 +1389,7 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
if (String(d["type"]) == "obj_property") {
#ifdef OSX_ENABLED
- const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Meta to drop a Getter. Hold Shift to drop a generic signature."));
+ const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a Getter. Hold Shift to drop a generic signature."), find_keycode_name(KEY_META)));
#else
const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Ctrl to drop a Getter. Hold Shift to drop a generic signature."));
#endif
@@ -1398,7 +1398,7 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
if (String(d["type"]) == "nodes") {
#ifdef OSX_ENABLED
- const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Meta to drop a simple reference to the node."));
+ const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a simple reference to the node."), find_keycode_name(KEY_META)));
#else
const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Ctrl to drop a simple reference to the node."));
#endif
@@ -1407,7 +1407,7 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
if (String(d["type"]) == "visual_script_variable_drag") {
#ifdef OSX_ENABLED
- const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Meta to drop a Variable Setter."));
+ const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a Variable Setter."), find_keycode_name(KEY_META)));
#else
const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Ctrl to drop a Variable Setter."));
#endif
@@ -2466,7 +2466,7 @@ VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_port_ac
in_guesses.push_back(g);
}
- return node->guess_output_type(in_guesses.ptr(), p_port_action_output);
+ return node->guess_output_type(in_guesses.ptrw(), p_port_action_output);
}
void VisualScriptEditor::_port_action_menu(int p_option) {
diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp
index 07dca4b904..ba58a8e1c0 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -1378,7 +1378,7 @@ public:
argp[i] = &arr[i];
}
- r_ret = Variant::construct(constructor->data_type, argp.ptr(), argp.size(), ce);
+ r_ret = Variant::construct(constructor->data_type, (const Variant **)argp.ptr(), argp.size(), ce);
if (ce.error != Variant::CallError::CALL_OK) {
r_error_str = "Invalid arguments to construct '" + Variant::get_type_name(constructor->data_type) + "'.";
@@ -1405,7 +1405,7 @@ public:
argp[i] = &arr[i];
}
- VisualScriptBuiltinFunc::exec_func(bifunc->func, argp.ptr(), &r_ret, ce, r_error_str);
+ VisualScriptBuiltinFunc::exec_func(bifunc->func, (const Variant **)argp.ptr(), &r_ret, ce, r_error_str);
if (ce.error != Variant::CallError::CALL_OK) {
r_error_str = "Builtin Call Failed. " + r_error_str;
@@ -1437,7 +1437,7 @@ public:
argp[i] = &arr[i];
}
- r_ret = base.call(call->method, argp.ptr(), argp.size(), ce);
+ r_ret = base.call(call->method, (const Variant **)argp.ptr(), argp.size(), ce);
if (ce.error != Variant::CallError::CALL_OK) {
r_error_str = "On call to '" + String(call->method) + "':";
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index 59d9540239..a38266acc0 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -731,9 +731,9 @@ void VisualScriptSwitch::_bind_methods() {
VisualScriptSwitch::VisualScriptSwitch() {
}
-//////////////////////////////////////////
-////////////////EVENT ACTION FILTER///////////
-//////////////////////////////////////////
+ //////////////////////////////////////////
+ ////////////////EVENT ACTION FILTER///////////
+ //////////////////////////////////////////
#if 0
int VisualScriptInputFilter::get_output_sequence_port_count() const {
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 05ff629d1b..5f98951bec 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -390,7 +390,7 @@ PropertyInfo VisualScriptOperator::get_input_value_port_info(int p_idx) const {
{ Variant::NIL, Variant::NIL }, //OP_GREATER_EQUAL,
//mathematic
{ Variant::NIL, Variant::NIL }, //OP_ADD,
- { Variant::NIL, Variant::NIL }, //OP_SUBSTRACT,
+ { Variant::NIL, Variant::NIL }, //OP_SUBTRACT,
{ Variant::NIL, Variant::NIL }, //OP_MULTIPLY,
{ Variant::NIL, Variant::NIL }, //OP_DIVIDE,
{ Variant::NIL, Variant::NIL }, //OP_NEGATE,
@@ -433,7 +433,7 @@ PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const {
Variant::BOOL, //OP_GREATER_EQUAL,
//mathematic
Variant::NIL, //OP_ADD,
- Variant::NIL, //OP_SUBSTRACT,
+ Variant::NIL, //OP_SUBTRACT,
Variant::NIL, //OP_MULTIPLY,
Variant::NIL, //OP_DIVIDE,
Variant::NIL, //OP_NEGATE,
@@ -474,7 +474,7 @@ static const char *op_names[] = {
"GreaterEq", //OP_GREATER_EQUAL,
//mathematic
"Add", //OP_ADD,
- "Subtract", //OP_SUBSTRACT,
+ "Subtract", //OP_SUBTRACT,
"Multiply", //OP_MULTIPLY,
"Divide", //OP_DIVIDE,
"Negate", //OP_NEGATE,
@@ -514,7 +514,7 @@ String VisualScriptOperator::get_text() const {
L"A \u2265 B", //OP_GREATER_EQUAL,
//mathematic
L"A + B", //OP_ADD,
- L"A - B", //OP_SUBSTRACT,
+ L"A - B", //OP_SUBTRACT,
L"A x B", //OP_MULTIPLY,
L"A \u00F7 B", //OP_DIVIDE,
L"\u00AC A", //OP_NEGATE,
@@ -1064,9 +1064,9 @@ void VisualScriptConstant::set_constant_type(Variant::Type p_type) {
return;
type = p_type;
- ports_changed_notify();
Variant::CallError ce;
value = Variant::construct(type, NULL, 0, ce);
+ ports_changed_notify();
_change_notify();
}
@@ -1111,7 +1111,7 @@ void VisualScriptConstant::_bind_methods() {
}
ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, argt), "set_constant_type", "get_constant_type");
- ADD_PROPERTY(PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT), "set_constant_value", "get_constant_value");
+ ADD_PROPERTY(PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT | PROPERTY_USAGE_DEFAULT), "set_constant_value", "get_constant_value");
}
class VisualScriptNodeInstanceConstant : public VisualScriptNodeInstance {
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 9fb6fa8197..03c0bfb1c2 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
@@ -64,7 +64,7 @@ int AudioStreamPlaybackOGGVorbis::_ov_seek_func(void *_f, ogg_int64_t offs, int
fa->seek_end(offs);
} else {
- ERR_PRINT("BUG, wtf was whence set to?\n");
+ ERR_PRINT("Vorbis seek function failure: Unexpected value in _whence\n");
}
int ret = fa->eof_reached() ? -1 : 0;
//printf("returning %i\n",ret);
diff --git a/modules/webm/config.py b/modules/webm/config.py
index 0374bb36f7..dcae4447d5 100644
--- a/modules/webm/config.py
+++ b/modules/webm/config.py
@@ -1,5 +1,5 @@
def can_build(platform):
- return True
+ return platform != 'iphone'
def configure(env):
pass
diff --git a/modules/webm/doc_classes/ResourceImporterWebm.xml b/modules/webm/doc_classes/ResourceImporterWebm.xml
index dcba351e37..5dadb83b07 100644
--- a/modules/webm/doc_classes/ResourceImporterWebm.xml
+++ b/modules/webm/doc_classes/ResourceImporterWebm.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceImporterWebm" inherits="ResourceImporter" category="Core" version="3.0-alpha">
+<class name="ResourceImporterWebm" inherits="ResourceImporter" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
diff --git a/modules/webm/doc_classes/VideoStreamWebm.xml b/modules/webm/doc_classes/VideoStreamWebm.xml
index 9a430f6b0d..6e8120b1de 100644
--- a/modules/webm/doc_classes/VideoStreamWebm.xml
+++ b/modules/webm/doc_classes/VideoStreamWebm.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VideoStreamWebm" inherits="VideoStream" category="Core" version="3.0-alpha">
+<class name="VideoStreamWebm" inherits="VideoStream" category="Core" version="3.0-beta">
<brief_description>
</brief_description>
<description>
@@ -24,10 +24,6 @@
</description>
</method>
</methods>
- <members>
- <member name="file" type="String" setter="set_file" getter="get_file">
- </member>
- </members>
<constants>
</constants>
</class>
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 0fc9df5b58..b055ccf5aa 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -92,21 +92,27 @@ private:
/**/
-VideoStreamPlaybackWebm::VideoStreamPlaybackWebm()
- : audio_track(0),
- webm(NULL),
- video(NULL),
- audio(NULL),
- video_frames(NULL), audio_frame(NULL),
- video_frames_pos(0), video_frames_capacity(0),
- num_decoded_samples(0), samples_offset(-1),
- mix_callback(NULL),
- mix_udata(NULL),
- playing(false), paused(false),
- delay_compensation(0.0),
- time(0.0), video_frame_delay(0.0), video_pos(0.0),
- texture(memnew(ImageTexture)),
- pcm(NULL) {}
+VideoStreamPlaybackWebm::VideoStreamPlaybackWebm() :
+ audio_track(0),
+ webm(NULL),
+ video(NULL),
+ audio(NULL),
+ video_frames(NULL),
+ audio_frame(NULL),
+ video_frames_pos(0),
+ video_frames_capacity(0),
+ num_decoded_samples(0),
+ samples_offset(-1),
+ mix_callback(NULL),
+ mix_udata(NULL),
+ playing(false),
+ paused(false),
+ delay_compensation(0.0),
+ time(0.0),
+ video_frame_delay(0.0),
+ video_pos(0.0),
+ texture(memnew(ImageTexture)),
+ pcm(NULL) {}
VideoStreamPlaybackWebm::~VideoStreamPlaybackWebm() {
delete_pointers();
@@ -403,8 +409,8 @@ void VideoStreamPlaybackWebm::delete_pointers() {
/**/
-VideoStreamWebm::VideoStreamWebm()
- : audio_track(0) {}
+VideoStreamWebm::VideoStreamWebm() :
+ audio_track(0) {}
Ref<VideoStreamPlayback> VideoStreamWebm::instance_playback() {
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
index f9295fed47..ea7af1bf9e 100644
--- a/modules/webp/SCsub
+++ b/modules/webp/SCsub
@@ -26,9 +26,6 @@ if env['builtin_libwebp']:
"dsp/alpha_processing_neon.c",
"dsp/alpha_processing_sse2.c",
"dsp/alpha_processing_sse41.c",
- "dsp/argb.c",
- "dsp/argb_mips_dsp_r2.c",
- "dsp/argb_sse2.c",
"dsp/cost.c",
"dsp/cost_mips32.c",
"dsp/cost_mips_dsp_r2.c",
@@ -36,6 +33,9 @@ if env['builtin_libwebp']:
"dsp/cpu.c",
"dsp/dec.c",
"dsp/dec_clip_tables.c",
+ "dsp/ssim.c",
+ "dsp/ssim_sse2.c",
+ "dsp/yuv_neon.c",
"dsp/dec_mips32.c",
"dsp/dec_mips_dsp_r2.c",
"dsp/dec_msa.c",
@@ -84,6 +84,7 @@ if env['builtin_libwebp']:
"dsp/yuv_sse2.c",
"enc/alpha_enc.c",
"enc/analysis_enc.c",
+ "enc/backward_references_cost_enc.c",
"enc/backward_references_enc.c",
"enc/config_enc.c",
"enc/cost_enc.c",
@@ -122,10 +123,10 @@ if env['builtin_libwebp']:
"utils/thread_utils.c",
"utils/utils.c",
]
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+ thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources]
env_webp.add_source_files(env.modules_sources, thirdparty_sources)
- env_webp.Append(CPPPATH=[thirdparty_dir])
+ env_webp.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"])
# Godot source files
env_webp.add_source_files(env.modules_sources, "*.cpp")