diff options
113 files changed, 3772 insertions, 2878 deletions
diff --git a/SConstruct b/SConstruct index 6045be54c7..c05a4332ab 100644 --- a/SConstruct +++ b/SConstruct @@ -72,6 +72,7 @@ env_base.AppendENVPath('PATH', os.getenv('PATH')) env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH')) env_base.global_defaults = global_defaults env_base.android_maven_repos = [] +env_base.android_flat_dirs = [] env_base.android_dependencies = [] env_base.android_gradle_plugins = [] env_base.android_gradle_classpath = [] @@ -96,6 +97,7 @@ env_base.SetOption('implicit_cache', 1) env_base.__class__.android_add_maven_repository = methods.android_add_maven_repository +env_base.__class__.android_add_flat_dir = methods.android_add_flat_dir env_base.__class__.android_add_dependency = methods.android_add_dependency env_base.__class__.android_add_java_dir = methods.android_add_java_dir env_base.__class__.android_add_res_dir = methods.android_add_res_dir diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 0834d6c321..d388a622de 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -1140,8 +1140,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo if (buf) { encode_uint32(0, buf); buf += 4; - r_len += 4; } + r_len += 4; + } else { _encode_string(obj->get_class(), buf, r_len); diff --git a/core/os/os.h b/core/os/os.h index 6fcfd71332..48effe99da 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -204,7 +204,7 @@ public: virtual String get_installed_templates_path() const { return ""; } virtual String get_executable_path() const; - virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL) = 0; + virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false) = 0; virtual Error kill(const ProcessID &p_pid) = 0; virtual int get_process_id() const; diff --git a/core/project_settings.cpp b/core/project_settings.cpp index ff2be87b07..3994011c06 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -667,8 +667,8 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin file->store_line("; Engine configuration file."); file->store_line("; It's best edited using the editor UI and not directly,"); file->store_line("; since the parameters that go here are not all obvious."); - file->store_line("; "); - file->store_line("; Format: "); + file->store_line(";"); + file->store_line("; Format:"); file->store_line("; [section] ; section goes between []"); file->store_line("; param=value ; assign values to parameters"); file->store_line(""); diff --git a/core/string_db.h b/core/string_db.h index 2bef29fab8..de91e2abd8 100644 --- a/core/string_db.h +++ b/core/string_db.h @@ -113,6 +113,9 @@ public: else return 0; } + _FORCE_INLINE_ const void *data_unique_pointer() const { + return (void *)_data; + } bool operator!=(const StringName &p_name) const; _FORCE_INLINE_ operator String() const { diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml index 4244e66a35..f87a40b8aa 100644 --- a/doc/classes/AcceptDialog.xml +++ b/doc/classes/AcceptDialog.xml @@ -92,8 +92,10 @@ </methods> <members> <member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok"> + If [code]true[/code] the dialog is hidden when accepted. Default value: [code]true[/code]. </member> <member name="dialog_text" type="String" setter="set_text" getter="get_text"> + The text displayed by this dialog. </member> </members> <signals> diff --git a/doc/classes/AnimatedSprite.xml b/doc/classes/AnimatedSprite.xml index 809890bea1..dce7bf283a 100644 --- a/doc/classes/AnimatedSprite.xml +++ b/doc/classes/AnimatedSprite.xml @@ -4,7 +4,7 @@ Sprite node that can use multiple textures for animation. </brief_description> <description> - Sprite node that can use multiple textures for animation. Animations are created using a [SpriteFrames] resource, which can be configured in the editor via the SpriteFrames panel. + Animations are created using a [SpriteFrames] resource, which can be configured in the editor via the SpriteFrames panel. </description> <tutorials> </tutorials> @@ -149,7 +149,7 @@ </methods> <members> <member name="animation" type="String" setter="set_animation" getter="get_animation"> - The current animation from the [code]frames[/code] resource. If this value is changed, the [code]frame[/code] counter is reset. + The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset. </member> <member name="centered" type="bool" setter="set_centered" getter="is_centered"> If [code]true[/code] texture will be centered. Default value: [code]true[/code]. @@ -161,7 +161,7 @@ If [code]true[/code] texture is flipped vertically. Default value: [code]false[/code]. </member> <member name="frame" type="int" setter="set_frame" getter="get_frame"> - The current frame index. + The displayed animation frame's index. </member> <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames"> The [SpriteFrames] resource containing the animation(s). @@ -170,7 +170,7 @@ The texture's drawing offset. </member> <member name="playing" type="bool" setter="_set_playing" getter="_is_playing"> - If [code]true[/code] the [code]animation[/code] is currently playing. + If [code]true[/code] the [member animation] is currently playing. </member> </members> <signals> @@ -181,7 +181,7 @@ </signal> <signal name="frame_changed"> <description> - Emitted when [code]frame[/code] changes. + Emitted when [member frame] changed. </description> </signal> </signals> diff --git a/doc/classes/AnimatedSprite3D.xml b/doc/classes/AnimatedSprite3D.xml index 4e28f7de8d..b0bb7bb6ab 100644 --- a/doc/classes/AnimatedSprite3D.xml +++ b/doc/classes/AnimatedSprite3D.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimatedSprite3D" inherits="SpriteBase3D" category="Core" version="3.0.alpha.custom_build"> <brief_description> + 2D sprite node in 3D world, that can use multiple 2D textures for animation. </brief_description> <description> + Animations are created using a [SpriteFrames] resource, which can be configured in the editor via the SpriteFrames panel. </description> <tutorials> </tutorials> @@ -83,18 +85,22 @@ </methods> <members> <member name="animation" type="String" setter="set_animation" getter="get_animation"> + The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset. </member> <member name="frame" type="int" setter="set_frame" getter="get_frame"> + The displayed animation frame's index. </member> <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames"> + The [SpriteFrames] resource containing the animation(s). </member> <member name="playing" type="bool" setter="_set_playing" getter="_is_playing"> + If [code]true[/code] the [member animation] is currently playing. </member> </members> <signals> <signal name="frame_changed"> <description> - Emitted when frame is changed. + Emitted when [member frame] changed. </description> </signal> </signals> diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 9542c83eaf..47100f23b8 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -104,6 +104,7 @@ <return type="Array"> </return> <description> + Returns a copy of this [code]Array[/code]. </description> </method> <method name="empty"> diff --git a/doc/classes/BackBufferCopy.xml b/doc/classes/BackBufferCopy.xml index 091bd3fa73..6c44430949 100644 --- a/doc/classes/BackBufferCopy.xml +++ b/doc/classes/BackBufferCopy.xml @@ -15,7 +15,7 @@ <return type="int" enum="BackBufferCopy.CopyMode"> </return> <description> - Return the copy mode currently applied to the BackBufferCopy (refer to constants section). + Return the copy mode currently applied to the BackBufferCopy. See [code]COPY_MODE_*[/code] constants. </description> </method> <method name="get_rect" qualifiers="const"> @@ -31,7 +31,7 @@ <argument index="0" name="copy_mode" type="int" enum="BackBufferCopy.CopyMode"> </argument> <description> - Set the copy mode of the BackBufferCopy (refer to constants section). + Set the copy mode of the BackBufferCopy. See [code]COPY_MODE_*[/code] constants. </description> </method> <method name="set_rect"> @@ -46,8 +46,10 @@ </methods> <members> <member name="copy_mode" type="int" setter="set_copy_mode" getter="get_copy_mode" enum="BackBufferCopy.CopyMode"> + Buffer mode. See [code]COPY_MODE_*[/code] constants. </member> <member name="rect" type="Rect2" setter="set_rect" getter="get_rect"> + The area covered by the BackBufferCopy. Only used if [code]copy_mode[/code] is [code]COPY_MODE_RECT[/code]. </member> </members> <constants> @@ -55,10 +57,10 @@ Disables the buffering mode. This means the BackBufferCopy node will directly use the portion of screen it covers. </constant> <constant name="COPY_MODE_RECT" value="1"> - Sets the copy mode to a region. + BackBufferCopy buffers a rectangular region. </constant> <constant name="COPY_MODE_VIEWPORT" value="2"> - Sets the copy mode to the entire screen. + BackBufferCopy buffers the entire screen. </constant> </constants> </class> diff --git a/doc/classes/BitMap.xml b/doc/classes/BitMap.xml index d872d0892d..63e6a5f682 100644 --- a/doc/classes/BitMap.xml +++ b/doc/classes/BitMap.xml @@ -77,6 +77,9 @@ </methods> <members> <member name="data" type="Dictionary" setter="_set_data" getter="_get_data"> + Returns a [Dictionary] with two keys : + [code]data[/code] : [PoolByteArray] with [code]true[/code]/[code]false[/code] [code]BitMap[/code] data. + [code]size[/code] : The [code]Bitmap[/code]'s size. </member> </members> <constants> diff --git a/doc/classes/Camera.xml b/doc/classes/Camera.xml index 2302c39e35..068b91204c 100644 --- a/doc/classes/Camera.xml +++ b/doc/classes/Camera.xml @@ -15,6 +15,7 @@ <return type="void"> </return> <description> + If this is the current Camera, remove it from being current. If it is inside the node tree, request to make the next Camera current, if any. </description> </method> <method name="get_camera_transform" qualifiers="const"> @@ -28,6 +29,7 @@ <return type="int"> </return> <description> + Returns the culling mask, describing which 3D render layers are rendered by this Camera. </description> </method> <method name="get_doppler_tracking" qualifiers="const"> @@ -40,30 +42,35 @@ <return type="Environment"> </return> <description> + Returns the [Environment] used by this Camera. </description> </method> <method name="get_fov" qualifiers="const"> <return type="float"> </return> <description> + Returns the [i]FOV[/i] Y angle in degrees (FOV means Field of View). </description> </method> <method name="get_h_offset" qualifiers="const"> <return type="float"> </return> <description> + Returns the horizontal (X) offset of the Camera viewport. </description> </method> <method name="get_keep_aspect_mode" qualifiers="const"> <return type="int" enum="Camera.KeepAspect"> </return> <description> + Returns the current mode for keeping the aspect ratio. See [code]KEEP_*[/code] constants. </description> </method> <method name="get_projection" qualifiers="const"> <return type="int" enum="Camera.Projection"> </return> <description> + Returns the Camera's projection. See PROJECTION_* constants. </description> </method> <method name="get_size" qualifiers="const"> @@ -76,25 +83,28 @@ <return type="float"> </return> <description> + Returns the vertical (Y) offset of the Camera viewport. </description> </method> <method name="get_zfar" qualifiers="const"> <return type="float"> </return> <description> + Returns the far clip plane in world space units. </description> </method> <method name="get_znear" qualifiers="const"> <return type="float"> </return> <description> + Returns the near clip plane in world space units. </description> </method> <method name="is_current" qualifiers="const"> <return type="bool"> </return> <description> - Return whether the Camera is the current one in the [Viewport], or plans to become current (if outside the scene tree). + Returns [code]true[/code] if the Camera is the current one in the [Viewport], or plans to become current (if outside the scene tree). </description> </method> <method name="is_position_behind" qualifiers="const"> @@ -103,6 +113,7 @@ <argument index="0" name="world_point" type="Vector3"> </argument> <description> + Returns [code]true[/code] if the given position is behind the Camera. </description> </method> <method name="make_current"> @@ -126,6 +137,7 @@ <argument index="0" name="screen_point" type="Vector2"> </argument> <description> + Returns how a 2D coordinate in the Viewport rectangle maps to a 3D point in worldspace. </description> </method> <method name="project_ray_normal" qualifiers="const"> @@ -134,7 +146,7 @@ <argument index="0" name="screen_point" type="Vector2"> </argument> <description> - Return a normal vector in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin,normal) for object intersection or picking. + Returns a normal vector in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking. </description> </method> <method name="project_ray_origin" qualifiers="const"> @@ -143,7 +155,7 @@ <argument index="0" name="screen_point" type="Vector2"> </argument> <description> - Return a 3D position in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin,normal) for object intersection or picking. + Returns a 3D position in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking. </description> </method> <method name="set_cull_mask"> @@ -152,6 +164,7 @@ <argument index="0" name="mask" type="int"> </argument> <description> + Sets the cull mask, describing which 3D render layers are rendered by this Camera. </description> </method> <method name="set_doppler_tracking"> @@ -160,6 +173,7 @@ <argument index="0" name="mode" type="int" enum="Camera.DopplerTracking"> </argument> <description> + Changes Doppler effect tracking. See [code]DOPPLER_*[/code] constants. </description> </method> <method name="set_environment"> @@ -168,6 +182,7 @@ <argument index="0" name="env" type="Environment"> </argument> <description> + Sets the [Environment] to use for this Camera. </description> </method> <method name="set_h_offset"> @@ -176,6 +191,7 @@ <argument index="0" name="ofs" type="float"> </argument> <description> + Sets the horizontal (X) offset of the Camera viewport. </description> </method> <method name="set_keep_aspect_mode"> @@ -184,6 +200,7 @@ <argument index="0" name="mode" type="int" enum="Camera.KeepAspect"> </argument> <description> + Sets the mode for keeping the aspect ratio. See [code]KEEP_*[/code] constants. </description> </method> <method name="set_orthogonal"> @@ -218,6 +235,7 @@ <argument index="0" name="ofs" type="float"> </argument> <description> + Sets the vertical (Y) offset of the Camera viewport. </description> </method> <method name="unproject_position" qualifiers="const"> @@ -226,7 +244,7 @@ <argument index="0" name="world_point" type="Vector3"> </argument> <description> - Return how a 3D point in worldspace maps to a 2D coordinate in the [Viewport] rectangle. + Returns how a 3D point in worldspace maps to a 2D coordinate in the [Viewport] rectangle. </description> </method> </methods> @@ -238,14 +256,19 @@ Orthogonal Projection (objects remain the same size on the screen no matter how far away they are). </constant> <constant name="KEEP_WIDTH" value="0"> + Try to keep the aspect ratio when scaling the Camera's viewport to the screen. If not possible, preserve the viewport's width by changing the height. Height is [code]sizey[/code] for orthographic projection, [code]fovy[/code] for perspective projection. </constant> <constant name="KEEP_HEIGHT" value="1"> + Try to keep the aspect ratio when scaling the Camera's viewport to the screen. If not possible, preserve the viewport's height by changing the width. Width is [code]sizex[/code] for orthographic projection, [code]fovx[/code] for perspective projection. </constant> <constant name="DOPPLER_TRACKING_DISABLED" value="0"> + Disable Doppler effect simulation (default). </constant> <constant name="DOPPLER_TRACKING_IDLE_STEP" value="1"> + Simulate Doppler effect by tracking positions of objects that are changed in [code]_process[/code]. Changes in the relative velocity of this Camera compared to those objects affect how Audio is perceived (changing the Audio's [code]pitch shift[/code]). </constant> <constant name="DOPPLER_TRACKING_FIXED_STEP" value="2"> + Simulate Doppler effect by tracking positions of objects that are changed in [code]_physics_process[/code]. Changes in the relative velocity of this Camera compared to those objects affect how Audio is perceived (changing the Audio's [code]pitch shift[/code]). </constant> </constants> </class> diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml index b6b699612e..c627112af5 100644 --- a/doc/classes/Camera2D.xml +++ b/doc/classes/Camera2D.xml @@ -5,7 +5,7 @@ </brief_description> <description> Camera node for 2D scenes. It forces the screen (current layer) to scroll following this node. This makes it easier (and faster) to program scrollable scenes than manually changing the position of [CanvasItem] based nodes. - This node is intended to be a simple helper get get things going quickly and it may happen often that more functionality is desired to change how the camera works. To make your own custom camera node, simply inherit from [Node2D] and change the transform of the canvas by calling get_viewport().set_canvas_transform(m) in [Viewport]. + This node is intended to be a simple helper to get things going quickly and it may happen often that more functionality is desired to change how the camera works. To make your own custom camera node, simply inherit from [Node2D] and change the transform of the canvas by calling get_viewport().set_canvas_transform(m) in [Viewport]. </description> <tutorials> </tutorials> @@ -324,18 +324,24 @@ </methods> <members> <member name="anchor_mode" type="int" setter="set_anchor_mode" getter="get_anchor_mode" enum="Camera2D.AnchorMode"> + The Camera2D's anchor point. See [code]ANCHOR_MODE_*[/code] constants. </member> <member name="current" type="bool" setter="_set_current" getter="is_current"> + If [code]true[/code] this camera is the active camera for the current scene. Only one camera can be current, so setting a different camera [code]current[/code] will disable this one. </member> <member name="drag_margin_bottom" type="float" setter="set_drag_margin" getter="get_drag_margin"> + Bottom margin needed to drag the camera. A value of [code]1[/code] makes the camera move only when reaching the edge of the screen. </member> <member name="drag_margin_h_enabled" type="bool" setter="set_h_drag_enabled" getter="is_h_drag_enabled"> </member> <member name="drag_margin_left" type="float" setter="set_drag_margin" getter="get_drag_margin"> + Left margin needed to drag the camera. A value of [code]1[/code] makes the camera move only when reaching the edge of the screen. </member> <member name="drag_margin_right" type="float" setter="set_drag_margin" getter="get_drag_margin"> + Right margin needed to drag the camera. A value of [code]1[/code] makes the camera move only when reaching the edge of the screen. </member> <member name="drag_margin_top" type="float" setter="set_drag_margin" getter="get_drag_margin"> + Top margin needed to drag the camera. A value of [code]1[/code] makes the camera move only when reaching the edge of the screen. </member> <member name="drag_margin_v_enabled" type="bool" setter="set_v_drag_enabled" getter="is_v_drag_enabled"> </member> @@ -346,16 +352,21 @@ <member name="editor_draw_screen" type="bool" setter="set_screen_drawing_enabled" getter="is_screen_drawing_enabled"> </member> <member name="limit_bottom" type="int" setter="set_limit" getter="get_limit"> + Bottom scroll limit in pixels. The camera stops moving when reaching this value. </member> <member name="limit_left" type="int" setter="set_limit" getter="get_limit"> + Left scroll limit in pixels. The camera stops moving when reaching this value. </member> <member name="limit_right" type="int" setter="set_limit" getter="get_limit"> + Right scroll limit in pixels. The camera stops moving when reaching this value. </member> <member name="limit_smoothed" type="bool" setter="set_limit_smoothing_enabled" getter="is_limit_smoothing_enabled"> </member> <member name="limit_top" type="int" setter="set_limit" getter="get_limit"> + Top scroll limit in pixels. The camera stops moving when reaching this value. </member> <member name="offset" type="Vector2" setter="set_offset" getter="get_offset"> + The camera's offset, useful for looking around or camera shake animations. </member> <member name="rotating" type="bool" setter="set_rotating" getter="is_rotating"> </member> @@ -364,6 +375,7 @@ <member name="smoothing_speed" type="float" setter="set_follow_smoothing" getter="get_follow_smoothing"> </member> <member name="zoom" type="Vector2" setter="set_zoom" getter="get_zoom"> + The camera's zoom relative to the viewport. Values larger than [code]Vector2(1, 1)[/code] zoom out and smaller values zoom in. For an example, use [code]Vector2(0.5, 0.5)[/code] for a 2x zoom in, and [code]Vector2(4, 4)[/code] for a 4x zoom out. </member> </members> <constants> diff --git a/doc/classes/CanvasModulate.xml b/doc/classes/CanvasModulate.xml index f0e3132da5..b4b20e29f9 100644 --- a/doc/classes/CanvasModulate.xml +++ b/doc/classes/CanvasModulate.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="CanvasModulate" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Tint the entire canvas + Tint the entire canvas. </brief_description> <description> - CanvasModulate tints the canvas elements using its assigned color + [code]CanvasModulate[/code] tints the canvas elements using its assigned [code]color[/code]. </description> <tutorials> </tutorials> @@ -30,6 +30,7 @@ </methods> <members> <member name="color" type="Color" setter="set_color" getter="get_color"> + The tint color to apply. </member> </members> <constants> diff --git a/doc/classes/ColorRect.xml b/doc/classes/ColorRect.xml index 90e88603b0..6e70a1e8b7 100644 --- a/doc/classes/ColorRect.xml +++ b/doc/classes/ColorRect.xml @@ -38,6 +38,10 @@ </methods> <members> <member name="color" type="Color" setter="set_frame_color" getter="get_frame_color"> + The color to fill the [code]ColorRect[/code]. + [codeblock] + $ColorRect.color = Color(1, 0, 0, 1) # Set ColorRect node's color to red + [/codeblock] </member> </members> <constants> diff --git a/doc/classes/ConvexPolygonShape.xml b/doc/classes/ConvexPolygonShape.xml index 9a7cb0d475..822b99547e 100644 --- a/doc/classes/ConvexPolygonShape.xml +++ b/doc/classes/ConvexPolygonShape.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ConvexPolygonShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Convex Polygon Shape. + Convex polygon shape for 3D physics. </brief_description> <description> - Convex polygon shape resource, which can be set into a [PhysicsBody] or area. + Convex polygon shape resource, which can be added to a [PhysicsBody] or area. </description> <tutorials> </tutorials> @@ -28,6 +28,7 @@ </methods> <members> <member name="points" type="PoolVector3Array" setter="set_points" getter="get_points"> + The list of 3D points forming the convex polygon shape. </member> </members> <constants> diff --git a/doc/classes/ConvexPolygonShape2D.xml b/doc/classes/ConvexPolygonShape2D.xml index c5b6d90041..0cb4f4045b 100644 --- a/doc/classes/ConvexPolygonShape2D.xml +++ b/doc/classes/ConvexPolygonShape2D.xml @@ -16,7 +16,7 @@ <return type="PoolVector2Array"> </return> <description> - Return a list of points in either clockwise or counter clockwise order, forming a convex polygon. + Returns a list of points in either clockwise or counter clockwise order, forming a convex polygon. </description> </method> <method name="set_point_cloud"> @@ -34,12 +34,13 @@ <argument index="0" name="points" type="PoolVector2Array"> </argument> <description> - Set a list of points in either clockwise or counter clockwise order, forming a convex polygon. + Sets a list of points in either clockwise or counter clockwise order, forming a convex polygon. </description> </method> </methods> <members> <member name="points" type="PoolVector2Array" setter="set_points" getter="get_points"> + The polygon's list of vertices. Can be in either clockwise or counterclockwise order. </member> </members> <constants> diff --git a/doc/classes/Directory.xml b/doc/classes/Directory.xml index ee0b873084..c3c4c7a8ac 100644 --- a/doc/classes/Directory.xml +++ b/doc/classes/Directory.xml @@ -85,6 +85,7 @@ <return type="int"> </return> <description> + Returns the currently opened directory's drive index. See [method get_drive] to convert returned index to the name of the drive. </description> </method> <method name="get_drive"> diff --git a/doc/classes/File.xml b/doc/classes/File.xml index e1a024270e..6272d4105c 100644 --- a/doc/classes/File.xml +++ b/doc/classes/File.xml @@ -30,14 +30,14 @@ <return type="void"> </return> <description> - Close the currently opened file. + Closes the currently opened file. </description> </method> <method name="eof_reached" qualifiers="const"> <return type="bool"> </return> <description> - Return whether the file cursor reached the end of the file. + Returns [code]true[/code] if the file cursor has reached the end of the file. </description> </method> <method name="file_exists" qualifiers="const"> @@ -46,42 +46,42 @@ <argument index="0" name="path" type="String"> </argument> <description> - Get whether or not the file in the specified path exists. + Returns [code]true[/code] if the file exists in the given path. </description> </method> <method name="get_16" qualifiers="const"> <return type="int"> </return> <description> - Get the next 16 bits from the file as an integer. + Returns the next 16 bits from the file as an integer. </description> </method> <method name="get_32" qualifiers="const"> <return type="int"> </return> <description> - Get the next 32 bits from the file as an integer. + Returns the next 32 bits from the file as an integer. </description> </method> <method name="get_64" qualifiers="const"> <return type="int"> </return> <description> - Get the next 64 bits from the file as an integer. + Returns the next 64 bits from the file as an integer. </description> </method> <method name="get_8" qualifiers="const"> <return type="int"> </return> <description> - Get the next 8 bits from the file as an integer. + Returns the next 8 bits from the file as an integer. </description> </method> <method name="get_as_text" qualifiers="const"> <return type="String"> </return> <description> - Get the whole file as a [String]. + Returns the whole file as a [String]. </description> </method> <method name="get_buffer" qualifiers="const"> @@ -90,7 +90,7 @@ <argument index="0" name="len" type="int"> </argument> <description> - Get next len bytes of the file as a [PoolByteArray]. + Returns next [code]len[/code] bytes of the file as a [PoolByteArray]. </description> </method> <method name="get_csv_line" qualifiers="const"> @@ -99,49 +99,49 @@ <argument index="0" name="delim" type="String" default="",""> </argument> <description> - Get the next value of the file in CSV (Comma Separated Values) format. You can pass a different delimiter to use other than the default "," (comma). + Returns the next value of the file in CSV (Comma Separated Values) format. You can pass a different delimiter to use other than the default "," (comma). </description> </method> <method name="get_double" qualifiers="const"> <return type="float"> </return> <description> - Get the next 64 bits from the file as a floating point number. + Returns the next 64 bits from the file as a floating point number. </description> </method> <method name="get_endian_swap"> <return type="bool"> </return> <description> - Get whether endian swap is enabled for this file. + Returns [code]true[/code] if endian swap is enabled for this file. </description> </method> <method name="get_error" qualifiers="const"> <return type="int" enum="Error"> </return> <description> - Get the last error that happened when trying to perform operations. Compare with the [code]ERR_FILE_*[/code] constants from [@Global Scope]. + Returns the last error that happened when trying to perform operations. Compare with the [code]ERR_FILE_*[/code] constants from [@Global Scope]. </description> </method> <method name="get_float" qualifiers="const"> <return type="float"> </return> <description> - Get the next 32 bits from the file as a floating point number. + Returns the next 32 bits from the file as a floating point number. </description> </method> <method name="get_len" qualifiers="const"> <return type="int"> </return> <description> - Return the size of the file in bytes. + Returns the size of the file in bytes. </description> </method> <method name="get_line" qualifiers="const"> <return type="String"> </return> <description> - Get the next line of the file as a [String]. + Returns the next line of the file as a [String]. </description> </method> <method name="get_md5" qualifiers="const"> @@ -150,7 +150,7 @@ <argument index="0" name="path" type="String"> </argument> <description> - Return a md5 String representing the file at the given path or an empty [String] on failure. + Returns an MD5 String representing the file at the given path or an empty [String] on failure. </description> </method> <method name="get_modified_time" qualifiers="const"> @@ -159,27 +159,28 @@ <argument index="0" name="file" type="String"> </argument> <description> + Returns the last time the [code]file[/code] was modified in unix timestamp format or returns a [String] "ERROR IN [code]file[/code]". This unix timestamp can be converted to datetime by using [method OS.get_datetime_from_unix_time]. </description> </method> <method name="get_pascal_string"> <return type="String"> </return> <description> - Get a [String] saved in Pascal format from the file. + Returns a [String] saved in Pascal format from the file. </description> </method> <method name="get_position" qualifiers="const"> <return type="int"> </return> <description> - Return the file cursor position. + Returns the file cursor's position. </description> </method> <method name="get_real" qualifiers="const"> <return type="float"> </return> <description> - Get the next bits from the file as a floating point number. + Returns the next bits from the file as a floating point number. </description> </method> <method name="get_sha256" qualifiers="const"> @@ -188,21 +189,21 @@ <argument index="0" name="path" type="String"> </argument> <description> - Return a sha256 String representing the file at the given path or an empty [String] on failure. + Returns a SHA-256 [String] representing the file at the given path or an empty [String] on failure. </description> </method> <method name="get_var" qualifiers="const"> <return type="Variant"> </return> <description> - Get the next Variant value from the file. + Returns the next [Variant] value from the file. </description> </method> <method name="is_open" qualifiers="const"> <return type="bool"> </return> <description> - Return whether the file is currently opened. + Returns [code]true[/code] if the file is currently opened. </description> </method> <method name="open"> @@ -213,7 +214,7 @@ <argument index="1" name="flags" type="int"> </argument> <description> - Open the file for writing or reading, depending on the flags. + Opens the file for writing or reading, depending on the flags. </description> </method> <method name="open_compressed"> @@ -226,7 +227,7 @@ <argument index="2" name="compression_mode" type="int" default="0"> </argument> <description> - Open a compressed file for reading or writing. The compression_mode can be set as one of the COMPRESSION_* constants. + Opens a compressed file for reading or writing. Use COMPRESSION_* constants to set [code]compression_mode[/code]. </description> </method> <method name="open_encrypted"> @@ -239,7 +240,7 @@ <argument index="2" name="key" type="PoolByteArray"> </argument> <description> - Open an encrypted file in write or read mode. You need to pass a binary key to encrypt/decrypt it. + Opens an encrypted file in write or read mode. You need to pass a binary key to encrypt/decrypt it. </description> </method> <method name="open_encrypted_with_pass"> @@ -252,7 +253,7 @@ <argument index="2" name="pass" type="String"> </argument> <description> - Open an encrypted file in write or read mode. You need to pass a password to encrypt/decrypt it. + Opens an encrypted file in write or read mode. You need to pass a password to encrypt/decrypt it. </description> </method> <method name="seek"> @@ -270,7 +271,7 @@ <argument index="0" name="position" type="int" default="0"> </argument> <description> - Change the file reading/writing cursor to the specified position (in bytes from the end of the file). Note that this is an offset, so you should use negative numbers or the cursor will be at the end of the file. + Changes the file reading/writing cursor to the specified position (in bytes from the end of the file). Note that this is an offset, so you should use negative numbers or the cursor will be at the end of the file. </description> </method> <method name="set_endian_swap"> @@ -279,7 +280,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> - Set whether to swap the endianness of the file. Enable this if you're dealing with files written in big endian machines. + If [code]true[/code] the file's endianness is swapped. Use this if you're dealing with files written in big endian machines. Note that this is about the file format, not CPU type. This is always reseted to [code]false[/code] whenever you open the file. </description> </method> @@ -289,7 +290,7 @@ <argument index="0" name="value" type="int"> </argument> <description> - Store an integer as 16 bits in the file. + Stores an integer as 16 bits in the file. </description> </method> <method name="store_32"> @@ -298,7 +299,7 @@ <argument index="0" name="value" type="int"> </argument> <description> - Store an integer as 32 bits in the file. + Stores an integer as 32 bits in the file. </description> </method> <method name="store_64"> @@ -307,7 +308,7 @@ <argument index="0" name="value" type="int"> </argument> <description> - Store an integer as 64 bits in the file. + Stores an integer as 64 bits in the file. </description> </method> <method name="store_8"> @@ -316,7 +317,7 @@ <argument index="0" name="value" type="int"> </argument> <description> - Store an integer as 8 bits in the file. + Stores an integer as 8 bits in the file. </description> </method> <method name="store_buffer"> @@ -325,7 +326,7 @@ <argument index="0" name="buffer" type="PoolByteArray"> </argument> <description> - Store the given array of bytes in the file. + Stores the given array of bytes in the file. </description> </method> <method name="store_double"> @@ -334,7 +335,7 @@ <argument index="0" name="value" type="float"> </argument> <description> - Store a floating point number as 64 bits in the file. + Stores a floating point number as 64 bits in the file. </description> </method> <method name="store_float"> @@ -343,7 +344,7 @@ <argument index="0" name="value" type="float"> </argument> <description> - Store a floating point number as 32 bits in the file. + Stores a floating point number as 32 bits in the file. </description> </method> <method name="store_line"> @@ -352,7 +353,7 @@ <argument index="0" name="line" type="String"> </argument> <description> - Store the given [String] as a line in the file. + Stores the given [String] as a line in the file. </description> </method> <method name="store_pascal_string"> @@ -361,7 +362,7 @@ <argument index="0" name="string" type="String"> </argument> <description> - Store the given [String] as a line in the file in Pascal format (i.e. also store the length of the string). + Stores the given [String] as a line in the file in Pascal format (i.e. also store the length of the string). </description> </method> <method name="store_real"> @@ -370,7 +371,7 @@ <argument index="0" name="value" type="float"> </argument> <description> - Store a floating point number in the file. + Stores a floating point number in the file. </description> </method> <method name="store_string"> @@ -379,7 +380,7 @@ <argument index="0" name="string" type="String"> </argument> <description> - Store the given [String] in the file. + Stores the given [String] in the file. </description> </method> <method name="store_var"> @@ -388,33 +389,34 @@ <argument index="0" name="value" type="Variant"> </argument> <description> - Store any Variant value in the file. + Stores any Variant value in the file. </description> </method> </methods> <constants> <constant name="READ" value="1"> - Open the file for reading. + Opens the file for read operations. </constant> <constant name="WRITE" value="2"> - Open the file for writing. Create it if the file not exists and truncate if it exists. + Opens the file for write operations. Create it if the file does not exist and truncate if it exists. </constant> <constant name="READ_WRITE" value="3"> - Open the file for reading and writing, without truncating the file. + Opens the file for read and write operations. Does not truncate the file. </constant> <constant name="WRITE_READ" value="7"> - Open the file for reading and writing. Create it if the file not exists and truncate if it exists. + Opens the file for read and write operations. Create it if the file does not exist and truncate if it exists. </constant> <constant name="COMPRESSION_FASTLZ" value="0"> - Use the FastLZ compression method. + Uses the FastLZ compression method. </constant> <constant name="COMPRESSION_DEFLATE" value="1"> - Use the Deflate compression method. + Uses the Deflate compression method. </constant> <constant name="COMPRESSION_ZSTD" value="2"> - Use the Zstd compression method. + Uses the Zstd compression method. </constant> <constant name="COMPRESSION_GZIP" value="3"> + Uses the gzip compression method. </constant> </constants> </class> diff --git a/doc/classes/FuncRef.xml b/doc/classes/FuncRef.xml index a7593dc2a1..1277cef77d 100644 --- a/doc/classes/FuncRef.xml +++ b/doc/classes/FuncRef.xml @@ -16,6 +16,7 @@ <return type="Variant"> </return> <description> + Calls the referenced function previously set by [method set_function] or [method @GDScript.funcref]. </description> </method> <method name="set_function"> @@ -24,7 +25,7 @@ <argument index="0" name="name" type="String"> </argument> <description> - Set the name of the function to call on the object, without parentheses or any parameters. + The name of the referenced function to call on the object, without parentheses or any parameters. </description> </method> <method name="set_instance"> @@ -33,7 +34,7 @@ <argument index="0" name="instance" type="Object"> </argument> <description> - Set the object on which to call the referenced function. This object must be of a type actually inheriting from [Object], not a built-in type such as [int], [Vector2] or [Dictionary]. + The object containing the referenced function. This object must be of a type actually inheriting from [Object], not a built-in type such as [int], [Vector2] or [Dictionary]. </description> </method> </methods> diff --git a/doc/classes/Gradient.xml b/doc/classes/Gradient.xml index f97908b0a2..e086ae86b1 100644 --- a/doc/classes/Gradient.xml +++ b/doc/classes/Gradient.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Gradient" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Color interpolator node + Color interpolator node. </brief_description> <description> Given a set of colors, this node will interpolate them in order, meaning, that if you have color 1, color 2 and color3, the ramp will interpolate (generate the colors between two colors) from color 1 to color 2 and from color 2 to color 3. Initially the ramp will have 2 colors (black and white), one (black) at ramp lower offset offset 0 and the other (white) at the ramp higher offset 1. @@ -122,8 +122,10 @@ </methods> <members> <member name="colors" type="PoolColorArray" setter="set_colors" getter="get_colors"> + Gradient's colors returned as a [PoolColorArray]. </member> <member name="offsets" type="PoolRealArray" setter="set_offsets" getter="get_offsets"> + Gradient's offsets returned as a [PoolRealArray]. </member> </members> <constants> diff --git a/doc/classes/GridContainer.xml b/doc/classes/GridContainer.xml index ca7b868cd8..30976eff99 100644 --- a/doc/classes/GridContainer.xml +++ b/doc/classes/GridContainer.xml @@ -30,6 +30,7 @@ </methods> <members> <member name="columns" type="int" setter="set_columns" getter="get_columns"> + The number of columns in the [code]GridContainer[/code]. If modified, [code]GridContainer[/code] reorders its children to accommodate the new layout. </member> </members> <constants> diff --git a/doc/classes/ImageTexture.xml b/doc/classes/ImageTexture.xml index 4fcdf684c0..fdaee798db 100644 --- a/doc/classes/ImageTexture.xml +++ b/doc/classes/ImageTexture.xml @@ -4,7 +4,7 @@ A [Texture] based on an [Image]. </brief_description> <description> - A [Texture] based on an [Image]. Can be created from an [Image]. + A [Texture] based on an [Image]. Can be created from an [Image] with [method create_from_image]. </description> <tutorials> </tutorials> @@ -93,6 +93,7 @@ <argument index="0" name="size" type="Vector2"> </argument> <description> + Resizes the [code]ImageTexture[/code] to the specified dimensions. </description> </method> <method name="set_storage"> diff --git a/doc/classes/ImmediateGeometry.xml b/doc/classes/ImmediateGeometry.xml index b12f9c99a9..cd7074aeaf 100644 --- a/doc/classes/ImmediateGeometry.xml +++ b/doc/classes/ImmediateGeometry.xml @@ -1,9 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ImmediateGeometry" inherits="GeometryInstance" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Node to draw simple geometry from code, ala OpenGL 1.x + Draws simple geometry from code. </brief_description> <description> + Draws simple geometry from code. Uses a drawing mode similar to OpenGL 1.x. </description> <tutorials> </tutorials> @@ -31,7 +32,7 @@ <argument index="0" name="position" type="Vector3"> </argument> <description> - Add a vertex with the currently set color/uv/etc. + Adds a vertex with the currently set color/uv/etc. </description> </method> <method name="begin"> @@ -50,14 +51,14 @@ <return type="void"> </return> <description> - Clear everything that was drawn using begin/end. + Clears everything that was drawn using begin/end. </description> </method> <method name="end"> <return type="void"> </return> <description> - Call this when done adding a batch of geometry, otherwise it can't be displayed. + Ends a drawing context and displays the results. </description> </method> <method name="set_color"> @@ -66,7 +67,7 @@ <argument index="0" name="color" type="Color"> </argument> <description> - Set the color that the next vertex will use to be drawn. + The current drawing color. </description> </method> <method name="set_normal"> @@ -75,7 +76,7 @@ <argument index="0" name="normal" type="Vector3"> </argument> <description> - Set the normal that the next vertex will use to be drawn. + The next vertex's normal. </description> </method> <method name="set_tangent"> @@ -84,7 +85,7 @@ <argument index="0" name="tangent" type="Plane"> </argument> <description> - Set the tangent (and binormal facing) that the next vertex will use to be drawn. + The next vertex's tangent (and binormal facing). </description> </method> <method name="set_uv"> @@ -93,7 +94,7 @@ <argument index="0" name="uv" type="Vector2"> </argument> <description> - Set the UV that the next vertex will use to be drawn. + The next vertex's UV. </description> </method> <method name="set_uv2"> @@ -102,7 +103,7 @@ <argument index="0" name="uv" type="Vector2"> </argument> <description> - Set the second layer of UV that the next vertex will use to be drawn. + The next vertex's second layer UV. </description> </method> </methods> diff --git a/doc/classes/KinematicBody.xml b/doc/classes/KinematicBody.xml index 8f242c5187..86354548cd 100644 --- a/doc/classes/KinematicBody.xml +++ b/doc/classes/KinematicBody.xml @@ -6,7 +6,7 @@ <description> Kinematic bodies are special types of bodies that are meant to be user-controlled. They are not affected by physics at all (to other types of bodies, such a character or a rigid body, these are the same as a static body). They have however, two main uses: Simulated Motion: When these bodies are moved manually, either from code or from an AnimationPlayer (with process mode set to fixed), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc). - Kinematic Characters: KinematicBody also has an api for moving objects (the [method move] method) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics. + Kinematic Characters: KinematicBody also has an API for moving objects (the [method move_and_collide] and [method move_and_slide] methods) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics. </description> <tutorials> </tutorials> @@ -17,6 +17,7 @@ <return type="Vector3"> </return> <description> + Returns the velocity of the floor. Only updates when calling [method move_and_slide]. </description> </method> <method name="get_safe_margin" qualifiers="const"> @@ -31,30 +32,35 @@ <argument index="0" name="slide_idx" type="int"> </argument> <description> + Returns a [KinematicCollision], which contains information about a collision that occured during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count]()-1). </description> </method> <method name="get_slide_count" qualifiers="const"> <return type="int"> </return> <description> + Returns the number of times the body collided and changed direction during the last call to [method move_and_slide]. </description> </method> <method name="is_on_ceiling" qualifiers="const"> <return type="bool"> </return> <description> + Returns [code]true[/code] if the body is on the ceiling. Only updates when calling [method move_and_slide]. </description> </method> <method name="is_on_floor" qualifiers="const"> <return type="bool"> </return> <description> + Returns [code]true[/code] if the body is on the floor. Only updates when calling [method move_and_slide]. </description> </method> <method name="is_on_wall" qualifiers="const"> <return type="bool"> </return> <description> + Returns [code]true[/code] if the body is on a wall. Only updates when calling [method move_and_slide]. </description> </method> <method name="move_and_collide"> @@ -63,6 +69,7 @@ <argument index="0" name="rel_vec" type="Vector3"> </argument> <description> + Moves the body along the vector [code]rel_vec[/code]. The body will stop if it collides. Returns a [KinematicCollision], which contains information about the collision. </description> </method> <method name="move_and_slide"> @@ -79,6 +86,13 @@ <argument index="4" name="floor_max_angle" type="float" default="0.785398"> </argument> <description> + Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [KinematicBody] or [RigidBody], it will also be affected by the motion of the other body. You can use this to make moving or rotating platforms, or to make nodes push other nodes. + [code]linear_velocity[/code] is a value in pixels per second. Unlike in for example [method move_and_collide], you should [i]not[/i] multiply it with [code]delta[/code] — this is done by the method. + [code]floor_normal[/code] is the up direction, used to determine what is a wall and what is a floor or a ceiling. If set to the default value of [code]Vector2(0, 0)[/code], everything is considered a wall. This is useful for topdown games. + If the body is standing on a slope and the horizontal speed (relative to the floor's speed) goes below [code]slope_stop_min_velocity[/code], the body will stop completely. This prevents the body from sliding down slopes when you include gravity in [code]linear_velocity[/code]. When set to lower values, the body will not be able to stand still on steep slopes. + If the body collides, it will change direction a maximum of [code]max_bounces[/code] times before it stops. + [code]floor_max_angle[/code] is the maximum angle (in radians) where a slope is still considered a floor (or a ceiling), rather than a wall. The default value equals 45 degrees. + Returns the movement that remained when the body stopped. To get more detailed information about collisions that occured, use [method get_slide_collision]. </description> </method> <method name="set_safe_margin"> @@ -97,11 +111,13 @@ <argument index="1" name="rel_vec" type="Vector3"> </argument> <description> + Checks for collisions without moving the body. Virtually sets the node's position, scale and rotation to that of the given [Transform], then tries to move the body along the vector [code]rel_vec[/code]. Returns [code]true[/code] if a collision would occur. </description> </method> </methods> <members> <member name="collision/safe_margin" type="float" setter="set_safe_margin" getter="get_safe_margin"> + If the body is at least this close to another body, this body will consider them to be colliding. </member> </members> <constants> diff --git a/doc/classes/KinematicBody2D.xml b/doc/classes/KinematicBody2D.xml index dddae2c0fc..e7c58fdb3a 100644 --- a/doc/classes/KinematicBody2D.xml +++ b/doc/classes/KinematicBody2D.xml @@ -6,7 +6,7 @@ <description> Kinematic bodies are special types of bodies that are meant to be user-controlled. They are not affected by physics at all (to other types of bodies, such a character or a rigid body, these are the same as a static body). They have however, two main uses: Simulated Motion: When these bodies are moved manually, either from code or from an AnimationPlayer (with process mode set to fixed), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc). - Kinematic Characters: KinematicBody2D also has an api for moving objects (the [method move] method) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics. + Kinematic Characters: KinematicBody2D also has an API for moving objects (the [method move_and_collide] and [method move_and_slide] methods) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics. </description> <tutorials> </tutorials> @@ -17,6 +17,7 @@ <return type="Vector2"> </return> <description> + Returns the velocity of the floor. Only updates when calling [method move_and_slide]. </description> </method> <method name="get_safe_margin" qualifiers="const"> @@ -31,30 +32,35 @@ <argument index="0" name="slide_idx" type="int"> </argument> <description> + Returns a [KinematicCollision2D], which contains information about a collision that occured during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count]()-1). </description> </method> <method name="get_slide_count" qualifiers="const"> <return type="int"> </return> <description> + Returns the number of times the body collided and changed direction during the last call to [method move_and_slide]. </description> </method> <method name="is_on_ceiling" qualifiers="const"> <return type="bool"> </return> <description> + Returns [code]true[/code] if the body is on the ceiling. Only updates when calling [method move_and_slide]. </description> </method> <method name="is_on_floor" qualifiers="const"> <return type="bool"> </return> <description> + Returns [code]true[/code] if the body is on the floor. Only updates when calling [method move_and_slide]. </description> </method> <method name="is_on_wall" qualifiers="const"> <return type="bool"> </return> <description> + Returns [code]true[/code] if the body is on a wall. Only updates when calling [method move_and_slide]. </description> </method> <method name="move_and_collide"> @@ -63,7 +69,7 @@ <argument index="0" name="rel_vec" type="Vector2"> </argument> <description> - Moves the body along the given vector. The body will stop if it collides. Returns a [KinematicCollision2D], which contains information about the colliding body. + Moves the body along the vector [code]rel_vec[/code]. The body will stop if it collides. Returns a [KinematicCollision2D], which contains information about the collision. </description> </method> <method name="move_and_slide"> @@ -80,6 +86,13 @@ <argument index="4" name="floor_max_angle" type="float" default="0.785398"> </argument> <description> + Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [KinematicBody2D] or [RigidBody2D], it will also be affected by the motion of the other body. You can use this to make moving or rotating platforms, or to make nodes push other nodes. + [code]linear_velocity[/code] is a value in pixels per second. Unlike in for example [method move_and_collide], you should [i]not[/i] multiply it with [code]delta[/code] — this is done by the method. + [code]floor_normal[/code] is the up direction, used to determine what is a wall and what is a floor or a ceiling. If set to the default value of [code]Vector2(0, 0)[/code], everything is considered a wall. This is useful for topdown games. + If the body is standing on a slope and the horizontal speed (relative to the floor's speed) goes below [code]slope_stop_min_velocity[/code], the body will stop completely. This prevents the body from sliding down slopes when you include gravity in [code]linear_velocity[/code]. When set to lower values, the body will not be able to stand still on steep slopes. + If the body collides, it will change direction a maximum of [code]max_bounces[/code] times before it stops. + [code]floor_max_angle[/code] is the maximum angle (in radians) where a slope is still considered a floor (or a ceiling), rather than a wall. The default value equals 45 degrees. + Returns the movement that remained when the body stopped. To get more detailed information about collisions that occured, use [method get_slide_collision]. </description> </method> <method name="set_safe_margin"> @@ -98,14 +111,15 @@ <argument index="1" name="rel_vec" type="Vector2"> </argument> <description> - Returns true if there would be a collision if the body moved from the given point in the given direction. + Checks for collisions without moving the body. Virtually sets the node's position, scale and rotation to that of the given [Transform2D], then tries to move the body along the vector [code]rel_vec[/code]. Returns [code]true[/code] if a collision would occur. </description> </method> </methods> <members> <member name="collision/safe_margin" type="float" setter="set_safe_margin" getter="get_safe_margin"> + If the body is at least this close to another body, this body will consider them to be colliding. </member> </members> <constants> </constants> -</class> +</class>
\ No newline at end of file diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml index 8c5e69b407..1d1ce63a58 100644 --- a/doc/classes/Label.xml +++ b/doc/classes/Label.xml @@ -15,7 +15,7 @@ <return type="int" enum="Label.Align"> </return> <description> - Return the alignment mode (any of the ALIGN_* enumeration values). + Returns the alignment mode (any of the ALIGN_* enumeration values). </description> </method> <method name="get_line_count" qualifiers="const"> @@ -36,76 +36,77 @@ <return type="int"> </return> <description> - Return the the number of lines to skipped before displaying. + Returns the the number of lines to skip before displaying. </description> </method> <method name="get_max_lines_visible" qualifiers="const"> <return type="int"> </return> <description> - Return the restricted number of lines to display. Returns -1 if unrestricted. + Returns the maximum number of lines to display. Returns -1 if unrestricted. </description> </method> <method name="get_percent_visible" qualifiers="const"> <return type="float"> </return> <description> - Return the restricted number of characters to display (as a percentage of the total text). + Returns the maximum number of characters to display as a percentage of the total text. </description> </method> <method name="get_text" qualifiers="const"> <return type="String"> </return> <description> - Return the label text. Text can contain newlines. + Returns the label text. Text can contain newlines. </description> </method> <method name="get_total_character_count" qualifiers="const"> <return type="int"> </return> <description> - Return the total length of the text. + Returns the total length of the text. </description> </method> <method name="get_valign" qualifiers="const"> <return type="int" enum="Label.VAlign"> </return> <description> - Return the vertical alignment mode (any of the VALIGN_* enumeration values). + Returns the vertical alignment mode (any of the VALIGN_* enumeration values). </description> </method> <method name="get_visible_characters" qualifiers="const"> <return type="int"> </return> <description> - Return the restricted number of characters to display. Returns -1 if unrestricted. + Returns the restricted number of characters to display. Returns -1 if unrestricted. </description> </method> <method name="get_visible_line_count" qualifiers="const"> <return type="int"> </return> <description> + Returns the number of lines shown. Useful if the [code]Label[/code] 's height cannot currently display all lines. </description> </method> <method name="has_autowrap" qualifiers="const"> <return type="bool"> </return> <description> - Return the state of the [i]autowrap[/i] mode (see [method set_autowrap]). + Returns [code]true[/code] if [i]autowrap[/i] mode (see [method set_autowrap]). </description> </method> <method name="is_clipping_text" qualifiers="const"> <return type="bool"> </return> <description> - Return [code]true[/code] if text would be cut off if it is too wide. + Returns [code]true[/code] if text would be cut off if it is too wide. </description> </method> <method name="is_uppercase" qualifiers="const"> <return type="bool"> </return> <description> - Return [code]true[/code] if text is displayed in all capitals. + Returns [code]true[/code] if text is displayed in all capitals. </description> </method> <method name="set_align"> diff --git a/doc/classes/LargeTexture.xml b/doc/classes/LargeTexture.xml index e4cabdc556..f5416488f6 100644 --- a/doc/classes/LargeTexture.xml +++ b/doc/classes/LargeTexture.xml @@ -5,7 +5,7 @@ </brief_description> <description> A Texture capable of storing many smaller Textures with offsets. - You can dynamically add pieces(Textures) to this fLargeTexture] using different offsets. + You can dynamically add pieces([Texture]) to this [code]LargeTexture[/code] using different offsets. </description> <tutorials> </tutorials> @@ -20,21 +20,21 @@ <argument index="1" name="texture" type="Texture"> </argument> <description> - Add another [Texture] to this [LargeTexture], starting on offset "ofs". + Add another [Texture] to this [code]LargeTexture[/code], starting on offset "ofs". </description> </method> <method name="clear"> <return type="void"> </return> <description> - Clear the [LargeTexture]. + Clears the [code]LargeTexture[/code]. </description> </method> <method name="get_piece_count" qualifiers="const"> <return type="int"> </return> <description> - Return the number of pieces currently in this [LargeTexture]. + Returns the number of pieces currently in this [code]LargeTexture[/code]. </description> </method> <method name="get_piece_offset" qualifiers="const"> @@ -43,7 +43,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Return the offset of the piece with index "idx". + Returns the offset of the piece with index "idx". </description> </method> <method name="get_piece_texture" qualifiers="const"> @@ -52,7 +52,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Return the [Texture] of the piece with index "idx". + Returns the [Texture] of the piece with index "idx". </description> </method> <method name="set_piece_offset"> @@ -63,7 +63,7 @@ <argument index="1" name="ofs" type="Vector2"> </argument> <description> - Set the offset of the piece with index "idx" to "ofs". + Sets the offset of the piece with index "idx" to "ofs". </description> </method> <method name="set_piece_texture"> @@ -74,7 +74,7 @@ <argument index="1" name="texture" type="Texture"> </argument> <description> - Set the [Texture] of the piece with index "idx" to "ofs". + Sets the [Texture] of the piece with index "idx" to "ofs". </description> </method> <method name="set_size"> @@ -83,12 +83,16 @@ <argument index="0" name="size" type="Vector2"> </argument> <description> - Set the size of this [LargeTexture]. + Sets the size of this [code]LargeTexture[/code]. </description> </method> </methods> <members> <member name="_data" type="Array" setter="_set_data" getter="_get_data"> + Returns an [Array] with offsets and textures data of each added piece. Schema is [offsets1, texture1, offsets2, texture2, large_texture_size]. + [code]offsets[/code] : [Vector2] offsets of the texture piece. + [code]second[/code] : [StreamTexture] data of the texture piece. + [code]last entry[/code] : [Vector2] size of the entire large texture. </member> </members> <constants> diff --git a/doc/classes/Light2D.xml b/doc/classes/Light2D.xml index 7ce7cef7c1..05054e06fd 100644 --- a/doc/classes/Light2D.xml +++ b/doc/classes/Light2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Light2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Node that casts light in a 2D environment. + Casts light in a 2D environment. </brief_description> <description> - Node that casts light in a 2D environment. Light is defined by a (usually grayscale) texture, a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related). Note that Light2D can be used as a mask. + Casts light in a 2D environment. Light is defined by a (usually grayscale) texture, a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related). Note that Light2D can be used as a mask. </description> <tutorials> </tutorials> @@ -385,7 +385,7 @@ If [code]true[/code] the Light2D will cast shadows. Default value: [code]false[/code]. </member> <member name="shadow_filter" type="int" setter="set_shadow_filter" getter="get_shadow_filter" enum="Light2D.ShadowFilter"> - Shadow filter type. May be one of [code][None, PCF5, PCF9, PCF13][/code]. Default value: [code]None[/code]. + Shadow filter type. Use SHADOW_FILTER_* constants to set [code]shadow_filter[/code]. Default value: [code]None[/code]. </member> <member name="shadow_filter_smooth" type="float" setter="set_shadow_smooth" getter="get_shadow_smooth"> Smoothing value for shadows. @@ -408,7 +408,7 @@ Adds the value of pixels corresponding to the Light2D to the values of pixels under it. This is the common behaviour of a light. </constant> <constant name="MODE_SUB" value="1"> - Subtract the value of pixels corresponding to the Light2D to the values of pixels under it, resulting in inversed light effect. + Subtracts the value of pixels corresponding to the Light2D to the values of pixels under it, resulting in inversed light effect. </constant> <constant name="MODE_MIX" value="2"> Mix the value of pixels corresponding to the Light2D to the values of pixels under it by linear interpolation. @@ -417,16 +417,22 @@ The light texture of the Light2D is used as a mask, hiding or revealing parts of the screen underneath depending on the value of each pixel of the light (mask) texture. </constant> <constant name="SHADOW_FILTER_NONE" value="0"> + No filter applies to the shadow map. See [method shadow_filter]. </constant> <constant name="SHADOW_FILTER_PCF3" value="1"> + Percentage closer filtering (3 samples) applies to the shadow map. See [method shadow_filter]. </constant> <constant name="SHADOW_FILTER_PCF5" value="2"> + Percentage closer filtering (5 samples) applies to the shadow map. See [method shadow_filter]. </constant> <constant name="SHADOW_FILTER_PCF7" value="3"> + Percentage closer filtering (7 samples) applies to the shadow map. See [method shadow_filter]. </constant> <constant name="SHADOW_FILTER_PCF9" value="4"> + Percentage closer filtering (9 samples) applies to the shadow map. See [method shadow_filter]. </constant> <constant name="SHADOW_FILTER_PCF13" value="5"> + Percentage closer filtering (13 samples) applies to the shadow map. See [method shadow_filter]. </constant> </constants> </class> diff --git a/doc/classes/Line2D.xml b/doc/classes/Line2D.xml index e6e615ccf1..3cca256a5d 100644 --- a/doc/classes/Line2D.xml +++ b/doc/classes/Line2D.xml @@ -17,7 +17,7 @@ <argument index="0" name="position" type="Vector2"> </argument> <description> - Add a point at the x/y position in the supplied [Vector2] + Add a point at the [code]position[/code]. Appends the point at the end of the line. </description> </method> <method name="get_begin_cap_mode" qualifiers="const"> @@ -54,6 +54,7 @@ <return type="int"> </return> <description> + Returns the Line2D's amount of points. </description> </method> <method name="get_point_position" qualifiers="const"> @@ -62,6 +63,7 @@ <argument index="0" name="i" type="int"> </argument> <description> + Returns point [code]i[code]'s position. </description> </method> <method name="get_points" qualifiers="const"> @@ -106,7 +108,7 @@ <argument index="0" name="i" type="int"> </argument> <description> - Remove the point at index 'i' from the line. + Remove the point at index [code]i[/code] from the line. </description> </method> <method name="set_begin_cap_mode"> @@ -157,6 +159,7 @@ <argument index="1" name="position" type="Vector2"> </argument> <description> + Overwites the position in point [code]i[/code] with the supplied [code]position[/code]. </description> </method> <method name="set_points"> @@ -210,44 +213,63 @@ </methods> <members> <member name="begin_cap_mode" type="int" setter="set_begin_cap_mode" getter="get_begin_cap_mode" enum="Line2D.LineCapMode"> + Controls the style of the line's first point. Use [code]LINE_CAP_*[/code] constants. Default value: [code]LINE_CAP_NONE[/code]. </member> <member name="default_color" type="Color" setter="set_default_color" getter="get_default_color"> + The line's color. Will not be used if a gradient is set. </member> <member name="end_cap_mode" type="int" setter="set_end_cap_mode" getter="get_end_cap_mode" enum="Line2D.LineCapMode"> + Controls the style of the line's last point. Use [code]LINE_CAP_*[/code] constants. Default value: [code]LINE_CAP_NONE[/code]. </member> <member name="gradient" type="Gradient" setter="set_gradient" getter="get_gradient"> + The gradient is drawn through the whole line from start to finish. The default color will not be used if a gradient is set. </member> <member name="joint_mode" type="int" setter="set_joint_mode" getter="get_joint_mode" enum="Line2D.LineJointMode"> + The style for the points inbetween the start and the end. </member> <member name="points" type="PoolVector2Array" setter="set_points" getter="get_points"> + The points that form the lines. The line is drawn between every point set in this array. </member> <member name="round_precision" type="int" setter="set_round_precision" getter="get_round_precision"> + The smoothness of the rounded joints and caps. This is only used if a cap or joint is set as round. </member> <member name="sharp_limit" type="float" setter="set_sharp_limit" getter="get_sharp_limit"> + The direction difference in radians between vector points. This value is only used if [code]joint mode[/code] is set to [code]LINE_JOINT_SHARP[/code]. </member> <member name="texture" type="Texture" setter="set_texture" getter="get_texture"> + The texture used for the line's texture. Uses [code]texture_mode[/code] for drawing style. </member> <member name="texture_mode" type="int" setter="set_texture_mode" getter="get_texture_mode" enum="Line2D.LineTextureMode"> + The style to render the [code]texture[/code] on the line. Use [code]LINE_TEXTURE_*[/code] constants. Default value: [code]LINE_TEXTURE_NONE[/code]. </member> <member name="width" type="float" setter="set_width" getter="get_width"> + The line's width. </member> </members> <constants> <constant name="LINE_JOINT_SHARP" value="0"> + The line's joints will be pointy. If [code]sharp_limit[/code] is greater than the rotation of a joint, it becomes a bevel joint instead. </constant> <constant name="LINE_JOINT_BEVEL" value="1"> + The line's joints will be bevelled/chamfered. </constant> <constant name="LINE_JOINT_ROUND" value="2"> + The line's joints will be rounded. </constant> <constant name="LINE_CAP_NONE" value="0"> + Don't have a line cap. </constant> <constant name="LINE_CAP_BOX" value="1"> + Draws the line cap as a box. </constant> <constant name="LINE_CAP_ROUND" value="2"> + Draws the line cap as a circle. </constant> <constant name="LINE_TEXTURE_NONE" value="0"> + Takes the left pixels of the texture and renders it over the whole line. </constant> <constant name="LINE_TEXTURE_TILE" value="1"> + Tiles the texture over the line. The texture need to be imported with Repeat Enabled for it to work properly. </constant> </constants> </class> diff --git a/doc/classes/Particles.xml b/doc/classes/Particles.xml index e17e60f2bc..1e89d2194c 100644 --- a/doc/classes/Particles.xml +++ b/doc/classes/Particles.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Particles" inherits="GeometryInstance" category="Core" version="3.0.alpha.custom_build"> <brief_description> + 3D particle emitter. </brief_description> <description> + 3D particle node used to create a variety of particle systems and effects. [code]Particles[/code] features an emitter that generates some number of particles at a given rate. + Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles. </description> <tutorials> </tutorials> @@ -252,8 +255,10 @@ </methods> <members> <member name="amount" type="int" setter="set_amount" getter="get_amount"> + Number of particles to emit. </member> <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="Particles.DrawOrder"> + Particle draw order. Uses [code]DRAW_ORDER_*[/code] values. Default value: [code]DRAW_ORDER_INDEX[/code]. </member> <member name="draw_pass_1" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh"> </member> @@ -266,36 +271,47 @@ <member name="draw_passes" type="int" setter="set_draw_passes" getter="get_draw_passes"> </member> <member name="emitting" type="bool" setter="set_emitting" getter="is_emitting"> + If [code]true[/code] particles are being emitted. Default value: [code]true[/code]. </member> <member name="explosiveness" type="float" setter="set_explosiveness_ratio" getter="get_explosiveness_ratio"> + Time ratio between each emission. If [code]0[/code] particles are emitted continuously. If [code]1[/code] all particles are emitted simultaneously. Default value: [code]0[/code]. </member> <member name="fixed_fps" type="int" setter="set_fixed_fps" getter="get_fixed_fps"> </member> <member name="fract_delta" type="bool" setter="set_fractional_delta" getter="get_fractional_delta"> </member> <member name="lifetime" type="float" setter="set_lifetime" getter="get_lifetime"> + Amount of time each particle will exist. Default value: [code]1[/code]. </member> <member name="local_coords" type="bool" setter="set_use_local_coordinates" getter="get_use_local_coordinates"> + If [code]true[/code] particles use the parent node's coordinate space. If [code]false[/code] they use global coordinates. Default value: [code]true[/code]. </member> <member name="one_shot" type="bool" setter="set_one_shot" getter="get_one_shot"> + If [code]true[/code] only [code]amount[/code] particles will be emitted. Default value: [code]false[/code]. </member> <member name="preprocess" type="float" setter="set_pre_process_time" getter="get_pre_process_time"> </member> <member name="process_material" type="Material" setter="set_process_material" getter="get_process_material"> + [Material] for processing particles. Can be a [ParticlesMaterial] or a [ShaderMaterial]. </member> <member name="randomness" type="float" setter="set_randomness_ratio" getter="get_randomness_ratio"> + Emission randomness ratio. Default value: [code]0[/code]. </member> <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale"> + Speed scaling ratio. Default value: [code]1[/code]. </member> <member name="visibility_aabb" type="Rect3" setter="set_visibility_aabb" getter="get_visibility_aabb"> </member> </members> <constants> <constant name="DRAW_ORDER_INDEX" value="0"> + Particles are drawn in the order emitted. </constant> <constant name="DRAW_ORDER_LIFETIME" value="1"> + Particles are drawn in order of remaining lifetime. </constant> <constant name="DRAW_ORDER_VIEW_DEPTH" value="2"> + Particles are drawn in order of depth. </constant> <constant name="MAX_DRAW_PASSES" value="4" enum=""> </constant> diff --git a/doc/classes/Particles2D.xml b/doc/classes/Particles2D.xml index d837d6eb62..b2c63ea0c3 100644 --- a/doc/classes/Particles2D.xml +++ b/doc/classes/Particles2D.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Particles2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> <brief_description> - 2D Particle emitter + 2D particle emitter. </brief_description> <description> - Particles2D is a particle system 2D [Node] that is used to simulate several types of particle effects, such as explosions, rain, snow, fireflies, or other magical-like shinny sparkles. Particles are drawn using impostors, and given their dynamic behavior, the user must provide a visibility bounding box (although helpers to create one automatically exist). + 2D particle node used to create a variety of particle systems and effects. [code]Particles2D[/code] features an emitter that generates some number of particles at a given rate. + Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles. </description> <tutorials> </tutorials> @@ -285,46 +286,61 @@ </methods> <members> <member name="amount" type="int" setter="set_amount" getter="get_amount"> + Number of particles to emit. </member> <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="Particles2D.DrawOrder"> + Particle draw order. Uses [code]DRAW_ORDER_*[/code] values. Default value: [code]DRAW_ORDER_INDEX[/code]. </member> <member name="emitting" type="bool" setter="set_emitting" getter="is_emitting"> + If [code]true[/code] particles are being emitted. Default value: [code]true[/code]. </member> <member name="explosiveness" type="float" setter="set_explosiveness_ratio" getter="get_explosiveness_ratio"> + Time ratio between each emission. If [code]0[/code] particles are emitted continuously. If [code]1[/code] all particles are emitted simultaneously. Default value: [code]0[/code]. </member> <member name="fixed_fps" type="int" setter="set_fixed_fps" getter="get_fixed_fps"> </member> <member name="fract_delta" type="bool" setter="set_fractional_delta" getter="get_fractional_delta"> </member> <member name="h_frames" type="int" setter="set_h_frames" getter="get_h_frames"> + Number of horizontal frames in [code]texture[/code]. </member> <member name="lifetime" type="float" setter="set_lifetime" getter="get_lifetime"> + Amount of time each particle will exist. Default value: [code]1[/code]. </member> <member name="local_coords" type="bool" setter="set_use_local_coordinates" getter="get_use_local_coordinates"> + If [code]true[/code] particles use the parent node's coordinate space. If [code]false[/code] they use global coordinates. Default value: [code]true[/code]. </member> <member name="normal_map" type="Texture" setter="set_normal_map" getter="get_normal_map"> </member> <member name="one_shot" type="bool" setter="set_one_shot" getter="get_one_shot"> + If [code]true[/code] only [code]amount[/code] particles will be emitted. Default value: [code]false[/code]. </member> <member name="preprocess" type="float" setter="set_pre_process_time" getter="get_pre_process_time"> </member> <member name="process_material" type="Material" setter="set_process_material" getter="get_process_material"> + [Material] for processing particles. Can be a [ParticlesMaterial] or a [ShaderMaterial]. </member> <member name="randomness" type="float" setter="set_randomness_ratio" getter="get_randomness_ratio"> + Emission randomness ratio. Default value: [code]0[/code]. </member> <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale"> + Speed scaling ratio. Default value: [code]1[/code]. </member> <member name="texture" type="Texture" setter="set_texture" getter="get_texture"> + Particle texture. If [code]null[/code] particles will be squares. </member> <member name="v_frames" type="int" setter="set_v_frames" getter="get_v_frames"> + Number of vertical frames in [code]texture[/code]. </member> <member name="visibility_rect" type="Rect2" setter="set_visibility_rect" getter="get_visibility_rect"> </member> </members> <constants> <constant name="DRAW_ORDER_INDEX" value="0"> + Particles are drawn in the order emitted. </constant> <constant name="DRAW_ORDER_LIFETIME" value="1"> + Particles are drawn in order of remaining lifetime. </constant> </constants> </class> diff --git a/doc/classes/ParticlesMaterial.xml b/doc/classes/ParticlesMaterial.xml index 1767a19a9f..bebdc44b69 100644 --- a/doc/classes/ParticlesMaterial.xml +++ b/doc/classes/ParticlesMaterial.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ParticlesMaterial" inherits="Material" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Particle properties for [Particles] and [Particles2D] nodes. </brief_description> <description> + ParticlesMaterial defines particle properties and behavior. It is used in the [code]process_material[/code] of [Particles] and [Particles2D] emitter nodes. + Some of this material's properties are applied to each particle when emitted, while others can have a [CurveTexture] applied to vary values over the lifetime of the particle. </description> <tutorials> </tutorials> @@ -294,152 +297,217 @@ </methods> <members> <member name="angle" type="float" setter="set_param" getter="get_param"> + Initial rotation applied to each particle. </member> <member name="angle_curve" type="Texture" setter="set_param_texture" getter="get_param_texture"> + Each particle's rotation will be animated along this [CurveTexture]. </member> <member name="angle_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Rotation randomness ratio. Default value: [code]0[/code]. </member> <member name="angular_velocity" type="float" setter="set_param" getter="get_param"> + Initial angular velocity applied to each particle. </member> <member name="angular_velocity_curve" type="Texture" setter="set_param_texture" getter="get_param_texture"> + Each particle's angular velocity will vary along this [CurveTexture]. </member> <member name="angular_velocity_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Angular velocity randomness ratio. Default value: [code]0[/code]. </member> <member name="anim_loop" type="bool" setter="set_flag" getter="get_flag"> + If [code]true[/code] animation will loop. Default value: [code]false[/code]. </member> <member name="anim_offset" type="float" setter="set_param" getter="get_param"> + Particle animation offset. </member> <member name="anim_offset_curve" type="Texture" setter="set_param_texture" getter="get_param_texture"> + Each particle's animation offset will vary along this [CurveTexture]. </member> <member name="anim_offset_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Animation offset randomness ratio. Default value: [code]0[/code]. </member> <member name="anim_speed" type="float" setter="set_param" getter="get_param"> + Particle animation speed. </member> <member name="anim_speed_curve" type="Texture" setter="set_param_texture" getter="get_param_texture"> + Each particle's animation speed will vary along this [CurveTexture]. </member> <member name="anim_speed_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Animation speed randomness ratio. Default value: [code]0[/code]. </member> <member name="color" type="Color" setter="set_color" getter="get_color"> + Each particle's initial color. If the [Particle2D]'s [code]texture[/code] is defined, it will be multiplied by this color. </member> <member name="color_ramp" type="Texture" setter="set_color_ramp" getter="get_color_ramp"> + Each particle's color will vary along this [GradientTexture]. </member> <member name="damping" type="float" setter="set_param" getter="get_param"> + The rate at which particles lose velocity. </member> <member name="damping_curve" type="Texture" setter="set_param_texture" getter="get_param_texture"> + Damping will vary along this [CurveTexture]. </member> <member name="damping_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Damping randomness ratio. Default value: [code]0[/code]. </member> <member name="emission_box_extents" type="Vector3" setter="set_emission_box_extents" getter="get_emission_box_extents"> + The box's extents if [code]emission_shape[/code] is set to [code]EMISSION_SHAPE_BOX[/code]. </member> <member name="emission_color_texture" type="Texture" setter="set_emission_color_texture" getter="get_emission_color_texture"> </member> <member name="emission_normal_texture" type="Texture" setter="set_emission_normal_texture" getter="get_emission_normal_texture"> </member> <member name="emission_point_count" type="int" setter="set_emission_point_count" getter="get_emission_point_count"> + The number of emission points if [code]emission_shape[/code] is set to [code]EMISSION_SHAPE_POINTS[/code] or [code]EMISSION_SHAPE_DIRECTED_POINTS[/code]. </member> <member name="emission_point_texture" type="Texture" setter="set_emission_point_texture" getter="get_emission_point_texture"> </member> <member name="emission_shape" type="int" setter="set_emission_shape" getter="get_emission_shape" enum="ParticlesMaterial.EmissionShape"> + Particles will be emitted inside this region. Use [code]EMISSION_SHAPE_*[/code] constants for values. Default value: [code]EMISSION_SHAPE_POINT[/code]. </member> <member name="emission_sphere_radius" type="float" setter="set_emission_sphere_radius" getter="get_emission_sphere_radius"> + The sphere's radius if [code]emission_shape[/code] is set to [code]EMISSION_SHAPE_SPHERE[/code]. </member> <member name="flag_align_y" type="bool" setter="set_flag" getter="get_flag"> </member> <member name="flag_disable_z" type="bool" setter="set_flag" getter="get_flag"> + If [code]true[/code] particles will not move on the z axis. Default value: [code]true[/code] for [Particles2D], [code]false[/code] for [Particles]. </member> <member name="flag_rotate_y" type="bool" setter="set_flag" getter="get_flag"> </member> <member name="flatness" type="float" setter="set_flatness" getter="get_flatness"> </member> <member name="gravity" type="Vector3" setter="set_gravity" getter="get_gravity"> + Gravity applied to every particle. Default value: [code](0, 98, 0)[/code]. </member> <member name="hue_variation" type="float" setter="set_param" getter="get_param"> + Initial hue variation applied to each particle. </member> <member name="hue_variation_curve" type="Texture" setter="set_param_texture" getter="get_param_texture"> + Each particle's hue will vary along this [CurveTexture]. </member> <member name="hue_variation_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Hue variation randomness ratio. Default value: [code]0[/code]. </member> <member name="initial_velocity" type="float" setter="set_param" getter="get_param"> + Initial velocity for each particle. </member> <member name="initial_velocity_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Initial velocity randomness ratio. Default value: [code]0[/code]. </member> <member name="linear_accel" type="float" setter="set_param" getter="get_param"> + Linear acceleration applied to each particle. </member> <member name="linear_accel_curve" type="Texture" setter="set_param_texture" getter="get_param_texture"> + Each particle's linear acceleration will vary along this [CurveTexture]. </member> <member name="linear_accel_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Linear acceleration randomness ratio. Default value: [code]0[/code]. </member> <member name="orbit_velocity" type="float" setter="set_param" getter="get_param"> + Orbital velocity applied to each particle. </member> <member name="orbit_velocity_curve" type="Texture" setter="set_param_texture" getter="get_param_texture"> + Each particle's orbital velocity will vary along this [CurveTexture]. </member> <member name="orbit_velocity_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Orbital velocity randomness ratio. Default value: [code]0[/code]. </member> <member name="radial_accel" type="float" setter="set_param" getter="get_param"> + Linear acceleration applied to each particle. </member> <member name="radial_accel_curve" type="Texture" setter="set_param_texture" getter="get_param_texture"> + Each particle's radial acceleration will vary along this [CurveTexture]. </member> <member name="radial_accel_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Radial acceleration randomness ratio. Default value: [code]0[/code]. </member> <member name="scale" type="float" setter="set_param" getter="get_param"> + Initial scale applied to each particle. </member> <member name="scale_curve" type="Texture" setter="set_param_texture" getter="get_param_texture"> + Each particle's scale will vary along this [CurveTexture]. </member> <member name="scale_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Scale randomness ratio. Default value: [code]0[/code]. </member> <member name="spread" type="float" setter="set_spread" getter="get_spread"> + Each particle's initial direction range from [code]+spread[/code] to [code]-spread[/code] degrees. Default value: [code]45[/code]. </member> <member name="tangential_accel" type="float" setter="set_param" getter="get_param"> + Tangential acceleration applied to each particle. Tangential acceleration is perpendicular to the particle's velocity. </member> <member name="tangential_accel_curve" type="Texture" setter="set_param_texture" getter="get_param_texture"> + Each particle's tangential acceleration will vary along this [CurveTexture]. </member> <member name="tangential_accel_random" type="float" setter="set_param_randomness" getter="get_param_randomness"> + Tangential acceleration randomness ratio. Default value: [code]0[/code]. </member> <member name="trail_color_modifier" type="GradientTexture" setter="set_trail_color_modifier" getter="get_trail_color_modifier"> + Trail particles' color will vary along this [GradientTexture]. </member> <member name="trail_divisor" type="int" setter="set_trail_divisor" getter="get_trail_divisor"> + Emitter will emit [code]amount[/code] divided by [code]trail_divisor[/code] particles. The remaining particles will be used as trail(s). </member> <member name="trail_size_modifier" type="CurveTexture" setter="set_trail_size_modifier" getter="get_trail_size_modifier"> + Trail particles' size will vary along this [CurveTexture]. </member> </members> <constants> <constant name="PARAM_INITIAL_LINEAR_VELOCITY" value="0"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set initial velocity properties. </constant> <constant name="PARAM_ANGULAR_VELOCITY" value="1"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set angular velocity properties. </constant> <constant name="PARAM_ORBIT_VELOCITY" value="2"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set orbital_velocity properties. </constant> <constant name="PARAM_LINEAR_ACCEL" value="3"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set linear acceleration properties. </constant> <constant name="PARAM_RADIAL_ACCEL" value="4"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set radial acceleration properties. </constant> <constant name="PARAM_TANGENTIAL_ACCEL" value="5"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set tangential acceleration properties. </constant> <constant name="PARAM_DAMPING" value="6"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set damping properties. </constant> <constant name="PARAM_ANGLE" value="7"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set angle properties. </constant> <constant name="PARAM_SCALE" value="8"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set scale properties. </constant> <constant name="PARAM_HUE_VARIATION" value="9"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set hue_variation properties. </constant> <constant name="PARAM_ANIM_SPEED" value="10"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set animation speed properties. </constant> <constant name="PARAM_ANIM_OFFSET" value="11"> + Use with [method set_param], [method set_param_randomness], and [method set_param_texture] to set animation offset properties. </constant> <constant name="PARAM_MAX" value="12"> </constant> <constant name="FLAG_ALIGN_Y_TO_VELOCITY" value="0"> + Use with [method set_flag] to set [member flag_align_y]. </constant> <constant name="FLAG_ROTATE_Y" value="1"> + Use with [method set_flag] to set [member flag_rotate_y] </constant> <constant name="FLAG_MAX" value="4"> </constant> <constant name="EMISSION_SHAPE_POINT" value="0"> + All particles will be emitted from a single point. </constant> <constant name="EMISSION_SHAPE_SPHERE" value="1"> + Particles will be emitted in the volume of a sphere. </constant> <constant name="EMISSION_SHAPE_BOX" value="2"> + Particles will be emitted in the volume of a box. </constant> <constant name="EMISSION_SHAPE_POINTS" value="3"> </constant> diff --git a/doc/classes/Performance.xml b/doc/classes/Performance.xml index 71987ace9e..82ee3531f1 100644 --- a/doc/classes/Performance.xml +++ b/doc/classes/Performance.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Performance" inherits="Object" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Exposes performance related data. </brief_description> <description> + This class provides access to a number of different monitors related to performance, such as memory usage, draw calls, and FPS. These are the same as the values displayed in the [i]Monitor[/i] tab in the editor's [i]Debugger[/i] panel. By using the [method get_monitor] method of this class, you can access this data from your code. Note that a few of these monitors are only available in debug mode and will always return 0 when used in a release build. + Many of these monitors are not updated in real-time, so there may be a short delay between changes. </description> <tutorials> </tutorials> @@ -15,63 +18,93 @@ <argument index="0" name="monitor" type="int" enum="Performance.Monitor"> </argument> <description> + Returns the value of one of the available monitors. You should provide one of this class's constants as the argument, like this: + [codeblock] + print(Performance.get_monitor(Performance.TIME_FPS)) # Prints the FPS to the console + [/codeblock] </description> </method> </methods> <constants> <constant name="TIME_FPS" value="0"> + Frames per second. </constant> <constant name="TIME_PROCESS" value="1"> + Time it took to complete one frame. </constant> - <constant name="TIME_FIXED_PROCESS" value="2"> + <constant name="TIME_PHYSICS_PROCESS" value="2"> + Time it took to complete one physics frame. </constant> <constant name="MEMORY_STATIC" value="3"> + Static memory currently used, in bytes. Not available in release builds. </constant> <constant name="MEMORY_DYNAMIC" value="4"> + Dynamic memory currently used, in bytes. Not available in release builds. </constant> <constant name="MEMORY_STATIC_MAX" value="5"> + Available static memory. Not available in release builds. </constant> <constant name="MEMORY_DYNAMIC_MAX" value="6"> + Available dynamic memory. Not available in release builds. </constant> <constant name="MEMORY_MESSAGE_BUFFER_MAX" value="7"> + Largest amount of memory the message queue buffer has used, in bytes. The message queue is used for deferred functions calls and notifications. </constant> <constant name="OBJECT_COUNT" value="8"> + Number of objects currently instanced (including nodes). </constant> <constant name="OBJECT_RESOURCE_COUNT" value="9"> + Number of resources currently used. </constant> <constant name="OBJECT_NODE_COUNT" value="10"> + Number of nodes currently instanced. This also includes the root node, as well as any nodes not in the scene tree. </constant> <constant name="RENDER_OBJECTS_IN_FRAME" value="11"> + 3D objects drawn per frame. </constant> <constant name="RENDER_VERTICES_IN_FRAME" value="12"> + Vertices drawn per frame. 3D only. </constant> <constant name="RENDER_MATERIAL_CHANGES_IN_FRAME" value="13"> + Material changes per frame. 3D only </constant> <constant name="RENDER_SHADER_CHANGES_IN_FRAME" value="14"> + Shader changes per frame. 3D only. </constant> <constant name="RENDER_SURFACE_CHANGES_IN_FRAME" value="15"> + Render surface changes per frame. 3D only. </constant> <constant name="RENDER_DRAW_CALLS_IN_FRAME" value="16"> - </constant> - <constant name="RENDER_USAGE_VIDEO_MEM_TOTAL" value="20"> + Draw calls per frame. 3D only. </constant> <constant name="RENDER_VIDEO_MEM_USED" value="17"> + Video memory used. Includes both texture and vertex memory. </constant> <constant name="RENDER_TEXTURE_MEM_USED" value="18"> + Texture memory used. </constant> <constant name="RENDER_VERTEX_MEM_USED" value="19"> + Vertex memory used. + </constant> + <constant name="RENDER_USAGE_VIDEO_MEM_TOTAL" value="20"> </constant> <constant name="PHYSICS_2D_ACTIVE_OBJECTS" value="21"> + Number of active [RigidBody2D] nodes in the game. </constant> <constant name="PHYSICS_2D_COLLISION_PAIRS" value="22"> + Number of collision pairs in the 2D physics engine. </constant> <constant name="PHYSICS_2D_ISLAND_COUNT" value="23"> + Number of islands in the 2D physics engine. </constant> <constant name="PHYSICS_3D_ACTIVE_OBJECTS" value="24"> + Number of active [RigidBody] and [VehicleBody] nodes in the game. </constant> <constant name="PHYSICS_3D_COLLISION_PAIRS" value="25"> + Number of collision pairs in the 3D physics engine. </constant> <constant name="PHYSICS_3D_ISLAND_COUNT" value="26"> + Number of islands in the 3D physics engine. </constant> <constant name="MONITOR_MAX" value="27"> </constant> diff --git a/doc/classes/Sprite.xml b/doc/classes/Sprite.xml index c0c491140f..0cdc8f7099 100644 --- a/doc/classes/Sprite.xml +++ b/doc/classes/Sprite.xml @@ -202,7 +202,7 @@ </methods> <members> <member name="centered" type="bool" setter="set_centered" getter="is_centered"> - If [code]true[/code] texture will be centered. Default value: [code]true[/code]. + If [code]true[/code] texture is centered. Default value: [code]true[/code]. </member> <member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h"> If [code]true[/code] texture is flipped horizontally. Default value: [code]false[/code]. @@ -211,40 +211,42 @@ If [code]true[/code] texture is flipped vertically. Default value: [code]false[/code]. </member> <member name="frame" type="int" setter="set_frame" getter="get_frame"> - Current frame to display from sprite sheet. [code]vframes[/code] or [code]hframes[/code] must be greater than 1. + Current frame to display from sprite sheet. [member vframes] or [member hframes] must be greater than 1. </member> <member name="hframes" type="int" setter="set_hframes" getter="get_hframes"> - The number of horizontal frames in the sprite sheet. + The number of collumns in the sprite sheet. </member> <member name="normal_map" type="Texture" setter="set_normal_map" getter="get_normal_map"> + The normal map gives depth to the Sprite. </member> <member name="offset" type="Vector2" setter="set_offset" getter="get_offset"> The texture's drawing offset. </member> <member name="region_enabled" type="bool" setter="set_region" getter="is_region"> - If [code]true[/code] texture will be cut from a larger atlas texture. See [code]region_rect[/code]. Default value: [code]false[/code]. + If [code]true[/code] texture is cut from a larger atlas texture. See [code]region_rect[/code]. Default value: [code]false[/code]. </member> <member name="region_filter_clip" type="bool" setter="set_region_filter_clip" getter="is_region_filter_clip_enabled"> + If [code]true[/code] the outermost pixels get blurred out. </member> <member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect"> - The region of the atlas texture to display. [code]region_enabled[/code] must be [code]true[/code]. + The region of the atlas texture to display. [member region_enabled] must be [code]true[/code]. </member> <member name="texture" type="Texture" setter="set_texture" getter="get_texture"> [Texture] object to draw. </member> <member name="vframes" type="int" setter="set_vframes" getter="get_vframes"> - The number of vertical frames in the sprite sheet. + The number of rows in the sprite sheet. </member> </members> <signals> <signal name="frame_changed"> <description> - Emitted when the [code]frame[/code] changes. + Emitted when the [member frame] changes. </description> </signal> <signal name="texture_changed"> <description> - Emitted when the [code]texture[/code] changes. + Emitted when the [member texture] changes. </description> </signal> </signals> diff --git a/doc/classes/Sprite3D.xml b/doc/classes/Sprite3D.xml index f6f2f8f00c..e51616a071 100644 --- a/doc/classes/Sprite3D.xml +++ b/doc/classes/Sprite3D.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Sprite3D" inherits="SpriteBase3D" category="Core" version="3.0.alpha.custom_build"> <brief_description> + 2D Sprite node in 3D world. </brief_description> <description> + A node that displays a 2D texture in a 3D environment. The texture displayed can be a region from a larger atlas texture, or a frame from a sprite sheet animation. </description> <tutorials> </tutorials> @@ -96,21 +98,28 @@ </methods> <members> <member name="frame" type="int" setter="set_frame" getter="get_frame"> + Current frame to display from sprite sheet. [member vframes] or [member hframes] must be greater than 1. </member> <member name="hframes" type="int" setter="set_hframes" getter="get_hframes"> + The number of columns in the sprite sheet. </member> <member name="region_enabled" type="bool" setter="set_region" getter="is_region"> + If [code]true[/code] texture will be cut from a larger atlas texture. See [member region_rect]. Default value: [code]false[/code]. </member> <member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect"> + The region of the atlas texture to display. [member region_enabled] must be [code]true[/code]. </member> <member name="texture" type="Texture" setter="set_texture" getter="get_texture"> + [Texture] object to draw. </member> <member name="vframes" type="int" setter="set_vframes" getter="get_vframes"> + The number of rows in the sprite sheet. </member> </members> <signals> <signal name="frame_changed"> <description> + Emitted when the [member frame] changes. </description> </signal> </signals> diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml index 1640e5dc9f..7ed681ea12 100644 --- a/doc/classes/SpriteBase3D.xml +++ b/doc/classes/SpriteBase3D.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="SpriteBase3D" inherits="GeometryInstance" category="Core" version="3.0.alpha.custom_build"> <brief_description> + 2D Sprite node in 3D environment. </brief_description> <description> + A node that displays 2D texture information in a 3D environment. </description> <tutorials> </tutorials> @@ -164,36 +166,51 @@ <member name="alpha_cut" type="int" setter="set_alpha_cut_mode" getter="get_alpha_cut_mode" enum="SpriteBase3D.AlphaCutMode"> </member> <member name="axis" type="int" setter="set_axis" getter="get_axis" enum="Vector3.Axis"> + The direction in which the front of the texture faces. </member> <member name="centered" type="bool" setter="set_centered" getter="is_centered"> + If [code]true[/code] texture will be centered. Default value: [code]true[/code]. </member> <member name="double_sided" type="bool" setter="set_draw_flag" getter="get_draw_flag"> + If [code]true[/code] texture can be seen from the back as well, if [code]false[/code], it is invisible when looking at it from behind. Default value: [code]true[/code]. </member> <member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h"> + If [code]true[/code] texture is flipped horizontally. Default value: [code]false[/code]. </member> <member name="flip_v" type="bool" setter="set_flip_v" getter="is_flipped_v"> + If [code]true[/code] texture is flipped vertically. Default value: [code]false[/code]. </member> <member name="modulate" type="Color" setter="set_modulate" getter="get_modulate"> + A color value that gets multiplied on, could be used for mood-coloring or to simulate the color of light. </member> <member name="offset" type="Vector2" setter="set_offset" getter="get_offset"> + The texture's drawing offset. </member> <member name="opacity" type="float" setter="set_opacity" getter="get_opacity"> + The objects visibility on a scale from [code]0[/code] fully invisible to [code]1[/code] fully visible. </member> <member name="pixel_size" type="float" setter="set_pixel_size" getter="get_pixel_size"> + The size of one pixel's width on the Sprite to scale it in 3D. </member> <member name="shaded" type="bool" setter="set_draw_flag" getter="get_draw_flag"> + If [code]true[/code] the [Light] in the [Environment] has effects on the Sprite. Default value: [code]false[/code]. </member> <member name="transparent" type="bool" setter="set_draw_flag" getter="get_draw_flag"> + If [code]true[/code] the texture's transparency and the opacity are used to make those parts of the Sprite invisible. Default value: [code]true[/code]. </member> </members> <constants> <constant name="FLAG_TRANSPARENT" value="0"> + If set, the texture's transparency and the opacity are used to make those parts of the Sprite invisible. </constant> <constant name="FLAG_SHADED" value="1"> + If set, the Light in the Environment has effects on the Sprite. </constant> <constant name="FLAG_DOUBLE_SIDED" value="2"> + If set, texture can be seen from the back as well, if not, it is invisible when looking at it from behind. </constant> <constant name="FLAG_MAX" value="3"> + Used internally to mark the end of the Flags section. </constant> <constant name="ALPHA_CUT_DISABLED" value="0"> </constant> diff --git a/doc/classes/TextureButton.xml b/doc/classes/TextureButton.xml index e4f00555b3..8e51548c10 100644 --- a/doc/classes/TextureButton.xml +++ b/doc/classes/TextureButton.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="TextureButton" inherits="BaseButton" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Button that can be themed with textures. + Texture-based button. Supports Pressed, Hover, Disabled and Focused states. </brief_description> <description> - Button that can be themed with textures. This is like a regular [Button] but can be themed by assigning textures to it. This button is intended to be easy to theme, however a regular button can expand (that uses styleboxes) and still be better if the interface is expect to have internationalization of texts. - Only the normal texture is required, the others are optional. + [code]TextureButton[/code] has the same functionality as [Button], except it uses sprites instead of Godot's [Theme] resource. It is faster to create, but it doesn't support localization like more complex Controls. + The Normal state's texture is required. Others are optional. </description> <tutorials> </tutorials> @@ -127,36 +127,51 @@ </methods> <members> <member name="expand" type="bool" setter="set_expand" getter="get_expand"> + If [code]true[/code] the texture stretches to the edges of the node's bounding rectangle using the [member stretch_mode]. If [code]false[/code] the texture will not scale with the node. Default value: [code]false[/code]. </member> <member name="stretch_mode" type="int" setter="set_stretch_mode" getter="get_stretch_mode" enum="TextureButton.StretchMode"> + Controls the texture's behavior when you resize the node's bounding rectangle, [b]only if[/b] [member expand] is [code]true[/code]. Set it to one of the [code]STRETCH_*[/code] constants. See the constants to learn more. </member> <member name="texture_click_mask" type="BitMap" setter="set_click_mask" getter="get_click_mask"> + Pure black and white [Bitmap] image to use for click detection. On the mask, white pixels represent the button's clickable area. Use it to create buttons with curved shapes. </member> <member name="texture_disabled" type="Texture" setter="set_disabled_texture" getter="get_disabled_texture"> + Texture to display when the node is disabled. See [member BaseButton.disabled]. </member> <member name="texture_focused" type="Texture" setter="set_focused_texture" getter="get_focused_texture"> + Texture to display when the node has mouse or keyboard focus. </member> <member name="texture_hover" type="Texture" setter="set_hover_texture" getter="get_hover_texture"> + Texture to display when the mouse hovers the node. </member> <member name="texture_normal" type="Texture" setter="set_normal_texture" getter="get_normal_texture"> + Texture to display by default, when the node is [b]not[/b] in the disabled, focused, hover or pressed state. </member> <member name="texture_pressed" type="Texture" setter="set_pressed_texture" getter="get_pressed_texture"> + Texture to display on mouse down over the node, if the node has keyboard focus and the player presses the enter key or if the player presses the [member BaseButton.shortcut] key. </member> </members> <constants> <constant name="STRETCH_SCALE" value="0"> + Scale to fit the node's bounding rectangle. </constant> <constant name="STRETCH_TILE" value="1"> + Tile inside the node's bounding rectangle. </constant> <constant name="STRETCH_KEEP" value="2"> + The texture keeps its original size and stays in the bounding rectangle's top-left corner. </constant> <constant name="STRETCH_KEEP_CENTERED" value="3"> + The texture keeps its original size and stays centered in the node's bounding rectangle. </constant> <constant name="STRETCH_KEEP_ASPECT" value="4"> + Scale the texture to fit the node's bounding rectangle, but maintain the texture's aspect ratio. </constant> <constant name="STRETCH_KEEP_ASPECT_CENTERED" value="5"> + Scale the texture to fit the node's bounding rectangle, center it, and maintain its aspect ratio. </constant> <constant name="STRETCH_KEEP_ASPECT_COVERED" value="6"> + Scale the texture so that the shorter side fits the bounding rectangle. The other side clips to the node's limits. </constant> </constants> </class> diff --git a/doc/classes/TextureProgress.xml b/doc/classes/TextureProgress.xml index 0a6ffcdeb8..f8165753c6 100644 --- a/doc/classes/TextureProgress.xml +++ b/doc/classes/TextureProgress.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="TextureProgress" inherits="Range" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Textured progress bar. + Texture-based progress bar. Useful for loading screens and life or stamina bars. </brief_description> <description> - A [ProgressBar] that uses textures to display fill percentage. Can be set to linear or radial mode. + TextureProgress works like [ProgressBar] but it uses up to 3 textures instead of Godot's [Theme] resource. Works horizontally, vertically, and radially. </description> <tutorials> </tutorials> @@ -151,51 +151,59 @@ The fill direction. Uses FILL_* constants. </member> <member name="nine_patch_stretch" type="bool" setter="set_nine_patch_stretch" getter="get_nine_patch_stretch"> - If [code]true[/code] textures will be stretched as [NinePatchRect]. Uses [code]stretch_margin[/code] properties (see below). Default value: [code]false[/code] + If [code]true[/code] Godot treats the bar's textures like [NinePatchRect]. Use [code]stretch_margin_*[/code], like [member stretch_margin_bottom], to set up the nine patch's 3x3 grid. Default value: [code]false[/code]. </member> <member name="radial_center_offset" type="Vector2" setter="set_radial_center_offset" getter="get_radial_center_offset"> - The offset amount for radial mode. + Offsets [member texture_progress] if [member fill_mode] is [code]FILL_CLOCKWISE[/code] or [code]FILL_COUNTER_CLOCKWISE[/code]. </member> <member name="radial_fill_degrees" type="float" setter="set_fill_degrees" getter="get_fill_degrees"> - The amount of the texture to use for radial mode. + Upper limit for the fill of [member texture_progress] if [member fill_mode] is [code]FILL_CLOCKWISE[/code] or [code]FILL_COUNTER_CLOCKWISE[/code]. When the node's [code]value[/code] is equal to its [code]max_value[/code], the texture fills up to this angle. + See [member Range.value], [member Range.max_value]. </member> <member name="radial_initial_angle" type="float" setter="set_radial_initial_angle" getter="get_radial_initial_angle"> - Start angle for radial mode. + Starting angle for the fill of [member texture_progress] if [member fill_mode] is [code]FILL_CLOCKWISE[/code] or [code]FILL_COUNTER_CLOCKWISE[/code]. When the node's [code]value[/code] is equal to its [code]min_value[/code], the texture doesn't show up at all. When the [code]value[/code] increases, the texture fills and tends towards [member radial_fill_degrees]. </member> <member name="stretch_margin_bottom" type="int" setter="set_stretch_margin" getter="get_stretch_margin"> - Nine-patch texture offset for bottom margin. + The height of the 9-patch's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders. </member> <member name="stretch_margin_left" type="int" setter="set_stretch_margin" getter="get_stretch_margin"> - Nine-patch texture offset for left margin. + The width of the 9-patch's left column. </member> <member name="stretch_margin_right" type="int" setter="set_stretch_margin" getter="get_stretch_margin"> - Nine-patch texture offset for right margin. + The width of the 9-patch's right column. </member> <member name="stretch_margin_top" type="int" setter="set_stretch_margin" getter="get_stretch_margin"> - Nine-patch texture offset for top margin. + The height of the 9-patch's top row. </member> <member name="texture_over" type="Texture" setter="set_over_texture" getter="get_over_texture"> - The [Texture] that will be drawn over the progress bar. + [Texture] that draws over the progress bar. Use it to add highlights or an upper-frame that hides part of [member texture_progress]. </member> <member name="texture_progress" type="Texture" setter="set_progress_texture" getter="get_progress_texture"> - The [Texture] used to display [code]value[/code]. + [Texture] that clips based on the node's [code]value[/code] and [member fill_mode]. As [code]value[/code] increased, the texture fills up. It shows entirely when [code]value[/code] reaches [code]max_value[/code]. It doesn't show at all if [code]value[/code] is equal to [code]min_value[/code]. + The [code]value[/code] property comes from [Range]. See [member Range.value], [member Range.min_value], [member Range.max_value]. </member> <member name="texture_under" type="Texture" setter="set_under_texture" getter="get_under_texture"> - The [Texture] that will be drawn under the progress bar. + [Texture] that draws under the progress bar. The bar's background. </member> </members> <constants> <constant name="FILL_LEFT_TO_RIGHT" value="0"> + The [member texture_progress] fills from left to right. </constant> <constant name="FILL_RIGHT_TO_LEFT" value="1"> + The [member texture_progress] fills from right to left. </constant> <constant name="FILL_TOP_TO_BOTTOM" value="2"> + The [member texture_progress] fills from top to bototm. </constant> <constant name="FILL_BOTTOM_TO_TOP" value="3"> + The [member texture_progress] fills from bottom to top. </constant> <constant name="FILL_CLOCKWISE" value="4"> + Turns the node into a radial bar. The [member texture_progress] fills clockwise. See [member radial_center_offset], [member radial_initial_angle] and [member radial_fill_degrees] to refine its behavior. </constant> <constant name="FILL_COUNTER_CLOCKWISE" value="5"> + Turns the node into a radial bar. The [member texture_progress] fills counter-clockwise. See [member radial_center_offset], [member radial_initial_angle] and [member radial_fill_degrees] to refine its behavior. </constant> </constants> </class> diff --git a/doc/classes/VisualScriptComment.xml b/doc/classes/VisualScriptComment.xml index da65998e78..69126052d0 100644 --- a/doc/classes/VisualScriptComment.xml +++ b/doc/classes/VisualScriptComment.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptComment" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> - A Visual Script node used to store information for the developer. + A Visual Script node used to annotate the script. </brief_description> <description> - A Visual Script node used to display text, so that code is more readable and better documented. + A Visual Script node used to display annotations in the script, so that code may be documented. Comment nodes can be resized so they encompass a group of nodes. </description> <tutorials> @@ -60,10 +60,10 @@ The text inside the comment node. </member> <member name="size" type="Vector2" setter="set_size" getter="get_size"> - The size (in pixels) of the comment node. + The comment node's size (in pixels). </member> <member name="title" type="String" setter="set_title" getter="get_title"> - The title of the comment node. + The comment node's title. </member> </members> <constants> diff --git a/doc/classes/VisualScriptCondition.xml b/doc/classes/VisualScriptCondition.xml index de814a6b17..a776c9bc9b 100644 --- a/doc/classes/VisualScriptCondition.xml +++ b/doc/classes/VisualScriptCondition.xml @@ -4,7 +4,14 @@ A Visual Script node which branches the flow. </brief_description> <description> - A Visual Script node which switches the flow based on a boolean. It acts similar to if/else in typical programming languages. + A Visual Script node that checks a [bool] input port. If [code]true[/code] it will exit via the “true” sequence port. If [code]false[/code] it will exit via the "false" sequence port. After exiting either, it exits via the “done” port. Sequence ports may be left disconnected. + [b]Input Ports:[/b] + - Sequence: [code]if (cond) is[/code] + - Data (boolean): [code]cond[/code] + [b]Output Ports:[/b] + - Sequence: [code]true[/code] + - Sequence: [code]false[/code] + - Sequence: [code]done[/code] </description> <tutorials> </tutorials> diff --git a/doc/classes/VisualScriptOperator.xml b/doc/classes/VisualScriptOperator.xml index 82951c9e0c..7e85af8af2 100644 --- a/doc/classes/VisualScriptOperator.xml +++ b/doc/classes/VisualScriptOperator.xml @@ -3,6 +3,13 @@ <brief_description> </brief_description> <description> + [b]Input Ports:[/b] + - Data (variant): [code]A[/code] + - Data (variant): [code]B[/code] + [b]Output Ports:[/b] + - Sequence: [code]true[/code] + - Sequence: [code]false[/code] + - Sequence: [code]done[/code] </description> <tutorials> </tutorials> diff --git a/doc/classes/VisualScriptSceneNode.xml b/doc/classes/VisualScriptSceneNode.xml index 90a8f132c0..b71bd9adfb 100644 --- a/doc/classes/VisualScriptSceneNode.xml +++ b/doc/classes/VisualScriptSceneNode.xml @@ -1,8 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="VisualScriptSceneNode" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Node reference. </brief_description> <description> + A direct reference to a node. + [b]Input Ports:[/b] + none + [b]Output Ports:[/b] + - Data: [code]node[/code] (obj) </description> <tutorials> </tutorials> @@ -26,6 +32,7 @@ </methods> <members> <member name="node_path" type="NodePath" setter="set_node_path" getter="get_node_path"> + The node's path in the scene tree. </member> </members> <constants> diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py index 6b936899d8..e89b49eb4d 100644 --- a/doc/tools/doc_status.py +++ b/doc/tools/doc_status.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import fnmatch import os @@ -297,17 +297,21 @@ input_class_list = [] merged_file = "" for arg in sys.argv[1:]: - if arg.startswith('--'): - flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]] - elif arg.startswith('-'): - for f in arg[1:]: - flags[f] = not flags[f] - elif os.path.isdir(arg): - for f in os.listdir(arg): - if f.endswith('.xml'): - input_file_list.append(os.path.join(arg, f)); - else: - input_class_list.append(arg) + try: + if arg.startswith('--'): + flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]] + elif arg.startswith('-'): + for f in arg[1:]: + flags[f] = not flags[f] + elif os.path.isdir(arg): + for f in os.listdir(arg): + if f.endswith('.xml'): + input_file_list.append(os.path.join(arg, f)); + else: + input_class_list.append(arg) + except KeyError: + print("Unknown command line flag: " + arg) + sys.exit(1) if flags['i']: for r in ['methods', 'constants', 'members', 'signals']: diff --git a/drivers/gles3/shaders/subsurf_scattering.glsl b/drivers/gles3/shaders/subsurf_scattering.glsl index 20c3b7473f..fc66d66198 100644 --- a/drivers/gles3/shaders/subsurf_scattering.glsl +++ b/drivers/gles3/shaders/subsurf_scattering.glsl @@ -82,18 +82,18 @@ QUALIFIER vec2 kernel[17] = vec2[]( const int kernel_size=11; -QUALIFIER vec4 kernel[11] = vec4[]( - vec4(0.560479, 0.0), - vec4(0.00471691, -2.0), - vec4(0.0192831, -1.28), - vec4(0.03639, -0.72), - vec4(0.0821904, -0.32), - vec4(0.0771802, -0.08), - vec4(0.0771802, 0.08), - vec4(0.0821904, 0.32), - vec4(0.03639, 0.72), - vec4(0.0192831, 1.28), - vec4(0.00471691,2.0) +QUALIFIER vec2 kernel[11] = vec2[]( + vec2(0.560479, 0.0), + vec2(0.00471691, -2.0), + vec2(0.0192831, -1.28), + vec2(0.03639, -0.72), + vec2(0.0821904, -0.32), + vec2(0.0771802, -0.08), + vec2(0.0771802, 0.08), + vec2(0.0821904, 0.32), + vec2(0.03639, 0.72), + vec2(0.0192831, 1.28), + vec2(0.00471691,2.0) ); #endif //USE_11_SAMPLES @@ -190,4 +190,3 @@ void main() { frag_color = base_color; } } - diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 29fe73f170..e0a62b316d 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -285,7 +285,7 @@ uint64_t OS_Unix::get_ticks_usec() const { return longtime; } -Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode) { +Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr) { if (p_blocking && r_pipe) { @@ -297,7 +297,11 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo argss += String(" \"") + p_arguments[i] + "\""; } - argss += " 2>/dev/null"; //silence stderr + if (read_stderr) { + argss += " 2>&1"; // Read stderr too + } else { + argss += " 2>/dev/null"; //silence stderr + } FILE *f = popen(argss.utf8().get_data(), "r"); ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index 1cc44c0ffd..87e73534c4 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -97,7 +97,7 @@ public: virtual void delay_usec(uint32_t p_usec) const; virtual uint64_t get_ticks_usec() const; - virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL); + virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false); virtual Error kill(const ProcessID &p_pid); virtual int get_process_id() const; diff --git a/editor/SCsub b/editor/SCsub index e44b4e4bb2..772feca5f8 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -237,7 +237,7 @@ def make_license_header(target, source, env): g.write("static const char *about_license =") for line in f: - escaped_string = escape_string(line.strip().replace("\"", "\\\"")) + escaped_string = escape_string(line.strip()) g.write("\n\t\"" + escaped_string + "\\n\"") g.write(";\n") @@ -323,12 +323,12 @@ def make_license_header(target, source, env): for k in j[0].split("\n"): if file_body != "": file_body += "\\n\"\n" - escaped_string = escape_string(k.strip().replace("\"", "\\\"")) + escaped_string = escape_string(k.strip()) file_body += "\t\"" + escaped_string for k in j[1].split("\n"): if copyright_body != "": copyright_body += "\\n\"\n" - escaped_string = escape_string(k.strip().replace("\"", "\\\"")) + escaped_string = escape_string(k.strip()) copyright_body += "\t\"" + escaped_string about_tp_file += "\t" + file_body + "\",\n" @@ -343,7 +343,7 @@ def make_license_header(target, source, env): for j in i[1].split("\n"): if body != "": body += "\\n\"\n" - escaped_string = escape_string(j.strip().replace("\"", "\\\"")) + escaped_string = escape_string(j.strip()) body += "\t\"" + escaped_string about_license_name += "\t\"" + i[0] + "\",\n" diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 4e0ad38320..ff415c83f1 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4588,7 +4588,8 @@ EditorNode::EditorNode() { { int dpi_mode = EditorSettings::get_singleton()->get("interface/editor/hidpi_mode"); if (dpi_mode == 0) { - editor_set_scale(OS::get_singleton()->get_screen_dpi(0) >= 192 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x > 2000 ? 2.0 : 1.0); + const int screen = OS::get_singleton()->get_current_screen(); + editor_set_scale(OS::get_singleton()->get_screen_dpi(screen) >= 192 && OS::get_singleton()->get_screen_size(screen).x > 2000 ? 2.0 : 1.0); } else if (dpi_mode == 1) { editor_set_scale(0.75); } else if (dpi_mode == 2) { diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp new file mode 100644 index 0000000000..2fd74d529e --- /dev/null +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -0,0 +1,619 @@ +/*************************************************************************/ +/* abstract_polygon_2d_editor.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 "abstract_polygon_2d_editor.h" + +#include "canvas_item_editor_plugin.h" + +bool AbstractPolygon2DEditor::_is_empty() const { + + if (!_get_node()) + return true; + + const int n = _get_polygon_count(); + + for (int i = 0; i < n; i++) { + + Vector<Vector2> vertices = _get_polygon(i); + + if (vertices.size() != 0) + return false; + } + + return true; +} + +int AbstractPolygon2DEditor::_get_polygon_count() const { + + return 1; +} + +Variant AbstractPolygon2DEditor::_get_polygon(int p_idx) const { + + return _get_node()->get("polygon"); +} + +void AbstractPolygon2DEditor::_set_polygon(int p_idx, const Variant &p_polygon) const { + + _get_node()->set("polygon", p_polygon); +} + +void AbstractPolygon2DEditor::_action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon) { + + Node2D *node = _get_node(); + undo_redo->add_do_method(node, "set_polygon", p_polygon); + undo_redo->add_undo_method(node, "set_polygon", p_previous); +} + +Vector2 AbstractPolygon2DEditor::_get_offset(int p_idx) const { + + return Vector2(0, 0); +} + +void AbstractPolygon2DEditor::_commit_action() { + + undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); + undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); + undo_redo->commit_action(); +} + +void AbstractPolygon2DEditor::_action_add_polygon(const Variant &p_polygon) { + + _action_set_polygon(0, p_polygon); +} + +void AbstractPolygon2DEditor::_action_remove_polygon(int p_idx) { + + _action_set_polygon(p_idx, _get_polygon(p_idx), PoolVector<Vector2>()); +} + +void AbstractPolygon2DEditor::_action_set_polygon(int p_idx, const Variant &p_polygon) { + + _action_set_polygon(p_idx, _get_polygon(p_idx), p_polygon); +} + +bool AbstractPolygon2DEditor::_has_resource() const { + + return true; +} + +void AbstractPolygon2DEditor::_create_resource() { +} + +void AbstractPolygon2DEditor::_menu_option(int p_option) { + + switch (p_option) { + + case MODE_CREATE: { + + mode = MODE_CREATE; + button_create->set_pressed(true); + button_edit->set_pressed(false); + } break; + case MODE_EDIT: { + + mode = MODE_EDIT; + button_create->set_pressed(false); + button_edit->set_pressed(true); + } break; + } +} + +void AbstractPolygon2DEditor::_notification(int p_what) { + + switch (p_what) { + + case NOTIFICATION_READY: { + + button_create->set_icon(get_icon("Edit", "EditorIcons")); + button_edit->set_icon(get_icon("MovePoint", "EditorIcons")); + button_edit->set_pressed(true); + + get_tree()->connect("node_removed", this, "_node_removed"); + + create_resource->connect("confirmed", this, "_create_resource"); + + } break; + case NOTIFICATION_PHYSICS_PROCESS: { + + } break; + } +} + +void AbstractPolygon2DEditor::_node_removed(Node *p_node) { + + if (p_node == _get_node()) { + edit(NULL); + hide(); + + canvas_item_editor->get_viewport_control()->update(); + } +} + +void AbstractPolygon2DEditor::_wip_close() { + + if (wip.size() >= 3) { + + undo_redo->create_action(TTR("Create Poly")); + _action_add_polygon(wip); + _commit_action(); + + mode = MODE_EDIT; + button_edit->set_pressed(true); + button_create->set_pressed(false); + } + + wip.clear(); + wip_active = false; + edited_point = -1; +} + +bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) { + + if (!_get_node()) + return false; + + Ref<InputEventMouseButton> mb = p_event; + + if (!_has_resource()) { + + if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) { + create_resource->set_text(String("No polygon resource on this node.\nCreate and assign one?")); + create_resource->popup_centered_minsize(); + } + return (mb.is_valid() && mb->get_button_index() == 1); + } + + if (mb.is_valid()) { + + Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform(); + + Vector2 gpoint = mb->get_position(); + Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint); + cpoint = canvas_item_editor->snap_point(cpoint); + cpoint = _get_node()->get_global_transform().affine_inverse().xform(cpoint); + + //first check if a point is to be added (segment split) + real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8); + + if (mode == MODE_CREATE) { + + if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { + + if (!wip_active) { + + wip.clear(); + wip.push_back(cpoint); + wip_active = true; + edited_point_pos = cpoint; + edited_polygon = -1; + edited_point = 1; + canvas_item_editor->get_viewport_control()->update(); + return true; + } else { + + if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_threshold) { + //wip closed + _wip_close(); + + return true; + } else { + + wip.push_back(cpoint); + edited_point = wip.size(); + canvas_item_editor->get_viewport_control()->update(); + return true; + + //add wip point + } + } + } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) { + _wip_close(); + } + } else if (mode == MODE_EDIT) { + + if (mb->get_button_index() == BUTTON_LEFT) { + + if (mb->is_pressed()) { + + if (mb->get_control()) { + + const int n_polygons = _get_polygon_count(); + + if (n_polygons >= 1) { + + Vector<Vector2> vertices = _get_polygon(n_polygons - 1); + + if (vertices.size() < 3) { + + vertices.push_back(cpoint); + undo_redo->create_action(TTR("Edit Poly")); + _action_set_polygon(n_polygons - 1, vertices); + _commit_action(); + return true; + } + } + + //search edges + int closest_poly = -1; + int closest_idx = -1; + Vector2 closest_pos; + real_t closest_dist = 1e10; + + for (int j = 0; j < n_polygons; j++) { + + PoolVector<Vector2> points = _get_polygon(j); + const Vector2 offset = _get_offset(j); + const int n_points = points.size(); + + for (int i = 0; i < n_points; i++) { + + Vector2 p[2] = { xform.xform(points[i] + offset), + xform.xform(points[(i + 1) % n_points] + offset) }; + + Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, p); + if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2) + continue; //not valid to reuse point + + real_t d = cp.distance_to(gpoint); + if (d < closest_dist && d < grab_threshold) { + closest_poly = j; + closest_dist = d; + closest_pos = cp; + closest_idx = i; + } + } + } + + if (closest_idx >= 0) { + + Vector<Vector2> vertices = _get_polygon(closest_poly); + pre_move_edit = vertices; + vertices.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos)); + edited_point = closest_idx + 1; + edited_polygon = closest_poly; + edited_point_pos = xform.affine_inverse().xform(closest_pos); + + undo_redo->create_action(TTR("Insert Point")); + _action_set_polygon(closest_poly, vertices); + _commit_action(); + + return true; + } + } else { + + //look for points to move + int closest_poly = -1; + int closest_idx = -1; + Vector2 closest_pos; + real_t closest_dist = 1e10; + + const int n_polygons = _get_polygon_count(); + + for (int j = 0; j < n_polygons; j++) { + + PoolVector<Vector2> points = _get_polygon(j); + const Vector2 offset = _get_offset(j); + const int n_points = points.size(); + + for (int i = 0; i < n_points; i++) { + + Vector2 cp = xform.xform(points[i] + offset); + + real_t d = cp.distance_to(gpoint); + if (d < closest_dist && d < grab_threshold) { + closest_poly = j; + closest_dist = d; + closest_pos = cp; + closest_idx = i; + } + } + } + + if (closest_idx >= 0) { + + pre_move_edit = _get_polygon(closest_poly); + edited_polygon = closest_poly; + edited_point = closest_idx; + edited_point_pos = xform.affine_inverse().xform(closest_pos); + canvas_item_editor->get_viewport_control()->update(); + return true; + } + } + } else { + + if (edited_point != -1) { + + //apply + + Vector<Vector2> vertices = _get_polygon(edited_polygon); + ERR_FAIL_INDEX_V(edited_point, vertices.size(), false); + vertices[edited_point] = edited_point_pos - _get_offset(edited_polygon); + + undo_redo->create_action(TTR("Edit Poly")); + _action_set_polygon(edited_polygon, pre_move_edit, vertices); + _commit_action(); + + edited_point = -1; + return true; + } + } + } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) { + + int closest_poly = -1; + int closest_idx = -1; + Vector2 closest_pos; + real_t closest_dist = 1e10; + const int n_polygons = _get_polygon_count(); + + for (int j = 0; j < n_polygons; j++) { + + PoolVector<Vector2> points = _get_polygon(j); + const int n_points = points.size(); + const Vector2 offset = _get_offset(j); + + for (int i = 0; i < n_points; i++) { + + Vector2 cp = xform.xform(points[i] + offset); + + real_t d = cp.distance_to(gpoint); + if (d < closest_dist && d < grab_threshold) { + closest_poly = j; + closest_dist = d; + closest_pos = cp; + closest_idx = i; + } + } + } + + if (closest_idx >= 0) { + + PoolVector<Vector2> vertices = _get_polygon(closest_poly); + + if (vertices.size() > 3) { + + vertices.remove(closest_idx); + + undo_redo->create_action(TTR("Edit Poly (Remove Point)")); + _action_set_polygon(closest_poly, vertices); + _commit_action(); + } else { + + undo_redo->create_action(TTR("Remove Poly And Point")); + _action_remove_polygon(closest_poly); + _commit_action(); + } + + if (_is_empty()) + _menu_option(MODE_CREATE); + return true; + } + } + } + } + + Ref<InputEventMouseMotion> mm = p_event; + + if (mm.is_valid()) { + + if (edited_point != -1 && (wip_active || (mm->get_button_mask() & BUTTON_MASK_LEFT))) { + + Vector2 gpoint = mm->get_position(); + Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint); + cpoint = canvas_item_editor->snap_point(cpoint); + edited_point_pos = _get_node()->get_global_transform().affine_inverse().xform(cpoint); + + if (!wip_active) { + + Vector<Vector2> vertices = _get_polygon(edited_polygon); + ERR_FAIL_INDEX_V(edited_point, vertices.size(), false); + vertices[edited_point] = edited_point_pos - _get_offset(edited_polygon); + _set_polygon(edited_polygon, vertices); + } + + canvas_item_editor->get_viewport_control()->update(); + } + } + + return false; +} + +void AbstractPolygon2DEditor::_canvas_draw() { + + if (!_get_node()) + return; + + Control *vpc = canvas_item_editor->get_viewport_control(); + + Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform(); + Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons"); + const int n_polygons = _get_polygon_count(); + + for (int j = -1; j < n_polygons; j++) { + + if (wip_active && wip_destructive && j != -1) + continue; + + PoolVector<Vector2> points; + Vector2 offset; + + if (wip_active && j == edited_polygon) { + + points = Variant(wip); + offset = Vector2(0, 0); + } else { + + if (j == -1) + continue; + points = _get_polygon(j); + offset = _get_offset(j); + } + + if (!wip_active && j == edited_polygon && edited_point >= 0 && EDITOR_DEF("editors/poly_editor/show_previous_outline", true)) { + + const Color col = Color(0.5, 0.5, 0.5); // FIXME polygon->get_outline_color(); + const int n = pre_move_edit.size(); + for (int i = 0; i < n; i++) { + + Vector2 p, p2; + p = pre_move_edit[i] + offset; + p2 = pre_move_edit[(i + 1) % n] + offset; + + Vector2 point = xform.xform(p); + Vector2 next_point = xform.xform(p2); + + vpc->draw_line(point, next_point, col, 2); + } + } + + const int n_points = points.size(); + const Color col = Color(1, 0.3, 0.1, 0.8); + + for (int i = 0; i < n_points; i++) { + + Vector2 p, p2; + p = (j == edited_polygon && i == edited_point) ? edited_point_pos : (points[i] + offset); + if (j == edited_polygon && ((wip_active && i == n_points - 1) || (((i + 1) % n_points) == edited_point))) + p2 = edited_point_pos; + else + p2 = points[(i + 1) % n_points] + offset; + + Vector2 point = xform.xform(p); + Vector2 next_point = xform.xform(p2); + + vpc->draw_line(point, next_point, col, 2); + vpc->draw_texture(handle, point - handle->get_size() * 0.5); + } + } +} + +void AbstractPolygon2DEditor::edit(Node *p_polygon) { + + if (!canvas_item_editor) { + canvas_item_editor = CanvasItemEditor::get_singleton(); + } + + if (p_polygon) { + + _set_node(p_polygon); + + //Enable the pencil tool if the polygon is empty + if (_is_empty()) + _menu_option(MODE_CREATE); + + if (!canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw")) + canvas_item_editor->get_viewport_control()->connect("draw", this, "_canvas_draw"); + + wip.clear(); + wip_active = false; + edited_point = -1; + + canvas_item_editor->get_viewport_control()->update(); + + } else { + + _set_node(NULL); + + if (canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw")) + canvas_item_editor->get_viewport_control()->disconnect("draw", this, "_canvas_draw"); + } +} + +void AbstractPolygon2DEditor::_bind_methods() { + + ClassDB::bind_method(D_METHOD("_canvas_draw"), &AbstractPolygon2DEditor::_canvas_draw); + ClassDB::bind_method(D_METHOD("_node_removed"), &AbstractPolygon2DEditor::_node_removed); + ClassDB::bind_method(D_METHOD("_menu_option"), &AbstractPolygon2DEditor::_menu_option); + ClassDB::bind_method(D_METHOD("_create_resource"), &AbstractPolygon2DEditor::_create_resource); +} + +AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wip_destructive) { + + canvas_item_editor = NULL; + editor = p_editor; + undo_redo = editor->get_undo_redo(); + + wip_active = false; + edited_polygon = -1; + wip_destructive = p_wip_destructive; + + add_child(memnew(VSeparator)); + button_create = memnew(ToolButton); + add_child(button_create); + button_create->connect("pressed", this, "_menu_option", varray(MODE_CREATE)); + button_create->set_toggle_mode(true); + button_create->set_tooltip(TTR("Create a new polygon from scratch.")); + + button_edit = memnew(ToolButton); + add_child(button_edit); + button_edit->connect("pressed", this, "_menu_option", varray(MODE_EDIT)); + button_edit->set_toggle_mode(true); + button_edit->set_tooltip(TTR("Edit existing polygon:\nLMB: Move Point.\nCtrl+LMB: Split Segment.\nRMB: Erase Point.")); + + create_resource = memnew(ConfirmationDialog); + add_child(create_resource); + create_resource->get_ok()->set_text(TTR("Create")); + + mode = MODE_EDIT; +} + +void AbstractPolygon2DEditorPlugin::edit(Object *p_object) { + + polygon_editor->edit(Object::cast_to<Node>(p_object)); +} + +bool AbstractPolygon2DEditorPlugin::handles(Object *p_object) const { + + return p_object->is_class(klass); +} + +void AbstractPolygon2DEditorPlugin::make_visible(bool p_visible) { + + if (p_visible) { + + polygon_editor->show(); + } else { + + polygon_editor->hide(); + polygon_editor->edit(NULL); + } +} + +AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(EditorNode *p_node, AbstractPolygon2DEditor *p_polygon_editor, String p_class) { + + editor = p_node; + polygon_editor = p_polygon_editor; + klass = p_class; + CanvasItemEditor::get_singleton()->add_control_to_menu_panel(polygon_editor); + + polygon_editor->hide(); +} + +AbstractPolygon2DEditorPlugin::~AbstractPolygon2DEditorPlugin() { +} diff --git a/editor/plugins/abstract_polygon_2d_editor.h b/editor/plugins/abstract_polygon_2d_editor.h new file mode 100644 index 0000000000..86e14694da --- /dev/null +++ b/editor/plugins/abstract_polygon_2d_editor.h @@ -0,0 +1,131 @@ +/*************************************************************************/ +/* abstract_polygon_2d_editor.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 ABSTRACT_POLYGON_2D_EDITOR_H +#define ABSTRACT_POLYGON_2D_EDITOR_H + +#include "editor/editor_node.h" +#include "editor/editor_plugin.h" +#include "scene/2d/polygon_2d.h" +#include "scene/gui/tool_button.h" + +/** + @author Juan Linietsky <reduzio@gmail.com> +*/ +class CanvasItemEditor; + +class AbstractPolygon2DEditor : public HBoxContainer { + + GDCLASS(AbstractPolygon2DEditor, HBoxContainer); + + ToolButton *button_create; + ToolButton *button_edit; + + int edited_polygon; + int edited_point; + Vector2 edited_point_pos; + Vector<Vector2> pre_move_edit; + Vector<Vector2> wip; + bool wip_active; + bool wip_destructive; + + CanvasItemEditor *canvas_item_editor; + EditorNode *editor; + Panel *panel; + ConfirmationDialog *create_resource; + +protected: + enum { + + MODE_CREATE, + MODE_EDIT, + MODE_CONT, + + }; + + int mode; + + UndoRedo *undo_redo; + + virtual void _menu_option(int p_option); + void _wip_close(); + void _canvas_draw(); + + void _notification(int p_what); + void _node_removed(Node *p_node); + static void _bind_methods(); + + bool _is_empty() const; + void _commit_action(); + +protected: + virtual Node2D *_get_node() const = 0; + virtual void _set_node(Node *p_polygon) = 0; + + virtual int _get_polygon_count() const; + virtual Vector2 _get_offset(int p_idx) const; + virtual Variant _get_polygon(int p_idx) const; + virtual void _set_polygon(int p_idx, const Variant &p_polygon) const; + + virtual void _action_add_polygon(const Variant &p_polygon); + virtual void _action_remove_polygon(int p_idx); + virtual void _action_set_polygon(int p_idx, const Variant &p_polygon); + virtual void _action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon); + + virtual bool _has_resource() const; + virtual void _create_resource(); + +public: + bool forward_gui_input(const Ref<InputEvent> &p_event); + void edit(Node *p_polygon); + AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wip_destructive = true); +}; + +class AbstractPolygon2DEditorPlugin : public EditorPlugin { + + GDCLASS(AbstractPolygon2DEditorPlugin, EditorPlugin); + + AbstractPolygon2DEditor *polygon_editor; + EditorNode *editor; + String klass; + +public: + virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return polygon_editor->forward_gui_input(p_event); } + + bool has_main_screen() const { return false; } + virtual String get_name() const { return klass; } + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; + virtual void make_visible(bool p_visible); + + AbstractPolygon2DEditorPlugin(EditorNode *p_node, AbstractPolygon2DEditor *p_polygon_editor, String p_class); + ~AbstractPolygon2DEditorPlugin(); +}; + +#endif // ABSTRACT_POLYGON_2D_EDITOR_H diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 4f6c8f89ee..4b216d63f5 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -993,7 +993,7 @@ void CanvasItemEditor::_prepare_drag(const Point2 &p_click_pos) { se->pre_drag_rect = canvas_item->get_item_rect(); } - if (selection.size() == 1 && Object::cast_to<Node2D>(selection[0])) { + if (selection.size() == 1 && Object::cast_to<Node2D>(selection[0]) && bone_ik_list.size() == 0) { drag = DRAG_NODE_2D; drag_point_from = Object::cast_to<Node2D>(selection[0])->get_global_position(); } else { @@ -2748,9 +2748,9 @@ void CanvasItemEditor::_notification(int p_what) { } if (all_control && has_control) - anchor_menu->show(); + presets_menu->show(); else - anchor_menu->hide(); + presets_menu->hide(); for (Map<ObjectID, BoneList>::Element *E = bone_list.front(); E; E = E->next()) { @@ -2782,57 +2782,15 @@ void CanvasItemEditor::_notification(int p_what) { select_sb->set_default_margin(Margin(i), 4); } - select_button->set_icon(get_icon("ToolSelect", "EditorIcons")); - list_select_button->set_icon(get_icon("ListSelect", "EditorIcons")); - move_button->set_icon(get_icon("ToolMove", "EditorIcons")); - rotate_button->set_icon(get_icon("ToolRotate", "EditorIcons")); - snap_button->set_icon(get_icon("Snap", "EditorIcons")); - snap_config_menu->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons")); - skeleton_menu->set_icon(get_icon("Bone", "EditorIcons")); - pan_button->set_icon(get_icon("ToolPan", "EditorIcons")); - pivot_button->set_icon(get_icon("EditPivot", "EditorIcons")); - select_handle = get_icon("EditorHandle", "EditorIcons"); - anchor_handle = get_icon("EditorControlAnchor", "EditorIcons"); - lock_button->set_icon(get_icon("Lock", "EditorIcons")); - unlock_button->set_icon(get_icon("Unlock", "EditorIcons")); - group_button->set_icon(get_icon("Group", "EditorIcons")); - ungroup_button->set_icon(get_icon("Ungroup", "EditorIcons")); - key_insert_button->set_icon(get_icon("Key", "EditorIcons")); - - zoom_minus->set_icon(get_icon("ZoomLess", "EditorIcons")); - zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons")); - zoom_plus->set_icon(get_icon("ZoomMore", "EditorIcons")); - - anchor_menu->set_icon(get_icon("Anchor", "EditorIcons")); - PopupMenu *p = anchor_menu->get_popup(); - - p->add_icon_item(get_icon("ControlAlignTopLeft", "EditorIcons"), "Top Left", ANCHOR_ALIGN_TOP_LEFT); - p->add_icon_item(get_icon("ControlAlignTopRight", "EditorIcons"), "Top Right", ANCHOR_ALIGN_TOP_RIGHT); - p->add_icon_item(get_icon("ControlAlignBottomRight", "EditorIcons"), "Bottom Right", ANCHOR_ALIGN_BOTTOM_RIGHT); - p->add_icon_item(get_icon("ControlAlignBottomLeft", "EditorIcons"), "Bottom Left", ANCHOR_ALIGN_BOTTOM_LEFT); - p->add_separator(); - p->add_icon_item(get_icon("ControlAlignLeftCenter", "EditorIcons"), "Center Left", ANCHOR_ALIGN_CENTER_LEFT); - p->add_icon_item(get_icon("ControlAlignTopCenter", "EditorIcons"), "Center Top", ANCHOR_ALIGN_CENTER_TOP); - p->add_icon_item(get_icon("ControlAlignRightCenter", "EditorIcons"), "Center Right", ANCHOR_ALIGN_CENTER_RIGHT); - p->add_icon_item(get_icon("ControlAlignBottomCenter", "EditorIcons"), "Center Bottom", ANCHOR_ALIGN_CENTER_BOTTOM); - p->add_icon_item(get_icon("ControlAlignCenter", "EditorIcons"), "Center", ANCHOR_ALIGN_CENTER); - p->add_separator(); - p->add_icon_item(get_icon("ControlAlignLeftWide", "EditorIcons"), "Left Wide", ANCHOR_ALIGN_LEFT_WIDE); - p->add_icon_item(get_icon("ControlAlignTopWide", "EditorIcons"), "Top Wide", ANCHOR_ALIGN_TOP_WIDE); - p->add_icon_item(get_icon("ControlAlignRightWide", "EditorIcons"), "Right Wide", ANCHOR_ALIGN_RIGHT_WIDE); - p->add_icon_item(get_icon("ControlAlignBottomWide", "EditorIcons"), "Bottom Wide", ANCHOR_ALIGN_BOTTOM_WIDE); - p->add_icon_item(get_icon("ControlVcenterWide", "EditorIcons"), "VCenter Wide ", ANCHOR_ALIGN_VCENTER_WIDE); - p->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), "HCenter Wide ", ANCHOR_ALIGN_HCENTER_WIDE); - p->add_separator(); - p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect", ANCHOR_ALIGN_WIDE); - p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect and Fit Parent", ANCHOR_ALIGN_WIDE_FIT); - AnimationPlayerEditor::singleton->get_key_editor()->connect("visibility_changed", this, "_keying_changed"); _keying_changed(); + } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { select_sb->set_texture(get_icon("EditorRect2D", "EditorIcons")); + } + if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { select_button->set_icon(get_icon("ToolSelect", "EditorIcons")); list_select_button->set_icon(get_icon("ListSelect", "EditorIcons")); move_button->set_icon(get_icon("ToolMove", "EditorIcons")); @@ -2850,30 +2808,56 @@ void CanvasItemEditor::_notification(int p_what) { ungroup_button->set_icon(get_icon("Ungroup", "EditorIcons")); key_insert_button->set_icon(get_icon("Key", "EditorIcons")); - anchor_menu->set_icon(get_icon("Anchor", "EditorIcons")); - PopupMenu *p = anchor_menu->get_popup(); - p->clear(); + zoom_minus->set_icon(get_icon("ZoomLess", "EditorIcons")); + zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons")); + zoom_plus->set_icon(get_icon("ZoomMore", "EditorIcons")); - p->add_icon_item(get_icon("ControlAlignTopLeft", "EditorIcons"), "Top Left", ANCHOR_ALIGN_TOP_LEFT); - p->add_icon_item(get_icon("ControlAlignTopRight", "EditorIcons"), "Top Right", ANCHOR_ALIGN_TOP_RIGHT); - p->add_icon_item(get_icon("ControlAlignBottomRight", "EditorIcons"), "Bottom Right", ANCHOR_ALIGN_BOTTOM_RIGHT); - p->add_icon_item(get_icon("ControlAlignBottomLeft", "EditorIcons"), "Bottom Left", ANCHOR_ALIGN_BOTTOM_LEFT); + PopupMenu *p = presets_menu->get_popup(); + + p->clear(); + p->add_icon_item(get_icon("ControlAlignTopLeft", "EditorIcons"), "Top Left", ANCHORS_AND_MARGINS_PRESET_TOP_LEFT); + p->add_icon_item(get_icon("ControlAlignTopRight", "EditorIcons"), "Top Right", ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT); + p->add_icon_item(get_icon("ControlAlignBottomRight", "EditorIcons"), "Bottom Right", ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT); + p->add_icon_item(get_icon("ControlAlignBottomLeft", "EditorIcons"), "Bottom Left", ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT); p->add_separator(); - p->add_icon_item(get_icon("ControlAlignLeftCenter", "EditorIcons"), "Center Left", ANCHOR_ALIGN_CENTER_LEFT); - p->add_icon_item(get_icon("ControlAlignTopCenter", "EditorIcons"), "Center Top", ANCHOR_ALIGN_CENTER_TOP); - p->add_icon_item(get_icon("ControlAlignRightCenter", "EditorIcons"), "Center Right", ANCHOR_ALIGN_CENTER_RIGHT); - p->add_icon_item(get_icon("ControlAlignBottomCenter", "EditorIcons"), "Center Bottom", ANCHOR_ALIGN_CENTER_BOTTOM); - p->add_icon_item(get_icon("ControlAlignCenter", "EditorIcons"), "Center", ANCHOR_ALIGN_CENTER); + p->add_icon_item(get_icon("ControlAlignLeftCenter", "EditorIcons"), "Center Left", ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT); + p->add_icon_item(get_icon("ControlAlignTopCenter", "EditorIcons"), "Center Top", ANCHORS_AND_MARGINS_PRESET_CENTER_TOP); + p->add_icon_item(get_icon("ControlAlignRightCenter", "EditorIcons"), "Center Right", ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT); + p->add_icon_item(get_icon("ControlAlignBottomCenter", "EditorIcons"), "Center Bottom", ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM); + p->add_icon_item(get_icon("ControlAlignCenter", "EditorIcons"), "Center", ANCHORS_AND_MARGINS_PRESET_CENTER); p->add_separator(); - p->add_icon_item(get_icon("ControlAlignLeftWide", "EditorIcons"), "Left Wide", ANCHOR_ALIGN_LEFT_WIDE); - p->add_icon_item(get_icon("ControlAlignTopWide", "EditorIcons"), "Top Wide", ANCHOR_ALIGN_TOP_WIDE); - p->add_icon_item(get_icon("ControlAlignRightWide", "EditorIcons"), "Right Wide", ANCHOR_ALIGN_RIGHT_WIDE); - p->add_icon_item(get_icon("ControlAlignBottomWide", "EditorIcons"), "Bottom Wide", ANCHOR_ALIGN_BOTTOM_WIDE); - p->add_icon_item(get_icon("ControlVcenterWide", "EditorIcons"), "VCenter Wide ", ANCHOR_ALIGN_VCENTER_WIDE); - p->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), "HCenter Wide ", ANCHOR_ALIGN_HCENTER_WIDE); + p->add_icon_item(get_icon("ControlAlignLeftWide", "EditorIcons"), "Left Wide", ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE); + p->add_icon_item(get_icon("ControlAlignTopWide", "EditorIcons"), "Top Wide", ANCHORS_AND_MARGINS_PRESET_TOP_WIDE); + p->add_icon_item(get_icon("ControlAlignRightWide", "EditorIcons"), "Right Wide", ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE); + p->add_icon_item(get_icon("ControlAlignBottomWide", "EditorIcons"), "Bottom Wide", ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE); + p->add_icon_item(get_icon("ControlVcenterWide", "EditorIcons"), "VCenter Wide ", ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE); + p->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), "HCenter Wide ", ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE); p->add_separator(); - p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect", ANCHOR_ALIGN_WIDE); - p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect and Fit Parent", ANCHOR_ALIGN_WIDE_FIT); + p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect", ANCHORS_AND_MARGINS_PRESET_WIDE); + p->add_separator(); + p->add_submenu_item(TTR("Anchors only"), "Anchors"); + p->set_item_icon(20, get_icon("Anchor", "EditorIcons")); + + anchors_popup->clear(); + anchors_popup->add_icon_item(get_icon("ControlAlignTopLeft", "EditorIcons"), "Top Left", ANCHORS_PRESET_TOP_LEFT); + anchors_popup->add_icon_item(get_icon("ControlAlignTopRight", "EditorIcons"), "Top Right", ANCHORS_PRESET_TOP_RIGHT); + anchors_popup->add_icon_item(get_icon("ControlAlignBottomRight", "EditorIcons"), "Bottom Right", ANCHORS_PRESET_BOTTOM_RIGHT); + anchors_popup->add_icon_item(get_icon("ControlAlignBottomLeft", "EditorIcons"), "Bottom Left", ANCHORS_PRESET_BOTTOM_LEFT); + anchors_popup->add_separator(); + anchors_popup->add_icon_item(get_icon("ControlAlignLeftCenter", "EditorIcons"), "Center Left", ANCHORS_PRESET_CENTER_LEFT); + anchors_popup->add_icon_item(get_icon("ControlAlignTopCenter", "EditorIcons"), "Center Top", ANCHORS_PRESET_CENTER_TOP); + anchors_popup->add_icon_item(get_icon("ControlAlignRightCenter", "EditorIcons"), "Center Right", ANCHORS_PRESET_CENTER_RIGHT); + anchors_popup->add_icon_item(get_icon("ControlAlignBottomCenter", "EditorIcons"), "Center Bottom", ANCHORS_PRESET_CENTER_BOTTOM); + anchors_popup->add_icon_item(get_icon("ControlAlignCenter", "EditorIcons"), "Center", ANCHORS_PRESET_CENTER); + anchors_popup->add_separator(); + anchors_popup->add_icon_item(get_icon("ControlAlignLeftWide", "EditorIcons"), "Left Wide", ANCHORS_PRESET_LEFT_WIDE); + anchors_popup->add_icon_item(get_icon("ControlAlignTopWide", "EditorIcons"), "Top Wide", ANCHORS_PRESET_TOP_WIDE); + anchors_popup->add_icon_item(get_icon("ControlAlignRightWide", "EditorIcons"), "Right Wide", ANCHORS_PRESET_RIGHT_WIDE); + anchors_popup->add_icon_item(get_icon("ControlAlignBottomWide", "EditorIcons"), "Bottom Wide", ANCHORS_PRESET_BOTTOM_WIDE); + anchors_popup->add_icon_item(get_icon("ControlVcenterWide", "EditorIcons"), "VCenter Wide ", ANCHORS_PRESET_VCENTER_WIDE); + anchors_popup->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), "HCenter Wide ", ANCHORS_PRESET_HCENTER_WIDE); + anchors_popup->add_separator(); + anchors_popup->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), "Full Rect", ANCHORS_PRESET_WIDE); } } @@ -3005,25 +2989,51 @@ void CanvasItemEditor::_update_scroll(float) { viewport_base->update(); } -void CanvasItemEditor::_set_anchors_preset(Control::LayoutPreset p_preset) { +void CanvasItemEditor::_set_anchors_and_margins_preset(Control::LayoutPreset p_preset) { List<Node *> &selection = editor_selection->get_selected_node_list(); - undo_redo->create_action(TTR("Change Anchors")); + undo_redo->create_action(TTR("Change Anchors and Margins")); for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { Control *c = Object::cast_to<Control>(E->get()); undo_redo->add_do_method(c, "set_anchors_preset", p_preset); + switch (p_preset) { + case PRESET_TOP_LEFT: + case PRESET_TOP_RIGHT: + case PRESET_BOTTOM_LEFT: + case PRESET_BOTTOM_RIGHT: + case PRESET_CENTER_LEFT: + case PRESET_CENTER_TOP: + case PRESET_CENTER_RIGHT: + case PRESET_CENTER_BOTTOM: + case PRESET_CENTER: + undo_redo->add_do_method(c, "set_margins_preset", p_preset, Control::PRESET_MODE_KEEP_SIZE); + break; + case PRESET_LEFT_WIDE: + case PRESET_TOP_WIDE: + case PRESET_RIGHT_WIDE: + case PRESET_BOTTOM_WIDE: + case PRESET_VCENTER_WIDE: + case PRESET_HCENTER_WIDE: + case PRESET_WIDE: + undo_redo->add_do_method(c, "set_margins_preset", p_preset, Control::PRESET_MODE_MINSIZE); + break; + } undo_redo->add_undo_method(c, "set_anchor", MARGIN_LEFT, c->get_anchor(MARGIN_LEFT)); undo_redo->add_undo_method(c, "set_anchor", MARGIN_TOP, c->get_anchor(MARGIN_TOP)); undo_redo->add_undo_method(c, "set_anchor", MARGIN_RIGHT, c->get_anchor(MARGIN_RIGHT)); undo_redo->add_undo_method(c, "set_anchor", MARGIN_BOTTOM, c->get_anchor(MARGIN_BOTTOM)); + undo_redo->add_undo_method(c, "set_margin", MARGIN_LEFT, c->get_margin(MARGIN_LEFT)); + undo_redo->add_undo_method(c, "set_margin", MARGIN_TOP, c->get_margin(MARGIN_TOP)); + undo_redo->add_undo_method(c, "set_margin", MARGIN_RIGHT, c->get_margin(MARGIN_RIGHT)); + undo_redo->add_undo_method(c, "set_margin", MARGIN_BOTTOM, c->get_margin(MARGIN_BOTTOM)); } undo_redo->commit_action(); } -void CanvasItemEditor::_set_full_rect() { +void CanvasItemEditor::_set_anchors_preset(Control::LayoutPreset p_preset) { List<Node *> &selection = editor_selection->get_selected_node_list(); undo_redo->create_action(TTR("Change Anchors")); @@ -3031,19 +3041,11 @@ void CanvasItemEditor::_set_full_rect() { Control *c = Object::cast_to<Control>(E->get()); - undo_redo->add_do_method(c, "set_anchors_preset", Control::PRESET_WIDE); - undo_redo->add_do_method(c, "set_margin", MARGIN_LEFT, 0); - undo_redo->add_do_method(c, "set_margin", MARGIN_TOP, 0); - undo_redo->add_do_method(c, "set_margin", MARGIN_RIGHT, 0); - undo_redo->add_do_method(c, "set_margin", MARGIN_BOTTOM, 0); + undo_redo->add_do_method(c, "set_anchors_preset", p_preset); undo_redo->add_undo_method(c, "set_anchor", MARGIN_LEFT, c->get_anchor(MARGIN_LEFT)); undo_redo->add_undo_method(c, "set_anchor", MARGIN_TOP, c->get_anchor(MARGIN_TOP)); undo_redo->add_undo_method(c, "set_anchor", MARGIN_RIGHT, c->get_anchor(MARGIN_RIGHT)); undo_redo->add_undo_method(c, "set_anchor", MARGIN_BOTTOM, c->get_anchor(MARGIN_BOTTOM)); - undo_redo->add_undo_method(c, "set_margin", MARGIN_LEFT, c->get_margin(MARGIN_LEFT)); - undo_redo->add_undo_method(c, "set_margin", MARGIN_TOP, c->get_margin(MARGIN_TOP)); - undo_redo->add_undo_method(c, "set_margin", MARGIN_RIGHT, c->get_margin(MARGIN_RIGHT)); - undo_redo->add_undo_method(c, "set_margin", MARGIN_BOTTOM, c->get_margin(MARGIN_BOTTOM)); } undo_redo->commit_action(); @@ -3237,57 +3239,104 @@ void CanvasItemEditor::_popup_callback(int p_op) { viewport->update(); } break; - case ANCHOR_ALIGN_TOP_LEFT: { + + case ANCHORS_AND_MARGINS_PRESET_TOP_LEFT: { + _set_anchors_and_margins_preset(PRESET_TOP_LEFT); + } break; + case ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT: { + _set_anchors_and_margins_preset(PRESET_TOP_RIGHT); + } break; + case ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT: { + _set_anchors_and_margins_preset(PRESET_BOTTOM_LEFT); + } break; + case ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT: { + _set_anchors_and_margins_preset(PRESET_BOTTOM_RIGHT); + } break; + case ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT: { + _set_anchors_and_margins_preset(PRESET_CENTER_LEFT); + } break; + case ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT: { + _set_anchors_and_margins_preset(PRESET_CENTER_RIGHT); + } break; + case ANCHORS_AND_MARGINS_PRESET_CENTER_TOP: { + _set_anchors_and_margins_preset(PRESET_CENTER_TOP); + } break; + case ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM: { + _set_anchors_and_margins_preset(PRESET_CENTER_BOTTOM); + } break; + case ANCHORS_AND_MARGINS_PRESET_CENTER: { + _set_anchors_and_margins_preset(PRESET_CENTER); + } break; + case ANCHORS_AND_MARGINS_PRESET_TOP_WIDE: { + _set_anchors_and_margins_preset(PRESET_TOP_WIDE); + } break; + case ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE: { + _set_anchors_and_margins_preset(PRESET_LEFT_WIDE); + } break; + case ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE: { + _set_anchors_and_margins_preset(PRESET_RIGHT_WIDE); + } break; + case ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE: { + _set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE); + } break; + case ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE: { + _set_anchors_and_margins_preset(PRESET_VCENTER_WIDE); + } break; + case ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE: { + _set_anchors_and_margins_preset(PRESET_HCENTER_WIDE); + } break; + case ANCHORS_AND_MARGINS_PRESET_WIDE: { + _set_anchors_and_margins_preset(Control::PRESET_WIDE); + } break; + + case ANCHORS_PRESET_TOP_LEFT: { _set_anchors_preset(PRESET_TOP_LEFT); } break; - case ANCHOR_ALIGN_TOP_RIGHT: { + case ANCHORS_PRESET_TOP_RIGHT: { _set_anchors_preset(PRESET_TOP_RIGHT); } break; - case ANCHOR_ALIGN_BOTTOM_LEFT: { + case ANCHORS_PRESET_BOTTOM_LEFT: { _set_anchors_preset(PRESET_BOTTOM_LEFT); } break; - case ANCHOR_ALIGN_BOTTOM_RIGHT: { + case ANCHORS_PRESET_BOTTOM_RIGHT: { _set_anchors_preset(PRESET_BOTTOM_RIGHT); } break; - case ANCHOR_ALIGN_CENTER_LEFT: { + case ANCHORS_PRESET_CENTER_LEFT: { _set_anchors_preset(PRESET_CENTER_LEFT); } break; - case ANCHOR_ALIGN_CENTER_RIGHT: { + case ANCHORS_PRESET_CENTER_RIGHT: { _set_anchors_preset(PRESET_CENTER_RIGHT); } break; - case ANCHOR_ALIGN_CENTER_TOP: { + case ANCHORS_PRESET_CENTER_TOP: { _set_anchors_preset(PRESET_CENTER_TOP); } break; - case ANCHOR_ALIGN_CENTER_BOTTOM: { + case ANCHORS_PRESET_CENTER_BOTTOM: { _set_anchors_preset(PRESET_CENTER_BOTTOM); } break; - case ANCHOR_ALIGN_CENTER: { + case ANCHORS_PRESET_CENTER: { _set_anchors_preset(PRESET_CENTER); } break; - case ANCHOR_ALIGN_TOP_WIDE: { + case ANCHORS_PRESET_TOP_WIDE: { _set_anchors_preset(PRESET_TOP_WIDE); } break; - case ANCHOR_ALIGN_LEFT_WIDE: { + case ANCHORS_PRESET_LEFT_WIDE: { _set_anchors_preset(PRESET_LEFT_WIDE); } break; - case ANCHOR_ALIGN_RIGHT_WIDE: { + case ANCHORS_PRESET_RIGHT_WIDE: { _set_anchors_preset(PRESET_RIGHT_WIDE); } break; - case ANCHOR_ALIGN_BOTTOM_WIDE: { + case ANCHORS_PRESET_BOTTOM_WIDE: { _set_anchors_preset(PRESET_BOTTOM_WIDE); } break; - case ANCHOR_ALIGN_VCENTER_WIDE: { + case ANCHORS_PRESET_VCENTER_WIDE: { _set_anchors_preset(PRESET_VCENTER_WIDE); } break; - case ANCHOR_ALIGN_HCENTER_WIDE: { + case ANCHORS_PRESET_HCENTER_WIDE: { _set_anchors_preset(PRESET_HCENTER_WIDE); } break; - case ANCHOR_ALIGN_WIDE: { + case ANCHORS_PRESET_WIDE: { _set_anchors_preset(Control::PRESET_WIDE); } break; - case ANCHOR_ALIGN_WIDE_FIT: { - _set_full_rect(); - } break; case ANIM_INSERT_KEY: case ANIM_INSERT_KEY_EXISTING: { @@ -3865,7 +3914,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p->add_separator(); p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_set_ik_chain", TTR("Make IK Chain")), SKELETON_SET_IK_CHAIN); p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_ik_chain", TTR("Clear IK Chain")), SKELETON_CLEAR_IK_CHAIN); - p->set_hide_on_checkable_item_selection(false); p->connect("id_pressed", this, "_popup_callback"); hb->add_child(memnew(VSeparator)); @@ -3883,13 +3931,18 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p->add_shortcut(ED_SHORTCUT("canvas_item_editor/center_selection", TTR("Center Selection"), KEY_F), VIEW_CENTER_TO_SELECTION); p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KEY_MASK_SHIFT | KEY_F), VIEW_FRAME_TO_SELECTION); - anchor_menu = memnew(MenuButton); - anchor_menu->set_text(TTR("Anchor")); - hb->add_child(anchor_menu); - anchor_menu->get_popup()->connect("id_pressed", this, "_popup_callback"); - anchor_menu->hide(); + presets_menu = memnew(MenuButton); + presets_menu->set_text(TTR("Layout")); + hb->add_child(presets_menu); + presets_menu->hide(); + + p = presets_menu->get_popup(); + p->connect("id_pressed", this, "_popup_callback"); - //p = anchor_menu->get_popup(); + anchors_popup = memnew(PopupMenu); + p->add_child(anchors_popup); + anchors_popup->set_name("Anchors"); + anchors_popup->connect("id_pressed", this, "_popup_callback"); animation_hb = memnew(HBoxContainer); hb->add_child(animation_hb); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index f87bfef8ad..69dc25d180 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -98,23 +98,54 @@ class CanvasItemEditor : public VBoxContainer { UNLOCK_SELECTED, GROUP_SELECTED, UNGROUP_SELECTED, - ANCHOR_ALIGN_TOP_LEFT, - ANCHOR_ALIGN_TOP_RIGHT, - ANCHOR_ALIGN_BOTTOM_LEFT, - ANCHOR_ALIGN_BOTTOM_RIGHT, - ANCHOR_ALIGN_CENTER_LEFT, - ANCHOR_ALIGN_CENTER_RIGHT, - ANCHOR_ALIGN_CENTER_TOP, - ANCHOR_ALIGN_CENTER_BOTTOM, - ANCHOR_ALIGN_CENTER, - ANCHOR_ALIGN_TOP_WIDE, - ANCHOR_ALIGN_LEFT_WIDE, - ANCHOR_ALIGN_RIGHT_WIDE, - ANCHOR_ALIGN_BOTTOM_WIDE, - ANCHOR_ALIGN_VCENTER_WIDE, - ANCHOR_ALIGN_HCENTER_WIDE, - ANCHOR_ALIGN_WIDE, - ANCHOR_ALIGN_WIDE_FIT, + ANCHORS_AND_MARGINS_PRESET_TOP_LEFT, + ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT, + ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT, + ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT, + ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT, + ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT, + ANCHORS_AND_MARGINS_PRESET_CENTER_TOP, + ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM, + ANCHORS_AND_MARGINS_PRESET_CENTER, + ANCHORS_AND_MARGINS_PRESET_TOP_WIDE, + ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE, + ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE, + ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE, + ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE, + ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE, + ANCHORS_AND_MARGINS_PRESET_WIDE, + ANCHORS_PRESET_TOP_LEFT, + ANCHORS_PRESET_TOP_RIGHT, + ANCHORS_PRESET_BOTTOM_LEFT, + ANCHORS_PRESET_BOTTOM_RIGHT, + ANCHORS_PRESET_CENTER_LEFT, + ANCHORS_PRESET_CENTER_RIGHT, + ANCHORS_PRESET_CENTER_TOP, + ANCHORS_PRESET_CENTER_BOTTOM, + ANCHORS_PRESET_CENTER, + ANCHORS_PRESET_TOP_WIDE, + ANCHORS_PRESET_LEFT_WIDE, + ANCHORS_PRESET_RIGHT_WIDE, + ANCHORS_PRESET_BOTTOM_WIDE, + ANCHORS_PRESET_VCENTER_WIDE, + ANCHORS_PRESET_HCENTER_WIDE, + ANCHORS_PRESET_WIDE, + MARGINS_PRESET_TOP_LEFT, + MARGINS_PRESET_TOP_RIGHT, + MARGINS_PRESET_BOTTOM_LEFT, + MARGINS_PRESET_BOTTOM_RIGHT, + MARGINS_PRESET_CENTER_LEFT, + MARGINS_PRESET_CENTER_RIGHT, + MARGINS_PRESET_CENTER_TOP, + MARGINS_PRESET_CENTER_BOTTOM, + MARGINS_PRESET_CENTER, + MARGINS_PRESET_TOP_WIDE, + MARGINS_PRESET_LEFT_WIDE, + MARGINS_PRESET_RIGHT_WIDE, + MARGINS_PRESET_BOTTOM_WIDE, + MARGINS_PRESET_VCENTER_WIDE, + MARGINS_PRESET_HCENTER_WIDE, + MARGINS_PRESET_WIDE, ANIM_INSERT_KEY, ANIM_INSERT_KEY_EXISTING, ANIM_INSERT_POS, @@ -279,7 +310,10 @@ class CanvasItemEditor : public VBoxContainer { MenuButton *view_menu; HBoxContainer *animation_hb; MenuButton *animation_menu; - MenuButton *anchor_menu; + + MenuButton *presets_menu; + PopupMenu *anchors_and_margins_popup; + PopupMenu *anchors_popup; Button *key_loc_button; Button *key_rot_button; @@ -386,7 +420,8 @@ class CanvasItemEditor : public VBoxContainer { void _snap_other_nodes(Point2 p_value, Point2 &r_current_snap, bool (&r_snapped)[2], const Node *p_current, const CanvasItem *p_to_snap); void _set_anchors_preset(Control::LayoutPreset p_preset); - void _set_full_rect(); + void _set_margins_preset(Control::LayoutPreset p_preset); + void _set_anchors_and_margins_preset(Control::LayoutPreset p_preset); void _zoom_on_position(float p_zoom, Point2 p_position = Point2()); void _zoom_minus(); diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 4501136e19..00e6d617a1 100644..100755 --- a/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -29,400 +29,20 @@ /*************************************************************************/ #include "collision_polygon_2d_editor_plugin.h" -#include "canvas_item_editor_plugin.h" -#include "editor/editor_settings.h" -#include "os/file_access.h" +Node2D *CollisionPolygon2DEditor::_get_node() const { -void CollisionPolygon2DEditor::_notification(int p_what) { - - switch (p_what) { - - case NOTIFICATION_READY: { - - button_create->set_icon(get_icon("Edit", "EditorIcons")); - button_edit->set_icon(get_icon("MovePoint", "EditorIcons")); - button_edit->set_pressed(true); - get_tree()->connect("node_removed", this, "_node_removed"); - - } break; - case NOTIFICATION_PHYSICS_PROCESS: { - - } break; - } -} -void CollisionPolygon2DEditor::_node_removed(Node *p_node) { - - if (p_node == node) { - node = NULL; - hide(); - canvas_item_editor->get_viewport_control()->update(); - } -} - -void CollisionPolygon2DEditor::_menu_option(int p_option) { - - switch (p_option) { - - case MODE_CREATE: { - - mode = MODE_CREATE; - button_create->set_pressed(true); - button_edit->set_pressed(false); - } break; - case MODE_EDIT: { - - mode = MODE_EDIT; - button_create->set_pressed(false); - button_edit->set_pressed(true); - } break; - } -} - -void CollisionPolygon2DEditor::_wip_close() { - - undo_redo->create_action(TTR("Create Poly")); - undo_redo->add_undo_method(node, "set_polygon", node->get_polygon()); - undo_redo->add_do_method(node, "set_polygon", wip); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - wip.clear(); - wip_active = false; - mode = MODE_EDIT; - button_edit->set_pressed(true); - button_create->set_pressed(false); - edited_point = -1; -} - -bool CollisionPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) { - - if (!node) - return false; - - Ref<InputEventMouseButton> mb = p_event; - - if (mb.is_valid()) { - Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); - - Vector2 gpoint = mb->get_position(); - Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint); - cpoint = canvas_item_editor->snap_point(cpoint); - cpoint = node->get_global_transform().affine_inverse().xform(cpoint); - - Vector<Vector2> poly = node->get_polygon(); - - //first check if a point is to be added (segment split) - real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8); - - switch (mode) { - - case MODE_CREATE: { - - if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { - - if (!wip_active) { - - wip.clear(); - wip.push_back(cpoint); - wip_active = true; - edited_point_pos = cpoint; - canvas_item_editor->get_viewport_control()->update(); - edited_point = 1; - return true; - } else { - - if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_threshold) { - //wip closed - _wip_close(); - - return true; - } else { - - wip.push_back(cpoint); - edited_point = wip.size(); - canvas_item_editor->get_viewport_control()->update(); - return true; - - //add wip point - } - } - } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) { - _wip_close(); - } - - } break; - - case MODE_EDIT: { - - if (mb->get_button_index() == BUTTON_LEFT) { - if (mb->is_pressed()) { - - if (mb->get_control()) { - - if (poly.size() < 3) { - - undo_redo->create_action(TTR("Edit Poly")); - undo_redo->add_undo_method(node, "set_polygon", poly); - poly.push_back(cpoint); - undo_redo->add_do_method(node, "set_polygon", poly); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - return true; - } - - //search edges - int closest_idx = -1; - Vector2 closest_pos; - real_t closest_dist = 1e10; - for (int i = 0; i < poly.size(); i++) { - - Vector2 points[2] = { xform.xform(poly[i]), - xform.xform(poly[(i + 1) % poly.size()]) }; - - Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points); - if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2) - continue; //not valid to reuse point - - real_t d = cp.distance_to(gpoint); - if (d < closest_dist && d < grab_threshold) { - closest_dist = d; - closest_pos = cp; - closest_idx = i; - } - } - - if (closest_idx >= 0) { - - pre_move_edit = poly; - poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos)); - edited_point = closest_idx + 1; - edited_point_pos = xform.affine_inverse().xform(closest_pos); - node->set_polygon(poly); - canvas_item_editor->get_viewport_control()->update(); - return true; - } - } else { - - //look for points to move - - int closest_idx = -1; - Vector2 closest_pos; - real_t closest_dist = 1e10; - for (int i = 0; i < poly.size(); i++) { - - Vector2 cp = xform.xform(poly[i]); - - real_t d = cp.distance_to(gpoint); - if (d < closest_dist && d < grab_threshold) { - closest_dist = d; - closest_pos = cp; - closest_idx = i; - } - } - - if (closest_idx >= 0) { - - pre_move_edit = poly; - edited_point = closest_idx; - edited_point_pos = xform.affine_inverse().xform(closest_pos); - canvas_item_editor->get_viewport_control()->update(); - return true; - } - } - } else { - - if (edited_point != -1) { - - //apply - - ERR_FAIL_INDEX_V(edited_point, poly.size(), false); - poly[edited_point] = edited_point_pos; - undo_redo->create_action(TTR("Edit Poly")); - undo_redo->add_do_method(node, "set_polygon", poly); - undo_redo->add_undo_method(node, "set_polygon", pre_move_edit); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - - edited_point = -1; - return true; - } - } - } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) { - - int closest_idx = -1; - Vector2 closest_pos; - real_t closest_dist = 1e10; - for (int i = 0; i < poly.size(); i++) { - - Vector2 cp = xform.xform(poly[i]); - - real_t d = cp.distance_to(gpoint); - if (d < closest_dist && d < grab_threshold) { - closest_dist = d; - closest_pos = cp; - closest_idx = i; - } - } - - if (closest_idx >= 0) { - - undo_redo->create_action(TTR("Edit Poly (Remove Point)")); - undo_redo->add_undo_method(node, "set_polygon", poly); - poly.remove(closest_idx); - undo_redo->add_do_method(node, "set_polygon", poly); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - return true; - } - } - - } break; - } - } - - Ref<InputEventMouseMotion> mm = p_event; - - if (mm.is_valid()) { - - if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) { - - Vector2 gpoint = mm->get_position(); - Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint); - cpoint = canvas_item_editor->snap_point(cpoint); - edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint); - - canvas_item_editor->get_viewport_control()->update(); - } - } - - return false; + return node; } -void CollisionPolygon2DEditor::_canvas_draw() { - - if (!node) - return; - - Control *vpc = canvas_item_editor->get_viewport_control(); - - Vector<Vector2> poly; - - if (wip_active) - poly = wip; - else - poly = node->get_polygon(); - Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); - Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons"); +void CollisionPolygon2DEditor::_set_node(Node *p_polygon) { - for (int i = 0; i < poly.size(); i++) { - - Vector2 p, p2; - p = i == edited_point ? edited_point_pos : poly[i]; - if ((wip_active && i == poly.size() - 1) || (((i + 1) % poly.size()) == edited_point)) - p2 = edited_point_pos; - else - p2 = poly[(i + 1) % poly.size()]; - - Vector2 point = xform.xform(p); - Vector2 next_point = xform.xform(p2); - - Color col = Color(1, 0.3, 0.1, 0.8); - vpc->draw_line(point, next_point, col, 2); - vpc->draw_texture(handle, point - handle->get_size() * 0.5); - } + node = Object::cast_to<CollisionPolygon2D>(p_polygon); } -void CollisionPolygon2DEditor::edit(Node *p_collision_polygon) { - - if (!canvas_item_editor) { - canvas_item_editor = CanvasItemEditor::get_singleton(); - } - - if (p_collision_polygon) { - - node = Object::cast_to<CollisionPolygon2D>(p_collision_polygon); - //Enable the pencil tool if the polygon is empty - if (node->get_polygon().size() == 0) { - _menu_option(MODE_CREATE); - } - if (!canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw")) - canvas_item_editor->get_viewport_control()->connect("draw", this, "_canvas_draw"); - wip.clear(); - wip_active = false; - edited_point = -1; - canvas_item_editor->get_viewport_control()->update(); - - } else { - node = NULL; - - if (canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw")) - canvas_item_editor->get_viewport_control()->disconnect("draw", this, "_canvas_draw"); - } -} - -void CollisionPolygon2DEditor::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_menu_option"), &CollisionPolygon2DEditor::_menu_option); - ClassDB::bind_method(D_METHOD("_canvas_draw"), &CollisionPolygon2DEditor::_canvas_draw); - ClassDB::bind_method(D_METHOD("_node_removed"), &CollisionPolygon2DEditor::_node_removed); -} - -CollisionPolygon2DEditor::CollisionPolygon2DEditor(EditorNode *p_editor) { - - node = NULL; - canvas_item_editor = NULL; - editor = p_editor; - undo_redo = editor->get_undo_redo(); - - add_child(memnew(VSeparator)); - button_create = memnew(ToolButton); - add_child(button_create); - button_create->connect("pressed", this, "_menu_option", varray(MODE_CREATE)); - button_create->set_toggle_mode(true); - button_create->set_tooltip(TTR("Create a new polygon from scratch.")); - - button_edit = memnew(ToolButton); - add_child(button_edit); - button_edit->connect("pressed", this, "_menu_option", varray(MODE_EDIT)); - button_edit->set_toggle_mode(true); - button_edit->set_tooltip(TTR("Edit existing polygon:\nLMB: Move Point.\nCtrl+LMB: Split Segment.\nRMB: Erase Point.")); - - mode = MODE_EDIT; - wip_active = false; -} - -void CollisionPolygon2DEditorPlugin::edit(Object *p_object) { - - collision_polygon_editor->edit(Object::cast_to<Node>(p_object)); -} - -bool CollisionPolygon2DEditorPlugin::handles(Object *p_object) const { - - return p_object->is_class("CollisionPolygon2D"); -} - -void CollisionPolygon2DEditorPlugin::make_visible(bool p_visible) { - - if (p_visible) { - collision_polygon_editor->show(); - } else { - - collision_polygon_editor->hide(); - collision_polygon_editor->edit(NULL); - } -} - -CollisionPolygon2DEditorPlugin::CollisionPolygon2DEditorPlugin(EditorNode *p_node) { - - editor = p_node; - collision_polygon_editor = memnew(CollisionPolygon2DEditor(p_node)); - CanvasItemEditor::get_singleton()->add_control_to_menu_panel(collision_polygon_editor); - - collision_polygon_editor->hide(); +CollisionPolygon2DEditor::CollisionPolygon2DEditor(EditorNode *p_editor) + : AbstractPolygon2DEditor(p_editor) { } -CollisionPolygon2DEditorPlugin::~CollisionPolygon2DEditorPlugin() { +CollisionPolygon2DEditorPlugin::CollisionPolygon2DEditorPlugin(EditorNode *p_node) + : AbstractPolygon2DEditorPlugin(p_node, memnew(CollisionPolygon2DEditor(p_node)), "CollisionPolygon2D") { } diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.h b/editor/plugins/collision_polygon_2d_editor_plugin.h index 4715abd2e6..edf3bbcc08 100644..100755 --- a/editor/plugins/collision_polygon_2d_editor_plugin.h +++ b/editor/plugins/collision_polygon_2d_editor_plugin.h @@ -30,78 +30,32 @@ #ifndef COLLISION_POLYGON_2D_EDITOR_PLUGIN_H #define COLLISION_POLYGON_2D_EDITOR_PLUGIN_H -#include "editor/editor_node.h" -#include "editor/editor_plugin.h" +#include "editor/plugins/abstract_polygon_2d_editor.h" #include "scene/2d/collision_polygon_2d.h" -#include "scene/gui/tool_button.h" /** @author Juan Linietsky <reduzio@gmail.com> */ -class CanvasItemEditor; +class CollisionPolygon2DEditor : public AbstractPolygon2DEditor { -class CollisionPolygon2DEditor : public HBoxContainer { + GDCLASS(CollisionPolygon2DEditor, AbstractPolygon2DEditor); - GDCLASS(CollisionPolygon2DEditor, HBoxContainer); - - UndoRedo *undo_redo; - enum Mode { - - MODE_CREATE, - MODE_EDIT, - - }; - - Mode mode; - - ToolButton *button_create; - ToolButton *button_edit; - - CanvasItemEditor *canvas_item_editor; - EditorNode *editor; - Panel *panel; CollisionPolygon2D *node; - MenuButton *options; - - int edited_point; - Vector2 edited_point_pos; - Vector<Vector2> pre_move_edit; - Vector<Vector2> wip; - bool wip_active; - - void _wip_close(); - void _canvas_draw(); - void _menu_option(int p_option); protected: - void _notification(int p_what); - void _node_removed(Node *p_node); - static void _bind_methods(); + virtual Node2D *_get_node() const; + virtual void _set_node(Node *p_polygon); public: - bool forward_gui_input(const Ref<InputEvent> &p_event); - void edit(Node *p_collision_polygon); CollisionPolygon2DEditor(EditorNode *p_editor); }; -class CollisionPolygon2DEditorPlugin : public EditorPlugin { - - GDCLASS(CollisionPolygon2DEditorPlugin, EditorPlugin); +class CollisionPolygon2DEditorPlugin : public AbstractPolygon2DEditorPlugin { - CollisionPolygon2DEditor *collision_polygon_editor; - EditorNode *editor; + GDCLASS(CollisionPolygon2DEditorPlugin, AbstractPolygon2DEditorPlugin); public: - virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_gui_input(p_event); } - - virtual String get_name() const { return "CollisionPolygon2D"; } - bool has_main_screen() const { return false; } - virtual void edit(Object *p_object); - virtual bool handles(Object *p_object) const; - virtual void make_visible(bool p_visible); - CollisionPolygon2DEditorPlugin(EditorNode *p_node); - ~CollisionPolygon2DEditorPlugin(); }; #endif // COLLISION_POLYGON_2D_EDITOR_PLUGIN_H diff --git a/editor/plugins/navigation_mesh_generator.cpp b/editor/plugins/navigation_mesh_generator.cpp index 526db3a582..86dc5c3663 100644 --- a/editor/plugins/navigation_mesh_generator.cpp +++ b/editor/plugins/navigation_mesh_generator.cpp @@ -38,9 +38,11 @@ void NavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector<float> & } void NavigationMeshGenerator::_add_mesh(const Ref<Mesh> &p_mesh, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices) { - int current_vertex_count = p_verticies.size() / 3; + int current_vertex_count = 0; for (int i = 0; i < p_mesh->get_surface_count(); i++) { + current_vertex_count = p_verticies.size() / 3; + if (p_mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) continue; diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp index 69e553eefb..6560a8dac7 100644..100755 --- a/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -29,485 +29,101 @@ /*************************************************************************/ #include "navigation_polygon_editor_plugin.h" -#include "canvas_item_editor_plugin.h" -#include "editor/editor_settings.h" -#include "os/file_access.h" +Ref<NavigationPolygon> NavigationPolygonEditor::_ensure_navpoly() const { -void NavigationPolygonEditor::_notification(int p_what) { + Ref<NavigationPolygon> navpoly = node->get_navigation_polygon(); + if (!navpoly.is_valid()) { - switch (p_what) { - - case NOTIFICATION_READY: { - - button_create->set_icon(get_icon("Edit", "EditorIcons")); - button_edit->set_icon(get_icon("MovePoint", "EditorIcons")); - button_edit->set_pressed(true); - get_tree()->connect("node_removed", this, "_node_removed"); - create_nav->connect("confirmed", this, "_create_nav"); - - } break; - case NOTIFICATION_PHYSICS_PROCESS: { - - } break; + navpoly = Ref<NavigationPolygon>(memnew(NavigationPolygon)); + node->set_navigation_polygon(navpoly); } + return navpoly; } -void NavigationPolygonEditor::_node_removed(Node *p_node) { - if (p_node == node) { - node = NULL; - hide(); - canvas_item_editor->get_viewport_control()->update(); - } -} +Node2D *NavigationPolygonEditor::_get_node() const { -void NavigationPolygonEditor::_create_nav() { - - if (!node) - return; - - undo_redo->create_action(TTR("Create Navigation Polygon")); - undo_redo->add_do_method(node, "set_navigation_polygon", Ref<NavigationPolygon>(memnew(NavigationPolygon))); - undo_redo->add_undo_method(node, "set_navigation_polygon", Variant(REF())); - undo_redo->commit_action(); - _menu_option(MODE_CREATE); + return node; } -void NavigationPolygonEditor::_menu_option(int p_option) { +void NavigationPolygonEditor::_set_node(Node *p_polygon) { - switch (p_option) { - - case MODE_CREATE: { - - mode = MODE_CREATE; - button_create->set_pressed(true); - button_edit->set_pressed(false); - } break; - case MODE_EDIT: { - - mode = MODE_EDIT; - button_create->set_pressed(false); - button_edit->set_pressed(true); - } break; - } + node = Object::cast_to<NavigationPolygonInstance>(p_polygon); } -void NavigationPolygonEditor::_wip_close() { +int NavigationPolygonEditor::_get_polygon_count() const { - if (wip.size() >= 3) { - - undo_redo->create_action(TTR("Create Poly")); - undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "remove_outline", node->get_navigation_polygon()->get_outline_count()); - undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "add_outline", wip); - undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines"); - undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines"); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - mode = MODE_EDIT; - button_edit->set_pressed(true); - button_create->set_pressed(false); - } - - wip.clear(); - wip_active = false; - edited_point = -1; + Ref<NavigationPolygon> navpoly = node->get_navigation_polygon(); + if (navpoly.is_valid()) + return navpoly->get_outline_count(); + else + return 0; } -bool NavigationPolygonEditor::forward_gui_input(const Ref<InputEvent> &p_event) { - - if (!node) - return false; - - if (node->get_navigation_polygon().is_null()) { - - Ref<InputEventMouseButton> mb = p_event; - - if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) { - create_nav->set_text("No NavigationPolygon resource on this node.\nCreate and assign one?"); - create_nav->popup_centered_minsize(); - } - return (mb.is_valid() && mb->get_button_index() == 1); - } - - Ref<InputEventMouseButton> mb = p_event; - - if (mb.is_valid()) { - - Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); - - Vector2 gpoint = mb->get_position(); - Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint); - cpoint = canvas_item_editor->snap_point(cpoint); - cpoint = node->get_global_transform().affine_inverse().xform(cpoint); - - //first check if a point is to be added (segment split) - real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8); - - switch (mode) { - - case MODE_CREATE: { - - if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { - - if (!wip_active) { - - wip.clear(); - wip.push_back(cpoint); - wip_active = true; - edited_point_pos = cpoint; - edited_outline = -1; - canvas_item_editor->get_viewport_control()->update(); - edited_point = 1; - return true; - } else { - - if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_threshold) { - //wip closed - _wip_close(); - - return true; - } else { - - wip.push_back(cpoint); - edited_point = wip.size(); - canvas_item_editor->get_viewport_control()->update(); - return true; - - //add wip point - } - } - } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) { - _wip_close(); - } - - } break; - - case MODE_EDIT: { - - if (mb->get_button_index() == BUTTON_LEFT) { - if (mb->is_pressed()) { - - if (mb->get_control()) { - - //search edges - int closest_outline = -1; - int closest_idx = -1; - Vector2 closest_pos; - real_t closest_dist = 1e10; - - for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) { - - PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j); - - int pc = points.size(); - PoolVector<Vector2>::Read poly = points.read(); - - for (int i = 0; i < pc; i++) { - - Vector2 points[2] = { xform.xform(poly[i]), - xform.xform(poly[(i + 1) % pc]) }; - - Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points); - if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2) - continue; //not valid to reuse point - - real_t d = cp.distance_to(gpoint); - if (d < closest_dist && d < grab_threshold) { - closest_dist = d; - closest_outline = j; - closest_pos = cp; - closest_idx = i; - } - } - } - - if (closest_idx >= 0) { - - pre_move_edit = node->get_navigation_polygon()->get_outline(closest_outline); - PoolVector<Point2> poly = pre_move_edit; - poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos)); - edited_point = closest_idx + 1; - edited_outline = closest_outline; - edited_point_pos = xform.affine_inverse().xform(closest_pos); - node->get_navigation_polygon()->set_outline(closest_outline, poly); - canvas_item_editor->get_viewport_control()->update(); - return true; - } - } else { - - //look for points to move - int closest_outline = -1; - int closest_idx = -1; - Vector2 closest_pos; - real_t closest_dist = 1e10; - - for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) { - - PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j); - - int pc = points.size(); - PoolVector<Vector2>::Read poly = points.read(); +Variant NavigationPolygonEditor::_get_polygon(int p_idx) const { - for (int i = 0; i < pc; i++) { - - Vector2 cp = xform.xform(poly[i]); - - real_t d = cp.distance_to(gpoint); - if (d < closest_dist && d < grab_threshold) { - closest_dist = d; - closest_pos = cp; - closest_outline = j; - closest_idx = i; - } - } - } - - if (closest_idx >= 0) { - - pre_move_edit = node->get_navigation_polygon()->get_outline(closest_outline); - edited_point = closest_idx; - edited_outline = closest_outline; - edited_point_pos = xform.affine_inverse().xform(closest_pos); - canvas_item_editor->get_viewport_control()->update(); - return true; - } - } - } else { - - if (edited_point != -1) { - - //apply - - PoolVector<Vector2> poly = node->get_navigation_polygon()->get_outline(edited_outline); - ERR_FAIL_INDEX_V(edited_point, poly.size(), false); - poly.set(edited_point, edited_point_pos); - undo_redo->create_action(TTR("Edit Poly")); - undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "set_outline", edited_outline, poly); - undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "set_outline", edited_outline, pre_move_edit); - undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines"); - undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines"); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - - edited_point = -1; - return true; - } - } - } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) { - - int closest_outline = -1; - int closest_idx = -1; - Vector2 closest_pos; - real_t closest_dist = 1e10; - - for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) { - - PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j); - - int pc = points.size(); - PoolVector<Vector2>::Read poly = points.read(); - - for (int i = 0; i < pc; i++) { - - Vector2 cp = xform.xform(poly[i]); - - real_t d = cp.distance_to(gpoint); - if (d < closest_dist && d < grab_threshold) { - closest_dist = d; - closest_pos = cp; - closest_outline = j; - closest_idx = i; - } - } - } - - if (closest_idx >= 0) { - - PoolVector<Vector2> poly = node->get_navigation_polygon()->get_outline(closest_outline); - - if (poly.size() > 3) { - undo_redo->create_action(TTR("Edit Poly (Remove Point)")); - undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "set_outline", closest_outline, poly); - poly.remove(closest_idx); - undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "set_outline", closest_outline, poly); - undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines"); - undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines"); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - } else { - - undo_redo->create_action(TTR("Remove Poly And Point")); - undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "add_outline_at_index", poly, closest_outline); - poly.remove(closest_idx); - undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "remove_outline", closest_outline); - undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines"); - undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines"); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - } - return true; - } - } - - } break; - } - } - - Ref<InputEventMouseMotion> mm = p_event; - - if (mm.is_valid()) { - - if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) { - - Vector2 gpoint = mm->get_position(); - Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint); - cpoint = canvas_item_editor->snap_point(cpoint); - edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint); - - canvas_item_editor->get_viewport_control()->update(); - } - } - - return false; + Ref<NavigationPolygon> navpoly = node->get_navigation_polygon(); + if (navpoly.is_valid()) + return navpoly->get_outline(p_idx); + else + return Variant(Vector<Vector2>()); } -void NavigationPolygonEditor::_canvas_draw() { - if (!node) - return; +void NavigationPolygonEditor::_set_polygon(int p_idx, const Variant &p_polygon) const { - Control *vpc = canvas_item_editor->get_viewport_control(); - if (node->get_navigation_polygon().is_null()) - return; - - Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); - Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons"); - - for (int j = -1; j < node->get_navigation_polygon()->get_outline_count(); j++) { - Vector<Vector2> poly; - - if (wip_active && j == edited_outline) { - poly = wip; - } else { - if (j == -1) - continue; - poly = Variant(node->get_navigation_polygon()->get_outline(j)); - } - - for (int i = 0; i < poly.size(); i++) { - - Vector2 p, p2; - p = (j == edited_outline && i == edited_point) ? edited_point_pos : poly[i]; - if (j == edited_outline && ((wip_active && i == poly.size() - 1) || (((i + 1) % poly.size()) == edited_point))) - p2 = edited_point_pos; - else - p2 = poly[(i + 1) % poly.size()]; - - Vector2 point = xform.xform(p); - Vector2 next_point = xform.xform(p2); - - Color col = Color(1, 0.3, 0.1, 0.8); - vpc->draw_line(point, next_point, col, 2); - vpc->draw_texture(handle, point - handle->get_size() * 0.5); - } - } + Ref<NavigationPolygon> navpoly = _ensure_navpoly(); + navpoly->set_outline(p_idx, p_polygon); + navpoly->make_polygons_from_outlines(); } -void NavigationPolygonEditor::edit(Node *p_collision_polygon) { - - if (!canvas_item_editor) { - canvas_item_editor = CanvasItemEditor::get_singleton(); - } - - if (p_collision_polygon) { +void NavigationPolygonEditor::_action_add_polygon(const Variant &p_polygon) { - node = Object::cast_to<NavigationPolygonInstance>(p_collision_polygon); - //Enable the pencil tool if the polygon is empty - if (!node->get_navigation_polygon().is_null()) { - if (node->get_navigation_polygon()->get_polygon_count() == 0) - _menu_option(MODE_CREATE); - } - if (!canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw")) - canvas_item_editor->get_viewport_control()->connect("draw", this, "_canvas_draw"); - wip.clear(); - wip_active = false; - edited_point = -1; - canvas_item_editor->get_viewport_control()->update(); - - } else { - node = NULL; - - if (canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw")) - canvas_item_editor->get_viewport_control()->disconnect("draw", this, "_canvas_draw"); - } + Ref<NavigationPolygon> navpoly = _ensure_navpoly(); + undo_redo->add_do_method(navpoly.ptr(), "add_outline", p_polygon); + undo_redo->add_undo_method(navpoly.ptr(), "remove_outline", navpoly->get_outline_count()); + undo_redo->add_do_method(navpoly.ptr(), "make_polygons_from_outlines"); + undo_redo->add_undo_method(navpoly.ptr(), "make_polygons_from_outlines"); } -void NavigationPolygonEditor::_bind_methods() { +void NavigationPolygonEditor::_action_remove_polygon(int p_idx) { - ClassDB::bind_method(D_METHOD("_menu_option"), &NavigationPolygonEditor::_menu_option); - ClassDB::bind_method(D_METHOD("_canvas_draw"), &NavigationPolygonEditor::_canvas_draw); - ClassDB::bind_method(D_METHOD("_node_removed"), &NavigationPolygonEditor::_node_removed); - ClassDB::bind_method(D_METHOD("_create_nav"), &NavigationPolygonEditor::_create_nav); + Ref<NavigationPolygon> navpoly = _ensure_navpoly(); + undo_redo->add_do_method(navpoly.ptr(), "remove_outline", p_idx); + undo_redo->add_undo_method(navpoly.ptr(), "add_outline_at_index", navpoly->get_outline(p_idx), p_idx); + undo_redo->add_do_method(navpoly.ptr(), "make_polygons_from_outlines"); + undo_redo->add_undo_method(navpoly.ptr(), "make_polygons_from_outlines"); } -NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) { - node = NULL; - canvas_item_editor = NULL; - editor = p_editor; - undo_redo = editor->get_undo_redo(); +void NavigationPolygonEditor::_action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon) { - add_child(memnew(VSeparator)); - button_create = memnew(ToolButton); - add_child(button_create); - button_create->connect("pressed", this, "_menu_option", varray(MODE_CREATE)); - button_create->set_toggle_mode(true); - button_create->set_tooltip(TTR("Create a new polygon from scratch.")); - - button_edit = memnew(ToolButton); - add_child(button_edit); - button_edit->connect("pressed", this, "_menu_option", varray(MODE_EDIT)); - button_edit->set_toggle_mode(true); - button_edit->set_tooltip(TTR("Edit existing polygon:") + "\n" + TTR("LMB: Move Point.") + "\n" + TTR("Ctrl+LMB: Split Segment.") + "\n" + TTR("RMB: Erase Point.")); - create_nav = memnew(ConfirmationDialog); - add_child(create_nav); - create_nav->get_ok()->set_text(TTR("Create")); - - mode = MODE_EDIT; - wip_active = false; - edited_outline = -1; + Ref<NavigationPolygon> navpoly = _ensure_navpoly(); + undo_redo->add_do_method(navpoly.ptr(), "set_outline", p_idx, p_polygon); + undo_redo->add_undo_method(navpoly.ptr(), "set_outline", p_idx, p_previous); + undo_redo->add_do_method(navpoly.ptr(), "make_polygons_from_outlines"); + undo_redo->add_undo_method(navpoly.ptr(), "make_polygons_from_outlines"); } -void NavigationPolygonEditorPlugin::edit(Object *p_object) { +bool NavigationPolygonEditor::_has_resource() const { - collision_polygon_editor->edit(Object::cast_to<Node>(p_object)); + return node && node->get_navigation_polygon().is_valid(); } -bool NavigationPolygonEditorPlugin::handles(Object *p_object) const { - - return p_object->is_class("NavigationPolygonInstance"); -} +void NavigationPolygonEditor::_create_resource() { -void NavigationPolygonEditorPlugin::make_visible(bool p_visible) { + if (!node) + return; - if (p_visible) { - collision_polygon_editor->show(); - } else { + undo_redo->create_action(TTR("Create Navigation Polygon")); + undo_redo->add_do_method(node, "set_navigation_polygon", Ref<NavigationPolygon>(memnew(NavigationPolygon))); + undo_redo->add_undo_method(node, "set_navigation_polygon", Variant(REF())); + undo_redo->commit_action(); - collision_polygon_editor->hide(); - collision_polygon_editor->edit(NULL); - } + _menu_option(MODE_CREATE); } -NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) { - - editor = p_node; - collision_polygon_editor = memnew(NavigationPolygonEditor(p_node)); - CanvasItemEditor::get_singleton()->add_control_to_menu_panel(collision_polygon_editor); - - collision_polygon_editor->hide(); +NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) + : AbstractPolygon2DEditor(p_editor) { } -NavigationPolygonEditorPlugin::~NavigationPolygonEditorPlugin() { +NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) + : AbstractPolygon2DEditorPlugin(p_node, memnew(NavigationPolygonEditor(p_node)), "NavigationPolygonInstance") { } diff --git a/editor/plugins/navigation_polygon_editor_plugin.h b/editor/plugins/navigation_polygon_editor_plugin.h index 7dd555e9c9..54cc347a8c 100644..100755 --- a/editor/plugins/navigation_polygon_editor_plugin.h +++ b/editor/plugins/navigation_polygon_editor_plugin.h @@ -30,83 +30,45 @@ #ifndef NAVIGATIONPOLYGONEDITORPLUGIN_H #define NAVIGATIONPOLYGONEDITORPLUGIN_H -#include "editor/editor_node.h" -#include "editor/editor_plugin.h" +#include "editor/plugins/abstract_polygon_2d_editor.h" #include "scene/2d/navigation_polygon.h" -#include "scene/gui/tool_button.h" /** @author Juan Linietsky <reduzio@gmail.com> */ -class CanvasItemEditor; +class NavigationPolygonEditor : public AbstractPolygon2DEditor { -class NavigationPolygonEditor : public HBoxContainer { + GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor); - GDCLASS(NavigationPolygonEditor, HBoxContainer); - - UndoRedo *undo_redo; - enum Mode { - - MODE_CREATE, - MODE_EDIT, - - }; - - Mode mode; - - ToolButton *button_create; - ToolButton *button_edit; - - ConfirmationDialog *create_nav; - - CanvasItemEditor *canvas_item_editor; - EditorNode *editor; - Panel *panel; NavigationPolygonInstance *node; - MenuButton *options; - int edited_outline; - int edited_point; - Vector2 edited_point_pos; - PoolVector<Vector2> pre_move_edit; - Vector<Vector2> wip; - bool wip_active; + Ref<NavigationPolygon> _ensure_navpoly() const; - void _wip_close(); - void _canvas_draw(); - void _create_nav(); +protected: + virtual Node2D *_get_node() const; + virtual void _set_node(Node *p_polygon); - void _menu_option(int p_option); + virtual int _get_polygon_count() const; + virtual Variant _get_polygon(int p_idx) const; + virtual void _set_polygon(int p_idx, const Variant &p_polygon) const; -protected: - void _notification(int p_what); - void _node_removed(Node *p_node); - static void _bind_methods(); + virtual void _action_add_polygon(const Variant &p_polygon); + virtual void _action_remove_polygon(int p_idx); + virtual void _action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon); + + virtual bool _has_resource() const; + virtual void _create_resource(); public: - bool forward_gui_input(const Ref<InputEvent> &p_event); - void edit(Node *p_collision_polygon); NavigationPolygonEditor(EditorNode *p_editor); }; -class NavigationPolygonEditorPlugin : public EditorPlugin { +class NavigationPolygonEditorPlugin : public AbstractPolygon2DEditorPlugin { - GDCLASS(NavigationPolygonEditorPlugin, EditorPlugin); - - NavigationPolygonEditor *collision_polygon_editor; - EditorNode *editor; + GDCLASS(NavigationPolygonEditorPlugin, AbstractPolygon2DEditorPlugin); public: - virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_gui_input(p_event); } - - virtual String get_name() const { return "NavigationPolygonInstance"; } - bool has_main_screen() const { return false; } - virtual void edit(Object *p_object); - virtual bool handles(Object *p_object) const; - virtual void make_visible(bool p_visible); - NavigationPolygonEditorPlugin(EditorNode *p_node); - ~NavigationPolygonEditorPlugin(); }; #endif // NAVIGATIONPOLYGONEDITORPLUGIN_H diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index af2349983d..0e8c13b067 100644..100755 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -35,15 +35,27 @@ #include "os/input.h" #include "os/keyboard.h" +Node2D *Polygon2DEditor::_get_node() const { + + return node; +} + +void Polygon2DEditor::_set_node(Node *p_polygon) { + + node = Object::cast_to<Polygon2D>(p_polygon); +} + +Vector2 Polygon2DEditor::_get_offset(int p_idx) const { + + return node->get_offset(); +} + void Polygon2DEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { - button_create->set_icon(get_icon("Edit", "EditorIcons")); - button_edit->set_icon(get_icon("MovePoint", "EditorIcons")); - button_edit->set_pressed(true); button_uv->set_icon(get_icon("Uv", "EditorIcons")); uv_button[UV_MODE_EDIT_POINT]->set_icon(get_icon("ToolSelect", "EditorIcons")); @@ -55,40 +67,17 @@ void Polygon2DEditor::_notification(int p_what) { b_snap_enable->set_icon(get_icon("SnapGrid", "EditorIcons")); uv_icon_zoom->set_texture(get_icon("Zoom", "EditorIcons")); - get_tree()->connect("node_removed", this, "_node_removed"); - } break; case NOTIFICATION_PHYSICS_PROCESS: { } break; } } -void Polygon2DEditor::_node_removed(Node *p_node) { - - if (p_node == node) { - edit(NULL); - hide(); - - canvas_item_editor->get_viewport_control()->update(); - } -} void Polygon2DEditor::_menu_option(int p_option) { switch (p_option) { - case MODE_CREATE: { - - mode = MODE_CREATE; - button_create->set_pressed(true); - button_edit->set_pressed(false); - } break; - case MODE_EDIT: { - - mode = MODE_EDIT; - button_create->set_pressed(false); - button_edit->set_pressed(true); - } break; case MODE_EDIT_UV: { if (node->get_texture().is_null()) { @@ -153,6 +142,9 @@ void Polygon2DEditor::_menu_option(int p_option) { undo_redo->commit_action(); } break; + default: { + AbstractPolygon2DEditor::_menu_option(p_option); + } break; } } @@ -185,289 +177,6 @@ void Polygon2DEditor::_set_snap_step_y(float p_val) { uv_edit_draw->update(); } -void Polygon2DEditor::_wip_close() { - - undo_redo->create_action(TTR("Create Poly")); - undo_redo->add_undo_method(node, "set_polygon", node->get_polygon()); - undo_redo->add_do_method(node, "set_polygon", wip); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - wip.clear(); - wip_active = false; - mode = MODE_EDIT; - button_edit->set_pressed(true); - button_create->set_pressed(false); - edited_point = -1; -} - -bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) { - - if (node == NULL) - return false; - - Ref<InputEventMouseButton> mb = p_event; - - if (mb.is_valid()) { - - Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); - - Vector2 gpoint = mb->get_position(); - Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint); - cpoint = canvas_item_editor->snap_point(cpoint); - cpoint = node->get_global_transform().affine_inverse().xform(cpoint); - - Vector<Vector2> poly = Variant(node->get_polygon()); - - //first check if a point is to be added (segment split) - real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8); - - switch (mode) { - - case MODE_CREATE: { - - if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { - - if (!wip_active) { - - wip.clear(); - wip.push_back(cpoint - node->get_offset()); - wip_active = true; - edited_point_pos = cpoint; - canvas_item_editor->get_viewport_control()->update(); - edited_point = 1; - return true; - } else { - - if (wip.size() > 1 && xform.xform(wip[0] + node->get_offset()).distance_to(gpoint) < grab_threshold) { - //wip closed - _wip_close(); - - return true; - } else { - - wip.push_back(cpoint - node->get_offset()); - edited_point = wip.size(); - canvas_item_editor->get_viewport_control()->update(); - return true; - - //add wip point - } - } - } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) { - _wip_close(); - } - - } break; - - case MODE_EDIT: { - - if (mb->get_button_index() == BUTTON_LEFT) { - if (mb->is_pressed()) { - - if (mb->get_control()) { - - if (poly.size() < 3) { - - undo_redo->create_action(TTR("Edit Poly")); - undo_redo->add_undo_method(node, "set_polygon", poly); - poly.push_back(cpoint); - undo_redo->add_do_method(node, "set_polygon", poly); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - return true; - } - - //search edges - int closest_idx = -1; - Vector2 closest_pos; - real_t closest_dist = 1e10; - for (int i = 0; i < poly.size(); i++) { - - Vector2 points[2] = { xform.xform(poly[i] + node->get_offset()), - xform.xform(poly[(i + 1) % poly.size()] + node->get_offset()) }; - - Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points); - if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2) - continue; //not valid to reuse point - - real_t d = cp.distance_to(gpoint); - if (d < closest_dist && d < grab_threshold) { - closest_dist = d; - closest_pos = cp; - closest_idx = i; - } - } - - if (closest_idx >= 0) { - - pre_move_edit = poly; - poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos) - node->get_offset()); - edited_point = closest_idx + 1; - edited_point_pos = xform.affine_inverse().xform(closest_pos); - node->set_polygon(Variant(poly)); - canvas_item_editor->get_viewport_control()->update(); - return true; - } - } else { - - //look for points to move - - int closest_idx = -1; - Vector2 closest_pos; - real_t closest_dist = 1e10; - for (int i = 0; i < poly.size(); i++) { - - Vector2 cp = xform.xform(poly[i] + node->get_offset()); - - real_t d = cp.distance_to(gpoint); - if (d < closest_dist && d < grab_threshold) { - closest_dist = d; - closest_pos = cp; - closest_idx = i; - } - } - - if (closest_idx >= 0) { - - pre_move_edit = poly; - edited_point = closest_idx; - edited_point_pos = xform.affine_inverse().xform(closest_pos); - canvas_item_editor->get_viewport_control()->update(); - return true; - } - } - } else { - - if (edited_point != -1) { - - //apply - - ERR_FAIL_INDEX_V(edited_point, poly.size(), false); - poly[edited_point] = edited_point_pos - node->get_offset(); - undo_redo->create_action(TTR("Edit Poly")); - undo_redo->add_do_method(node, "set_polygon", poly); - undo_redo->add_undo_method(node, "set_polygon", pre_move_edit); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - - edited_point = -1; - return true; - } - } - } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) { - - int closest_idx = -1; - Vector2 closest_pos; - real_t closest_dist = 1e10; - for (int i = 0; i < poly.size(); i++) { - - Vector2 cp = xform.xform(poly[i] + node->get_offset()); - - real_t d = cp.distance_to(gpoint); - if (d < closest_dist && d < grab_threshold) { - closest_dist = d; - closest_pos = cp; - closest_idx = i; - } - } - - if (closest_idx >= 0) { - - undo_redo->create_action(TTR("Edit Poly (Remove Point)")); - undo_redo->add_undo_method(node, "set_polygon", poly); - poly.remove(closest_idx); - undo_redo->add_do_method(node, "set_polygon", poly); - undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update"); - undo_redo->commit_action(); - return true; - } - } - - } break; - } - } - - Ref<InputEventMouseMotion> mm = p_event; - - if (mm.is_valid()) { - - if (edited_point != -1 && (wip_active || (mm->get_button_mask() & BUTTON_MASK_LEFT))) { - - Vector2 gpoint = mm->get_position(); - Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint); - cpoint = canvas_item_editor->snap_point(cpoint); - edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint); - - if (!wip_active) { - - Vector<Vector2> poly = Variant(node->get_polygon()); - ERR_FAIL_INDEX_V(edited_point, poly.size(), false); - poly[edited_point] = edited_point_pos - node->get_offset(); - node->set_polygon(Variant(poly)); - } - - canvas_item_editor->get_viewport_control()->update(); - } - } - - return false; -} -void Polygon2DEditor::_canvas_draw() { - - if (!node) - return; - - Control *vpc = canvas_item_editor->get_viewport_control(); - - Vector<Vector2> poly; - - if (wip_active) - poly = wip; - else - poly = Variant(node->get_polygon()); - - Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); - Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons"); - - if (!wip_active && edited_point >= 0 && EDITOR_DEF("editors/poly_editor/show_previous_outline", true)) { - - const Color col = node->get_color().contrasted(); - const int n = pre_move_edit.size(); - for (int i = 0; i < n; i++) { - - Vector2 p, p2; - p = pre_move_edit[i] + node->get_offset(); - p2 = pre_move_edit[(i + 1) % n] + node->get_offset(); - - Vector2 point = xform.xform(p); - Vector2 next_point = xform.xform(p2); - - vpc->draw_line(point, next_point, col, 2); - } - } - - for (int i = 0; i < poly.size(); i++) { - - Vector2 p, p2; - p = i == edited_point ? edited_point_pos : (poly[i] + node->get_offset()); - if ((wip_active && i == poly.size() - 1) || (((i + 1) % poly.size()) == edited_point)) - p2 = edited_point_pos; - else - p2 = poly[(i + 1) % poly.size()] + node->get_offset(); - - Vector2 point = xform.xform(p); - Vector2 next_point = xform.xform(p2); - - Color col = Color(1, 0.3, 0.1, 0.8); - vpc->draw_line(point, next_point, col, 2); - vpc->draw_texture(handle, point - handle->get_size() * 0.5); - } -} - void Polygon2DEditor::_uv_mode(int p_mode) { uv_mode = UVMode(p_mode); @@ -714,44 +423,12 @@ void Polygon2DEditor::_uv_draw() { updating_uv_scroll = false; } -void Polygon2DEditor::edit(Node *p_collision_polygon) { - - if (!canvas_item_editor) { - canvas_item_editor = CanvasItemEditor::get_singleton(); - } - - if (p_collision_polygon) { - - node = Object::cast_to<Polygon2D>(p_collision_polygon); - //Enable the pencil tool if the polygon is empty - if (node->get_polygon().size() == 0) { - _menu_option(MODE_CREATE); - } - if (!canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw")) - canvas_item_editor->get_viewport_control()->connect("draw", this, "_canvas_draw"); - - wip.clear(); - wip_active = false; - edited_point = -1; - - } else { - - node = NULL; - - if (canvas_item_editor->get_viewport_control()->is_connected("draw", this, "_canvas_draw")) - canvas_item_editor->get_viewport_control()->disconnect("draw", this, "_canvas_draw"); - } -} - void Polygon2DEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_menu_option"), &Polygon2DEditor::_menu_option); - ClassDB::bind_method(D_METHOD("_canvas_draw"), &Polygon2DEditor::_canvas_draw); ClassDB::bind_method(D_METHOD("_uv_mode"), &Polygon2DEditor::_uv_mode); ClassDB::bind_method(D_METHOD("_uv_draw"), &Polygon2DEditor::_uv_draw); ClassDB::bind_method(D_METHOD("_uv_input"), &Polygon2DEditor::_uv_input); ClassDB::bind_method(D_METHOD("_uv_scroll_changed"), &Polygon2DEditor::_uv_scroll_changed); - ClassDB::bind_method(D_METHOD("_node_removed"), &Polygon2DEditor::_node_removed); ClassDB::bind_method(D_METHOD("_set_use_snap"), &Polygon2DEditor::_set_use_snap); ClassDB::bind_method(D_METHOD("_set_show_grid"), &Polygon2DEditor::_set_show_grid); ClassDB::bind_method(D_METHOD("_set_snap_off_x"), &Polygon2DEditor::_set_snap_off_x); @@ -773,35 +450,17 @@ Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const { return p_target; } -Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) { - - node = NULL; - canvas_item_editor = NULL; - editor = p_editor; - undo_redo = editor->get_undo_redo(); +Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) + : AbstractPolygon2DEditor(p_editor) { snap_step = Vector2(10, 10); use_snap = false; snap_show_grid = false; - add_child(memnew(VSeparator)); - button_create = memnew(ToolButton); - add_child(button_create); - button_create->connect("pressed", this, "_menu_option", varray(MODE_CREATE)); - button_create->set_toggle_mode(true); - - button_edit = memnew(ToolButton); - add_child(button_edit); - button_edit->connect("pressed", this, "_menu_option", varray(MODE_EDIT)); - button_edit->set_toggle_mode(true); - button_uv = memnew(ToolButton); add_child(button_uv); button_uv->connect("pressed", this, "_menu_option", varray(MODE_EDIT_UV)); - mode = MODE_EDIT; - wip_active = false; - uv_mode = UV_MODE_EDIT_POINT; uv_edit = memnew(AcceptDialog); add_child(uv_edit); @@ -941,35 +600,6 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) { uv_edit_draw->set_clip_contents(true); } -void Polygon2DEditorPlugin::edit(Object *p_object) { - - collision_polygon_editor->edit(Object::cast_to<Node>(p_object)); -} - -bool Polygon2DEditorPlugin::handles(Object *p_object) const { - - return p_object->is_class("Polygon2D"); -} - -void Polygon2DEditorPlugin::make_visible(bool p_visible) { - - if (p_visible) { - collision_polygon_editor->show(); - } else { - - collision_polygon_editor->hide(); - collision_polygon_editor->edit(NULL); - } -} - -Polygon2DEditorPlugin::Polygon2DEditorPlugin(EditorNode *p_node) { - - editor = p_node; - collision_polygon_editor = memnew(Polygon2DEditor(p_node)); - CanvasItemEditor::get_singleton()->add_control_to_menu_panel(collision_polygon_editor); - - collision_polygon_editor->hide(); -} - -Polygon2DEditorPlugin::~Polygon2DEditorPlugin() { +Polygon2DEditorPlugin::Polygon2DEditorPlugin(EditorNode *p_node) + : AbstractPolygon2DEditorPlugin(p_node, memnew(Polygon2DEditor(p_node)), "Polygon2D") { } diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h index f9d6a6b4b6..90da3e61c1 100644..100755 --- a/editor/plugins/polygon_2d_editor_plugin.h +++ b/editor/plugins/polygon_2d_editor_plugin.h @@ -30,26 +30,18 @@ #ifndef POLYGON_2D_EDITOR_PLUGIN_H #define POLYGON_2D_EDITOR_PLUGIN_H -#include "editor/editor_node.h" -#include "editor/editor_plugin.h" -#include "scene/2d/polygon_2d.h" -#include "scene/gui/tool_button.h" +#include "editor/plugins/abstract_polygon_2d_editor.h" /** @author Juan Linietsky <reduzio@gmail.com> */ -class CanvasItemEditor; +class Polygon2DEditor : public AbstractPolygon2DEditor { -class Polygon2DEditor : public HBoxContainer { + GDCLASS(Polygon2DEditor, AbstractPolygon2DEditor); - GDCLASS(Polygon2DEditor, HBoxContainer); - - UndoRedo *undo_redo; enum Mode { - MODE_CREATE, - MODE_EDIT, - MODE_EDIT_UV, + MODE_EDIT_UV = MODE_CONT, UVEDIT_POLYGON_TO_UV, UVEDIT_UV_TO_POLYGON, UVEDIT_UV_CLEAR @@ -64,7 +56,7 @@ class Polygon2DEditor : public HBoxContainer { UV_MODE_MAX }; - Mode mode; + Polygon2D *node; UVMode uv_mode; AcceptDialog *uv_edit; @@ -90,34 +82,19 @@ class Polygon2DEditor : public HBoxContainer { AcceptDialog *error; - ToolButton *button_create; - ToolButton *button_edit; ToolButton *button_uv; - CanvasItemEditor *canvas_item_editor; - EditorNode *editor; - Panel *panel; - Polygon2D *node; - MenuButton *options; - - int edited_point; - Vector2 edited_point_pos; - Vector<Vector2> pre_move_edit; - Vector<Vector2> wip; - bool wip_active; - bool use_snap; bool snap_show_grid; Vector2 snap_offset; Vector2 snap_step; + virtual void _menu_option(int p_option); + void _uv_scroll_changed(float); void _uv_input(const Ref<InputEvent> &p_input); void _uv_draw(); void _uv_mode(int p_mode); - void _wip_close(); - void _canvas_draw(); - void _menu_option(int p_option); void _set_use_snap(bool p_use); void _set_show_grid(bool p_show); @@ -127,36 +104,26 @@ class Polygon2DEditor : public HBoxContainer { void _set_snap_step_y(float p_val); protected: + virtual Node2D *_get_node() const; + virtual void _set_node(Node *p_polygon); + + virtual Vector2 _get_offset(int p_idx) const; + void _notification(int p_what); - void _node_removed(Node *p_node); static void _bind_methods(); Vector2 snap_point(Vector2 p_target) const; public: - bool forward_gui_input(const Ref<InputEvent> &p_event); - void edit(Node *p_collision_polygon); Polygon2DEditor(EditorNode *p_editor); }; -class Polygon2DEditorPlugin : public EditorPlugin { - - GDCLASS(Polygon2DEditorPlugin, EditorPlugin); +class Polygon2DEditorPlugin : public AbstractPolygon2DEditorPlugin { - Polygon2DEditor *collision_polygon_editor; - EditorNode *editor; + GDCLASS(Polygon2DEditorPlugin, AbstractPolygon2DEditorPlugin); public: - virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_gui_input(p_event); } - - virtual String get_name() const { return "Polygon2D"; } - bool has_main_screen() const { return false; } - virtual void edit(Object *p_object); - virtual bool handles(Object *p_object) const; - virtual void make_visible(bool p_visible); - Polygon2DEditorPlugin(EditorNode *p_node); - ~Polygon2DEditorPlugin(); }; #endif // POLYGON_2D_EDITOR_PLUGIN_H diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 5e66488afb..477d440f28 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1278,7 +1278,11 @@ void ScriptEditor::_members_overview_selected(int p_idx) { if (!se) { return; } - se->goto_line(members_overview->get_item_metadata(p_idx)); + Dictionary state; + state["scroll_position"] = members_overview->get_item_metadata(p_idx); + state["column"] = 0; + state["row"] = members_overview->get_item_metadata(p_idx); + se->set_edit_state(state); se->ensure_focus(); } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index a24856dad7..adf65c11e1 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -529,9 +529,9 @@ void ScriptTextEditor::ensure_focus() { void ScriptTextEditor::set_edit_state(const Variant &p_state) { Dictionary state = p_state; - code_editor->get_text_edit()->set_v_scroll(state["scroll_position"]); code_editor->get_text_edit()->cursor_set_column(state["column"]); code_editor->get_text_edit()->cursor_set_line(state["row"]); + code_editor->get_text_edit()->set_v_scroll(state["scroll_position"]); code_editor->get_text_edit()->grab_focus(); //int scroll_pos; diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 425390723c..32973db6ec 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -1442,6 +1442,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { case TRANSFORM_ROTATE: { Plane plane; + Vector3 axis; switch (_edit.plane) { case TRANSFORM_VIEW: @@ -1449,12 +1450,15 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { break; case TRANSFORM_X_AXIS: plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(0)); + axis = Vector3(1, 0, 0); break; case TRANSFORM_Y_AXIS: plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(1)); + axis = Vector3(0, 1, 0); break; case TRANSFORM_Z_AXIS: plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(2)); + axis = Vector3(0, 0, 1); break; } @@ -1470,6 +1474,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { Vector3 x_axis = plane.normal.cross(y_axis).normalized(); float angle = Math::atan2(x_axis.dot(intersection - _edit.center), y_axis.dot(intersection - _edit.center)); + if (_edit.snap || spatial_editor->is_snap_enabled()) { float snap = spatial_editor->get_rotate_snap(); @@ -1486,11 +1491,10 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { set_message(vformat(TTR("Rotating %s degrees."), rtos(Math::rad2deg(angle)))); } - Transform r; - r.basis.rotate(plane.normal, angle); - List<Node *> &selection = editor_selection->get_selected_node_list(); + bool local_coords = spatial_editor->are_local_coords_enabled(); + for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { Spatial *sp = Object::cast_to<Spatial>(E->get()); @@ -1501,27 +1505,33 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { if (!se) continue; - Transform original = se->original; + Transform t; - Transform base = Transform(Basis(), _edit.center); - Transform t = base * r * base.inverse() * original; + if (local_coords) { - sp->set_global_transform(t); + Transform original_local = se->original_local; + Basis rot = Basis(axis, angle); + + t.basis = original_local.get_basis() * rot; + t.origin = original_local.origin; + + sp->set_transform(t); + + } else { + + Transform original = se->original; + Transform r; + Transform base = Transform(Basis(), _edit.center); + + r.basis.rotate(plane.normal, angle); + t = base * r * base.inverse() * original; + + sp->set_global_transform(t); + } } surface->update(); - /* - VisualServer::get_singleton()->poly_clear(indicators); - - Vector<Vector3> points; - Vector<Vector3> empty; - Vector<Color> colors; - points.push_back(intersection); - points.push_back(_edit.original.origin); - colors.push_back( Color(255,155,100) ); - colors.push_back( Color(255,155,100) ); - VisualServer::get_singleton()->poly_add_primitive(indicators,points,empty,colors,empty); - */ + } break; default: {} } diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 1fb3fb2ed1..9f23df5c03 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1420,7 +1420,8 @@ ProjectManager::ProjectManager() { { int dpi_mode = EditorSettings::get_singleton()->get("interface/editor/hidpi_mode"); if (dpi_mode == 0) { - editor_set_scale(OS::get_singleton()->get_screen_dpi(0) >= 192 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x > 2000 ? 2.0 : 1.0); + const int screen = OS::get_singleton()->get_current_screen(); + editor_set_scale(OS::get_singleton()->get_screen_dpi(screen) >= 192 && OS::get_singleton()->get_screen_size(screen).x > 2000 ? 2.0 : 1.0); } else if (dpi_mode == 1) { editor_set_scale(0.75); } else if (dpi_mode == 2) { diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 47ebf49c43..658f67d6a4 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -861,7 +861,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: names.push_back(TTR("Assign")); names.push_back(TTR("Clear")); - if (owner->is_class("Node") && (v.get_type() == Variant::NODE_PATH) && Object::cast_to<Node>(owner)->has_node(v)) + if (owner && owner->is_class("Node") && (v.get_type() == Variant::NODE_PATH) && Object::cast_to<Node>(owner)->has_node(v)) names.push_back(TTR("Select Node")); config_action_buttons(names); diff --git a/methods.py b/methods.py index f1ef95f6fe..b56a0364b5 100644 --- a/methods.py +++ b/methods.py @@ -1360,6 +1360,10 @@ def win32_spawn(sh, escape, cmd, args, spawnenv): return exit_code """ +def android_add_flat_dir(self, dir): + if (dir not in self.android_flat_dirs): + self.android_flat_dirs.append(dir) + def android_add_maven_repository(self, url): if (url not in self.android_maven_repos): self.android_maven_repos.append(url) diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index be0975b53c..6592d0ae1d 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -35,9 +35,9 @@ def _build_gdnative_api_struct_header(api): '\tconst char *version;', ] - for funcname, funcdef in api['api'].items(): + for funcdef in api['api']: args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']]) - out.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcname, args)) + out.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args)) out += [ '} godot_gdnative_api_struct;', @@ -63,8 +63,8 @@ def _build_gdnative_api_struct_source(api): '\t_gdnative_api_version,', ] - for funcname in api['api'].keys(): - out.append('\t%s,' % funcname) + for funcdef in api['api']: + out.append('\t%s,' % funcdef['name']) out.append('};\n') return '\n'.join(out) @@ -74,8 +74,7 @@ def build_gdnative_api_struct(target, source, env): from collections import OrderedDict with open(source[0].path, 'r') as fd: - # Keep the json ordered - api = json.load(fd, object_pairs_hook=OrderedDict) + api = json.load(fd) header, source = target with open(header.path, 'w') as fd: @@ -107,14 +106,14 @@ def _build_gdnative_wrapper_code(api): '' ] - for funcname, funcdef in api['api'].items(): + for funcdef in api['api']: args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']]) - out.append('%s %s(%s) {' % (_spaced(funcdef['return_type']), funcname, args)) + out.append('%s%s(%s) {' % (_spaced(funcdef['return_type']), funcdef['name'], args)) args = ', '.join(['%s' % n for t, n in funcdef['arguments']]) return_line = '\treturn ' if funcdef['return_type'] != 'void' else '\t' - return_line += '_gdnative_wrapper_api_struct->' + funcname + '(' + args + ');' + return_line += '_gdnative_wrapper_api_struct->' + funcdef['name'] + '(' + args + ');' out.append(return_line) out.append('}') @@ -132,7 +131,6 @@ def _build_gdnative_wrapper_code(api): def build_gdnative_wrapper_code(target, source, env): import json with open(source[0].path, 'r') as fd: -#Keep the json ordered api = json.load(fd) wrapper_file = target[0] @@ -143,7 +141,7 @@ def build_gdnative_wrapper_code(target, source, env): if ARGUMENTS.get('gdnative_wrapper', False): #build wrapper code - gdn_env.Command('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', build_gdnative_wrapper_code) + gensource, = gdn_env.Command('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', build_gdnative_wrapper_code) gd_wrapper_env = env.Clone() gd_wrapper_env.Append(CPPPATH=['#modules/gdnative/include/']) @@ -151,4 +149,4 @@ if ARGUMENTS.get('gdnative_wrapper', False): # I think this doesn't work on MSVC yet... gd_wrapper_env.Append(CCFLAGS=['-fPIC']) - gd_wrapper_env.Library("#bin/gdnative_wrapper_code", ["#modules/gdnative/gdnative_wrapper_code.gen.cpp"]) + gd_wrapper_env.Library("#bin/gdnative_wrapper_code", [gensource]) diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp index cf1f6a4f16..64a7c33cf8 100644 --- a/modules/gdnative/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative/gdnative.cpp @@ -41,6 +41,7 @@ extern "C" { #endif extern "C" void _string_api_anchor(); +extern "C" void _string_name_api_anchor(); extern "C" void _vector2_api_anchor(); extern "C" void _rect2_api_anchor(); extern "C" void _vector3_api_anchor(); @@ -61,6 +62,7 @@ extern "C" void _variant_api_anchor(); void _api_anchor() { _string_api_anchor(); + _string_name_api_anchor(); _vector2_api_anchor(); _rect2_api_anchor(); _vector3_api_anchor(); diff --git a/modules/gdnative/gdnative/string_name.cpp b/modules/gdnative/gdnative/string_name.cpp new file mode 100644 index 0000000000..5c00fdfc2f --- /dev/null +++ b/modules/gdnative/gdnative/string_name.cpp @@ -0,0 +1,91 @@ +/*************************************************************************/ +/* string_name.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.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/string_name.h" + +#include "core/string_db.h" +#include "core/ustring.h" + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +void _string_name_api_anchor() { +} + +void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name) { + StringName *dest = (StringName *)r_dest; + const String *name = (const String *)p_name; + memnew_placement(dest, StringName(*name)); +} + +void GDAPI godot_string_name_new_data(godot_string_name *r_dest, const char *p_name) { + StringName *dest = (StringName *)r_dest; + memnew_placement(dest, StringName(p_name)); +} + +godot_string GDAPI godot_string_name_get_name(const godot_string_name *p_self) { + godot_string ret; + const StringName *self = (const StringName *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +uint32_t GDAPI godot_string_name_get_hash(const godot_string_name *p_self) { + const StringName *self = (const StringName *)p_self; + return self->hash(); +} + +const void GDAPI *godot_string_name_get_data_unique_pointer(const godot_string_name *p_self) { + const StringName *self = (const StringName *)p_self; + return self->data_unique_pointer(); +} + +godot_bool GDAPI godot_string_name_operator_equal(const godot_string_name *p_self, const godot_string_name *p_other) { + const StringName *self = (const StringName *)p_self; + const StringName *other = (const StringName *)p_other; + return self == other; +} + +godot_bool GDAPI godot_string_name_operator_less(const godot_string_name *p_self, const godot_string_name *p_other) { + const StringName *self = (const StringName *)p_self; + const StringName *other = (const StringName *)p_other; + return self < other; +} + +void GDAPI godot_string_name_destroy(godot_string_name *p_self) { + StringName *self = (StringName *)p_self; + self->~StringName(); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 8b6593c9c3..4d3c024a8f 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -1,7 +1,8 @@ { "version": "1.0.0", - "api": { - "godot_color_new_rgba": { + "api": [ + { + "name": "godot_color_new_rgba", "return_type": "void", "arguments": [ ["godot_color *", "r_dest"], @@ -11,7 +12,8 @@ ["const godot_real", "p_a"] ] }, - "godot_color_new_rgb": { + { + "name": "godot_color_new_rgb", "return_type": "void", "arguments": [ ["godot_color *", "r_dest"], @@ -20,113 +22,131 @@ ["const godot_real", "p_b"] ] }, - "godot_color_get_r": { + { + "name": "godot_color_get_r", "return_type": "godot_real", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_set_r": { + { + "name": "godot_color_set_r", "return_type": "void", "arguments": [ ["godot_color *", "p_self"], ["const godot_real", "r"] ] }, - "godot_color_get_g": { + { + "name": "godot_color_get_g", "return_type": "godot_real", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_set_g": { + { + "name": "godot_color_set_g", "return_type": "void", "arguments": [ ["godot_color *", "p_self"], ["const godot_real", "g"] ] }, - "godot_color_get_b": { + { + "name": "godot_color_get_b", "return_type": "godot_real", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_set_b": { + { + "name": "godot_color_set_b", "return_type": "void", "arguments": [ ["godot_color *", "p_self"], ["const godot_real", "b"] ] }, - "godot_color_get_a": { + { + "name": "godot_color_get_a", "return_type": "godot_real", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_set_a": { + { + "name": "godot_color_set_a", "return_type": "void", "arguments": [ ["godot_color *", "p_self"], ["const godot_real", "a"] ] }, - "godot_color_get_h": { + { + "name": "godot_color_get_h", "return_type": "godot_real", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_get_s": { + { + "name": "godot_color_get_s", "return_type": "godot_real", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_get_v": { + { + "name": "godot_color_get_v", "return_type": "godot_real", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_as_string": { + { + "name": "godot_color_as_string", "return_type": "godot_string", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_to_rgba32": { + { + "name": "godot_color_to_rgba32", "return_type": "godot_int", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_to_argb32": { + { + "name": "godot_color_to_argb32", "return_type": "godot_int", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_gray": { + { + "name": "godot_color_gray", "return_type": "godot_real", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_inverted": { + { + "name": "godot_color_inverted", "return_type": "godot_color", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_contrasted": { + { + "name": "godot_color_contrasted", "return_type": "godot_color", "arguments": [ ["const godot_color *", "p_self"] ] }, - "godot_color_linear_interpolate": { + { + "name": "godot_color_linear_interpolate", "return_type": "godot_color", "arguments": [ ["const godot_color *", "p_self"], @@ -134,35 +154,40 @@ ["const godot_real", "p_t"] ] }, - "godot_color_blend": { + { + "name": "godot_color_blend", "return_type": "godot_color", "arguments": [ ["const godot_color *", "p_self"], ["const godot_color *", "p_over"] ] }, - "godot_color_to_html": { + { + "name": "godot_color_to_html", "return_type": "godot_string", "arguments": [ ["const godot_color *", "p_self"], ["const godot_bool", "p_with_alpha"] ] }, - "godot_color_operator_equal": { + { + "name": "godot_color_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_color *", "p_self"], ["const godot_color *", "p_b"] ] }, - "godot_color_operator_less": { + { + "name": "godot_color_operator_less", "return_type": "godot_bool", "arguments": [ ["const godot_color *", "p_self"], ["const godot_color *", "p_b"] ] }, - "godot_vector2_new": { + { + "name": "godot_vector2_new", "return_type": "void", "arguments": [ ["godot_vector2 *", "r_dest"], @@ -170,71 +195,82 @@ ["const godot_real", "p_y"] ] }, - "godot_vector2_as_string": { + { + "name": "godot_vector2_as_string", "return_type": "godot_string", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_normalized": { + { + "name": "godot_vector2_normalized", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_length": { + { + "name": "godot_vector2_length", "return_type": "godot_real", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_angle": { + { + "name": "godot_vector2_angle", "return_type": "godot_real", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_length_squared": { + { + "name": "godot_vector2_length_squared", "return_type": "godot_real", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_is_normalized": { + { + "name": "godot_vector2_is_normalized", "return_type": "godot_bool", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_distance_to": { + { + "name": "godot_vector2_distance_to", "return_type": "godot_real", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_to"] ] }, - "godot_vector2_distance_squared_to": { + { + "name": "godot_vector2_distance_squared_to", "return_type": "godot_real", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_to"] ] }, - "godot_vector2_angle_to": { + { + "name": "godot_vector2_angle_to", "return_type": "godot_real", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_to"] ] }, - "godot_vector2_angle_to_point": { + { + "name": "godot_vector2_angle_to_point", "return_type": "godot_real", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_to"] ] }, - "godot_vector2_linear_interpolate": { + { + "name": "godot_vector2_linear_interpolate", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], @@ -242,7 +278,8 @@ ["const godot_real", "p_t"] ] }, - "godot_vector2_cubic_interpolate": { + { + "name": "godot_vector2_cubic_interpolate", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], @@ -252,168 +289,193 @@ ["const godot_real", "p_t"] ] }, - "godot_vector2_rotated": { + { + "name": "godot_vector2_rotated", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_real", "p_phi"] ] }, - "godot_vector2_tangent": { + { + "name": "godot_vector2_tangent", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_floor": { + { + "name": "godot_vector2_floor", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_snapped": { + { + "name": "godot_vector2_snapped", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_by"] ] }, - "godot_vector2_aspect": { + { + "name": "godot_vector2_aspect", "return_type": "godot_real", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_dot": { + { + "name": "godot_vector2_dot", "return_type": "godot_real", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_with"] ] }, - "godot_vector2_slide": { + { + "name": "godot_vector2_slide", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_n"] ] }, - "godot_vector2_bounce": { + { + "name": "godot_vector2_bounce", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_n"] ] }, - "godot_vector2_reflect": { + { + "name": "godot_vector2_reflect", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_n"] ] }, - "godot_vector2_abs": { + { + "name": "godot_vector2_abs", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_clamped": { + { + "name": "godot_vector2_clamped", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_real", "p_length"] ] }, - "godot_vector2_operator_add": { + { + "name": "godot_vector2_operator_add", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_b"] ] }, - "godot_vector2_operator_substract": { + { + "name": "godot_vector2_operator_substract", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_b"] ] }, - "godot_vector2_operator_multiply_vector": { + { + "name": "godot_vector2_operator_multiply_vector", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_b"] ] }, - "godot_vector2_operator_multiply_scalar": { + { + "name": "godot_vector2_operator_multiply_scalar", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_real", "p_b"] ] }, - "godot_vector2_operator_divide_vector": { + { + "name": "godot_vector2_operator_divide_vector", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_b"] ] }, - "godot_vector2_operator_divide_scalar": { + { + "name": "godot_vector2_operator_divide_scalar", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_real", "p_b"] ] }, - "godot_vector2_operator_equal": { + { + "name": "godot_vector2_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_b"] ] }, - "godot_vector2_operator_less": { + { + "name": "godot_vector2_operator_less", "return_type": "godot_bool", "arguments": [ ["const godot_vector2 *", "p_self"], ["const godot_vector2 *", "p_b"] ] }, - "godot_vector2_operator_neg": { + { + "name": "godot_vector2_operator_neg", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_set_x": { + { + "name": "godot_vector2_set_x", "return_type": "void", "arguments": [ ["godot_vector2 *", "p_self"], ["const godot_real", "p_x"] ] }, - "godot_vector2_set_y": { + { + "name": "godot_vector2_set_y", "return_type": "void", "arguments": [ ["godot_vector2 *", "p_self"], ["const godot_real", "p_y"] ] }, - "godot_vector2_get_x": { + { + "name": "godot_vector2_get_x", "return_type": "godot_real", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_vector2_get_y": { + { + "name": "godot_vector2_get_y", "return_type": "godot_real", "arguments": [ ["const godot_vector2 *", "p_self"] ] }, - "godot_quat_new": { + { + "name": "godot_quat_new", "return_type": "void", "arguments": [ ["godot_quat *", "r_dest"], @@ -423,7 +485,8 @@ ["const godot_real", "p_w"] ] }, - "godot_quat_new_with_axis_angle": { + { + "name": "godot_quat_new_with_axis_angle", "return_type": "void", "arguments": [ ["godot_quat *", "r_dest"], @@ -431,109 +494,126 @@ ["const godot_real", "p_angle"] ] }, - "godot_quat_get_x": { + { + "name": "godot_quat_get_x", "return_type": "godot_real", "arguments": [ ["const godot_quat *", "p_self"] ] }, - "godot_quat_set_x": { + { + "name": "godot_quat_set_x", "return_type": "void", "arguments": [ ["godot_quat *", "p_self"], ["const godot_real", "val"] ] }, - "godot_quat_get_y": { + { + "name": "godot_quat_get_y", "return_type": "godot_real", "arguments": [ ["const godot_quat *", "p_self"] ] }, - "godot_quat_set_y": { + { + "name": "godot_quat_set_y", "return_type": "void", "arguments": [ ["godot_quat *", "p_self"], ["const godot_real", "val"] ] }, - "godot_quat_get_z": { + { + "name": "godot_quat_get_z", "return_type": "godot_real", "arguments": [ ["const godot_quat *", "p_self"] ] }, - "godot_quat_set_z": { + { + "name": "godot_quat_set_z", "return_type": "void", "arguments": [ ["godot_quat *", "p_self"], ["const godot_real", "val"] ] }, - "godot_quat_get_w": { + { + "name": "godot_quat_get_w", "return_type": "godot_real", "arguments": [ ["const godot_quat *", "p_self"] ] }, - "godot_quat_set_w": { + { + "name": "godot_quat_set_w", "return_type": "void", "arguments": [ ["godot_quat *", "p_self"], ["const godot_real", "val"] ] }, - "godot_quat_as_string": { + { + "name": "godot_quat_as_string", "return_type": "godot_string", "arguments": [ ["const godot_quat *", "p_self"] ] }, - "godot_quat_length": { + { + "name": "godot_quat_length", "return_type": "godot_real", "arguments": [ ["const godot_quat *", "p_self"] ] }, - "godot_quat_length_squared": { + { + "name": "godot_quat_length_squared", "return_type": "godot_real", "arguments": [ ["const godot_quat *", "p_self"] ] }, - "godot_quat_normalized": { + { + "name": "godot_quat_normalized", "return_type": "godot_quat", "arguments": [ ["const godot_quat *", "p_self"] ] }, - "godot_quat_is_normalized": { + { + "name": "godot_quat_is_normalized", "return_type": "godot_bool", "arguments": [ ["const godot_quat *", "p_self"] ] }, - "godot_quat_inverse": { + { + "name": "godot_quat_inverse", "return_type": "godot_quat", "arguments": [ ["const godot_quat *", "p_self"] ] }, - "godot_quat_dot": { + { + "name": "godot_quat_dot", "return_type": "godot_real", "arguments": [ ["const godot_quat *", "p_self"], ["const godot_quat *", "p_b"] ] }, - "godot_quat_xform": { + { + "name": "godot_quat_xform", "return_type": "godot_vector3", "arguments": [ ["const godot_quat *", "p_self"], ["const godot_vector3 *", "p_v"] ] }, - "godot_quat_slerp": { + { + "name": "godot_quat_slerp", "return_type": "godot_quat", "arguments": [ ["const godot_quat *", "p_self"], @@ -541,7 +621,8 @@ ["const godot_real", "p_t"] ] }, - "godot_quat_slerpni": { + { + "name": "godot_quat_slerpni", "return_type": "godot_quat", "arguments": [ ["const godot_quat *", "p_self"], @@ -549,7 +630,8 @@ ["const godot_real", "p_t"] ] }, - "godot_quat_cubic_slerp": { + { + "name": "godot_quat_cubic_slerp", "return_type": "godot_quat", "arguments": [ ["const godot_quat *", "p_self"], @@ -559,48 +641,55 @@ ["const godot_real", "p_t"] ] }, - "godot_quat_operator_multiply": { + { + "name": "godot_quat_operator_multiply", "return_type": "godot_quat", "arguments": [ ["const godot_quat *", "p_self"], ["const godot_real", "p_b"] ] }, - "godot_quat_operator_add": { + { + "name": "godot_quat_operator_add", "return_type": "godot_quat", "arguments": [ ["const godot_quat *", "p_self"], ["const godot_quat *", "p_b"] ] }, - "godot_quat_operator_substract": { + { + "name": "godot_quat_operator_substract", "return_type": "godot_quat", "arguments": [ ["const godot_quat *", "p_self"], ["const godot_quat *", "p_b"] ] }, - "godot_quat_operator_divide": { + { + "name": "godot_quat_operator_divide", "return_type": "godot_quat", "arguments": [ ["const godot_quat *", "p_self"], ["const godot_real", "p_b"] ] }, - "godot_quat_operator_equal": { + { + "name": "godot_quat_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_quat *", "p_self"], ["const godot_quat *", "p_b"] ] }, - "godot_quat_operator_neg": { + { + "name": "godot_quat_operator_neg", "return_type": "godot_quat", "arguments": [ ["const godot_quat *", "p_self"] ] }, - "godot_basis_new_with_rows": { + { + "name": "godot_basis_new_with_rows", "return_type": "void", "arguments": [ ["godot_basis *", "r_dest"], @@ -609,7 +698,8 @@ ["const godot_vector3 *", "p_z_axis"] ] }, - "godot_basis_new_with_axis_and_angle": { + { + "name": "godot_basis_new_with_axis_and_angle", "return_type": "void", "arguments": [ ["godot_basis *", "r_dest"], @@ -617,44 +707,51 @@ ["const godot_real", "p_phi"] ] }, - "godot_basis_new_with_euler": { + { + "name": "godot_basis_new_with_euler", "return_type": "void", "arguments": [ ["godot_basis *", "r_dest"], ["const godot_vector3 *", "p_euler"] ] }, - "godot_basis_as_string": { + { + "name": "godot_basis_as_string", "return_type": "godot_string", "arguments": [ ["const godot_basis *", "p_self"] ] }, - "godot_basis_inverse": { + { + "name": "godot_basis_inverse", "return_type": "godot_basis", "arguments": [ ["const godot_basis *", "p_self"] ] }, - "godot_basis_transposed": { + { + "name": "godot_basis_transposed", "return_type": "godot_basis", "arguments": [ ["const godot_basis *", "p_self"] ] }, - "godot_basis_orthonormalized": { + { + "name": "godot_basis_orthonormalized", "return_type": "godot_basis", "arguments": [ ["const godot_basis *", "p_self"] ] }, - "godot_basis_determinant": { + { + "name": "godot_basis_determinant", "return_type": "godot_real", "arguments": [ ["const godot_basis *", "p_self"] ] }, - "godot_basis_rotated": { + { + "name": "godot_basis_rotated", "return_type": "godot_basis", "arguments": [ ["const godot_basis *", "p_self"], @@ -662,94 +759,108 @@ ["const godot_real", "p_phi"] ] }, - "godot_basis_scaled": { + { + "name": "godot_basis_scaled", "return_type": "godot_basis", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_vector3 *", "p_scale"] ] }, - "godot_basis_get_scale": { + { + "name": "godot_basis_get_scale", "return_type": "godot_vector3", "arguments": [ ["const godot_basis *", "p_self"] ] }, - "godot_basis_get_euler": { + { + "name": "godot_basis_get_euler", "return_type": "godot_vector3", "arguments": [ ["const godot_basis *", "p_self"] ] }, - "godot_basis_tdotx": { + { + "name": "godot_basis_tdotx", "return_type": "godot_real", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_vector3 *", "p_with"] ] }, - "godot_basis_tdoty": { + { + "name": "godot_basis_tdoty", "return_type": "godot_real", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_vector3 *", "p_with"] ] }, - "godot_basis_tdotz": { + { + "name": "godot_basis_tdotz", "return_type": "godot_real", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_vector3 *", "p_with"] ] }, - "godot_basis_xform": { + { + "name": "godot_basis_xform", "return_type": "godot_vector3", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_vector3 *", "p_v"] ] }, - "godot_basis_xform_inv": { + { + "name": "godot_basis_xform_inv", "return_type": "godot_vector3", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_vector3 *", "p_v"] ] }, - "godot_basis_get_orthogonal_index": { + { + "name": "godot_basis_get_orthogonal_index", "return_type": "godot_int", "arguments": [ ["const godot_basis *", "p_self"] ] }, - "godot_basis_new": { + { + "name": "godot_basis_new", "return_type": "void", "arguments": [ ["godot_basis *", "r_dest"] ] }, - "godot_basis_new_with_euler_quat": { + { + "name": "godot_basis_new_with_euler_quat", "return_type": "void", "arguments": [ ["godot_basis *", "r_dest"], ["const godot_quat *", "p_euler"] ] }, - "godot_basis_get_elements": { + { + "name": "godot_basis_get_elements", "return_type": "void", "arguments": [ ["godot_basis *", "p_self"], ["godot_vector3 *", "p_elements"] ] }, - "godot_basis_get_axis": { + { + "name": "godot_basis_get_axis", "return_type": "godot_vector3", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_int", "p_axis"] ] }, - "godot_basis_set_axis": { + { + "name": "godot_basis_set_axis", "return_type": "void", "arguments": [ ["godot_basis *", "p_self"], @@ -757,14 +868,16 @@ ["const godot_vector3 *", "p_value"] ] }, - "godot_basis_get_row": { + { + "name": "godot_basis_get_row", "return_type": "godot_vector3", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_int", "p_row"] ] }, - "godot_basis_set_row": { + { + "name": "godot_basis_set_row", "return_type": "void", "arguments": [ ["godot_basis *", "p_self"], @@ -772,42 +885,48 @@ ["const godot_vector3 *", "p_value"] ] }, - "godot_basis_operator_equal": { + { + "name": "godot_basis_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_basis *", "p_b"] ] }, - "godot_basis_operator_add": { + { + "name": "godot_basis_operator_add", "return_type": "godot_basis", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_basis *", "p_b"] ] }, - "godot_basis_operator_substract": { + { + "name": "godot_basis_operator_substract", "return_type": "godot_basis", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_basis *", "p_b"] ] }, - "godot_basis_operator_multiply_vector": { + { + "name": "godot_basis_operator_multiply_vector", "return_type": "godot_basis", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_basis *", "p_b"] ] }, - "godot_basis_operator_multiply_scalar": { + { + "name": "godot_basis_operator_multiply_scalar", "return_type": "godot_basis", "arguments": [ ["const godot_basis *", "p_self"], ["const godot_real", "p_b"] ] }, - "godot_vector3_new": { + { + "name": "godot_vector3_new", "return_type": "void", "arguments": [ ["godot_vector3 *", "r_dest"], @@ -816,62 +935,72 @@ ["const godot_real", "p_z"] ] }, - "godot_vector3_as_string": { + { + "name": "godot_vector3_as_string", "return_type": "godot_string", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_min_axis": { + { + "name": "godot_vector3_min_axis", "return_type": "godot_int", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_max_axis": { + { + "name": "godot_vector3_max_axis", "return_type": "godot_int", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_length": { + { + "name": "godot_vector3_length", "return_type": "godot_real", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_length_squared": { + { + "name": "godot_vector3_length_squared", "return_type": "godot_real", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_is_normalized": { + { + "name": "godot_vector3_is_normalized", "return_type": "godot_bool", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_normalized": { + { + "name": "godot_vector3_normalized", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_inverse": { + { + "name": "godot_vector3_inverse", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_snapped": { + { + "name": "godot_vector3_snapped", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_by"] ] }, - "godot_vector3_rotated": { + { + "name": "godot_vector3_rotated", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], @@ -879,7 +1008,8 @@ ["const godot_real", "p_phi"] ] }, - "godot_vector3_linear_interpolate": { + { + "name": "godot_vector3_linear_interpolate", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], @@ -887,7 +1017,8 @@ ["const godot_real", "p_t"] ] }, - "godot_vector3_cubic_interpolate": { + { + "name": "godot_vector3_cubic_interpolate", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], @@ -897,156 +1028,179 @@ ["const godot_real", "p_t"] ] }, - "godot_vector3_dot": { + { + "name": "godot_vector3_dot", "return_type": "godot_real", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_b"] ] }, - "godot_vector3_cross": { + { + "name": "godot_vector3_cross", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_b"] ] }, - "godot_vector3_outer": { + { + "name": "godot_vector3_outer", "return_type": "godot_basis", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_b"] ] }, - "godot_vector3_to_diagonal_matrix": { + { + "name": "godot_vector3_to_diagonal_matrix", "return_type": "godot_basis", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_abs": { + { + "name": "godot_vector3_abs", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_floor": { + { + "name": "godot_vector3_floor", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_ceil": { + { + "name": "godot_vector3_ceil", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_distance_to": { + { + "name": "godot_vector3_distance_to", "return_type": "godot_real", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_b"] ] }, - "godot_vector3_distance_squared_to": { + { + "name": "godot_vector3_distance_squared_to", "return_type": "godot_real", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_b"] ] }, - "godot_vector3_angle_to": { + { + "name": "godot_vector3_angle_to", "return_type": "godot_real", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_to"] ] }, - "godot_vector3_slide": { + { + "name": "godot_vector3_slide", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_n"] ] }, - "godot_vector3_bounce": { + { + "name": "godot_vector3_bounce", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_n"] ] }, - "godot_vector3_reflect": { + { + "name": "godot_vector3_reflect", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_n"] ] }, - "godot_vector3_operator_add": { + { + "name": "godot_vector3_operator_add", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_b"] ] }, - "godot_vector3_operator_substract": { + { + "name": "godot_vector3_operator_substract", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_b"] ] }, - "godot_vector3_operator_multiply_vector": { + { + "name": "godot_vector3_operator_multiply_vector", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_b"] ] }, - "godot_vector3_operator_multiply_scalar": { + { + "name": "godot_vector3_operator_multiply_scalar", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_real", "p_b"] ] }, - "godot_vector3_operator_divide_vector": { + { + "name": "godot_vector3_operator_divide_vector", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_b"] ] }, - "godot_vector3_operator_divide_scalar": { + { + "name": "godot_vector3_operator_divide_scalar", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_real", "p_b"] ] }, - "godot_vector3_operator_equal": { + { + "name": "godot_vector3_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_b"] ] }, - "godot_vector3_operator_less": { + { + "name": "godot_vector3_operator_less", "return_type": "godot_bool", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3 *", "p_b"] ] }, - "godot_vector3_operator_neg": { + { + "name": "godot_vector3_operator_neg", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"] ] }, - "godot_vector3_set_axis": { + { + "name": "godot_vector3_set_axis", "return_type": "void", "arguments": [ ["godot_vector3 *", "p_self"], @@ -1054,48 +1208,55 @@ ["const godot_real", "p_val"] ] }, - "godot_vector3_get_axis": { + { + "name": "godot_vector3_get_axis", "return_type": "godot_real", "arguments": [ ["const godot_vector3 *", "p_self"], ["const godot_vector3_axis", "p_axis"] ] }, - "godot_pool_byte_array_new": { + { + "name": "godot_pool_byte_array_new", "return_type": "void", "arguments": [ ["godot_pool_byte_array *", "r_dest"] ] }, - "godot_pool_byte_array_new_copy": { + { + "name": "godot_pool_byte_array_new_copy", "return_type": "void", "arguments": [ ["godot_pool_byte_array *", "r_dest"], ["const godot_pool_byte_array *", "p_src"] ] }, - "godot_pool_byte_array_new_with_array": { + { + "name": "godot_pool_byte_array_new_with_array", "return_type": "void", "arguments": [ ["godot_pool_byte_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, - "godot_pool_byte_array_append": { + { + "name": "godot_pool_byte_array_append", "return_type": "void", "arguments": [ ["godot_pool_byte_array *", "p_self"], ["const uint8_t", "p_data"] ] }, - "godot_pool_byte_array_append_array": { + { + "name": "godot_pool_byte_array_append_array", "return_type": "void", "arguments": [ ["godot_pool_byte_array *", "p_self"], ["const godot_pool_byte_array *", "p_array"] ] }, - "godot_pool_byte_array_insert": { + { + "name": "godot_pool_byte_array_insert", "return_type": "godot_error", "arguments": [ ["godot_pool_byte_array *", "p_self"], @@ -1103,34 +1264,39 @@ ["const uint8_t", "p_data"] ] }, - "godot_pool_byte_array_invert": { + { + "name": "godot_pool_byte_array_invert", "return_type": "void", "arguments": [ ["godot_pool_byte_array *", "p_self"] ] }, - "godot_pool_byte_array_push_back": { + { + "name": "godot_pool_byte_array_push_back", "return_type": "void", "arguments": [ ["godot_pool_byte_array *", "p_self"], ["const uint8_t", "p_data"] ] }, - "godot_pool_byte_array_remove": { + { + "name": "godot_pool_byte_array_remove", "return_type": "void", "arguments": [ ["godot_pool_byte_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_byte_array_resize": { + { + "name": "godot_pool_byte_array_resize", "return_type": "void", "arguments": [ ["godot_pool_byte_array *", "p_self"], ["const godot_int", "p_size"] ] }, - "godot_pool_byte_array_set": { + { + "name": "godot_pool_byte_array_set", "return_type": "void", "arguments": [ ["godot_pool_byte_array *", "p_self"], @@ -1138,60 +1304,69 @@ ["const uint8_t", "p_data"] ] }, - "godot_pool_byte_array_get": { + { + "name": "godot_pool_byte_array_get", "return_type": "uint8_t", "arguments": [ ["const godot_pool_byte_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_byte_array_size": { + { + "name": "godot_pool_byte_array_size", "return_type": "godot_int", "arguments": [ ["const godot_pool_byte_array *", "p_self"] ] }, - "godot_pool_byte_array_destroy": { + { + "name": "godot_pool_byte_array_destroy", "return_type": "void", "arguments": [ ["godot_pool_byte_array *", "p_self"] ] }, - "godot_pool_int_array_new": { + { + "name": "godot_pool_int_array_new", "return_type": "void", "arguments": [ ["godot_pool_int_array *", "r_dest"] ] }, - "godot_pool_int_array_new_copy": { + { + "name": "godot_pool_int_array_new_copy", "return_type": "void", "arguments": [ ["godot_pool_int_array *", "r_dest"], ["const godot_pool_int_array *", "p_src"] ] }, - "godot_pool_int_array_new_with_array": { + { + "name": "godot_pool_int_array_new_with_array", "return_type": "void", "arguments": [ ["godot_pool_int_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, - "godot_pool_int_array_append": { + { + "name": "godot_pool_int_array_append", "return_type": "void", "arguments": [ ["godot_pool_int_array *", "p_self"], ["const godot_int", "p_data"] ] }, - "godot_pool_int_array_append_array": { + { + "name": "godot_pool_int_array_append_array", "return_type": "void", "arguments": [ ["godot_pool_int_array *", "p_self"], ["const godot_pool_int_array *", "p_array"] ] }, - "godot_pool_int_array_insert": { + { + "name": "godot_pool_int_array_insert", "return_type": "godot_error", "arguments": [ ["godot_pool_int_array *", "p_self"], @@ -1199,34 +1374,39 @@ ["const godot_int", "p_data"] ] }, - "godot_pool_int_array_invert": { + { + "name": "godot_pool_int_array_invert", "return_type": "void", "arguments": [ ["godot_pool_int_array *", "p_self"] ] }, - "godot_pool_int_array_push_back": { + { + "name": "godot_pool_int_array_push_back", "return_type": "void", "arguments": [ ["godot_pool_int_array *", "p_self"], ["const godot_int", "p_data"] ] }, - "godot_pool_int_array_remove": { + { + "name": "godot_pool_int_array_remove", "return_type": "void", "arguments": [ ["godot_pool_int_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_int_array_resize": { + { + "name": "godot_pool_int_array_resize", "return_type": "void", "arguments": [ ["godot_pool_int_array *", "p_self"], ["const godot_int", "p_size"] ] }, - "godot_pool_int_array_set": { + { + "name": "godot_pool_int_array_set", "return_type": "void", "arguments": [ ["godot_pool_int_array *", "p_self"], @@ -1234,60 +1414,69 @@ ["const godot_int", "p_data"] ] }, - "godot_pool_int_array_get": { + { + "name": "godot_pool_int_array_get", "return_type": "godot_int", "arguments": [ ["const godot_pool_int_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_int_array_size": { + { + "name": "godot_pool_int_array_size", "return_type": "godot_int", "arguments": [ ["const godot_pool_int_array *", "p_self"] ] }, - "godot_pool_int_array_destroy": { + { + "name": "godot_pool_int_array_destroy", "return_type": "void", "arguments": [ ["godot_pool_int_array *", "p_self"] ] }, - "godot_pool_real_array_new": { + { + "name": "godot_pool_real_array_new", "return_type": "void", "arguments": [ ["godot_pool_real_array *", "r_dest"] ] }, - "godot_pool_real_array_new_copy": { + { + "name": "godot_pool_real_array_new_copy", "return_type": "void", "arguments": [ ["godot_pool_real_array *", "r_dest"], ["const godot_pool_real_array *", "p_src"] ] }, - "godot_pool_real_array_new_with_array": { + { + "name": "godot_pool_real_array_new_with_array", "return_type": "void", "arguments": [ ["godot_pool_real_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, - "godot_pool_real_array_append": { + { + "name": "godot_pool_real_array_append", "return_type": "void", "arguments": [ ["godot_pool_real_array *", "p_self"], ["const godot_real", "p_data"] ] }, - "godot_pool_real_array_append_array": { + { + "name": "godot_pool_real_array_append_array", "return_type": "void", "arguments": [ ["godot_pool_real_array *", "p_self"], ["const godot_pool_real_array *", "p_array"] ] }, - "godot_pool_real_array_insert": { + { + "name": "godot_pool_real_array_insert", "return_type": "godot_error", "arguments": [ ["godot_pool_real_array *", "p_self"], @@ -1295,34 +1484,39 @@ ["const godot_real", "p_data"] ] }, - "godot_pool_real_array_invert": { + { + "name": "godot_pool_real_array_invert", "return_type": "void", "arguments": [ ["godot_pool_real_array *", "p_self"] ] }, - "godot_pool_real_array_push_back": { + { + "name": "godot_pool_real_array_push_back", "return_type": "void", "arguments": [ ["godot_pool_real_array *", "p_self"], ["const godot_real", "p_data"] ] }, - "godot_pool_real_array_remove": { + { + "name": "godot_pool_real_array_remove", "return_type": "void", "arguments": [ ["godot_pool_real_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_real_array_resize": { + { + "name": "godot_pool_real_array_resize", "return_type": "void", "arguments": [ ["godot_pool_real_array *", "p_self"], ["const godot_int", "p_size"] ] }, - "godot_pool_real_array_set": { + { + "name": "godot_pool_real_array_set", "return_type": "void", "arguments": [ ["godot_pool_real_array *", "p_self"], @@ -1330,60 +1524,69 @@ ["const godot_real", "p_data"] ] }, - "godot_pool_real_array_get": { + { + "name": "godot_pool_real_array_get", "return_type": "godot_real", "arguments": [ ["const godot_pool_real_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_real_array_size": { + { + "name": "godot_pool_real_array_size", "return_type": "godot_int", "arguments": [ ["const godot_pool_real_array *", "p_self"] ] }, - "godot_pool_real_array_destroy": { + { + "name": "godot_pool_real_array_destroy", "return_type": "void", "arguments": [ ["godot_pool_real_array *", "p_self"] ] }, - "godot_pool_string_array_new": { + { + "name": "godot_pool_string_array_new", "return_type": "void", "arguments": [ ["godot_pool_string_array *", "r_dest"] ] }, - "godot_pool_string_array_new_copy": { + { + "name": "godot_pool_string_array_new_copy", "return_type": "void", "arguments": [ ["godot_pool_string_array *", "r_dest"], ["const godot_pool_string_array *", "p_src"] ] }, - "godot_pool_string_array_new_with_array": { + { + "name": "godot_pool_string_array_new_with_array", "return_type": "void", "arguments": [ ["godot_pool_string_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, - "godot_pool_string_array_append": { + { + "name": "godot_pool_string_array_append", "return_type": "void", "arguments": [ ["godot_pool_string_array *", "p_self"], ["const godot_string *", "p_data"] ] }, - "godot_pool_string_array_append_array": { + { + "name": "godot_pool_string_array_append_array", "return_type": "void", "arguments": [ ["godot_pool_string_array *", "p_self"], ["const godot_pool_string_array *", "p_array"] ] }, - "godot_pool_string_array_insert": { + { + "name": "godot_pool_string_array_insert", "return_type": "godot_error", "arguments": [ ["godot_pool_string_array *", "p_self"], @@ -1391,34 +1594,39 @@ ["const godot_string *", "p_data"] ] }, - "godot_pool_string_array_invert": { + { + "name": "godot_pool_string_array_invert", "return_type": "void", "arguments": [ ["godot_pool_string_array *", "p_self"] ] }, - "godot_pool_string_array_push_back": { + { + "name": "godot_pool_string_array_push_back", "return_type": "void", "arguments": [ ["godot_pool_string_array *", "p_self"], ["const godot_string *", "p_data"] ] }, - "godot_pool_string_array_remove": { + { + "name": "godot_pool_string_array_remove", "return_type": "void", "arguments": [ ["godot_pool_string_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_string_array_resize": { + { + "name": "godot_pool_string_array_resize", "return_type": "void", "arguments": [ ["godot_pool_string_array *", "p_self"], ["const godot_int", "p_size"] ] }, - "godot_pool_string_array_set": { + { + "name": "godot_pool_string_array_set", "return_type": "void", "arguments": [ ["godot_pool_string_array *", "p_self"], @@ -1426,60 +1634,69 @@ ["const godot_string *", "p_data"] ] }, - "godot_pool_string_array_get": { + { + "name": "godot_pool_string_array_get", "return_type": "godot_string", "arguments": [ ["const godot_pool_string_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_string_array_size": { + { + "name": "godot_pool_string_array_size", "return_type": "godot_int", "arguments": [ ["const godot_pool_string_array *", "p_self"] ] }, - "godot_pool_string_array_destroy": { + { + "name": "godot_pool_string_array_destroy", "return_type": "void", "arguments": [ ["godot_pool_string_array *", "p_self"] ] }, - "godot_pool_vector2_array_new": { + { + "name": "godot_pool_vector2_array_new", "return_type": "void", "arguments": [ ["godot_pool_vector2_array *", "r_dest"] ] }, - "godot_pool_vector2_array_new_copy": { + { + "name": "godot_pool_vector2_array_new_copy", "return_type": "void", "arguments": [ ["godot_pool_vector2_array *", "r_dest"], ["const godot_pool_vector2_array *", "p_src"] ] }, - "godot_pool_vector2_array_new_with_array": { + { + "name": "godot_pool_vector2_array_new_with_array", "return_type": "void", "arguments": [ ["godot_pool_vector2_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, - "godot_pool_vector2_array_append": { + { + "name": "godot_pool_vector2_array_append", "return_type": "void", "arguments": [ ["godot_pool_vector2_array *", "p_self"], ["const godot_vector2 *", "p_data"] ] }, - "godot_pool_vector2_array_append_array": { + { + "name": "godot_pool_vector2_array_append_array", "return_type": "void", "arguments": [ ["godot_pool_vector2_array *", "p_self"], ["const godot_pool_vector2_array *", "p_array"] ] }, - "godot_pool_vector2_array_insert": { + { + "name": "godot_pool_vector2_array_insert", "return_type": "godot_error", "arguments": [ ["godot_pool_vector2_array *", "p_self"], @@ -1487,34 +1704,39 @@ ["const godot_vector2 *", "p_data"] ] }, - "godot_pool_vector2_array_invert": { + { + "name": "godot_pool_vector2_array_invert", "return_type": "void", "arguments": [ ["godot_pool_vector2_array *", "p_self"] ] }, - "godot_pool_vector2_array_push_back": { + { + "name": "godot_pool_vector2_array_push_back", "return_type": "void", "arguments": [ ["godot_pool_vector2_array *", "p_self"], ["const godot_vector2 *", "p_data"] ] }, - "godot_pool_vector2_array_remove": { + { + "name": "godot_pool_vector2_array_remove", "return_type": "void", "arguments": [ ["godot_pool_vector2_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_vector2_array_resize": { + { + "name": "godot_pool_vector2_array_resize", "return_type": "void", "arguments": [ ["godot_pool_vector2_array *", "p_self"], ["const godot_int", "p_size"] ] }, - "godot_pool_vector2_array_set": { + { + "name": "godot_pool_vector2_array_set", "return_type": "void", "arguments": [ ["godot_pool_vector2_array *", "p_self"], @@ -1522,60 +1744,69 @@ ["const godot_vector2 *", "p_data"] ] }, - "godot_pool_vector2_array_get": { + { + "name": "godot_pool_vector2_array_get", "return_type": "godot_vector2", "arguments": [ ["const godot_pool_vector2_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_vector2_array_size": { + { + "name": "godot_pool_vector2_array_size", "return_type": "godot_int", "arguments": [ ["const godot_pool_vector2_array *", "p_self"] ] }, - "godot_pool_vector2_array_destroy": { + { + "name": "godot_pool_vector2_array_destroy", "return_type": "void", "arguments": [ ["godot_pool_vector2_array *", "p_self"] ] }, - "godot_pool_vector3_array_new": { + { + "name": "godot_pool_vector3_array_new", "return_type": "void", "arguments": [ ["godot_pool_vector3_array *", "r_dest"] ] }, - "godot_pool_vector3_array_new_copy": { + { + "name": "godot_pool_vector3_array_new_copy", "return_type": "void", "arguments": [ ["godot_pool_vector3_array *", "r_dest"], ["const godot_pool_vector3_array *", "p_src"] ] }, - "godot_pool_vector3_array_new_with_array": { + { + "name": "godot_pool_vector3_array_new_with_array", "return_type": "void", "arguments": [ ["godot_pool_vector3_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, - "godot_pool_vector3_array_append": { + { + "name": "godot_pool_vector3_array_append", "return_type": "void", "arguments": [ ["godot_pool_vector3_array *", "p_self"], ["const godot_vector3 *", "p_data"] ] }, - "godot_pool_vector3_array_append_array": { + { + "name": "godot_pool_vector3_array_append_array", "return_type": "void", "arguments": [ ["godot_pool_vector3_array *", "p_self"], ["const godot_pool_vector3_array *", "p_array"] ] }, - "godot_pool_vector3_array_insert": { + { + "name": "godot_pool_vector3_array_insert", "return_type": "godot_error", "arguments": [ ["godot_pool_vector3_array *", "p_self"], @@ -1583,34 +1814,39 @@ ["const godot_vector3 *", "p_data"] ] }, - "godot_pool_vector3_array_invert": { + { + "name": "godot_pool_vector3_array_invert", "return_type": "void", "arguments": [ ["godot_pool_vector3_array *", "p_self"] ] }, - "godot_pool_vector3_array_push_back": { + { + "name": "godot_pool_vector3_array_push_back", "return_type": "void", "arguments": [ ["godot_pool_vector3_array *", "p_self"], ["const godot_vector3 *", "p_data"] ] }, - "godot_pool_vector3_array_remove": { + { + "name": "godot_pool_vector3_array_remove", "return_type": "void", "arguments": [ ["godot_pool_vector3_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_vector3_array_resize": { + { + "name": "godot_pool_vector3_array_resize", "return_type": "void", "arguments": [ ["godot_pool_vector3_array *", "p_self"], ["const godot_int", "p_size"] ] }, - "godot_pool_vector3_array_set": { + { + "name": "godot_pool_vector3_array_set", "return_type": "void", "arguments": [ ["godot_pool_vector3_array *", "p_self"], @@ -1618,60 +1854,69 @@ ["const godot_vector3 *", "p_data"] ] }, - "godot_pool_vector3_array_get": { + { + "name": "godot_pool_vector3_array_get", "return_type": "godot_vector3", "arguments": [ ["const godot_pool_vector3_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_vector3_array_size": { + { + "name": "godot_pool_vector3_array_size", "return_type": "godot_int", "arguments": [ ["const godot_pool_vector3_array *", "p_self"] ] }, - "godot_pool_vector3_array_destroy": { + { + "name": "godot_pool_vector3_array_destroy", "return_type": "void", "arguments": [ ["godot_pool_vector3_array *", "p_self"] ] }, - "godot_pool_color_array_new": { + { + "name": "godot_pool_color_array_new", "return_type": "void", "arguments": [ ["godot_pool_color_array *", "r_dest"] ] }, - "godot_pool_color_array_new_copy": { + { + "name": "godot_pool_color_array_new_copy", "return_type": "void", "arguments": [ ["godot_pool_color_array *", "r_dest"], ["const godot_pool_color_array *", "p_src"] ] }, - "godot_pool_color_array_new_with_array": { + { + "name": "godot_pool_color_array_new_with_array", "return_type": "void", "arguments": [ ["godot_pool_color_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, - "godot_pool_color_array_append": { + { + "name": "godot_pool_color_array_append", "return_type": "void", "arguments": [ ["godot_pool_color_array *", "p_self"], ["const godot_color *", "p_data"] ] }, - "godot_pool_color_array_append_array": { + { + "name": "godot_pool_color_array_append_array", "return_type": "void", "arguments": [ ["godot_pool_color_array *", "p_self"], ["const godot_pool_color_array *", "p_array"] ] }, - "godot_pool_color_array_insert": { + { + "name": "godot_pool_color_array_insert", "return_type": "godot_error", "arguments": [ ["godot_pool_color_array *", "p_self"], @@ -1679,34 +1924,39 @@ ["const godot_color *", "p_data"] ] }, - "godot_pool_color_array_invert": { + { + "name": "godot_pool_color_array_invert", "return_type": "void", "arguments": [ ["godot_pool_color_array *", "p_self"] ] }, - "godot_pool_color_array_push_back": { + { + "name": "godot_pool_color_array_push_back", "return_type": "void", "arguments": [ ["godot_pool_color_array *", "p_self"], ["const godot_color *", "p_data"] ] }, - "godot_pool_color_array_remove": { + { + "name": "godot_pool_color_array_remove", "return_type": "void", "arguments": [ ["godot_pool_color_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_color_array_resize": { + { + "name": "godot_pool_color_array_resize", "return_type": "void", "arguments": [ ["godot_pool_color_array *", "p_self"], ["const godot_int", "p_size"] ] }, - "godot_pool_color_array_set": { + { + "name": "godot_pool_color_array_set", "return_type": "void", "arguments": [ ["godot_pool_color_array *", "p_self"], @@ -1714,88 +1964,101 @@ ["const godot_color *", "p_data"] ] }, - "godot_pool_color_array_get": { + { + "name": "godot_pool_color_array_get", "return_type": "godot_color", "arguments": [ ["const godot_pool_color_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_pool_color_array_size": { + { + "name": "godot_pool_color_array_size", "return_type": "godot_int", "arguments": [ ["const godot_pool_color_array *", "p_self"] ] }, - "godot_pool_color_array_destroy": { + { + "name": "godot_pool_color_array_destroy", "return_type": "void", "arguments": [ ["godot_pool_color_array *", "p_self"] ] }, - "godot_array_new": { + { + "name": "godot_array_new", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"] ] }, - "godot_array_new_copy": { + { + "name": "godot_array_new_copy", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], ["const godot_array *", "p_src"] ] }, - "godot_array_new_pool_color_array": { + { + "name": "godot_array_new_pool_color_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], ["const godot_pool_color_array *", "p_pca"] ] }, - "godot_array_new_pool_vector3_array": { + { + "name": "godot_array_new_pool_vector3_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], ["const godot_pool_vector3_array *", "p_pv3a"] ] }, - "godot_array_new_pool_vector2_array": { + { + "name": "godot_array_new_pool_vector2_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], ["const godot_pool_vector2_array *", "p_pv2a"] ] }, - "godot_array_new_pool_string_array": { + { + "name": "godot_array_new_pool_string_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], ["const godot_pool_string_array *", "p_psa"] ] }, - "godot_array_new_pool_real_array": { + { + "name": "godot_array_new_pool_real_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], ["const godot_pool_real_array *", "p_pra"] ] }, - "godot_array_new_pool_int_array": { + { + "name": "godot_array_new_pool_int_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], ["const godot_pool_int_array *", "p_pia"] ] }, - "godot_array_new_pool_byte_array": { + { + "name": "godot_array_new_pool_byte_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], ["const godot_pool_byte_array *", "p_pba"] ] }, - "godot_array_set": { + { + "name": "godot_array_set", "return_type": "void", "arguments": [ ["godot_array *", "p_self"], @@ -1803,66 +2066,76 @@ ["const godot_variant *", "p_value"] ] }, - "godot_array_get": { + { + "name": "godot_array_get", "return_type": "godot_variant", "arguments": [ ["const godot_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_array_operator_index": { + { + "name": "godot_array_operator_index", "return_type": "godot_variant *", "arguments": [ ["godot_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_array_append": { + { + "name": "godot_array_append", "return_type": "void", "arguments": [ ["godot_array *", "p_self"], ["const godot_variant *", "p_value"] ] }, - "godot_array_clear": { + { + "name": "godot_array_clear", "return_type": "void", "arguments": [ ["godot_array *", "p_self"] ] }, - "godot_array_count": { + { + "name": "godot_array_count", "return_type": "godot_int", "arguments": [ ["const godot_array *", "p_self"], ["const godot_variant *", "p_value"] ] }, - "godot_array_empty": { + { + "name": "godot_array_empty", "return_type": "godot_bool", "arguments": [ ["const godot_array *", "p_self"] ] }, - "godot_array_erase": { + { + "name": "godot_array_erase", "return_type": "void", "arguments": [ ["godot_array *", "p_self"], ["const godot_variant *", "p_value"] ] }, - "godot_array_front": { + { + "name": "godot_array_front", "return_type": "godot_variant", "arguments": [ ["const godot_array *", "p_self"] ] }, - "godot_array_back": { + { + "name": "godot_array_back", "return_type": "godot_variant", "arguments": [ ["const godot_array *", "p_self"] ] }, - "godot_array_find": { + { + "name": "godot_array_find", "return_type": "godot_int", "arguments": [ ["const godot_array *", "p_self"], @@ -1870,27 +2143,31 @@ ["const godot_int", "p_from"] ] }, - "godot_array_find_last": { + { + "name": "godot_array_find_last", "return_type": "godot_int", "arguments": [ ["const godot_array *", "p_self"], ["const godot_variant *", "p_what"] ] }, - "godot_array_has": { + { + "name": "godot_array_has", "return_type": "godot_bool", "arguments": [ ["const godot_array *", "p_self"], ["const godot_variant *", "p_value"] ] }, - "godot_array_hash": { + { + "name": "godot_array_hash", "return_type": "godot_int", "arguments": [ ["const godot_array *", "p_self"] ] }, - "godot_array_insert": { + { + "name": "godot_array_insert", "return_type": "void", "arguments": [ ["godot_array *", "p_self"], @@ -1898,53 +2175,61 @@ ["const godot_variant *", "p_value"] ] }, - "godot_array_invert": { + { + "name": "godot_array_invert", "return_type": "void", "arguments": [ ["godot_array *", "p_self"] ] }, - "godot_array_pop_back": { + { + "name": "godot_array_pop_back", "return_type": "godot_variant", "arguments": [ ["godot_array *", "p_self"] ] }, - "godot_array_pop_front": { + { + "name": "godot_array_pop_front", "return_type": "godot_variant", "arguments": [ ["godot_array *", "p_self"] ] }, - "godot_array_push_back": { + { + "name": "godot_array_push_back", "return_type": "void", "arguments": [ ["godot_array *", "p_self"], ["const godot_variant *", "p_value"] ] }, - "godot_array_push_front": { + { + "name": "godot_array_push_front", "return_type": "void", "arguments": [ ["godot_array *", "p_self"], ["const godot_variant *", "p_value"] ] }, - "godot_array_remove": { + { + "name": "godot_array_remove", "return_type": "void", "arguments": [ ["godot_array *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_array_resize": { + { + "name": "godot_array_resize", "return_type": "void", "arguments": [ ["godot_array *", "p_self"], ["const godot_int", "p_size"] ] }, - "godot_array_rfind": { + { + "name": "godot_array_rfind", "return_type": "godot_int", "arguments": [ ["const godot_array *", "p_self"], @@ -1952,19 +2237,22 @@ ["const godot_int", "p_from"] ] }, - "godot_array_size": { + { + "name": "godot_array_size", "return_type": "godot_int", "arguments": [ ["const godot_array *", "p_self"] ] }, - "godot_array_sort": { + { + "name": "godot_array_sort", "return_type": "void", "arguments": [ ["godot_array *", "p_self"] ] }, - "godot_array_sort_custom": { + { + "name": "godot_array_sort_custom", "return_type": "void", "arguments": [ ["godot_array *", "p_self"], @@ -1972,96 +2260,111 @@ ["const godot_string *", "p_func"] ] }, - "godot_array_destroy": { + { + "name": "godot_array_destroy", "return_type": "void", "arguments": [ ["godot_array *", "p_self"] ] }, - "godot_dictionary_new": { + { + "name": "godot_dictionary_new", "return_type": "void", "arguments": [ ["godot_dictionary *", "r_dest"] ] }, - "godot_dictionary_new_copy": { + { + "name": "godot_dictionary_new_copy", "return_type": "void", "arguments": [ ["godot_dictionary *", "r_dest"], ["const godot_dictionary *", "p_src"] ] }, - "godot_dictionary_destroy": { + { + "name": "godot_dictionary_destroy", "return_type": "void", "arguments": [ ["godot_dictionary *", "p_self"] ] }, - "godot_dictionary_size": { + { + "name": "godot_dictionary_size", "return_type": "godot_int", "arguments": [ ["const godot_dictionary *", "p_self"] ] }, - "godot_dictionary_empty": { + { + "name": "godot_dictionary_empty", "return_type": "godot_bool", "arguments": [ ["const godot_dictionary *", "p_self"] ] }, - "godot_dictionary_clear": { + { + "name": "godot_dictionary_clear", "return_type": "void", "arguments": [ ["godot_dictionary *", "p_self"] ] }, - "godot_dictionary_has": { + { + "name": "godot_dictionary_has", "return_type": "godot_bool", "arguments": [ ["const godot_dictionary *", "p_self"], ["const godot_variant *", "p_key"] ] }, - "godot_dictionary_has_all": { + { + "name": "godot_dictionary_has_all", "return_type": "godot_bool", "arguments": [ ["const godot_dictionary *", "p_self"], ["const godot_array *", "p_keys"] ] }, - "godot_dictionary_erase": { + { + "name": "godot_dictionary_erase", "return_type": "void", "arguments": [ ["godot_dictionary *", "p_self"], ["const godot_variant *", "p_key"] ] }, - "godot_dictionary_hash": { + { + "name": "godot_dictionary_hash", "return_type": "godot_int", "arguments": [ ["const godot_dictionary *", "p_self"] ] }, - "godot_dictionary_keys": { + { + "name": "godot_dictionary_keys", "return_type": "godot_array", "arguments": [ ["const godot_dictionary *", "p_self"] ] }, - "godot_dictionary_values": { + { + "name": "godot_dictionary_values", "return_type": "godot_array", "arguments": [ ["const godot_dictionary *", "p_self"] ] }, - "godot_dictionary_get": { + { + "name": "godot_dictionary_get", "return_type": "godot_variant", "arguments": [ ["const godot_dictionary *", "p_self"], ["const godot_variant *", "p_key"] ] }, - "godot_dictionary_set": { + { + "name": "godot_dictionary_set", "return_type": "void", "arguments": [ ["godot_dictionary *", "p_self"], @@ -2069,111 +2372,128 @@ ["const godot_variant *", "p_value"] ] }, - "godot_dictionary_operator_index": { + { + "name": "godot_dictionary_operator_index", "return_type": "godot_variant *", "arguments": [ ["godot_dictionary *", "p_self"], ["const godot_variant *", "p_key"] ] }, - "godot_dictionary_next": { + { + "name": "godot_dictionary_next", "return_type": "godot_variant *", "arguments": [ ["const godot_dictionary *", "p_self"], ["const godot_variant *", "p_key"] ] }, - "godot_dictionary_operator_equal": { + { + "name": "godot_dictionary_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_dictionary *", "p_self"], ["const godot_dictionary *", "p_b"] ] }, - "godot_dictionary_to_json": { + { + "name": "godot_dictionary_to_json", "return_type": "godot_string", "arguments": [ ["const godot_dictionary *", "p_self"] ] }, - "godot_node_path_new": { + { + "name": "godot_node_path_new", "return_type": "void", "arguments": [ ["godot_node_path *", "r_dest"], ["const godot_string *", "p_from"] ] }, - "godot_node_path_new_copy": { + { + "name": "godot_node_path_new_copy", "return_type": "void", "arguments": [ ["godot_node_path *", "r_dest"], ["const godot_node_path *", "p_src"] ] }, - "godot_node_path_destroy": { + { + "name": "godot_node_path_destroy", "return_type": "void", "arguments": [ ["godot_node_path *", "p_self"] ] }, - "godot_node_path_as_string": { + { + "name": "godot_node_path_as_string", "return_type": "godot_string", "arguments": [ ["const godot_node_path *", "p_self"] ] }, - "godot_node_path_is_absolute": { + { + "name": "godot_node_path_is_absolute", "return_type": "godot_bool", "arguments": [ ["const godot_node_path *", "p_self"] ] }, - "godot_node_path_get_name_count": { + { + "name": "godot_node_path_get_name_count", "return_type": "godot_int", "arguments": [ ["const godot_node_path *", "p_self"] ] }, - "godot_node_path_get_name": { + { + "name": "godot_node_path_get_name", "return_type": "godot_string", "arguments": [ ["const godot_node_path *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_node_path_get_subname_count": { + { + "name": "godot_node_path_get_subname_count", "return_type": "godot_int", "arguments": [ ["const godot_node_path *", "p_self"] ] }, - "godot_node_path_get_subname": { + { + "name": "godot_node_path_get_subname", "return_type": "godot_string", "arguments": [ ["const godot_node_path *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_node_path_get_property": { + { + "name": "godot_node_path_get_property", "return_type": "godot_string", "arguments": [ ["const godot_node_path *", "p_self"] ] }, - "godot_node_path_is_empty": { + { + "name": "godot_node_path_is_empty", "return_type": "godot_bool", "arguments": [ ["const godot_node_path *", "p_self"] ] }, - "godot_node_path_operator_equal": { + { + "name": "godot_node_path_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_node_path *", "p_self"], ["const godot_node_path *", "p_b"] ] }, - "godot_plane_new_with_reals": { + { + "name": "godot_plane_new_with_reals", "return_type": "void", "arguments": [ ["godot_plane *", "r_dest"], @@ -2183,7 +2503,8 @@ ["const godot_real", "p_d"] ] }, - "godot_plane_new_with_vectors": { + { + "name": "godot_plane_new_with_vectors", "return_type": "void", "arguments": [ ["godot_plane *", "r_dest"], @@ -2192,7 +2513,8 @@ ["const godot_vector3 *", "p_v3"] ] }, - "godot_plane_new_with_normal": { + { + "name": "godot_plane_new_with_normal", "return_type": "void", "arguments": [ ["godot_plane *", "r_dest"], @@ -2200,45 +2522,52 @@ ["const godot_real", "p_d"] ] }, - "godot_plane_as_string": { + { + "name": "godot_plane_as_string", "return_type": "godot_string", "arguments": [ ["const godot_plane *", "p_self"] ] }, - "godot_plane_normalized": { + { + "name": "godot_plane_normalized", "return_type": "godot_plane", "arguments": [ ["const godot_plane *", "p_self"] ] }, - "godot_plane_center": { + { + "name": "godot_plane_center", "return_type": "godot_vector3", "arguments": [ ["const godot_plane *", "p_self"] ] }, - "godot_plane_get_any_point": { + { + "name": "godot_plane_get_any_point", "return_type": "godot_vector3", "arguments": [ ["const godot_plane *", "p_self"] ] }, - "godot_plane_is_point_over": { + { + "name": "godot_plane_is_point_over", "return_type": "godot_bool", "arguments": [ ["const godot_plane *", "p_self"], ["const godot_vector3 *", "p_point"] ] }, - "godot_plane_distance_to": { + { + "name": "godot_plane_distance_to", "return_type": "godot_real", "arguments": [ ["const godot_plane *", "p_self"], ["const godot_vector3 *", "p_point"] ] }, - "godot_plane_has_point": { + { + "name": "godot_plane_has_point", "return_type": "godot_bool", "arguments": [ ["const godot_plane *", "p_self"], @@ -2246,14 +2575,16 @@ ["const godot_real", "p_epsilon"] ] }, - "godot_plane_project": { + { + "name": "godot_plane_project", "return_type": "godot_vector3", "arguments": [ ["const godot_plane *", "p_self"], ["const godot_vector3 *", "p_point"] ] }, - "godot_plane_intersect_3": { + { + "name": "godot_plane_intersect_3", "return_type": "godot_bool", "arguments": [ ["const godot_plane *", "p_self"], @@ -2262,7 +2593,8 @@ ["const godot_plane *", "p_c"] ] }, - "godot_plane_intersects_ray": { + { + "name": "godot_plane_intersects_ray", "return_type": "godot_bool", "arguments": [ ["const godot_plane *", "p_self"], @@ -2271,7 +2603,8 @@ ["const godot_vector3 *", "p_dir"] ] }, - "godot_plane_intersects_segment": { + { + "name": "godot_plane_intersects_segment", "return_type": "godot_bool", "arguments": [ ["const godot_plane *", "p_self"], @@ -2280,46 +2613,53 @@ ["const godot_vector3 *", "p_end"] ] }, - "godot_plane_operator_neg": { + { + "name": "godot_plane_operator_neg", "return_type": "godot_plane", "arguments": [ ["const godot_plane *", "p_self"] ] }, - "godot_plane_operator_equal": { + { + "name": "godot_plane_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_plane *", "p_self"], ["const godot_plane *", "p_b"] ] }, - "godot_plane_set_normal": { + { + "name": "godot_plane_set_normal", "return_type": "void", "arguments": [ ["godot_plane *", "p_self"], ["const godot_vector3 *", "p_normal"] ] }, - "godot_plane_get_normal": { + { + "name": "godot_plane_get_normal", "return_type": "godot_vector3", "arguments": [ ["const godot_plane *", "p_self"] ] }, - "godot_plane_get_d": { + { + "name": "godot_plane_get_d", "return_type": "godot_real", "arguments": [ ["const godot_plane *", "p_self"] ] }, - "godot_plane_set_d": { + { + "name": "godot_plane_set_d", "return_type": "void", "arguments": [ ["godot_plane *", "p_self"], ["const godot_real", "p_d"] ] }, - "godot_rect2_new_with_position_and_size": { + { + "name": "godot_rect2_new_with_position_and_size", "return_type": "void", "arguments": [ ["godot_rect2 *", "r_dest"], @@ -2327,7 +2667,8 @@ ["const godot_vector2 *", "p_size"] ] }, - "godot_rect2_new": { + { + "name": "godot_rect2_new", "return_type": "void", "arguments": [ ["godot_rect2 *", "r_dest"], @@ -2337,107 +2678,123 @@ ["const godot_real", "p_height"] ] }, - "godot_rect2_as_string": { + { + "name": "godot_rect2_as_string", "return_type": "godot_string", "arguments": [ ["const godot_rect2 *", "p_self"] ] }, - "godot_rect2_get_area": { + { + "name": "godot_rect2_get_area", "return_type": "godot_real", "arguments": [ ["const godot_rect2 *", "p_self"] ] }, - "godot_rect2_intersects": { + { + "name": "godot_rect2_intersects", "return_type": "godot_bool", "arguments": [ ["const godot_rect2 *", "p_self"], ["const godot_rect2 *", "p_b"] ] }, - "godot_rect2_encloses": { + { + "name": "godot_rect2_encloses", "return_type": "godot_bool", "arguments": [ ["const godot_rect2 *", "p_self"], ["const godot_rect2 *", "p_b"] ] }, - "godot_rect2_has_no_area": { + { + "name": "godot_rect2_has_no_area", "return_type": "godot_bool", "arguments": [ ["const godot_rect2 *", "p_self"] ] }, - "godot_rect2_clip": { + { + "name": "godot_rect2_clip", "return_type": "godot_rect2", "arguments": [ ["const godot_rect2 *", "p_self"], ["const godot_rect2 *", "p_b"] ] }, - "godot_rect2_merge": { + { + "name": "godot_rect2_merge", "return_type": "godot_rect2", "arguments": [ ["const godot_rect2 *", "p_self"], ["const godot_rect2 *", "p_b"] ] }, - "godot_rect2_has_point": { + { + "name": "godot_rect2_has_point", "return_type": "godot_bool", "arguments": [ ["const godot_rect2 *", "p_self"], ["const godot_vector2 *", "p_point"] ] }, - "godot_rect2_grow": { + { + "name": "godot_rect2_grow", "return_type": "godot_rect2", "arguments": [ ["const godot_rect2 *", "p_self"], ["const godot_real", "p_by"] ] }, - "godot_rect2_expand": { + { + "name": "godot_rect2_expand", "return_type": "godot_rect2", "arguments": [ ["const godot_rect2 *", "p_self"], ["const godot_vector2 *", "p_to"] ] }, - "godot_rect2_operator_equal": { + { + "name": "godot_rect2_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_rect2 *", "p_self"], ["const godot_rect2 *", "p_b"] ] }, - "godot_rect2_get_position": { + { + "name": "godot_rect2_get_position", "return_type": "godot_vector2", "arguments": [ ["const godot_rect2 *", "p_self"] ] }, - "godot_rect2_get_size": { + { + "name": "godot_rect2_get_size", "return_type": "godot_vector2", "arguments": [ ["const godot_rect2 *", "p_self"] ] }, - "godot_rect2_set_position": { + { + "name": "godot_rect2_set_position", "return_type": "void", "arguments": [ ["godot_rect2 *", "p_self"], ["const godot_vector2 *", "p_pos"] ] }, - "godot_rect2_set_size": { + { + "name": "godot_rect2_set_size", "return_type": "void", "arguments": [ ["godot_rect2 *", "p_self"], ["const godot_vector2 *", "p_size"] ] }, - "godot_rect3_new": { + { + "name": "godot_rect3_new", "return_type": "void", "arguments": [ ["godot_rect3 *", "r_dest"], @@ -2445,92 +2802,106 @@ ["const godot_vector3 *", "p_size"] ] }, - "godot_rect3_get_position": { + { + "name": "godot_rect3_get_position", "return_type": "godot_vector3", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_set_position": { + { + "name": "godot_rect3_set_position", "return_type": "void", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_vector3 *", "p_v"] ] }, - "godot_rect3_get_size": { + { + "name": "godot_rect3_get_size", "return_type": "godot_vector3", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_set_size": { + { + "name": "godot_rect3_set_size", "return_type": "void", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_vector3 *", "p_v"] ] }, - "godot_rect3_as_string": { + { + "name": "godot_rect3_as_string", "return_type": "godot_string", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_get_area": { + { + "name": "godot_rect3_get_area", "return_type": "godot_real", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_has_no_area": { + { + "name": "godot_rect3_has_no_area", "return_type": "godot_bool", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_has_no_surface": { + { + "name": "godot_rect3_has_no_surface", "return_type": "godot_bool", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_intersects": { + { + "name": "godot_rect3_intersects", "return_type": "godot_bool", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_rect3 *", "p_with"] ] }, - "godot_rect3_encloses": { + { + "name": "godot_rect3_encloses", "return_type": "godot_bool", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_rect3 *", "p_with"] ] }, - "godot_rect3_merge": { + { + "name": "godot_rect3_merge", "return_type": "godot_rect3", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_rect3 *", "p_with"] ] }, - "godot_rect3_intersection": { + { + "name": "godot_rect3_intersection", "return_type": "godot_rect3", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_rect3 *", "p_with"] ] }, - "godot_rect3_intersects_plane": { + { + "name": "godot_rect3_intersects_plane", "return_type": "godot_bool", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_plane *", "p_plane"] ] }, - "godot_rect3_intersects_segment": { + { + "name": "godot_rect3_intersects_segment", "return_type": "godot_bool", "arguments": [ ["const godot_rect3 *", "p_self"], @@ -2538,118 +2909,136 @@ ["const godot_vector3 *", "p_to"] ] }, - "godot_rect3_has_point": { + { + "name": "godot_rect3_has_point", "return_type": "godot_bool", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_vector3 *", "p_point"] ] }, - "godot_rect3_get_support": { + { + "name": "godot_rect3_get_support", "return_type": "godot_vector3", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_vector3 *", "p_dir"] ] }, - "godot_rect3_get_longest_axis": { + { + "name": "godot_rect3_get_longest_axis", "return_type": "godot_vector3", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_get_longest_axis_index": { + { + "name": "godot_rect3_get_longest_axis_index", "return_type": "godot_int", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_get_longest_axis_size": { + { + "name": "godot_rect3_get_longest_axis_size", "return_type": "godot_real", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_get_shortest_axis": { + { + "name": "godot_rect3_get_shortest_axis", "return_type": "godot_vector3", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_get_shortest_axis_index": { + { + "name": "godot_rect3_get_shortest_axis_index", "return_type": "godot_int", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_get_shortest_axis_size": { + { + "name": "godot_rect3_get_shortest_axis_size", "return_type": "godot_real", "arguments": [ ["const godot_rect3 *", "p_self"] ] }, - "godot_rect3_expand": { + { + "name": "godot_rect3_expand", "return_type": "godot_rect3", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_vector3 *", "p_to_point"] ] }, - "godot_rect3_grow": { + { + "name": "godot_rect3_grow", "return_type": "godot_rect3", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_real", "p_by"] ] }, - "godot_rect3_get_endpoint": { + { + "name": "godot_rect3_get_endpoint", "return_type": "godot_vector3", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_rect3_operator_equal": { + { + "name": "godot_rect3_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_rect3 *", "p_self"], ["const godot_rect3 *", "p_b"] ] }, - "godot_rid_new": { + { + "name": "godot_rid_new", "return_type": "void", "arguments": [ ["godot_rid *", "r_dest"] ] }, - "godot_rid_get_id": { + { + "name": "godot_rid_get_id", "return_type": "godot_int", "arguments": [ ["const godot_rid *", "p_self"] ] }, - "godot_rid_new_with_resource": { + { + "name": "godot_rid_new_with_resource", "return_type": "void", "arguments": [ ["godot_rid *", "r_dest"], ["const godot_object *", "p_from"] ] }, - "godot_rid_operator_equal": { + { + "name": "godot_rid_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_rid *", "p_self"], ["const godot_rid *", "p_b"] ] }, - "godot_rid_operator_less": { + { + "name": "godot_rid_operator_less", "return_type": "godot_bool", "arguments": [ ["const godot_rid *", "p_self"], ["const godot_rid *", "p_b"] ] }, - "godot_transform_new_with_axis_origin": { + { + "name": "godot_transform_new_with_axis_origin", "return_type": "void", "arguments": [ ["godot_transform *", "r_dest"], @@ -2659,7 +3048,8 @@ ["const godot_vector3 *", "p_origin"] ] }, - "godot_transform_new": { + { + "name": "godot_transform_new", "return_type": "void", "arguments": [ ["godot_transform *", "r_dest"], @@ -2667,57 +3057,66 @@ ["const godot_vector3 *", "p_origin"] ] }, - "godot_transform_get_basis": { + { + "name": "godot_transform_get_basis", "return_type": "godot_basis", "arguments": [ ["const godot_transform *", "p_self"] ] }, - "godot_transform_set_basis": { + { + "name": "godot_transform_set_basis", "return_type": "void", "arguments": [ ["godot_transform *", "p_self"], ["godot_basis *", "p_v"] ] }, - "godot_transform_get_origin": { + { + "name": "godot_transform_get_origin", "return_type": "godot_vector3", "arguments": [ ["const godot_transform *", "p_self"] ] }, - "godot_transform_set_origin": { + { + "name": "godot_transform_set_origin", "return_type": "void", "arguments": [ ["godot_transform *", "p_self"], ["godot_vector3 *", "p_v"] ] }, - "godot_transform_as_string": { + { + "name": "godot_transform_as_string", "return_type": "godot_string", "arguments": [ ["const godot_transform *", "p_self"] ] }, - "godot_transform_inverse": { + { + "name": "godot_transform_inverse", "return_type": "godot_transform", "arguments": [ ["const godot_transform *", "p_self"] ] }, - "godot_transform_affine_inverse": { + { + "name": "godot_transform_affine_inverse", "return_type": "godot_transform", "arguments": [ ["const godot_transform *", "p_self"] ] }, - "godot_transform_orthonormalized": { + { + "name": "godot_transform_orthonormalized", "return_type": "godot_transform", "arguments": [ ["const godot_transform *", "p_self"] ] }, - "godot_transform_rotated": { + { + "name": "godot_transform_rotated", "return_type": "godot_transform", "arguments": [ ["const godot_transform *", "p_self"], @@ -2725,21 +3124,24 @@ ["const godot_real", "p_phi"] ] }, - "godot_transform_scaled": { + { + "name": "godot_transform_scaled", "return_type": "godot_transform", "arguments": [ ["const godot_transform *", "p_self"], ["const godot_vector3 *", "p_scale"] ] }, - "godot_transform_translated": { + { + "name": "godot_transform_translated", "return_type": "godot_transform", "arguments": [ ["const godot_transform *", "p_self"], ["const godot_vector3 *", "p_ofs"] ] }, - "godot_transform_looking_at": { + { + "name": "godot_transform_looking_at", "return_type": "godot_transform", "arguments": [ ["const godot_transform *", "p_self"], @@ -2747,69 +3149,79 @@ ["const godot_vector3 *", "p_up"] ] }, - "godot_transform_xform_plane": { + { + "name": "godot_transform_xform_plane", "return_type": "godot_plane", "arguments": [ ["const godot_transform *", "p_self"], ["const godot_plane *", "p_v"] ] }, - "godot_transform_xform_inv_plane": { + { + "name": "godot_transform_xform_inv_plane", "return_type": "godot_plane", "arguments": [ ["const godot_transform *", "p_self"], ["const godot_plane *", "p_v"] ] }, - "godot_transform_new_identity": { + { + "name": "godot_transform_new_identity", "return_type": "void", "arguments": [ ["godot_transform *", "r_dest"] ] }, - "godot_transform_operator_equal": { + { + "name": "godot_transform_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_transform *", "p_self"], ["const godot_transform *", "p_b"] ] }, - "godot_transform_operator_multiply": { + { + "name": "godot_transform_operator_multiply", "return_type": "godot_transform", "arguments": [ ["const godot_transform *", "p_self"], ["const godot_transform *", "p_b"] ] }, - "godot_transform_xform_vector3": { + { + "name": "godot_transform_xform_vector3", "return_type": "godot_vector3", "arguments": [ ["const godot_transform *", "p_self"], ["const godot_vector3 *", "p_v"] ] }, - "godot_transform_xform_inv_vector3": { + { + "name": "godot_transform_xform_inv_vector3", "return_type": "godot_vector3", "arguments": [ ["const godot_transform *", "p_self"], ["const godot_vector3 *", "p_v"] ] }, - "godot_transform_xform_rect3": { + { + "name": "godot_transform_xform_rect3", "return_type": "godot_rect3", "arguments": [ ["const godot_transform *", "p_self"], ["const godot_rect3 *", "p_v"] ] }, - "godot_transform_xform_inv_rect3": { + { + "name": "godot_transform_xform_inv_rect3", "return_type": "godot_rect3", "arguments": [ ["const godot_transform *", "p_self"], ["const godot_rect3 *", "p_v"] ] }, - "godot_transform2d_new": { + { + "name": "godot_transform2d_new", "return_type": "void", "arguments": [ ["godot_transform2d *", "r_dest"], @@ -2817,7 +3229,8 @@ ["const godot_vector2 *", "p_pos"] ] }, - "godot_transform2d_new_axis_origin": { + { + "name": "godot_transform2d_new_axis_origin", "return_type": "void", "arguments": [ ["godot_transform2d *", "r_dest"], @@ -2826,98 +3239,113 @@ ["const godot_vector2 *", "p_origin"] ] }, - "godot_transform2d_as_string": { + { + "name": "godot_transform2d_as_string", "return_type": "godot_string", "arguments": [ ["const godot_transform2d *", "p_self"] ] }, - "godot_transform2d_inverse": { + { + "name": "godot_transform2d_inverse", "return_type": "godot_transform2d", "arguments": [ ["const godot_transform2d *", "p_self"] ] }, - "godot_transform2d_affine_inverse": { + { + "name": "godot_transform2d_affine_inverse", "return_type": "godot_transform2d", "arguments": [ ["const godot_transform2d *", "p_self"] ] }, - "godot_transform2d_get_rotation": { + { + "name": "godot_transform2d_get_rotation", "return_type": "godot_real", "arguments": [ ["const godot_transform2d *", "p_self"] ] }, - "godot_transform2d_get_origin": { + { + "name": "godot_transform2d_get_origin", "return_type": "godot_vector2", "arguments": [ ["const godot_transform2d *", "p_self"] ] }, - "godot_transform2d_get_scale": { + { + "name": "godot_transform2d_get_scale", "return_type": "godot_vector2", "arguments": [ ["const godot_transform2d *", "p_self"] ] }, - "godot_transform2d_orthonormalized": { + { + "name": "godot_transform2d_orthonormalized", "return_type": "godot_transform2d", "arguments": [ ["const godot_transform2d *", "p_self"] ] }, - "godot_transform2d_rotated": { + { + "name": "godot_transform2d_rotated", "return_type": "godot_transform2d", "arguments": [ ["const godot_transform2d *", "p_self"], ["const godot_real", "p_phi"] ] }, - "godot_transform2d_scaled": { + { + "name": "godot_transform2d_scaled", "return_type": "godot_transform2d", "arguments": [ ["const godot_transform2d *", "p_self"], ["const godot_vector2 *", "p_scale"] ] }, - "godot_transform2d_translated": { + { + "name": "godot_transform2d_translated", "return_type": "godot_transform2d", "arguments": [ ["const godot_transform2d *", "p_self"], ["const godot_vector2 *", "p_offset"] ] }, - "godot_transform2d_xform_vector2": { + { + "name": "godot_transform2d_xform_vector2", "return_type": "godot_vector2", "arguments": [ ["const godot_transform2d *", "p_self"], ["const godot_vector2 *", "p_v"] ] }, - "godot_transform2d_xform_inv_vector2": { + { + "name": "godot_transform2d_xform_inv_vector2", "return_type": "godot_vector2", "arguments": [ ["const godot_transform2d *", "p_self"], ["const godot_vector2 *", "p_v"] ] }, - "godot_transform2d_basis_xform_vector2": { + { + "name": "godot_transform2d_basis_xform_vector2", "return_type": "godot_vector2", "arguments": [ ["const godot_transform2d *", "p_self"], ["const godot_vector2 *", "p_v"] ] }, - "godot_transform2d_basis_xform_inv_vector2": { + { + "name": "godot_transform2d_basis_xform_inv_vector2", "return_type": "godot_vector2", "arguments": [ ["const godot_transform2d *", "p_self"], ["const godot_vector2 *", "p_v"] ] }, - "godot_transform2d_interpolate_with": { + { + "name": "godot_transform2d_interpolate_with", "return_type": "godot_transform2d", "arguments": [ ["const godot_transform2d *", "p_self"], @@ -2925,411 +3353,474 @@ ["const godot_real", "p_c"] ] }, - "godot_transform2d_operator_equal": { + { + "name": "godot_transform2d_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_transform2d *", "p_self"], ["const godot_transform2d *", "p_b"] ] }, - "godot_transform2d_operator_multiply": { + { + "name": "godot_transform2d_operator_multiply", "return_type": "godot_transform2d", "arguments": [ ["const godot_transform2d *", "p_self"], ["const godot_transform2d *", "p_b"] ] }, - "godot_transform2d_new_identity": { + { + "name": "godot_transform2d_new_identity", "return_type": "void", "arguments": [ ["godot_transform2d *", "r_dest"] ] }, - "godot_transform2d_xform_rect2": { + { + "name": "godot_transform2d_xform_rect2", "return_type": "godot_rect2", "arguments": [ ["const godot_transform2d *", "p_self"], ["const godot_rect2 *", "p_v"] ] }, - "godot_transform2d_xform_inv_rect2": { + { + "name": "godot_transform2d_xform_inv_rect2", "return_type": "godot_rect2", "arguments": [ ["const godot_transform2d *", "p_self"], ["const godot_rect2 *", "p_v"] ] }, - "godot_variant_get_type": { + { + "name": "godot_variant_get_type", "return_type": "godot_variant_type", "arguments": [ ["const godot_variant *", "p_v"] ] }, - "godot_variant_new_copy": { + { + "name": "godot_variant_new_copy", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_variant *", "p_src"] ] }, - "godot_variant_new_nil": { + { + "name": "godot_variant_new_nil", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"] ] }, - "godot_variant_new_bool": { + { + "name": "godot_variant_new_bool", "return_type": "void", "arguments": [ ["godot_variant *", "p_v"], ["const godot_bool", "p_b"] ] }, - "godot_variant_new_uint": { + { + "name": "godot_variant_new_uint", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const uint64_t", "p_i"] ] }, - "godot_variant_new_int": { + { + "name": "godot_variant_new_int", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const int64_t", "p_i"] ] }, - "godot_variant_new_real": { + { + "name": "godot_variant_new_real", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const double", "p_r"] ] }, - "godot_variant_new_string": { + { + "name": "godot_variant_new_string", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_string *", "p_s"] ] }, - "godot_variant_new_vector2": { + { + "name": "godot_variant_new_vector2", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_vector2 *", "p_v2"] ] }, - "godot_variant_new_rect2": { + { + "name": "godot_variant_new_rect2", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_rect2 *", "p_rect2"] ] }, - "godot_variant_new_vector3": { + { + "name": "godot_variant_new_vector3", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_vector3 *", "p_v3"] ] }, - "godot_variant_new_transform2d": { + { + "name": "godot_variant_new_transform2d", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_transform2d *", "p_t2d"] ] }, - "godot_variant_new_plane": { + { + "name": "godot_variant_new_plane", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_plane *", "p_plane"] ] }, - "godot_variant_new_quat": { + { + "name": "godot_variant_new_quat", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_quat *", "p_quat"] ] }, - "godot_variant_new_rect3": { + { + "name": "godot_variant_new_rect3", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_rect3 *", "p_rect3"] ] }, - "godot_variant_new_basis": { + { + "name": "godot_variant_new_basis", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_basis *", "p_basis"] ] }, - "godot_variant_new_transform": { + { + "name": "godot_variant_new_transform", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_transform *", "p_trans"] ] }, - "godot_variant_new_color": { + { + "name": "godot_variant_new_color", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_color *", "p_color"] ] }, - "godot_variant_new_node_path": { + { + "name": "godot_variant_new_node_path", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_node_path *", "p_np"] ] }, - "godot_variant_new_rid": { + { + "name": "godot_variant_new_rid", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_rid *", "p_rid"] ] }, - "godot_variant_new_object": { + { + "name": "godot_variant_new_object", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_object *", "p_obj"] ] }, - "godot_variant_new_dictionary": { + { + "name": "godot_variant_new_dictionary", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_dictionary *", "p_dict"] ] }, - "godot_variant_new_array": { + { + "name": "godot_variant_new_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_array *", "p_arr"] ] }, - "godot_variant_new_pool_byte_array": { + { + "name": "godot_variant_new_pool_byte_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_pool_byte_array *", "p_pba"] ] }, - "godot_variant_new_pool_int_array": { + { + "name": "godot_variant_new_pool_int_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_pool_int_array *", "p_pia"] ] }, - "godot_variant_new_pool_real_array": { + { + "name": "godot_variant_new_pool_real_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_pool_real_array *", "p_pra"] ] }, - "godot_variant_new_pool_string_array": { + { + "name": "godot_variant_new_pool_string_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_pool_string_array *", "p_psa"] ] }, - "godot_variant_new_pool_vector2_array": { + { + "name": "godot_variant_new_pool_vector2_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_pool_vector2_array *", "p_pv2a"] ] }, - "godot_variant_new_pool_vector3_array": { + { + "name": "godot_variant_new_pool_vector3_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_pool_vector3_array *", "p_pv3a"] ] }, - "godot_variant_new_pool_color_array": { + { + "name": "godot_variant_new_pool_color_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], ["const godot_pool_color_array *", "p_pca"] ] }, - "godot_variant_as_bool": { + { + "name": "godot_variant_as_bool", "return_type": "godot_bool", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_uint": { + { + "name": "godot_variant_as_uint", "return_type": "uint64_t", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_int": { + { + "name": "godot_variant_as_int", "return_type": "int64_t", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_real": { + { + "name": "godot_variant_as_real", "return_type": "double", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_string": { + { + "name": "godot_variant_as_string", "return_type": "godot_string", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_vector2": { + { + "name": "godot_variant_as_vector2", "return_type": "godot_vector2", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_rect2": { + { + "name": "godot_variant_as_rect2", "return_type": "godot_rect2", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_vector3": { + { + "name": "godot_variant_as_vector3", "return_type": "godot_vector3", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_transform2d": { + { + "name": "godot_variant_as_transform2d", "return_type": "godot_transform2d", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_plane": { + { + "name": "godot_variant_as_plane", "return_type": "godot_plane", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_quat": { + { + "name": "godot_variant_as_quat", "return_type": "godot_quat", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_rect3": { + { + "name": "godot_variant_as_rect3", "return_type": "godot_rect3", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_basis": { + { + "name": "godot_variant_as_basis", "return_type": "godot_basis", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_transform": { + { + "name": "godot_variant_as_transform", "return_type": "godot_transform", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_color": { + { + "name": "godot_variant_as_color", "return_type": "godot_color", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_node_path": { + { + "name": "godot_variant_as_node_path", "return_type": "godot_node_path", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_rid": { + { + "name": "godot_variant_as_rid", "return_type": "godot_rid", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_object": { + { + "name": "godot_variant_as_object", "return_type": "godot_object *", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_dictionary": { + { + "name": "godot_variant_as_dictionary", "return_type": "godot_dictionary", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_array": { + { + "name": "godot_variant_as_array", "return_type": "godot_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_pool_byte_array": { + { + "name": "godot_variant_as_pool_byte_array", "return_type": "godot_pool_byte_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_pool_int_array": { + { + "name": "godot_variant_as_pool_int_array", "return_type": "godot_pool_int_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_pool_real_array": { + { + "name": "godot_variant_as_pool_real_array", "return_type": "godot_pool_real_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_pool_string_array": { + { + "name": "godot_variant_as_pool_string_array", "return_type": "godot_pool_string_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_pool_vector2_array": { + { + "name": "godot_variant_as_pool_vector2_array", "return_type": "godot_pool_vector2_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_pool_vector3_array": { + { + "name": "godot_variant_as_pool_vector3_array", "return_type": "godot_pool_vector3_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_as_pool_color_array": { + { + "name": "godot_variant_as_pool_color_array", "return_type": "godot_pool_color_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_call": { + { + "name": "godot_variant_call", "return_type": "godot_variant", "arguments": [ ["godot_variant *", "p_self"], @@ -3339,60 +3830,69 @@ ["godot_variant_call_error *", "r_error"] ] }, - "godot_variant_has_method": { + { + "name": "godot_variant_has_method", "return_type": "godot_bool", "arguments": [ ["const godot_variant *", "p_self"], ["const godot_string *", "p_method"] ] }, - "godot_variant_operator_equal": { + { + "name": "godot_variant_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_variant *", "p_self"], ["const godot_variant *", "p_other"] ] }, - "godot_variant_operator_less": { + { + "name": "godot_variant_operator_less", "return_type": "godot_bool", "arguments": [ ["const godot_variant *", "p_self"], ["const godot_variant *", "p_other"] ] }, - "godot_variant_hash_compare": { + { + "name": "godot_variant_hash_compare", "return_type": "godot_bool", "arguments": [ ["const godot_variant *", "p_self"], ["const godot_variant *", "p_other"] ] }, - "godot_variant_booleanize": { + { + "name": "godot_variant_booleanize", "return_type": "godot_bool", "arguments": [ ["const godot_variant *", "p_self"] ] }, - "godot_variant_destroy": { + { + "name": "godot_variant_destroy", "return_type": "void", "arguments": [ ["godot_variant *", "p_self"] ] }, - "godot_string_new": { + { + "name": "godot_string_new", "return_type": "void", "arguments": [ ["godot_string *", "r_dest"] ] }, - "godot_string_new_copy": { + { + "name": "godot_string_new_copy", "return_type": "void", "arguments": [ ["godot_string *", "r_dest"], ["const godot_string *", "p_src"] ] }, - "godot_string_new_data": { + { + "name": "godot_string_new_data", "return_type": "void", "arguments": [ ["godot_string *", "r_dest"], @@ -3400,7 +3900,8 @@ ["const int", "p_size"] ] }, - "godot_string_new_unicode_data": { + { + "name": "godot_string_new_unicode_data", "return_type": "void", "arguments": [ ["godot_string *", "r_dest"], @@ -3408,7 +3909,8 @@ ["const int", "p_size"] ] }, - "godot_string_get_data": { + { + "name": "godot_string_get_data", "return_type": "void", "arguments": [ ["const godot_string *", "p_self"], @@ -3416,93 +3918,107 @@ ["int *", "p_size"] ] }, - "godot_string_operator_index": { + { + "name": "godot_string_operator_index", "return_type": "wchar_t *", "arguments": [ ["godot_string *", "p_self"], ["const godot_int", "p_idx"] ] }, - "godot_string_c_str": { + { + "name": "godot_string_c_str", "return_type": "const char *", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_unicode_str": { + { + "name": "godot_string_unicode_str", "return_type": "const wchar_t *", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_operator_equal": { + { + "name": "godot_string_operator_equal", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_b"] ] }, - "godot_string_operator_less": { + { + "name": "godot_string_operator_less", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_b"] ] }, - "godot_string_operator_plus": { + { + "name": "godot_string_operator_plus", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_b"] ] }, - "godot_string_length": { + { + "name": "godot_string_length", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_begins_with": { + { + "name": "godot_string_begins_with", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_string"] ] }, - "godot_string_begins_with_char_array": { + { + "name": "godot_string_begins_with_char_array", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"], ["const char *", "p_char_array"] ] }, - "godot_string_bigrams": { + { + "name": "godot_string_bigrams", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_chr": { + { + "name": "godot_string_chr", "return_type": "godot_string", "arguments": [ ["wchar_t", "p_character"] ] }, - "godot_string_ends_with": { + { + "name": "godot_string_ends_with", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_string"] ] }, - "godot_string_find": { + { + "name": "godot_string_find", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], ["godot_string", "p_what"] ] }, - "godot_string_find_from": { + { + "name": "godot_string_find_from", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], @@ -3510,14 +4026,16 @@ ["godot_int", "p_from"] ] }, - "godot_string_findmk": { + { + "name": "godot_string_findmk", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], ["const godot_array *", "p_keys"] ] }, - "godot_string_findmk_from": { + { + "name": "godot_string_findmk_from", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], @@ -3525,7 +4043,8 @@ ["godot_int", "p_from"] ] }, - "godot_string_findmk_from_in_place": { + { + "name": "godot_string_findmk_from_in_place", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], @@ -3534,14 +4053,16 @@ ["godot_int *", "r_key"] ] }, - "godot_string_findn": { + { + "name": "godot_string_findn", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], ["godot_string", "p_what"] ] }, - "godot_string_findn_from": { + { + "name": "godot_string_findn_from", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], @@ -3549,21 +4070,24 @@ ["godot_int", "p_from"] ] }, - "godot_string_find_last": { + { + "name": "godot_string_find_last", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], ["godot_string", "p_what"] ] }, - "godot_string_format": { + { + "name": "godot_string_format", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["const godot_variant *", "p_values"] ] }, - "godot_string_format_with_custom_placeholder": { + { + "name": "godot_string_format_with_custom_placeholder", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -3571,26 +4095,30 @@ ["const char *", "p_placeholder"] ] }, - "godot_string_hex_encode_buffer": { + { + "name": "godot_string_hex_encode_buffer", "return_type": "godot_string", "arguments": [ ["const uint8_t *", "p_buffer"], ["godot_int", "p_len"] ] }, - "godot_string_hex_to_int": { + { + "name": "godot_string_hex_to_int", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_hex_to_int_without_prefix": { + { + "name": "godot_string_hex_to_int_without_prefix", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_insert": { + { + "name": "godot_string_insert", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -3598,34 +4126,39 @@ ["godot_string", "p_string"] ] }, - "godot_string_is_numeric": { + { + "name": "godot_string_is_numeric", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_is_subsequence_of": { + { + "name": "godot_string_is_subsequence_of", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_string"] ] }, - "godot_string_is_subsequence_ofi": { + { + "name": "godot_string_is_subsequence_ofi", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_string"] ] }, - "godot_string_lpad": { + { + "name": "godot_string_lpad", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["godot_int", "p_min_length"] ] }, - "godot_string_lpad_with_custom_character": { + { + "name": "godot_string_lpad_with_custom_character", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -3633,40 +4166,46 @@ ["const godot_string *", "p_character"] ] }, - "godot_string_match": { + { + "name": "godot_string_match", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_wildcard"] ] }, - "godot_string_matchn": { + { + "name": "godot_string_matchn", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_wildcard"] ] }, - "godot_string_md5": { + { + "name": "godot_string_md5", "return_type": "godot_string", "arguments": [ ["const uint8_t *", "p_md5"] ] }, - "godot_string_num": { + { + "name": "godot_string_num", "return_type": "godot_string", "arguments": [ ["double", "p_num"] ] }, - "godot_string_num_int64": { + { + "name": "godot_string_num_int64", "return_type": "godot_string", "arguments": [ ["int64_t", "p_num"], ["godot_int", "p_base"] ] }, - "godot_string_num_int64_capitalized": { + { + "name": "godot_string_num_int64_capitalized", "return_type": "godot_string", "arguments": [ ["int64_t", "p_num"], @@ -3674,40 +4213,46 @@ ["godot_bool", "p_capitalize_hex"] ] }, - "godot_string_num_real": { + { + "name": "godot_string_num_real", "return_type": "godot_string", "arguments": [ ["double", "p_num"] ] }, - "godot_string_num_scientific": { + { + "name": "godot_string_num_scientific", "return_type": "godot_string", "arguments": [ ["double", "p_num"] ] }, - "godot_string_num_with_decimals": { + { + "name": "godot_string_num_with_decimals", "return_type": "godot_string", "arguments": [ ["double", "p_num"], ["godot_int", "p_decimals"] ] }, - "godot_string_pad_decimals": { + { + "name": "godot_string_pad_decimals", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["godot_int", "p_digits"] ] }, - "godot_string_pad_zeros": { + { + "name": "godot_string_pad_zeros", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["godot_int", "p_digits"] ] }, - "godot_string_replace_first": { + { + "name": "godot_string_replace_first", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -3715,7 +4260,8 @@ ["godot_string", "p_with"] ] }, - "godot_string_replace": { + { + "name": "godot_string_replace", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -3723,7 +4269,8 @@ ["godot_string", "p_with"] ] }, - "godot_string_replacen": { + { + "name": "godot_string_replacen", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -3731,21 +4278,24 @@ ["godot_string", "p_with"] ] }, - "godot_string_rfind": { + { + "name": "godot_string_rfind", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], ["godot_string", "p_what"] ] }, - "godot_string_rfindn": { + { + "name": "godot_string_rfindn", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], ["godot_string", "p_what"] ] }, - "godot_string_rfind_from": { + { + "name": "godot_string_rfind_from", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], @@ -3753,7 +4303,8 @@ ["godot_int", "p_from"] ] }, - "godot_string_rfindn_from": { + { + "name": "godot_string_rfindn_from", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], @@ -3761,14 +4312,16 @@ ["godot_int", "p_from"] ] }, - "godot_string_rpad": { + { + "name": "godot_string_rpad", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["godot_int", "p_min_length"] ] }, - "godot_string_rpad_with_custom_character": { + { + "name": "godot_string_rpad_with_custom_character", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -3776,14 +4329,16 @@ ["const godot_string *", "p_character"] ] }, - "godot_string_similarity": { + { + "name": "godot_string_similarity", "return_type": "godot_real", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_string"] ] }, - "godot_string_sprintf": { + { + "name": "godot_string_sprintf", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -3791,7 +4346,8 @@ ["godot_bool *", "p_error"] ] }, - "godot_string_substr": { + { + "name": "godot_string_substr", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -3799,107 +4355,124 @@ ["godot_int", "p_chars"] ] }, - "godot_string_to_double": { + { + "name": "godot_string_to_double", "return_type": "double", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_to_float": { + { + "name": "godot_string_to_float", "return_type": "godot_real", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_to_int": { + { + "name": "godot_string_to_int", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_camelcase_to_underscore": { + { + "name": "godot_string_camelcase_to_underscore", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_camelcase_to_underscore_lowercased": { + { + "name": "godot_string_camelcase_to_underscore_lowercased", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_capitalize": { + { + "name": "godot_string_capitalize", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_char_to_double": { + { + "name": "godot_string_char_to_double", "return_type": "double", "arguments": [ ["const char *", "p_what"] ] }, - "godot_string_char_to_int": { + { + "name": "godot_string_char_to_int", "return_type": "godot_int", "arguments": [ ["const char *", "p_what"] ] }, - "godot_string_wchar_to_int": { + { + "name": "godot_string_wchar_to_int", "return_type": "int64_t", "arguments": [ ["const wchar_t *", "p_str"] ] }, - "godot_string_char_to_int_with_len": { + { + "name": "godot_string_char_to_int_with_len", "return_type": "godot_int", "arguments": [ ["const char *", "p_what"], ["godot_int", "p_len"] ] }, - "godot_string_char_to_int64_with_len": { + { + "name": "godot_string_char_to_int64_with_len", "return_type": "int64_t", "arguments": [ ["const wchar_t *", "p_str"], ["int", "p_len"] ] }, - "godot_string_hex_to_int64": { + { + "name": "godot_string_hex_to_int64", "return_type": "int64_t", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_hex_to_int64_with_prefix": { + { + "name": "godot_string_hex_to_int64_with_prefix", "return_type": "int64_t", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_to_int64": { + { + "name": "godot_string_to_int64", "return_type": "int64_t", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_unicode_char_to_double": { + { + "name": "godot_string_unicode_char_to_double", "return_type": "double", "arguments": [ ["const wchar_t *", "p_str"], ["const wchar_t **", "r_end"] ] }, - "godot_string_get_slice_count": { + { + "name": "godot_string_get_slice_count", "return_type": "godot_int", "arguments": [ ["const godot_string *", "p_self"], ["godot_string", "p_splitter"] ] }, - "godot_string_get_slice": { + { + "name": "godot_string_get_slice", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -3907,7 +4480,8 @@ ["godot_int", "p_slice"] ] }, - "godot_string_get_slicec": { + { + "name": "godot_string_get_slicec", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -3915,147 +4489,169 @@ ["godot_int", "p_slice"] ] }, - "godot_string_split": { + { + "name": "godot_string_split", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_splitter"] ] }, - "godot_string_split_allow_empty": { + { + "name": "godot_string_split_allow_empty", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_splitter"] ] }, - "godot_string_split_floats": { + { + "name": "godot_string_split_floats", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_splitter"] ] }, - "godot_string_split_floats_allows_empty": { + { + "name": "godot_string_split_floats_allows_empty", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_splitter"] ] }, - "godot_string_split_floats_mk": { + { + "name": "godot_string_split_floats_mk", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"], ["const godot_array *", "p_splitters"] ] }, - "godot_string_split_floats_mk_allows_empty": { + { + "name": "godot_string_split_floats_mk_allows_empty", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"], ["const godot_array *", "p_splitters"] ] }, - "godot_string_split_ints": { + { + "name": "godot_string_split_ints", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_splitter"] ] }, - "godot_string_split_ints_allows_empty": { + { + "name": "godot_string_split_ints_allows_empty", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_splitter"] ] }, - "godot_string_split_ints_mk": { + { + "name": "godot_string_split_ints_mk", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"], ["const godot_array *", "p_splitters"] ] }, - "godot_string_split_ints_mk_allows_empty": { + { + "name": "godot_string_split_ints_mk_allows_empty", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"], ["const godot_array *", "p_splitters"] ] }, - "godot_string_split_spaces": { + { + "name": "godot_string_split_spaces", "return_type": "godot_array", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_char_lowercase": { + { + "name": "godot_string_char_lowercase", "return_type": "wchar_t", "arguments": [ ["wchar_t", "p_char"] ] }, - "godot_string_char_uppercase": { + { + "name": "godot_string_char_uppercase", "return_type": "wchar_t", "arguments": [ ["wchar_t", "p_char"] ] }, - "godot_string_to_lower": { + { + "name": "godot_string_to_lower", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_to_upper": { + { + "name": "godot_string_to_upper", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_get_basename": { + { + "name": "godot_string_get_basename", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_get_extension": { + { + "name": "godot_string_get_extension", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_left": { + { + "name": "godot_string_left", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["godot_int", "p_pos"] ] }, - "godot_string_ord_at": { + { + "name": "godot_string_ord_at", "return_type": "wchar_t", "arguments": [ ["const godot_string *", "p_self"], ["godot_int", "p_idx"] ] }, - "godot_string_plus_file": { + { + "name": "godot_string_plus_file", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_file"] ] }, - "godot_string_right": { + { + "name": "godot_string_right", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["godot_int", "p_pos"] ] }, - "godot_string_strip_edges": { + { + "name": "godot_string_strip_edges", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], @@ -4063,13 +4659,15 @@ ["godot_bool", "p_right"] ] }, - "godot_string_strip_escapes": { + { + "name": "godot_string_strip_escapes", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_erase": { + { + "name": "godot_string_erase", "return_type": "void", "arguments": [ ["godot_string *", "p_self"], @@ -4077,35 +4675,40 @@ ["godot_int", "p_chars"] ] }, - "godot_string_ascii": { + { + "name": "godot_string_ascii", "return_type": "void", "arguments": [ ["godot_string *", "p_self"], ["char *", "result"] ] }, - "godot_string_ascii_extended": { + { + "name": "godot_string_ascii_extended", "return_type": "void", "arguments": [ ["godot_string *", "p_self"], ["char *", "result"] ] }, - "godot_string_utf8": { + { + "name": "godot_string_utf8", "return_type": "void", "arguments": [ ["godot_string *", "p_self"], ["char *", "result"] ] }, - "godot_string_parse_utf8": { + { + "name": "godot_string_parse_utf8", "return_type": "godot_bool", "arguments": [ ["godot_string *", "p_self"], ["const char *", "p_utf8"] ] }, - "godot_string_parse_utf8_with_len": { + { + "name": "godot_string_parse_utf8_with_len", "return_type": "godot_bool", "arguments": [ ["godot_string *", "p_self"], @@ -4113,279 +4716,384 @@ ["godot_int", "p_len"] ] }, - "godot_string_chars_to_utf8": { + { + "name": "godot_string_chars_to_utf8", "return_type": "godot_string", "arguments": [ ["const char *", "p_utf8"] ] }, - "godot_string_chars_to_utf8_with_len": { + { + "name": "godot_string_chars_to_utf8_with_len", "return_type": "godot_string", "arguments": [ ["const char *", "p_utf8"], ["godot_int", "p_len"] ] }, - "godot_string_hash": { + { + "name": "godot_string_hash", "return_type": "uint32_t", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_hash64": { + { + "name": "godot_string_hash64", "return_type": "uint64_t", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_hash_chars": { + { + "name": "godot_string_hash_chars", "return_type": "uint32_t", "arguments": [ ["const char *", "p_cstr"] ] }, - "godot_string_hash_chars_with_len": { + { + "name": "godot_string_hash_chars_with_len", "return_type": "uint32_t", "arguments": [ ["const char *", "p_cstr"], ["godot_int", "p_len"] ] }, - "godot_string_hash_utf8_chars": { + { + "name": "godot_string_hash_utf8_chars", "return_type": "uint32_t", "arguments": [ ["const wchar_t *", "p_str"] ] }, - "godot_string_hash_utf8_chars_with_len": { + { + "name": "godot_string_hash_utf8_chars_with_len", "return_type": "uint32_t", "arguments": [ ["const wchar_t *", "p_str"], ["godot_int", "p_len"] ] }, - "godot_string_md5_buffer": { + { + "name": "godot_string_md5_buffer", "return_type": "godot_pool_byte_array", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_md5_text": { + { + "name": "godot_string_md5_text", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_sha256_buffer": { + { + "name": "godot_string_sha256_buffer", "return_type": "godot_pool_byte_array", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_sha256_text": { + { + "name": "godot_string_sha256_text", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_empty": { + { + "name": "godot_string_empty", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_get_base_dir": { + { + "name": "godot_string_get_base_dir", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_get_file": { + { + "name": "godot_string_get_file", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_humanize_size": { + { + "name": "godot_string_humanize_size", "return_type": "godot_string", "arguments": [ ["size_t", "p_size"] ] }, - "godot_string_is_abs_path": { + { + "name": "godot_string_is_abs_path", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_is_rel_path": { + { + "name": "godot_string_is_rel_path", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_is_resource_file": { + { + "name": "godot_string_is_resource_file", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_path_to": { + { + "name": "godot_string_path_to", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_path"] ] }, - "godot_string_path_to_file": { + { + "name": "godot_string_path_to_file", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_path"] ] }, - "godot_string_simplify_path": { + { + "name": "godot_string_simplify_path", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_c_escape": { + { + "name": "godot_string_c_escape", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_c_escape_multiline": { + { + "name": "godot_string_c_escape_multiline", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_c_unescape": { + { + "name": "godot_string_c_unescape", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_http_escape": { + { + "name": "godot_string_http_escape", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_http_unescape": { + { + "name": "godot_string_http_unescape", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_json_escape": { + { + "name": "godot_string_json_escape", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_word_wrap": { + { + "name": "godot_string_word_wrap", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"], ["godot_int", "p_chars_per_line"] ] }, - "godot_string_xml_escape": { + { + "name": "godot_string_xml_escape", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_xml_escape_with_quotes": { + { + "name": "godot_string_xml_escape_with_quotes", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_xml_unescape": { + { + "name": "godot_string_xml_unescape", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_percent_decode": { + { + "name": "godot_string_percent_decode", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_percent_encode": { + { + "name": "godot_string_percent_encode", "return_type": "godot_string", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_is_valid_float": { + { + "name": "godot_string_is_valid_float", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_is_valid_hex_number": { + { + "name": "godot_string_is_valid_hex_number", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"], ["godot_bool", "p_with_prefix"] ] }, - "godot_string_is_valid_html_color": { + { + "name": "godot_string_is_valid_html_color", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_is_valid_identifier": { + { + "name": "godot_string_is_valid_identifier", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_is_valid_integer": { + { + "name": "godot_string_is_valid_integer", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_is_valid_ip_address": { + { + "name": "godot_string_is_valid_ip_address", "return_type": "godot_bool", "arguments": [ ["const godot_string *", "p_self"] ] }, - "godot_string_destroy": { + { + "name": "godot_string_destroy", "return_type": "void", "arguments": [ ["godot_string *", "p_self"] ] }, - "godot_object_destroy": { + { + "name": "godot_string_name_new", + "return_type": "void", + "arguments": [ + ["godot_string_name *", "r_dest"], + ["const godot_string *", "p_name"] + ] + }, + { + "name": "godot_string_name_new_data", + "return_type": "void", + "arguments": [ + ["godot_string_name *", "r_dest"], + ["const char *", "p_name"] + ] + }, + { + "name": "godot_string_name_get_name", + "return_type": "godot_string", + "arguments": [ + ["const godot_string_name *", "p_self"] + ] + }, + { + "name": "godot_string_name_get_hash", + "return_type": "uint32_t", + "arguments": [ + ["const godot_string_name *", "p_self"] + ] + }, + { + "name": "godot_string_name_get_data_unique_pointer", + "return_type": "const void *", + "arguments": [ + ["const godot_string_name *", "p_self"] + ] + }, + { + "name": "godot_string_name_operator_equal", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string_name *", "p_self"], + ["const godot_string_name *", "p_other"] + ] + }, + { + "name": "godot_string_name_operator_less", + "return_type": "godot_bool", + "arguments": [ + ["const godot_string_name *", "p_self"], + ["const godot_string_name *", "p_other"] + ] + }, + { + "name": "godot_string_name_destroy", + "return_type": "void", + "arguments": [ + ["godot_string_name *", "p_self"] + ] + }, + { + "name": "godot_object_destroy", "return_type": "void", "arguments": [ ["godot_object *", "p_o"] ] }, - "godot_global_get_singleton": { + { + "name": "godot_global_get_singleton", "return_type": "godot_object *", "arguments": [ ["char *", "p_name"] ] }, - "godot_method_bind_get_method": { + { + "name": "godot_method_bind_get_method", "return_type": "godot_method_bind *", "arguments": [ ["const char *", "p_classname"], ["const char *", "p_methodname"] ] }, - "godot_method_bind_ptrcall": { + { + "name": "godot_method_bind_ptrcall", "return_type": "void", "arguments": [ ["godot_method_bind *", "p_method_bind"], @@ -4394,7 +5102,8 @@ ["void *", "p_ret"] ] }, - "godot_method_bind_call": { + { + "name": "godot_method_bind_call", "return_type": "godot_variant", "arguments": [ ["godot_method_bind *", "p_method_bind"], @@ -4404,32 +5113,37 @@ ["godot_variant_call_error *", "p_call_error"] ] }, - "godot_get_class_constructor": { + { + "name": "godot_get_class_constructor", "return_type": "godot_class_constructor", "arguments": [ ["const char *", "p_classname"] ] }, - "godot_alloc": { + { + "name": "godot_alloc", "return_type": "void *", "arguments": [ ["int", "p_bytes"] ] }, - "godot_realloc": { + { + "name": "godot_realloc", "return_type": "void *", "arguments": [ ["void *", "p_ptr"], ["int", "p_bytes"] ] }, - "godot_free": { + { + "name": "godot_free", "return_type": "void", "arguments": [ ["void *", "p_ptr"] ] }, - "godot_print_error": { + { + "name": "godot_print_error", "return_type": "void", "arguments": [ ["const char *", "p_description"], @@ -4438,7 +5152,8 @@ ["int", "p_line"] ] }, - "godot_print_warning": { + { + "name": "godot_print_warning", "return_type": "void", "arguments": [ ["const char *", "p_description"], @@ -4447,13 +5162,15 @@ ["int", "p_line"] ] }, - "godot_print": { + { + "name": "godot_print", "return_type": "void", "arguments": [ ["const godot_string *", "p_message"] ] }, - "godot_nativescript_register_class": { + { + "name": "godot_nativescript_register_class", "return_type": "void", "arguments": [ ["void *", "p_gdnative_handle"], @@ -4463,7 +5180,8 @@ ["godot_instance_destroy_func", "p_destroy_func"] ] }, - "godot_nativescript_register_tool_class": { + { + "name": "godot_nativescript_register_tool_class", "return_type": "void", "arguments": [ ["void *", "p_gdnative_handle"], @@ -4473,7 +5191,8 @@ ["godot_instance_destroy_func", "p_destroy_func"] ] }, - "godot_nativescript_register_method": { + { + "name": "godot_nativescript_register_method", "return_type": "void", "arguments": [ ["void *", "p_gdnative_handle"], @@ -4483,7 +5202,8 @@ ["godot_instance_method", "p_method"] ] }, - "godot_nativescript_register_property": { + { + "name": "godot_nativescript_register_property", "return_type": "void", "arguments": [ ["void *", "p_gdnative_handle"], @@ -4494,7 +5214,8 @@ ["godot_property_get_func", "p_get_func"] ] }, - "godot_nativescript_register_signal": { + { + "name": "godot_nativescript_register_signal", "return_type": "void", "arguments": [ ["void *", "p_gdnative_handle"], @@ -4502,11 +5223,12 @@ ["const godot_signal *", "p_signal"] ] }, - "godot_nativescript_get_userdata": { + { + "name": "godot_nativescript_get_userdata", "return_type": "void *", "arguments": [ ["godot_object *", "p_instance"] ] } - } + ] } diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index 008968a5e5..2d8726e5db 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -141,6 +141,10 @@ typedef void godot_object; #include <gdnative/string.h> +/////// String name + +#include <gdnative/string_name.h> + ////// Vector2 #include <gdnative/vector2.h> diff --git a/modules/gdnative/include/gdnative/string_name.h b/modules/gdnative/include/gdnative/string_name.h new file mode 100644 index 0000000000..e217487250 --- /dev/null +++ b/modules/gdnative/include/gdnative/string_name.h @@ -0,0 +1,68 @@ +/*************************************************************************/ +/* string_name.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.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_STRING_NAME_H +#define GODOT_STRING_NAME_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> +#include <wchar.h> + +#define GODOT_STRING_NAME_SIZE sizeof(void *) + +#ifndef GODOT_CORE_API_GODOT_STRING_NAME_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_STRING_NAME_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_STRING_NAME_SIZE]; +} godot_string_name; +#endif + +#include <gdnative/gdnative.h> + +void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name); +void GDAPI godot_string_name_new_data(godot_string_name *r_dest, const char *p_name); + +godot_string GDAPI godot_string_name_get_name(const godot_string_name *p_self); + +uint32_t GDAPI godot_string_name_get_hash(const godot_string_name *p_self); +const void GDAPI *godot_string_name_get_data_unique_pointer(const godot_string_name *p_self); + +godot_bool GDAPI godot_string_name_operator_equal(const godot_string_name *p_self, const godot_string_name *p_other); +godot_bool GDAPI godot_string_name_operator_less(const godot_string_name *p_self, const godot_string_name *p_other); + +void GDAPI godot_string_name_destroy(godot_string_name *p_self); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_STRING_NAME_H diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp index fdd5a2ea19..9a956ff594 100644 --- a/modules/gdnative/nativescript/api_generator.cpp +++ b/modules/gdnative/nativescript/api_generator.cpp @@ -80,6 +80,7 @@ struct PropertyAPI { String getter; String setter; String type; + int index; }; struct ConstantAPI { @@ -259,6 +260,8 @@ List<ClassAPI> generate_c_api_classes() { property_api.type = get_type_name(p->get()); } + property_api.index = ClassDB::get_property_index(class_name, p->get().name); + if (!property_api.setter.empty() || !property_api.getter.empty()) { class_api.properties.push_back(property_api); } @@ -395,7 +398,8 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) { source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n"); source.push_back("\t\t\t\t\"type\": \"" + e->get().type + "\",\n"); source.push_back("\t\t\t\t\"getter\": \"" + e->get().getter + "\",\n"); - source.push_back("\t\t\t\t\"setter\": \"" + e->get().setter + "\"\n"); + source.push_back("\t\t\t\t\"setter\": \"" + e->get().setter + "\",\n"); + source.push_back(String("\t\t\t\t\"index\": ") + itos(e->get().index) + "\n"); source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n"); } source.push_back("\t\t],\n"); diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index 997c342045..059cd197d1 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -247,6 +247,7 @@ void unregister_gdnative_types() { singleton_gdnatives[i]->terminate(); } + singleton_gdnatives.clear(); unregister_nativescript_types(); diff --git a/modules/mono/SCsub b/modules/mono/SCsub index 0af2056c5c..caf4fdb3ca 100644 --- a/modules/mono/SCsub +++ b/modules/mono/SCsub @@ -2,9 +2,10 @@ Import('env') +from compat import byte_to_str def make_cs_files_header(src, dst): - with open(dst, 'wb') as header: + with open(dst, 'w') as header: header.write('/* This is an automatically generated file; DO NOT EDIT! OK THX */\n') header.write('#ifndef _CS_FILES_DATA_H\n') header.write('#define _CS_FILES_DATA_H\n\n') @@ -26,7 +27,7 @@ def make_cs_files_header(src, dst): for i, buf_idx in enumerate(range(len(buf))): if i > 0: header.write(', ') - header.write(str(ord(buf[buf_idx]))) + header.write(byte_to_str(buf[buf_idx])) inserted_files += '\tr_files.insert(\"' + file + '\", ' \ 'CompressedFile(_cs_' + name + '_compressed_size, ' \ '_cs_' + name + '_uncompressed_size, ' \ diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 7de90dfbc3..fe78ce423c 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -782,7 +782,7 @@ bool CSharpInstance::set(const StringName &p_name, const Variant &p_value) { if (method) { MonoObject *ret = method->invoke(mono_object, args); - if (ret && UNBOX_BOOLEAN(ret)) + if (ret && GDMonoMarshal::unbox<MonoBoolean>(ret) == true) return true; } diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp index 7b80e26645..1bad8a3f85 100644 --- a/modules/mono/editor/godotsharp_builds.cpp +++ b/modules/mono/editor/godotsharp_builds.cpp @@ -59,7 +59,7 @@ String _find_build_engine_on_unix(const String &p_name) { "/opt/novell/mono/bin/" }; - for (int i = 0; i < sizeof(locations) / sizeof(char); i++) { + for (int i = 0; i < sizeof(locations) / sizeof(const char *); i++) { String location = locations[i]; if (FileAccess::exists(location + p_name)) { diff --git a/modules/mono/glue/cs_files/Basis.cs b/modules/mono/glue/cs_files/Basis.cs index 6a73ebd554..c50e783349 100644 --- a/modules/mono/glue/cs_files/Basis.cs +++ b/modules/mono/glue/cs_files/Basis.cs @@ -160,26 +160,29 @@ namespace Godot Basis m = this.orthonormalized(); Vector3 euler; + euler.z = 0.0f; - euler.y = Mathf.asin(m.x[2]); + float mxy = m.y[2]; - if (euler.y < Mathf.PI * 0.5f) + + if (mxy < 1.0f) { - if (euler.y > -Mathf.PI * 0.5f) + if (mxy > -1.0f) { - euler.x = Mathf.atan2(-m.y[2], m.z[2]); - euler.z = Mathf.atan2(-m.x[1], m.x[0]); + 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.z = 0.0f; - euler.x = euler.z - Mathf.atan2(m.y[0], m.y[1]); + euler.x = Mathf.PI * 0.5f; + euler.y = -Mathf.atan2(-m.x[1], m.x[0]); } } else { - euler.z = 0f; - euler.x = Mathf.atan2(m.x[1], m.y[1]) - euler.z; + euler.x = -Mathf.PI * 0.5f; + euler.y = -Mathf.atan2(m.x[1], m.x[0]); } return euler; @@ -273,7 +276,7 @@ namespace Godot public Basis rotated(Vector3 axis, float phi) { - return this * new Basis(axis, phi); + return new Basis(axis, phi) * this; } public Basis scaled(Vector3 scale) @@ -281,13 +284,13 @@ namespace Godot Basis m = this; m[0, 0] *= scale.x; - m[1, 0] *= scale.x; - m[2, 0] *= scale.x; - m[0, 1] *= scale.y; + m[0, 1] *= scale.x; + m[0, 2] *= scale.x; + m[1, 0] *= scale.y; m[1, 1] *= scale.y; - m[2, 1] *= scale.y; - m[0, 2] *= scale.z; - m[1, 2] *= scale.z; + m[1, 2] *= scale.y; + m[2, 0] *= scale.z; + m[2, 1] *= scale.z; m[2, 2] *= scale.z; return m; @@ -347,6 +350,48 @@ namespace Godot ); } + public Quat Quat() { + float trace = x[0] + y[1] + z[2]; + + if (trace > 0.0f) { + float s = Mathf.sqrt(trace + 1.0f) * 2f; + float inv_s = 1f / s; + return new Quat( + (z[1] - y[2]) * inv_s, + (x[2] - z[0]) * inv_s, + (y[0] - x[1]) * inv_s, + 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 inv_s = 1f / s; + return new Quat( + s * 0.25f, + (x[1] + y[0]) * inv_s, + (x[2] + z[0]) * inv_s, + (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 inv_s = 1f / s; + return new Quat( + (x[1] + y[0]) * inv_s, + s * 0.25f, + (y[2] + z[1]) * inv_s, + (x[2] - z[0]) * inv_s + ); + } else { + 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, + (y[2] + z[1]) * inv_s, + s * 0.25f, + (y[0] - x[1]) * inv_s + ); + } + } + public Basis(Quat quat) { float s = 2.0f / quat.length_squared(); diff --git a/modules/mono/glue/cs_files/Quat.cs b/modules/mono/glue/cs_files/Quat.cs index 6345239f47..9b4b7fb297 100644 --- a/modules/mono/glue/cs_files/Quat.cs +++ b/modules/mono/glue/cs_files/Quat.cs @@ -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/Transform.cs b/modules/mono/glue/cs_files/Transform.cs index 2010f0b3af..74271e758b 100644 --- a/modules/mono/glue/cs_files/Transform.cs +++ b/modules/mono/glue/cs_files/Transform.cs @@ -35,7 +35,7 @@ namespace Godot public Transform rotated(Vector3 axis, float phi) { - return this * new Transform(new Basis(axis, phi), new Vector3()); + return new Transform(new Basis(axis, phi), new Vector3()) * this; } public Transform scaled(Vector3 scale) @@ -104,6 +104,12 @@ namespace Godot this.origin = origin; } + public Transform(Quat quat, Vector3 origin) + { + this.basis = new Basis(quat); + this.origin = origin; + } + public Transform(Basis basis, Vector3 origin) { this.basis = basis; diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index d0b5b12d4b..2c88832998 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -266,6 +266,13 @@ void GDMono::add_assembly(uint32_t p_domain_id, GDMonoAssembly *p_assembly) { assemblies[p_domain_id][p_assembly->get_name()] = p_assembly; } +GDMonoAssembly **GDMono::get_loaded_assembly(const String &p_name) { + + MonoDomain *domain = mono_domain_get(); + uint32_t domain_id = domain ? mono_domain_get_id(domain) : 0; + return assemblies[domain_id].getptr(p_name); +} + bool GDMono::_load_assembly(const String &p_name, GDMonoAssembly **r_assembly) { CRASH_COND(!r_assembly); @@ -278,34 +285,17 @@ bool GDMono::_load_assembly(const String &p_name, GDMonoAssembly **r_assembly) { MonoAssembly *assembly = mono_assembly_load_full(aname, NULL, &status, false); mono_assembly_name_free(aname); - if (!assembly) - return false; + ERR_FAIL_NULL_V(assembly, false); uint32_t domain_id = mono_domain_get_id(mono_domain_get()); GDMonoAssembly **stored_assembly = assemblies[domain_id].getptr(p_name); - if (stored_assembly) { - // Loaded by our preload hook (status is not initialized when returning from a preload hook) - ERR_FAIL_COND_V((*stored_assembly)->get_assembly() != assembly, false); - *r_assembly = *stored_assembly; - } else { - ERR_FAIL_COND_V(status != MONO_IMAGE_OK, false); - - MonoImage *assembly_image = mono_assembly_get_image(assembly); - ERR_FAIL_NULL_V(assembly_image, false); - - const char *path = mono_image_get_filename(assembly_image); - - *r_assembly = memnew(GDMonoAssembly(p_name, path)); - Error error = (*r_assembly)->wrapper_for_image(assembly_image); + ERR_FAIL_COND_V(status != MONO_IMAGE_OK, false); + ERR_FAIL_COND_V(stored_assembly == NULL, false); - if (error != OK) { - memdelete(*r_assembly); - *r_assembly = NULL; - ERR_FAIL_V(false); - } - } + ERR_FAIL_COND_V((*stored_assembly)->get_assembly() != assembly, false); + *r_assembly = *stored_assembly; if (OS::get_singleton()->is_stdout_verbose()) OS::get_singleton()->print(String("Mono: Assembly " + p_name + " loaded from path: " + (*r_assembly)->get_path() + "\n").utf8()); diff --git a/modules/mono/mono_gd/gd_mono.h b/modules/mono/mono_gd/gd_mono.h index ab96d575e6..b188c0730a 100644 --- a/modules/mono/mono_gd/gd_mono.h +++ b/modules/mono/mono_gd/gd_mono.h @@ -122,7 +122,9 @@ public: static GDMono *get_singleton() { return singleton; } + // Do not use these, unless you know what you're doing void add_assembly(uint32_t p_domain_id, GDMonoAssembly *p_assembly); + GDMonoAssembly **get_loaded_assembly(const String &p_name); _FORCE_INLINE_ bool is_runtime_initialized() const { return runtime_initialized; } _FORCE_INLINE_ bool is_finalizing_scripts_domain() const { return finalizing_scripts_domain; } diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp index a98537b9e1..4b370295f3 100644 --- a/modules/mono/mono_gd/gd_mono_assembly.cpp +++ b/modules/mono/mono_gd/gd_mono_assembly.cpp @@ -39,28 +39,60 @@ #include "../godotsharp_dirs.h" #include "gd_mono_class.h" -MonoAssembly *gdmono_load_assembly_from(const String &p_name, const String &p_path) { +bool GDMonoAssembly::no_search = false; +Vector<String> GDMonoAssembly::search_dirs; - MonoDomain *domain = mono_domain_get(); +MonoAssembly *GDMonoAssembly::_search_hook(MonoAssemblyName *aname, void *user_data) { - GDMonoAssembly *assembly = memnew(GDMonoAssembly(p_name, p_path)); - Error err = assembly->load(domain); - ERR_FAIL_COND_V(err != OK, NULL); + (void)user_data; // UNUSED - GDMono::get_singleton()->add_assembly(mono_domain_get_id(domain), assembly); + String name = mono_assembly_name_get_name(aname); + bool has_extension = name.ends_with(".dll") || name.ends_with(".exe"); - return assembly->get_assembly(); -} + if (no_search) + return NULL; -MonoAssembly *gdmono_MonoAssemblyPreLoad(MonoAssemblyName *aname, char **assemblies_path, void *user_data) { + GDMonoAssembly **loaded_asm = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name); + if (loaded_asm) + return (*loaded_asm)->get_assembly(); - (void)user_data; // UNUSED + no_search = true; // Avoid the recursion madness + + String path; + MonoAssembly *res = NULL; + + for (int i = 0; i < search_dirs.size(); i++) { + const String &search_dir = search_dirs[i]; - MonoAssembly *assembly_loaded = mono_assembly_loaded(aname); - if (assembly_loaded) // Already loaded - return assembly_loaded; + if (has_extension) { + path = search_dir.plus_file(name); + if (FileAccess::exists(path)) { + res = _load_assembly_from(name.get_basename(), path); + break; + } + } else { + path = search_dir.plus_file(name + ".dll"); + if (FileAccess::exists(path)) { + res = _load_assembly_from(name, path); + break; + } + + path = search_dir.plus_file(name + ".exe"); + if (FileAccess::exists(path)) { + res = _load_assembly_from(name, path); + break; + } + } + } - static Vector<String> search_dirs; + no_search = false; + + return res; +} + +MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data) { + + (void)user_data; // UNUSED if (search_dirs.empty()) { search_dirs.push_back(GodotSharpDirs::get_res_temp_assemblies_dir()); @@ -80,35 +112,32 @@ MonoAssembly *gdmono_MonoAssemblyPreLoad(MonoAssemblyName *aname, char **assembl } } - String name = mono_assembly_name_get_name(aname); - bool has_extension = name.ends_with(".dll") || name.ends_with(".exe"); + return NULL; +} - String path; +MonoAssembly *GDMonoAssembly::_load_assembly_from(const String &p_name, const String &p_path) { - for (int i = 0; i < search_dirs.size(); i++) { - const String &search_dir = search_dirs[i]; + GDMonoAssembly *assembly = memnew(GDMonoAssembly(p_name, p_path)); - if (has_extension) { - path = search_dir.plus_file(name); - if (FileAccess::exists(path)) - return gdmono_load_assembly_from(name.get_basename(), path); - } else { - path = search_dir.plus_file(name + ".dll"); - if (FileAccess::exists(path)) - return gdmono_load_assembly_from(name, path); + MonoDomain *domain = mono_domain_get(); - path = search_dir.plus_file(name + ".exe"); - if (FileAccess::exists(path)) - return gdmono_load_assembly_from(name, path); - } + Error err = assembly->load(domain); + + if (err != OK) { + memdelete(assembly); + ERR_FAIL_V(NULL); } - return NULL; + GDMono::get_singleton()->add_assembly(domain ? mono_domain_get_id(domain) : 0, assembly); + + return assembly->get_assembly(); } void GDMonoAssembly::initialize() { - mono_install_assembly_preload_hook(&gdmono_MonoAssemblyPreLoad, NULL); + // TODO refonly as well? + mono_install_assembly_preload_hook(&GDMonoAssembly::_preload_hook, NULL); + mono_install_assembly_search_hook(&GDMonoAssembly::_search_hook, NULL); } Error GDMonoAssembly::load(MonoDomain *p_domain) { @@ -153,7 +182,7 @@ no_pdb: ERR_FAIL_COND_V(status != MONO_IMAGE_OK || assembly == NULL, ERR_FILE_CANT_OPEN); - if (mono_image_get_entry_point(image)) { + if (p_domain && mono_image_get_entry_point(image)) { // TODO should this be removed? do we want to call main? what other effects does this have? mono_jit_exec(p_domain, assembly, 0, NULL); } diff --git a/modules/mono/mono_gd/gd_mono_assembly.h b/modules/mono/mono_gd/gd_mono_assembly.h index 89e091549c..710b674622 100644 --- a/modules/mono/mono_gd/gd_mono_assembly.h +++ b/modules/mono/mono_gd/gd_mono_assembly.h @@ -86,6 +86,14 @@ class GDMonoAssembly { Vector<uint8_t> pdb_data; #endif + static bool no_search; + static Vector<String> search_dirs; + + static MonoAssembly *_search_hook(MonoAssemblyName *aname, void *user_data); + static MonoAssembly *_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data); + + static MonoAssembly *_load_assembly_from(const String &p_name, const String &p_path); + friend class GDMono; static void initialize(); diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 0c64380e31..c2d8eeaa32 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -279,11 +279,11 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { } bool GDMonoField::get_bool_value(MonoObject *p_object) { - return UNBOX_BOOLEAN(get_value(p_object)); + return (bool)GDMonoMarshal::unbox<MonoBoolean>(get_value(p_object)); } int GDMonoField::get_int_value(MonoObject *p_object) { - return UNBOX_INT32(get_value(p_object)); + return GDMonoMarshal::unbox<int32_t>(get_value(p_object)); } String GDMonoField::get_string_value(MonoObject *p_object) { diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index b5419952de..b64915109f 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -41,11 +41,11 @@ namespace GDMonoMarshal { return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(m_t), raw); \ } -#define RETURN_UNBOXED_STRUCT(m_t, m_var_in) \ - { \ - float *raw = UNBOX_FLOAT_PTR(m_var_in); \ - MARSHALLED_IN(m_t, raw, ret); \ - return ret; \ +#define RETURN_UNBOXED_STRUCT(m_t, m_var_in) \ + { \ + float *raw = (float *)mono_object_unbox(m_var_in); \ + MARSHALLED_IN(m_t, raw, ret); \ + return ret; \ } Variant::Type managed_to_variant_type(const ManagedType &p_type) { @@ -453,30 +453,30 @@ Variant mono_object_to_variant(MonoObject *p_obj) { Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) { switch (p_type.type_encoding) { case MONO_TYPE_BOOLEAN: - return (bool)UNBOX_BOOLEAN(p_obj); + return (bool)unbox<MonoBoolean>(p_obj); case MONO_TYPE_I1: - return UNBOX_INT8(p_obj); + return unbox<int8_t>(p_obj); case MONO_TYPE_I2: - return UNBOX_INT16(p_obj); + return unbox<int16_t>(p_obj); case MONO_TYPE_I4: - return UNBOX_INT32(p_obj); + return unbox<int32_t>(p_obj); case MONO_TYPE_I8: - return UNBOX_INT64(p_obj); + return unbox<int64_t>(p_obj); case MONO_TYPE_U1: - return UNBOX_UINT8(p_obj); + return unbox<uint8_t>(p_obj); case MONO_TYPE_U2: - return UNBOX_UINT16(p_obj); + return unbox<uint16_t>(p_obj); case MONO_TYPE_U4: - return UNBOX_UINT32(p_obj); + return unbox<uint32_t>(p_obj); case MONO_TYPE_U8: - return UNBOX_UINT64(p_obj); + return unbox<uint64_t>(p_obj); case MONO_TYPE_R4: - return UNBOX_FLOAT(p_obj); + return unbox<float>(p_obj); case MONO_TYPE_R8: - return UNBOX_DOUBLE(p_obj); + return unbox<double>(p_obj); case MONO_TYPE_STRING: { String str = mono_string_to_godot((MonoString *)p_obj); @@ -554,29 +554,18 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) { // GodotObject if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) { - GDMonoField *ptr_field = CACHED_FIELD(GodotObject, ptr); - - ERR_FAIL_NULL_V(ptr_field, Variant()); - - void *ptr_to_unmanaged = UNBOX_PTR(ptr_field->get_value(p_obj)); - - if (!ptr_to_unmanaged) // IntPtr.Zero - return Variant(); - - Object *object_ptr = static_cast<Object *>(ptr_to_unmanaged); - - if (!object_ptr) - return Variant(); - - return object_ptr; + Object *ptr = unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_obj)); + return ptr ? Variant(ptr) : Variant(); } if (CACHED_CLASS(NodePath) == type_class) { - return UNBOX_PTR(CACHED_FIELD(NodePath, ptr)->get_value(p_obj)); + NodePath *ptr = unbox<NodePath *>(CACHED_FIELD(NodePath, ptr)->get_value(p_obj)); + return ptr ? Variant(*ptr) : Variant(); } if (CACHED_CLASS(RID) == type_class) { - return UNBOX_PTR(CACHED_FIELD(RID, ptr)->get_value(p_obj)); + RID *ptr = unbox<RID *>(CACHED_FIELD(RID, ptr)->get_value(p_obj)); + return ptr ? Variant(*ptr) : Variant(); } } break; diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index 5fbafa0acb..38dd22357d 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -36,21 +36,10 @@ namespace GDMonoMarshal { -#define UNBOX_CHAR_PTR(x) (char *)mono_object_unbox(x) -#define UNBOX_FLOAT_PTR(x) (float *)mono_object_unbox(x) - -#define UNBOX_DOUBLE(x) *(double *)mono_object_unbox(x) -#define UNBOX_FLOAT(x) *(float *)mono_object_unbox(x) -#define UNBOX_INT64(x) *(int64_t *)mono_object_unbox(x) -#define UNBOX_INT32(x) *(int32_t *)mono_object_unbox(x) -#define UNBOX_INT16(x) *(int16_t *)mono_object_unbox(x) -#define UNBOX_INT8(x) *(int8_t *)mono_object_unbox(x) -#define UNBOX_UINT64(x) *(uint64_t *)mono_object_unbox(x) -#define UNBOX_UINT32(x) *(uint32_t *)mono_object_unbox(x) -#define UNBOX_UINT16(x) *(uint16_t *)mono_object_unbox(x) -#define UNBOX_UINT8(x) *(uint8_t *)mono_object_unbox(x) -#define UNBOX_BOOLEAN(x) *(MonoBoolean *)mono_object_unbox(x) -#define UNBOX_PTR(x) mono_object_unbox(x) +template <typename T> +T unbox(MonoObject *p_obj) { + return *(T *)mono_object_unbox(p_obj); +} #define BOX_DOUBLE(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(double), &x) #define BOX_FLOAT(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(float), &x) diff --git a/platform/android/SCsub b/platform/android/SCsub index e9a370869f..7fa0262359 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -46,8 +46,18 @@ gradle_baseout = open_utf8(abspath + "/java/build.gradle", "w") gradle_text = gradle_basein.read() - +gradle_maven_flat_text = "" +if len(env.android_flat_dirs) > 0: + gradle_maven_flat_text += "flatDir {\n" + gradle_maven_flat_text += "\tdirs " + for x in env.android_flat_dirs: + gradle_maven_flat_text += "'" + x + "'," + + gradle_maven_flat_text = gradle_maven_flat_text[:-1] + gradle_maven_flat_text += "\n\t}\n" + gradle_maven_repos_text = "" +gradle_maven_repos_text += gradle_maven_flat_text if len(env.android_maven_repos) > 0: gradle_maven_repos_text += "" diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template index 1df56ce621..7cb6cf860a 100644 --- a/platform/android/build.gradle.template +++ b/platform/android/build.gradle.template @@ -1,6 +1,7 @@ buildscript { repositories { jcenter() + $$GRADLE_REPOSITORY_URLS$$ } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' @@ -54,11 +55,11 @@ android { ] res.srcDirs = [ 'res' - $$GRADLE_RES_DIRS$$ + $$GRADLE_RES_DIRS$$ ] aidl.srcDirs = [ 'aidl' - $$GRADLE_AIDL_DIRS$$ + $$GRADLE_AIDL_DIRS$$ ] assets.srcDirs = [ 'assets' diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index da6ceacdac..65cafbd6d4 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -81,7 +81,7 @@ void _set_keep_screen_on(bool p_enabled) { extern int gargc; extern char **gargv; -extern int iphone_main(int, int, int, char **); +extern int iphone_main(int, int, int, char **, String); extern void iphone_finish(); CMMotionManager *motionManager; @@ -393,15 +393,6 @@ static int frame_count = 0; }; ++frame_count; - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, - NSUserDomainMask, YES); - NSString *documentsDirectory = [paths objectAtIndex:0]; - // NSString *documentsDirectory = [[[NSFileManager defaultManager] - // URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] - // lastObject]; - OSIPhone::get_singleton()->set_data_dir( - String::utf8([documentsDirectory UTF8String])); - NSString *locale_code = [[NSLocale currentLocale] localeIdentifier]; OSIPhone::get_singleton()->set_locale( String::utf8([locale_code UTF8String])); @@ -604,7 +595,11 @@ static int frame_count = 0; glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); - int err = iphone_main(backingWidth, backingHeight, gargc, gargv); + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, + NSUserDomainMask, YES); + NSString *documentsDirectory = [paths objectAtIndex:0]; + + int err = iphone_main(backingWidth, backingHeight, gargc, gargv, String::utf8([documentsDirectory UTF8String])); if (err != 0) { // bail, things did not go very well for us, should probably output a message on screen with our error code... exit(0); diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm index 821ef2a3ab..3955b9f0aa 100644 --- a/platform/iphone/game_center.mm +++ b/platform/iphone/game_center.mm @@ -89,7 +89,7 @@ Error GameCenter::connect() { ret["type"] = "authentication"; if (player.isAuthenticated) { ret["result"] = "ok"; - ret["player_id"] = player.playerID; + ret["player_id"] = [player.playerID UTF8String]; GameCenter::get_singleton()->connected = true; } else { ret["result"] = "error"; diff --git a/platform/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp index 8c6d6d8da4..7d21d35e18 100644 --- a/platform/iphone/godot_iphone.cpp +++ b/platform/iphone/godot_iphone.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "main/main.h" #include "os_iphone.h" +#include "ustring.h" #include <stdio.h> #include <string.h> @@ -41,9 +42,9 @@ int add_path(int p_argc, char **p_args); int add_cmdline(int p_argc, char **p_args); }; -int iphone_main(int, int, int, char **); +int iphone_main(int, int, int, char **, String); -int iphone_main(int width, int height, int argc, char **argv) { +int iphone_main(int width, int height, int argc, char **argv, String data_dir) { int len = strlen(argv[0]); @@ -63,7 +64,7 @@ int iphone_main(int width, int height, int argc, char **argv) { char cwd[512]; getcwd(cwd, sizeof(cwd)); printf("cwd %s\n", cwd); - os = new OSIPhone(width, height); + os = new OSIPhone(width, height, data_dir); char *fargv[64]; for (int i = 0; i < argc; i++) { diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index 219e93facf..08792b8631 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -97,6 +97,8 @@ void OSIPhone::initialize_core() { OS_Unix::initialize_core(); SemaphoreIphone::make_default(); + + set_data_dir(data_dir); }; void OSIPhone::initialize_logger() { @@ -572,7 +574,7 @@ bool OSIPhone::_check_internal_feature_support(const String &p_feature) { return p_feature == "mobile" || p_feature == "etc" || p_feature == "pvrtc" || p_feature == "etc2"; } -OSIPhone::OSIPhone(int width, int height) { +OSIPhone::OSIPhone(int width, int height, String p_data_dir) { main_loop = NULL; visual_server = NULL; @@ -586,6 +588,10 @@ OSIPhone::OSIPhone(int width, int height) { event_count = 0; virtual_keyboard_height = 0; + // can't call set_data_dir from here, since it requires DirAccess + // which is initialized in initialize_core + data_dir = p_data_dir; + _set_logger(memnew(SyslogLogger)); }; diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index cf2396e87b..e70ac9ba98 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -201,7 +201,7 @@ public: virtual void native_video_stop(); virtual bool _check_internal_feature_support(const String &p_feature); - OSIPhone(int width, int height); + OSIPhone(int width, int height, String p_data_dir); ~OSIPhone(); }; diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 0fd21d62ee..0ba0ddec7d 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -53,9 +53,16 @@ class EditorExportPlatformOSX : public EditorExportPlatform { void _fix_plist(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &plist, const String &p_binary); void _make_icon(const Ref<Image> &p_icon, Vector<uint8_t> &p_data); -#ifdef OSX_ENABLED + Error _code_sign(const Ref<EditorExportPreset> &p_preset, const String &p_path); Error _create_dmg(const String &p_dmg_path, const String &p_pkg_name, const String &p_app_path_name); + +#ifdef OSX_ENABLED + bool use_codesign() const { return true; } + bool use_dmg() const { return true; } +#else + bool use_codesign() const { return false; } + bool use_dmg() const { return false; } #endif protected: @@ -67,11 +74,7 @@ public: virtual String get_os_name() const { return "OSX"; } virtual Ref<Texture> get_logo() const { return logo; } -#ifdef OSX_ENABLED - virtual String get_binary_extension() const { return "dmg"; } -#else - virtual String get_binary_extension() const { return "zip"; } -#endif + virtual String get_binary_extension() const { return use_dmg() ? "dmg" : "zip"; } virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0); virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const; @@ -220,7 +223,6 @@ void EditorExportPlatformOSX::_fix_plist(const Ref<EditorExportPreset> &p_preset } } -#ifdef OSX_ENABLED /** If we're running the OSX version of the Godot editor we'll: - export our application bundle to a temporary folder @@ -230,6 +232,7 @@ void EditorExportPlatformOSX::_fix_plist(const Ref<EditorExportPreset> &p_preset Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_preset, const String &p_path) { List<String> args; + if (p_preset->get("codesign/entitlements") != "") { /* this should point to our entitlements.plist file that sandboxes our application, I don't know if this should also be placed in our app bundle */ args.push_back("-entitlements"); @@ -239,14 +242,25 @@ Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_prese args.push_back(p_preset->get("codesign/identity")); args.push_back("-v"); /* provide some more feedback */ args.push_back(p_path); - Error err = OS::get_singleton()->execute("/usr/bin/codesign", args, true); - ERR_FAIL_COND_V(err, err); + + String str; + Error err = OS::get_singleton()->execute("/usr/bin/codesign", args, true, NULL, &str, NULL, true); + ERR_FAIL_COND_V(err != OK, err); + + print_line("codesign: " + str); + if (str.find("no identity found") != -1) { + EditorNode::add_io_error("codesign: no identity found"); + return FAILED; + } return OK; } Error EditorExportPlatformOSX::_create_dmg(const String &p_dmg_path, const String &p_pkg_name, const String &p_app_path_name) { List<String> args; + + OS::get_singleton()->move_to_trash(p_dmg_path); + args.push_back("create"); args.push_back(p_dmg_path); args.push_back("-volname"); @@ -255,8 +269,20 @@ Error EditorExportPlatformOSX::_create_dmg(const String &p_dmg_path, const Strin args.push_back("HFS+"); args.push_back("-srcfolder"); args.push_back(p_app_path_name); - Error err = OS::get_singleton()->execute("/usr/bin/hdiutil", args, true); - ERR_FAIL_COND_V(err, err); + + String str; + Error err = OS::get_singleton()->execute("/usr/bin/hdiutil", args, true, NULL, &str, NULL, true); + ERR_FAIL_COND_V(err != OK, err); + + print_line("hdiutil returned: " + str); + if (str.find("create failed") != -1) { + if (str.find("File exists") != -1) { + EditorNode::add_io_error("hdiutil: create failed - file exists"); + } else { + EditorNode::add_io_error("hdiutil: create failed"); + } + return FAILED; + } return OK; } @@ -309,28 +335,45 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p else pkg_name = "Unnamed"; - // We're on OSX so we can export to DMG, but first we create our application bundle - String tmp_app_path_name = p_path.get_base_dir() + "/" + pkg_name + ".app"; - print_line("Exporting to " + tmp_app_path_name); - DirAccess *tmp_app_path = DirAccess::create_for_path(tmp_app_path_name); - ERR_FAIL_COND_V(!tmp_app_path, ERR_CANT_CREATE) + Error err = OK; + String tmp_app_path_name = ""; + zlib_filefunc_def io2 = io; + FileAccess *dst_f = NULL; + io2.opaque = &dst_f; + zipFile dst_pkg_zip = NULL; + + if (use_dmg()) { + // We're on OSX so we can export to DMG, but first we create our application bundle + tmp_app_path_name = EditorSettings::get_singleton()->get_settings_path() + "/tmp/" + pkg_name + ".app"; + print_line("Exporting to " + tmp_app_path_name); + DirAccess *tmp_app_path = DirAccess::create_for_path(tmp_app_path_name); + if (!tmp_app_path) { + err = ERR_CANT_CREATE; + } - ///@TODO We should delete the existing application bundle especially if we attempt to code sign it, but what is a safe way to do this? Maybe call system function so it moves to trash? - // tmp_app_path->erase_contents_recursive(); + // Create our folder structure or rely on unzip? + if (err == OK) { + print_line("Creating " + tmp_app_path_name + "/Contents/MacOS"); + err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/MacOS"); + } - // Create our folder structure or rely on unzip? - print_line("Creating " + tmp_app_path_name + "/Contents/MacOS"); - Error dir_err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/MacOS"); - ERR_FAIL_COND_V(dir_err, ERR_CANT_CREATE) - print_line("Creating " + tmp_app_path_name + "/Contents/Resources"); - dir_err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Resources"); - ERR_FAIL_COND_V(dir_err, ERR_CANT_CREATE) + if (err == OK) { + print_line("Creating " + tmp_app_path_name + "/Contents/Resources"); + err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Resources"); + } + } else { + // Open our destination zip file + dst_pkg_zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2); + if (!dst_pkg_zip) { + err = ERR_CANT_CREATE; + } + } - /* Now process our template */ + // Now process our template bool found_binary = false; int total_size = 0; - while (ret == UNZ_OK) { + while (ret == UNZ_OK && err == OK) { bool is_execute = false; //get filename @@ -392,287 +435,152 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p print_line("ADDING: " + file + " size: " + itos(data.size())); total_size += data.size(); - /* write it into our application bundle */ - file = tmp_app_path_name + "/" + file; - - /* write the file, need to add chmod */ - FileAccess *f = FileAccess::open(file, FileAccess::WRITE); - ERR_FAIL_COND_V(!f, ERR_CANT_CREATE) - f->store_buffer(data.ptr(), data.size()); - f->close(); - memdelete(f); - - if (is_execute) { - // we need execute rights on this file - chmod(file.utf8().get_data(), 0755); + if (use_dmg()) { + // write it into our application bundle + file = tmp_app_path_name + "/" + file; + + // write the file, need to add chmod + FileAccess *f = FileAccess::open(file, FileAccess::WRITE); + if (f) { + f->store_buffer(data.ptr(), data.size()); + f->close(); + if (is_execute) { + // Chmod with 0755 if the file is executable + f->_chmod(file, 0755); + } + memdelete(f); + } else { + err = ERR_CANT_CREATE; + } } else { - // seems to already be set correctly - // chmod(file.utf8().get_data(), 0644); + // add it to our zip file + file = pkg_name + ".app/" + file; + + zip_fileinfo fi; + fi.tmz_date.tm_hour = info.tmu_date.tm_hour; + fi.tmz_date.tm_min = info.tmu_date.tm_min; + fi.tmz_date.tm_sec = info.tmu_date.tm_sec; + fi.tmz_date.tm_mon = info.tmu_date.tm_mon; + fi.tmz_date.tm_mday = info.tmu_date.tm_mday; + fi.tmz_date.tm_year = info.tmu_date.tm_year; + fi.dosDate = info.dosDate; + fi.internal_fa = info.internal_fa; + fi.external_fa = info.external_fa; + + int zerr = zipOpenNewFileInZip(dst_pkg_zip, + file.utf8().get_data(), + &fi, + NULL, + 0, + NULL, + 0, + NULL, + Z_DEFLATED, + Z_DEFAULT_COMPRESSION); + + print_line("OPEN ERR: " + itos(zerr)); + zerr = zipWriteInFileInZip(dst_pkg_zip, data.ptr(), data.size()); + print_line("WRITE ERR: " + itos(zerr)); + zipCloseFileInZip(dst_pkg_zip); } } ret = unzGoToNextFile(src_pkg_zip); } - /* we're done with our source zip */ + // we're done with our source zip unzClose(src_pkg_zip); if (!found_binary) { ERR_PRINTS("Requested template binary '" + binary_to_use + "' not found. It might be missing from your template archive."); - unzClose(src_pkg_zip); - return ERR_FILE_NOT_FOUND; - } - - ep.step("Making PKG", 1); - - String pack_path = tmp_app_path_name + "/Contents/Resources/" + pkg_name + ".pck"; - Error err = save_pack(p_preset, pack_path); - // chmod(pack_path.utf8().get_data(), 0644); - - if (err) { - return err; + err = ERR_FILE_NOT_FOUND; } - /* see if we can code sign our new package */ - if (p_preset->get("codesign/identity") != "") { - ep.step("Code signing bundle", 2); + if (err == OK) { + ep.step("Making PKG", 1); - /* the order in which we code sign is important, this is a bit of a shame or we could do this in our loop that extracts the files from our ZIP */ + if (use_dmg()) { + String pack_path = tmp_app_path_name + "/Contents/Resources/" + pkg_name + ".pck"; + err = save_pack(p_preset, pack_path); - // start with our application - err = _code_sign(p_preset, tmp_app_path_name + "/Contents/MacOS/" + pkg_name); - ERR_FAIL_COND_V(err, err); + // see if we can code sign our new package + String identity = p_preset->get("codesign/identity"); + if (err == OK && identity != "") { + ep.step("Code signing bundle", 2); - ///@TODO we should check the contents of /Contents/Frameworks for frameworks to sign + // the order in which we code sign is important, this is a bit of a shame or we could do this in our loop that extracts the files from our ZIP - // we should probably loop through all resources and sign them? - err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Resources/icon.icns"); - ERR_FAIL_COND_V(err, err); - err = _code_sign(p_preset, pack_path); - ERR_FAIL_COND_V(err, err); - err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Info.plist"); - ERR_FAIL_COND_V(err, err); - } + // start with our application + err = _code_sign(p_preset, tmp_app_path_name + "/Contents/MacOS/" + pkg_name); - /* and finally create a DMG */ - ep.step("Making DMG", 3); - err = _create_dmg(p_path, pkg_name, tmp_app_path_name); - ERR_FAIL_COND_V(err, err); - - return OK; -} - -#else - -/** - When exporting for OSX from any other platform we don't have access to code signing or creating DMGs so we'll wrap the bundle into a zip file. - - Should probably find a nicer way to have just one export method instead of duplicating the method like this but I would the code got very - messy with switches inside of it. -**/ -Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) { - - String src_pkg_name; - - EditorProgress ep("export", "Exporting for OSX", 104); - - if (p_debug) - src_pkg_name = p_preset->get("custom_package/debug"); - else - src_pkg_name = p_preset->get("custom_package/release"); - - if (src_pkg_name == "") { - String err; - src_pkg_name = find_export_template("osx.zip", &err); - if (src_pkg_name == "") { - EditorNode::add_io_error(err); - return ERR_FILE_NOT_FOUND; - } - } - - FileAccess *src_f = NULL; - zlib_filefunc_def io = zipio_create_io_from_file(&src_f); - - ep.step("Creating app", 0); - - unzFile src_pkg_zip = unzOpen2(src_pkg_name.utf8().get_data(), &io); - if (!src_pkg_zip) { - - EditorNode::add_io_error("Could not find template app to export:\n" + src_pkg_name); - return ERR_FILE_NOT_FOUND; - } - - ERR_FAIL_COND_V(!src_pkg_zip, ERR_CANT_OPEN); - int ret = unzGoToFirstFile(src_pkg_zip); - - String binary_to_use = "godot_osx_" + String(p_debug ? "debug" : "release") + "."; - int bits_mode = p_preset->get("application/bits_mode"); - binary_to_use += String(bits_mode == 0 ? "fat" : bits_mode == 1 ? "64" : "32"); - - print_line("binary: " + binary_to_use); - String pkg_name; - if (p_preset->get("application/name") != "") - pkg_name = p_preset->get("application/name"); // app_name - else if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "") - pkg_name = String(ProjectSettings::get_singleton()->get("application/config/name")); - else - pkg_name = "Unnamed"; - - /* Open our destination zip file */ - zlib_filefunc_def io2 = io; - FileAccess *dst_f = NULL; - io2.opaque = &dst_f; - zipFile dst_pkg_zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2); - - bool found_binary = false; - - while (ret == UNZ_OK) { - - //get filename - unz_file_info info; - char fname[16384]; - ret = unzGetCurrentFileInfo(src_pkg_zip, &info, fname, 16384, NULL, 0, NULL, 0); - - String file = fname; - - print_line("READ: " + file); - Vector<uint8_t> data; - data.resize(info.uncompressed_size); - - //read - unzOpenCurrentFile(src_pkg_zip); - unzReadCurrentFile(src_pkg_zip, data.ptr(), data.size()); - unzCloseCurrentFile(src_pkg_zip); - - //write + ///@TODO we should check the contents of /Contents/Frameworks for frameworks to sign + } - file = file.replace_first("osx_template.app/", ""); + if (err == OK && identity != "") { + // we should probably loop through all resources and sign them? + err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Resources/icon.icns"); + } - if (file == "Contents/Info.plist") { - print_line("parse plist"); - _fix_plist(p_preset, data, pkg_name); - } + if (err == OK && identity != "") { + err = _code_sign(p_preset, pack_path); + } - if (file.begins_with("Contents/MacOS/godot_")) { - if (file != "Contents/MacOS/" + binary_to_use) { - ret = unzGoToNextFile(src_pkg_zip); - continue; //ignore! + if (err == OK && identity != "") { + err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Info.plist"); } - found_binary = true; - file = "Contents/MacOS/" + pkg_name; - } - if (file == "Contents/Resources/icon.icns") { - //see if there is an icon - String iconpath; - if (p_preset->get("application/icon") != "") - iconpath = p_preset->get("application/icon"); - else - iconpath = ProjectSettings::get_singleton()->get("application/config/icon"); - print_line("icon? " + iconpath); - if (iconpath != "") { - Ref<Image> icon; - icon.instance(); - icon->load(iconpath); - if (!icon->empty()) { - print_line("loaded?"); - _make_icon(icon, data); - } + // and finally create a DMG + if (err == OK) { + ep.step("Making DMG", 3); + err = _create_dmg(p_path, pkg_name, tmp_app_path_name); } - //bleh? - } - if (data.size() > 0) { - print_line("ADDING: " + file + " size: " + itos(data.size())); + // Clean up temporary .app dir + OS::get_singleton()->move_to_trash(tmp_app_path_name); + } else { - /* add it to our zip file */ - file = pkg_name + ".app/" + file; - - zip_fileinfo fi; - fi.tmz_date.tm_hour = info.tmu_date.tm_hour; - fi.tmz_date.tm_min = info.tmu_date.tm_min; - fi.tmz_date.tm_sec = info.tmu_date.tm_sec; - fi.tmz_date.tm_mon = info.tmu_date.tm_mon; - fi.tmz_date.tm_mday = info.tmu_date.tm_mday; - fi.tmz_date.tm_year = info.tmu_date.tm_year; - fi.dosDate = info.dosDate; - fi.internal_fa = info.internal_fa; - fi.external_fa = info.external_fa; - - int err = zipOpenNewFileInZip(dst_pkg_zip, - file.utf8().get_data(), - &fi, - NULL, - 0, - NULL, - 0, - NULL, - Z_DEFLATED, - Z_DEFAULT_COMPRESSION); - - print_line("OPEN ERR: " + itos(err)); - err = zipWriteInFileInZip(dst_pkg_zip, data.ptr(), data.size()); - print_line("WRITE ERR: " + itos(err)); - zipCloseFileInZip(dst_pkg_zip); + String pack_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/" + pkg_name + ".pck"; + Error err = save_pack(p_preset, pack_path); + + if (err == OK) { + zipOpenNewFileInZip(dst_pkg_zip, + (pkg_name + ".app/Contents/Resources/" + pkg_name + ".pck").utf8().get_data(), + NULL, + NULL, + 0, + NULL, + 0, + NULL, + Z_DEFLATED, + Z_DEFAULT_COMPRESSION); + + FileAccess *pf = FileAccess::open(pack_path, FileAccess::READ); + if (pf) { + const int BSIZE = 16384; + uint8_t buf[BSIZE]; + + while (true) { + + int r = pf->get_buffer(buf, BSIZE); + if (r <= 0) + break; + zipWriteInFileInZip(dst_pkg_zip, buf, r); + } + zipCloseFileInZip(dst_pkg_zip); + memdelete(pf); + } else { + err = ERR_CANT_OPEN; + } + } } - - ret = unzGoToNextFile(src_pkg_zip); } - if (!found_binary) { - ERR_PRINTS("Requested template binary '" + binary_to_use + "' not found. It might be missing from your template archive."); + if (dst_pkg_zip) { zipClose(dst_pkg_zip, NULL); - unzClose(src_pkg_zip); - return ERR_FILE_NOT_FOUND; } - ep.step("Making PKG", 1); - - String pack_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/" + pkg_name + ".pck"; - Error err = save_pack(p_preset, pack_path); - - if (err) { - zipClose(dst_pkg_zip, NULL); - unzClose(src_pkg_zip); - return err; - } - - { - //write datapack - - zipOpenNewFileInZip(dst_pkg_zip, - (pkg_name + ".app/Contents/Resources/" + pkg_name + ".pck").utf8().get_data(), - NULL, - NULL, - 0, - NULL, - 0, - NULL, - Z_DEFLATED, - Z_DEFAULT_COMPRESSION); - - FileAccess *pf = FileAccess::open(pack_path, FileAccess::READ); - ERR_FAIL_COND_V(!pf, ERR_CANT_OPEN); - const int BSIZE = 16384; - uint8_t buf[BSIZE]; - - while (true) { - - int r = pf->get_buffer(buf, BSIZE); - if (r <= 0) - break; - zipWriteInFileInZip(dst_pkg_zip, buf, r); - } - zipCloseFileInZip(dst_pkg_zip); - memdelete(pf); - } - - zipClose(dst_pkg_zip, NULL); - unzClose(src_pkg_zip); - return OK; } -#endif bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const { diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index eb8c0566b4..05adfeb0f5 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -112,15 +112,16 @@ public: CrashHandler crash_handler; float _mouse_scale(float p_scale) { - if (display_scale > 1.0) + if (_display_scale() > 1.0) return p_scale; else return 1.0; } - void _update_window(); + float _display_scale() const; + float _display_scale(id screen) const; - float display_scale; + void _update_window(); protected: virtual int get_video_driver_count() const; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 8323aa84a8..2c81a02014 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -180,13 +180,13 @@ static bool mouse_down_control = false; if (newBackingScaleFactor != oldBackingScaleFactor) { //Set new display scale and window size - OS_OSX::singleton->display_scale = newBackingScaleFactor; + float newDisplayScale = OS_OSX::singleton->is_hidpi_allowed() ? newBackingScaleFactor : 1.0; const NSRect contentRect = [OS_OSX::singleton->window_view frame]; const NSRect fbRect = contentRect; //convertRectToBacking(contentRect); - OS_OSX::singleton->window_size.width = fbRect.size.width * OS_OSX::singleton->display_scale; - OS_OSX::singleton->window_size.height = fbRect.size.height * OS_OSX::singleton->display_scale; + OS_OSX::singleton->window_size.width = fbRect.size.width * newDisplayScale; + OS_OSX::singleton->window_size.height = fbRect.size.height * newDisplayScale; //Update context if (OS_OSX::singleton->main_loop) { @@ -206,8 +206,9 @@ static bool mouse_down_control = false; const NSRect contentRect = [OS_OSX::singleton->window_view frame]; const NSRect fbRect = contentRect; //convertRectToBacking(contentRect); - OS_OSX::singleton->window_size.width = fbRect.size.width * OS_OSX::singleton->display_scale; - OS_OSX::singleton->window_size.height = fbRect.size.height * OS_OSX::singleton->display_scale; + float displayScale = OS_OSX::singleton->_display_scale(); + OS_OSX::singleton->window_size.width = fbRect.size.width * displayScale; + OS_OSX::singleton->window_size.height = fbRect.size.height * displayScale; if (OS_OSX::singleton->main_loop) { Main::force_redraw(); @@ -352,7 +353,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { const NSRect contentRect = [OS_OSX::singleton->window_view frame]; - NSRect pointInWindowRect = NSMakeRect(OS_OSX::singleton->im_position.x / OS_OSX::singleton->display_scale, contentRect.size.height - (OS_OSX::singleton->im_position.y / OS_OSX::singleton->display_scale) - 1, 0, 0); + float displayScale = OS_OSX::singleton->_display_scale(); + NSRect pointInWindowRect = NSMakeRect(OS_OSX::singleton->im_position.x / displayScale, contentRect.size.height - (OS_OSX::singleton->im_position.y / displayScale) - 1, 0, 0); NSPoint pointOnScreen = [[OS_OSX::singleton->window_view window] convertRectToScreen:pointInWindowRect].origin; return NSMakeRect(pointOnScreen.x, pointOnScreen.y, 0, 0); @@ -940,15 +942,6 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au kTISNotifySelectedKeyboardInputSourceChanged, NULL, CFNotificationSuspensionBehaviorDeliverImmediately); - if (is_hidpi_allowed() && [[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)]) { - for (NSScreen *screen in [NSScreen screens]) { - float s = [screen backingScaleFactor]; - if (s > display_scale) { - display_scale = s; - } - } - } - window_delegate = [[GodotWindowDelegate alloc] init]; // Don't use accumulation buffer support; it's not accelerated @@ -972,10 +965,19 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au window_view = [[GodotContentView alloc] init]; - window_size.width = p_desired.width * display_scale; - window_size.height = p_desired.height * display_scale; + float displayScale = 1.0; + if (is_hidpi_allowed()) { + // note that mainScreen is not screen #0 but the one with the keyboard focus. + NSScreen *screen = [NSScreen mainScreen]; + if ([screen respondsToSelector:@selector(backingScaleFactor)]) { + displayScale = fmax(displayScale, [screen backingScaleFactor]); + } + } + + window_size.width = p_desired.width * displayScale; + window_size.height = p_desired.height * displayScale; - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && display_scale > 1) { + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && displayScale > 1.0) { [window_view setWantsBestResolutionOpenGLSurface:YES]; //if (current_videomode.resizable) [window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; @@ -1274,7 +1276,8 @@ void OS_OSX::warp_mouse_position(const Point2 &p_to) { //local point in window coords const NSRect contentRect = [window_view frame]; - NSRect pointInWindowRect = NSMakeRect(p_to.x / display_scale, contentRect.size.height - (p_to.y / display_scale) - 1, 0, 0); + float displayScale = _display_scale(); + NSRect pointInWindowRect = NSMakeRect(p_to.x / displayScale, contentRect.size.height - (p_to.y / displayScale) - 1, 0, 0); NSPoint pointOnScreen = [[window_view window] convertRectToScreen:pointInWindowRect].origin; //point in scren coords @@ -1475,17 +1478,17 @@ int OS_OSX::get_screen_count() const { return [screenArray count]; }; +static int get_screen_index(NSScreen *screen) { + const NSUInteger index = [[NSScreen screens] indexOfObject:screen]; + return index == NSNotFound ? 0 : index; +} + int OS_OSX::get_current_screen() const { - Vector2 wpos = get_window_position(); - - int count = get_screen_count(); - for (int i = 0; i < count; i++) { - Point2 pos = get_screen_position(i); - Size2 size = get_screen_size(i); - if ((wpos.x >= pos.x && wpos.x < pos.x + size.width) && (wpos.y >= pos.y && wpos.y < pos.y + size.height)) - return i; + if (window_object) { + return get_screen_index([window_object screen]); + } else { + return get_screen_index([NSScreen mainScreen]); } - return 0; }; void OS_OSX::set_current_screen(int p_screen) { @@ -1500,12 +1503,7 @@ Point2 OS_OSX::get_screen_position(int p_screen) const { NSArray *screenArray = [NSScreen screens]; if (p_screen < [screenArray count]) { - float displayScale = 1.0; - - if (display_scale > 1.0 && [[screenArray objectAtIndex:p_screen] respondsToSelector:@selector(backingScaleFactor)]) { - displayScale = [[screenArray objectAtIndex:p_screen] backingScaleFactor]; - } - + float displayScale = _display_scale([screenArray objectAtIndex:p_screen]); NSRect nsrect = [[screenArray objectAtIndex:p_screen] frame]; return Point2(nsrect.origin.x, nsrect.origin.y) * displayScale; } @@ -1520,12 +1518,7 @@ int OS_OSX::get_screen_dpi(int p_screen) const { NSArray *screenArray = [NSScreen screens]; if (p_screen < [screenArray count]) { - float displayScale = 1.0; - - if (display_scale > 1.0 && [[screenArray objectAtIndex:p_screen] respondsToSelector:@selector(backingScaleFactor)]) { - displayScale = [[screenArray objectAtIndex:p_screen] backingScaleFactor]; - } - + float displayScale = _display_scale([screenArray objectAtIndex:p_screen]); NSDictionary *description = [[screenArray objectAtIndex:p_screen] deviceDescription]; NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue]; CGSize displayPhysicalSize = CGDisplayScreenSize( @@ -1544,12 +1537,7 @@ Size2 OS_OSX::get_screen_size(int p_screen) const { NSArray *screenArray = [NSScreen screens]; if (p_screen < [screenArray count]) { - float displayScale = 1.0; - - if (display_scale > 1.0 && [[screenArray objectAtIndex:p_screen] respondsToSelector:@selector(backingScaleFactor)]) { - displayScale = [[screenArray objectAtIndex:p_screen] backingScaleFactor]; - } - + float displayScale = _display_scale([screenArray objectAtIndex:p_screen]); // Note: Use frame to get the whole screen size NSRect nsrect = [[screenArray objectAtIndex:p_screen] frame]; return Size2(nsrect.size.width, nsrect.size.height) * displayScale; @@ -1583,10 +1571,28 @@ void OS_OSX::_update_window() { } } +float OS_OSX::_display_scale() const { + if (window_object) { + return _display_scale([window_object screen]); + } else { + return _display_scale([NSScreen mainScreen]); + } +} + +float OS_OSX::_display_scale(id screen) const { + if (is_hidpi_allowed()) { + if ([screen respondsToSelector:@selector(backingScaleFactor)]) { + return fmax(1.0, [screen backingScaleFactor]); + } + } else { + return 1.0; + } +} + Point2 OS_OSX::get_window_position() const { Size2 wp([window_object frame].origin.x, [window_object frame].origin.y); - wp *= display_scale; + wp *= _display_scale(); return wp; }; @@ -1594,10 +1600,11 @@ void OS_OSX::set_window_position(const Point2 &p_position) { Size2 scr = get_screen_size(); NSPoint pos; + float displayScale = _display_scale(); - pos.x = p_position.x / display_scale; + pos.x = p_position.x / displayScale; // For OS X the y starts at the bottom - pos.y = (scr.height - p_position.y) / display_scale; + pos.y = (scr.height - p_position.y) / displayScale; [window_object setFrameTopLeftPoint:pos]; @@ -2039,7 +2046,6 @@ OS_OSX::OS_OSX() { minimized = false; window_size = Vector2(1024, 600); zoomed = false; - display_scale = 1.0; _set_logger(memnew(OSXTerminalLogger)); } diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 031c714514..ff5a935229 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -674,7 +674,7 @@ void OSUWP::set_cursor_shape(CursorShape p_shape) { cursor_shape = p_shape; } -Error OSUWP::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode) { +Error OSUWP::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr) { return FAILED; }; diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index df38faa8e1..22f8938049 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -215,7 +215,7 @@ public: virtual void delay_usec(uint32_t p_usec) const; virtual uint64_t get_ticks_usec() const; - virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL); + virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false); virtual Error kill(const ProcessID &p_pid); virtual bool has_environment(const String &p_var) const; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index bee8c90ad3..c27e7c0d2b 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1812,7 +1812,7 @@ void OS_Windows::set_cursor_shape(CursorShape p_shape) { cursor_shape = p_shape; } -Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode) { +Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr) { if (p_blocking && r_pipe) { diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 9560bc61ca..c0b8dfc691 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -240,7 +240,7 @@ public: virtual void delay_usec(uint32_t p_usec) const; virtual uint64_t get_ticks_usec() const; - virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL); + virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false); virtual Error kill(const ProcessID &p_pid); virtual int get_process_id() const; diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index a38bee1b43..05963acf56 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -434,7 +434,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float pa->object->set(pa->prop, value, &valid); //you are not speshul #ifdef DEBUG_ENABLED if (!valid) { - ERR_PRINTS("Failed setting track value '" + String(pa->owner->path) + "'. Check if property exists or the type of key is valid"); + ERR_PRINTS("Failed setting track value '" + String(pa->owner->path) + "'. Check if property exists or the type of key is valid. Animation '" + a->get_name() + "' at node '" + get_path() + "'."); } #endif @@ -442,7 +442,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float case SP_NODE2D_POS: { #ifdef DEBUG_ENABLED if (value.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Position key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Position key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2(). Animation '" + a->get_name() + "' at node '" + get_path() + "'."); } #endif static_cast<Node2D *>(pa->object)->set_position(value); @@ -450,7 +450,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float case SP_NODE2D_ROT: { #ifdef DEBUG_ENABLED if (value.is_num()) { - ERR_PRINTS("Rotation key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not numerical"); + ERR_PRINTS("Rotation key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not numerical. Animation '" + a->get_name() + "' at node '" + get_path() + "'."); } #endif @@ -459,7 +459,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float case SP_NODE2D_SCALE: { #ifdef DEBUG_ENABLED if (value.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Scale key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Scale key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()." + a->get_name() + "' at node '" + get_path() + "'."); } #endif @@ -615,7 +615,7 @@ void AnimationPlayer::_animation_update_transforms() { pa->object->set(pa->prop, pa->value_accum, &valid); //you are not speshul #ifdef DEBUG_ENABLED if (!valid) { - ERR_PRINTS("Failed setting key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "'. Check if property exists or the type of key is right for the property"); + ERR_PRINTS("Failed setting key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "'. Check if property exists or the type of key is right for the property"); } #endif @@ -623,7 +623,7 @@ void AnimationPlayer::_animation_update_transforms() { case SP_NODE2D_POS: { #ifdef DEBUG_ENABLED if (pa->value_accum.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Position key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Position key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); } #endif static_cast<Node2D *>(pa->object)->set_position(pa->value_accum); @@ -631,7 +631,7 @@ void AnimationPlayer::_animation_update_transforms() { case SP_NODE2D_ROT: { #ifdef DEBUG_ENABLED if (pa->value_accum.is_num()) { - ERR_PRINTS("Rotation key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not numerical"); + ERR_PRINTS("Rotation key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not numerical"); } #endif @@ -640,7 +640,7 @@ void AnimationPlayer::_animation_update_transforms() { case SP_NODE2D_SCALE: { #ifdef DEBUG_ENABLED if (pa->value_accum.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Scale key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Scale key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); } #endif diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 320dad9301..d8ff048dfb 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -115,7 +115,9 @@ Vector<String> FileDialog::get_selected_files() const { void FileDialog::update_dir() { dir->set_text(dir_access->get_current_dir()); - drives->select(dir_access->get_current_drive()); + if (drives->is_visible()) { + drives->select(dir_access->get_current_drive()); + } } void FileDialog::_dir_entered(String p_dir) { @@ -667,7 +669,6 @@ void FileDialog::_update_drives() { drives->show(); for (int i = 0; i < dir_access->get_drive_count(); i++) { - String d = dir_access->get_drive(i); drives->add_item(dir_access->get_drive(i)); } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index d14d3ef947..33c29547be 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4287,6 +4287,14 @@ int TextEdit::get_v_scroll() const { } void TextEdit::set_v_scroll(int p_scroll) { + if (p_scroll < 0) { + p_scroll = 0; + } + if (!scroll_past_end_of_file_enabled) { + if (p_scroll + get_visible_rows() > get_line_count()) { + p_scroll = get_line_count() - get_visible_rows(); + } + } v_scroll->set_value(p_scroll); cursor.line_ofs = p_scroll; } diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index 1553c3c8e6..a7c31cf16c 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -914,6 +914,21 @@ bool PhysicsServerSW::body_test_motion(RID p_body, const Transform &p_from, cons return body->get_space()->test_body_motion(body, p_from, p_motion, p_margin, r_result); } +PhysicsDirectBodyState *PhysicsServerSW::body_get_direct_state(RID p_body) { + + BodySW *body = body_owner.get(p_body); + ERR_FAIL_COND_V(!body, NULL); + + if (!doing_sync || body->get_space()->is_locked()) { + + ERR_EXPLAIN("Body state is inaccessible right now, wait for iteration or physics process notification."); + ERR_FAIL_V(NULL); + } + + direct_state->body = body; + return direct_state; +} + /* JOINT API */ RID PhysicsServerSW::joint_create_pin(RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B) { diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h index aea3e150b0..f9eb8fa454 100644 --- a/servers/physics/physics_server_sw.h +++ b/servers/physics/physics_server_sw.h @@ -223,6 +223,9 @@ public: virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, float p_margin = 0.001, MotionResult *r_result = NULL); + // this function only works on physics process, errors and returns null otherwise + virtual PhysicsDirectBodyState *body_get_direct_state(RID p_body); + /* JOINT API */ virtual RID joint_create_pin(RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B); diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index 2b7505169a..df3bf72a31 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -954,6 +954,21 @@ bool Physics2DServerSW::body_test_motion(RID p_body, const Transform2D &p_from, return body->get_space()->test_body_motion(body, p_from, p_motion, p_margin, r_result); } +Physics2DDirectBodyState *Physics2DServerSW::body_get_direct_state(RID p_body) { + + Body2DSW *body = body_owner.get(p_body); + ERR_FAIL_COND_V(!body, NULL); + + if ((using_threads && !doing_sync) || body->get_space()->is_locked()) { + + ERR_EXPLAIN("Body state is inaccessible right now, wait for iteration or physics process notification."); + ERR_FAIL_V(NULL); + } + + direct_state->body = body; + return direct_state; +} + /* JOINT API */ void Physics2DServerSW::joint_set_param(RID p_joint, JointParam p_param, real_t p_value) { diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h index 0ebd43be53..c40cf0e3e0 100644 --- a/servers/physics_2d/physics_2d_server_sw.h +++ b/servers/physics_2d/physics_2d_server_sw.h @@ -222,6 +222,9 @@ public: virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, real_t p_margin = 0.001, MotionResult *r_result = NULL); + // this function only works on physics process, errors and returns null otherwise + virtual Physics2DDirectBodyState *body_get_direct_state(RID p_body); + /* JOINT API */ virtual void joint_set_param(RID p_joint, JointParam p_param, real_t p_value); diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h index 5bec2f7cbd..50e9ab1005 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.h +++ b/servers/physics_2d/physics_2d_server_wrap_mt.h @@ -253,6 +253,13 @@ public: return physics_2d_server->body_test_motion(p_body, p_from, p_motion, p_margin, r_result); } + // this function only works on physics process, errors and returns null otherwise + Physics2DDirectBodyState *body_get_direct_state(RID p_body) { + + ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), NULL); + return physics_2d_server->body_get_direct_state(p_body); + } + /* JOINT API */ FUNC3(joint_set_param, RID, JointParam, real_t); diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index b42b85b1be..671c31e6a3 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -579,6 +579,8 @@ void Physics2DServer::_bind_methods() { ClassDB::bind_method(D_METHOD("body_test_motion", "body", "from", "motion", "margin", "result"), &Physics2DServer::_body_test_motion, DEFVAL(0.08), DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("body_get_direct_state", "body"), &Physics2DServer::body_get_direct_state); + /* JOINT API */ ClassDB::bind_method(D_METHOD("joint_set_param", "joint", "param", "value"), &Physics2DServer::joint_set_param); diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index 34f885db1d..18f4f460b6 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -468,6 +468,9 @@ public: virtual void body_set_pickable(RID p_body, bool p_pickable) = 0; + // this function only works on physics process, errors and returns null otherwise + virtual Physics2DDirectBodyState *body_get_direct_state(RID p_body) = 0; + struct MotionResult { Vector2 motion; diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index 0e54867ee1..6d192886a5 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -504,6 +504,8 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(D_METHOD("body_set_ray_pickable", "body", "enable"), &PhysicsServer::body_set_ray_pickable); ClassDB::bind_method(D_METHOD("body_is_ray_pickable", "body"), &PhysicsServer::body_is_ray_pickable); + ClassDB::bind_method(D_METHOD("body_get_direct_state", "body"), &PhysicsServer::body_get_direct_state); + /* JOINT API */ BIND_ENUM_CONSTANT(JOINT_PIN); diff --git a/servers/physics_server.h b/servers/physics_server.h index 7012caeae6..8cec125646 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -464,6 +464,9 @@ public: virtual void body_set_ray_pickable(RID p_body, bool p_enable) = 0; virtual bool body_is_ray_pickable(RID p_body) const = 0; + // this function only works on physics process, errors and returns null otherwise + virtual PhysicsDirectBodyState *body_get_direct_state(RID p_body) = 0; + struct MotionResult { Vector3 motion; |