Skip to content

Commit

Permalink
Uniformize layer names, script methods and documentation
Browse files Browse the repository at this point in the history
- Back to 1-based layer names to make it clearer in editor UI
- Layer bit accessors are renamed to layer value and 1-based too
- Uniform errors and documentation in render and physics
- Fix a few remaining collision_layer used in place of collision_mask
  • Loading branch information
pouleyKetchoupp committed Aug 12, 2021
1 parent 7188cb6 commit 989acbb
Show file tree
Hide file tree
Showing 42 changed files with 391 additions and 357 deletions.
14 changes: 7 additions & 7 deletions doc/classes/Camera3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
Gets the camera transform. Subclassed cameras such as [ClippedCamera3D] may provide different transforms than the [Node] transform.
</description>
</method>
<method name="get_cull_mask_bit" qualifiers="const">
<method name="get_cull_mask_value" qualifiers="const">
<return type="bool" />
<argument index="0" name="layer" type="int" />
<argument index="0" name="layer_number" type="int" />
<description>
Returns [code]true[/code] if the given [code]layer[/code] in the [member cull_mask] is enabled, [code]false[/code] otherwise.
Returns whether or not the specified layer of the [member cull_mask] is enabled, given a [code]layer_number[/code] between 1 and 20.
</description>
</method>
<method name="get_frustum" qualifiers="const">
Expand Down Expand Up @@ -92,12 +92,12 @@
Returns a 3D position in world space, 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_bit">
<method name="set_cull_mask_value">
<return type="void" />
<argument index="0" name="layer" type="int" />
<argument index="1" name="enable" type="bool" />
<argument index="0" name="layer_number" type="int" />
<argument index="1" name="value" type="bool" />
<description>
Enables or disables the given [code]layer[/code] in the [member cull_mask].
Based on [code]value[/code], enables or disables the specified layer in the [member cull_mask], given a [code]layer_number[/code] between 1 and 20.
</description>
</method>
<method name="set_frustum">
Expand Down
14 changes: 6 additions & 8 deletions doc/classes/ClippedCamera3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@
Returns the distance the camera has been offset due to a collision.
</description>
</method>
<method name="get_collision_mask_bit" qualifiers="const">
<method name="get_collision_mask_value" qualifiers="const">
<return type="bool" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<description>
Returns [code]true[/code] if the specified bit index is on.
[b]Note:[/b] Bit indices range from 0-19.
Returns whether or not the specified layer of the [member collision_mask] is enabled, given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="remove_exception">
Expand All @@ -57,13 +56,12 @@
Removes a collision exception with the specified [RID].
</description>
</method>
<method name="set_collision_mask_bit">
<method name="set_collision_mask_value">
<return type="void" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<argument index="1" name="value" type="bool" />
<description>
Sets the specified bit index to the [code]value[/code].
[b]Note:[/b] Bit indices range from 0-19.
Based on [code]value[/code], enables or disables the specified layer in the [member collision_mask], given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
</methods>
Expand Down
26 changes: 12 additions & 14 deletions doc/classes/CollisionObject2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
</description>
</method>
<method name="get_collision_layer_bit" qualifiers="const">
<method name="get_collision_layer_value" qualifiers="const">
<return type="bool" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<description>
Returns whether or not the specified [code]bit[/code] of the [member collision_layer] is set.
Returns whether or not the specified layer of the [member collision_layer] is enabled, given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="get_collision_mask_bit" qualifiers="const">
<method name="get_collision_mask_value" qualifiers="const">
<return type="bool" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<description>
Returns whether or not the specified [code]bit[/code] of the [member collision_mask] is set.
Returns whether or not the specified layer of the [member collision_mask] is enabled, given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="get_rid" qualifiers="const">
Expand Down Expand Up @@ -79,22 +79,20 @@
Removes the given shape owner.
</description>
</method>
<method name="set_collision_layer_bit">
<method name="set_collision_layer_value">
<return type="void" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<argument index="1" name="value" type="bool" />
<description>
If [code]value[/code] is [code]true[/code], sets the specified [code]bit[/code] in the the [member collision_layer].
If [code]value[/code] is [code]false[/code], clears the specified [code]bit[/code] in the the [member collision_layer].
Based on [code]value[/code], enables or disables the specified layer in the [member collision_layer], given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="set_collision_mask_bit">
<method name="set_collision_mask_value">
<return type="void" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<argument index="1" name="value" type="bool" />
<description>
If [code]value[/code] is [code]true[/code], sets the specified [code]bit[/code] in the the [member collision_mask].
If [code]value[/code] is [code]false[/code], clears the specified [code]bit[/code] in the the [member collision_mask].
Based on [code]value[/code], enables or disables the specified layer in the [member collision_mask], given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="shape_find_owner" qualifiers="const">
Expand Down
26 changes: 12 additions & 14 deletions doc/classes/CollisionObject3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
</description>
</method>
<method name="get_collision_layer_bit" qualifiers="const">
<method name="get_collision_layer_value" qualifiers="const">
<return type="bool" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<description>
Returns whether or not the specified [code]bit[/code] of the [member collision_layer] is set.
Returns whether or not the specified layer of the [member collision_layer] is enabled, given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="get_collision_mask_bit" qualifiers="const">
<method name="get_collision_mask_value" qualifiers="const">
<return type="bool" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<description>
Returns whether or not the specified [code]bit[/code] of the [member collision_mask] is set.
Returns whether or not the specified layer of the [member collision_mask] is enabled, given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="get_rid" qualifiers="const">
Expand Down Expand Up @@ -67,22 +67,20 @@
Removes the given shape owner.
</description>
</method>
<method name="set_collision_layer_bit">
<method name="set_collision_layer_value">
<return type="void" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<argument index="1" name="value" type="bool" />
<description>
If [code]value[/code] is [code]true[/code], sets the specified [code]bit[/code] in the the [member collision_layer].
If [code]value[/code] is [code]false[/code], clears the specified [code]bit[/code] in the the [member collision_layer].
Based on [code]value[/code], enables or disables the specified layer in the [member collision_layer], given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="set_collision_mask_bit">
<method name="set_collision_mask_value">
<return type="void" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<argument index="1" name="value" type="bool" />
<description>
If [code]value[/code] is [code]true[/code], sets the specified [code]bit[/code] in the the [member collision_mask].
If [code]value[/code] is [code]false[/code], clears the specified [code]bit[/code] in the the [member collision_mask].
Based on [code]value[/code], enables or disables the specified layer in the [member collision_mask], given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="shape_find_owner" qualifiers="const">
Expand Down
13 changes: 6 additions & 7 deletions doc/classes/NavigationMesh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
Initializes the navigation mesh by setting the vertices and indices according to a [Mesh].
</description>
</method>
<method name="get_collision_mask_bit" qualifiers="const">
<method name="get_collision_mask_value" qualifiers="const">
<return type="bool" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<description>
Returns whether the specified [code]bit[/code] of the [member geometry/collision_mask] is set.
Returns whether or not the specified layer of the [member geometry/collision_mask] is enabled, given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="get_polygon">
Expand All @@ -56,13 +56,12 @@
Returns a [PackedVector3Array] containing all the vertices being used to create the polygons.
</description>
</method>
<method name="set_collision_mask_bit">
<method name="set_collision_mask_value">
<return type="void" />
<argument index="0" name="bit" type="int" />
<argument index="0" name="layer_number" type="int" />
<argument index="1" name="value" type="bool" />
<description>
If [code]value[/code] is [code]true[/code], sets the specified [code]bit[/code] in the [member geometry/collision_mask].
If [code]value[/code] is [code]false[/code], clears the specified [code]bit[/code] in the [member geometry/collision_mask].
Based on [code]value[/code], enables or disables the specified layer in the [member geometry/collision_mask], given a [code]layer_number[/code] between 1 and 32.
</description>
</method>
<method name="set_vertices">
Expand Down
12 changes: 7 additions & 5 deletions doc/classes/OccluderInstance3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@
<tutorials>
</tutorials>
<methods>
<method name="get_bake_mask_bit" qualifiers="const">
<method name="get_bake_mask_value" qualifiers="const">
<return type="bool" />
<argument index="0" name="layer" type="int" />
<argument index="0" name="layer_number" type="int" />
<description>
Returns whether or not the specified layer of the [member bake_mask] is enabled, given a [code]layer_number[/code] between 1 and 20.
</description>
</method>
<method name="set_bake_mask_bit">
<method name="set_bake_mask_value">
<return type="void" />
<argument index="0" name="layer" type="int" />
<argument index="1" name="enabled" type="bool" />
<argument index="0" name="layer_number" type="int" />
<argument index="1" name="value" type="bool" />
<description>
Based on [code]value[/code], enables or disables the specified layer in the [member bake_mask], given a [code]layer_number[/code] between 1 and 20.
</description>
</method>
</methods>
Expand Down
10 changes: 5 additions & 5 deletions doc/classes/PhysicsDirectSpaceState2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<argument index="0" name="point" type="Vector2" />
<argument index="1" name="max_results" type="int" default="32" />
<argument index="2" name="exclude" type="Array" default="[]" />
<argument index="3" name="collision_layer" type="int" default="2147483647" />
<argument index="3" name="collision_mask" type="int" default="2147483647" />
<argument index="4" name="collide_with_bodies" type="bool" default="true" />
<argument index="5" name="collide_with_areas" type="bool" default="false" />
<description>
Expand All @@ -57,7 +57,7 @@
[code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method PhysicsServer2D.shape_set_data].
[code]rid[/code]: The intersecting object's [RID].
[code]shape[/code]: The shape index of the colliding shape.
Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody2D]s or [Area2D]s, respectively.
Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to detect, or booleans to determine if the ray should collide with [PhysicsBody2D]s or [Area2D]s, respectively.
[b]Note:[/b] [ConcavePolygonShape2D]s and [CollisionPolygon2D]s in [code]Segments[/code] build mode are not solid shapes. Therefore, they will not be detected.
</description>
</method>
Expand All @@ -67,7 +67,7 @@
<argument index="1" name="canvas_instance_id" type="int" />
<argument index="2" name="max_results" type="int" default="32" />
<argument index="3" name="exclude" type="Array" default="[]" />
<argument index="4" name="collision_layer" type="int" default="2147483647" />
<argument index="4" name="collision_mask" type="int" default="2147483647" />
<argument index="5" name="collide_with_bodies" type="bool" default="true" />
<argument index="6" name="collide_with_areas" type="bool" default="false" />
<description>
Expand All @@ -78,7 +78,7 @@
<argument index="0" name="from" type="Vector2" />
<argument index="1" name="to" type="Vector2" />
<argument index="2" name="exclude" type="Array" default="[]" />
<argument index="3" name="collision_layer" type="int" default="2147483647" />
<argument index="3" name="collision_mask" type="int" default="2147483647" />
<argument index="4" name="collide_with_bodies" type="bool" default="true" />
<argument index="5" name="collide_with_areas" type="bool" default="false" />
<description>
Expand All @@ -91,7 +91,7 @@
[code]rid[/code]: The intersecting object's [RID].
[code]shape[/code]: The shape index of the colliding shape.
If the ray did not intersect anything, then an empty dictionary is returned instead.
Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody2D]s or [Area2D]s, respectively.
Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to detect, or booleans to determine if the ray should collide with [PhysicsBody2D]s or [Area2D]s, respectively.
</description>
</method>
<method name="intersect_shape">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/PhysicsDirectSpaceState3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
[code]rid[/code]: The intersecting object's [RID].
[code]shape[/code]: The shape index of the colliding shape.
If the ray did not intersect anything, then an empty dictionary is returned instead.
Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody3D]s or [Area3D]s, respectively.
Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to detect, or booleans to determine if the ray should collide with [PhysicsBody3D]s or [Area3D]s, respectively.
</description>
</method>
<method name="intersect_shape">
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/PhysicsShapeQueryParameters2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<member name="collide_with_bodies" type="bool" setter="set_collide_with_bodies" getter="is_collide_with_bodies_enabled" default="true">
If [code]true[/code], the query will take [PhysicsBody2D]s into account.
</member>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer" default="2147483647">
The physics layer(s) the query will take into account (as a bitmask). See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="2147483647">
The physics layers the query will detect (as a bitmask). By default, all collision layers are detected. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
</member>
<member name="exclude" type="Array" setter="set_exclude" getter="get_exclude" default="[]">
The list of objects or object [RID]s that will be excluded from collisions.
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/PhysicsShapeQueryParameters3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
If [code]true[/code], the query will take [PhysicsBody3D]s into account.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="2147483647">
The physics layer(s) the query will take into account (as a bitmask). See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
The physics layers the query will detect (as a bitmask). By default, all collision layers are detected. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
</member>
<member name="exclude" type="Array" setter="set_exclude" getter="get_exclude" default="[]">
The list of objects or object [RID]s that will be excluded from collisions.
Expand Down
Loading

0 comments on commit 989acbb

Please sign in to comment.