summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compat.py29
-rw-r--r--doc/classes/AnimatedSprite.xml10
-rw-r--r--doc/classes/AnimatedSprite3D.xml8
-rw-r--r--doc/classes/BackBufferCopy.xml10
-rw-r--r--doc/classes/Camera2D.xml12
-rw-r--r--doc/classes/KinematicBody.xml18
-rw-r--r--doc/classes/KinematicBody2D.xml22
-rw-r--r--doc/classes/Sprite.xml18
-rw-r--r--doc/classes/Sprite3D.xml9
-rw-r--r--doc/classes/SpriteBase3D.xml17
-rw-r--r--editor/SCsub14
-rw-r--r--modules/mono/editor/godotsharp_builds.cpp2
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp34
-rw-r--r--modules/mono/mono_gd/gd_mono.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.cpp97
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.h8
-rw-r--r--modules/mono/mono_reg_utils.py6
-rw-r--r--platform/osx/detect.py2
18 files changed, 224 insertions, 94 deletions
diff --git a/compat.py b/compat.py
index 7338c479fb..e1bc0ed673 100644
--- a/compat.py
+++ b/compat.py
@@ -14,6 +14,17 @@ if sys.version_info < (3,):
return x
def iteritems(d):
return d.iteritems()
+ def escape_string(s):
+ if isinstance(s, unicode):
+ s = s.encode('ascii')
+ result = ''
+ for c in s:
+ if not (32 <= ord(c) < 127) or c in ('\\', '"'):
+ result += '\\%03o' % ord(c)
+ else:
+ result += c
+ return result
+
else:
def isbasestring(s):
return isinstance(s, (str, bytes))
@@ -29,3 +40,21 @@ else:
return codecs.utf_8_encode(x)[0]
def iteritems(d):
return iter(d.items())
+ def charcode_to_c_escapes(c):
+ rev_result = []
+ while c >= 256:
+ c, low = (c // 256, c % 256)
+ rev_result.append('\\%03o' % low)
+ rev_result.append('\\%03o' % c)
+ return ''.join(reversed(rev_result))
+ def escape_string(s):
+ result = ''
+ if isinstance(s, str):
+ s = s.encode('utf-8')
+ for c in s:
+ if not(32 <= c < 127) or c in (ord('\\'), ord('"')):
+ result += charcode_to_c_escapes(c)
+ else:
+ result += chr(c)
+ return result
+
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/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/Camera2D.xml b/doc/classes/Camera2D.xml
index b6b699612e..228b6ebf91 100644
--- a/doc/classes/Camera2D.xml
+++ b/doc/classes/Camera2D.xml
@@ -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/KinematicBody.xml b/doc/classes/KinematicBody.xml
index 8f242c5187..fb7edd65ad 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[/delta] — 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..d9e669f493 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[/delta] — 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/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/editor/SCsub b/editor/SCsub
index 11cdb471a8..e44b4e4bb2 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -4,18 +4,8 @@ Import('env')
env.editor_sources = []
import os
-from compat import encode_utf8, byte_to_str, open_utf8
-
-def escape_string(s, encoding='ascii'):
- if isinstance(s, unicode):
- s = s.encode(encoding)
- result = ''
- for c in s:
- if not (32 <= ord(c) < 127) or c in ('\\', '"'):
- result += '\\%03o' % ord(c)
- else:
- result += c
- return result
+from compat import encode_utf8, byte_to_str, open_utf8, escape_string
+
def make_certs_header(target, source, env):
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/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..a623b34b68 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) {
+ no_search = true; // Avoid the recursion madness
- (void)user_data; // UNUSED
+ GDMonoAssembly **loaded_asm = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name);
+ if (loaded_asm)
+ return (*loaded_asm)->get_assembly();
+
+ 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_reg_utils.py b/modules/mono/mono_reg_utils.py
index 6f1620ff49..e9988625f5 100644
--- a/modules/mono/mono_reg_utils.py
+++ b/modules/mono/mono_reg_utils.py
@@ -1,7 +1,11 @@
import os
if os.name == 'nt':
- import _winreg as winreg
+ import sys
+ if sys.version_info < (3,):
+ import _winreg as winreg
+ else:
+ import winreg
def _reg_open_key(key, subkey):
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index f66c3f00da..31032659b6 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -62,7 +62,7 @@ def configure(env):
## Compiler configuration
- if (not os.environ.has_key("OSXCROSS_ROOT")): # regular native build
+ if "OSXCROSS_ROOT" not in os.environ: # regular native build
if (env["bits"] == "fat"):
env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64'])