Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
66b0b0c1
Unverified
Commit
66b0b0c1
authored
May 11, 2020
by
Rémi Verschelde
Committed by
GitHub
May 11, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #38635 from Calinou/tilemap-rename-ysort-index
Rename various TileMap methods/properties for clarity and consistency
parents
17099eca
c64c45cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
20 deletions
+20
-20
TileMap.xml
doc/classes/TileMap.xml
+4
-4
tile_map.cpp
scene/2d/tile_map.cpp
+12
-12
tile_map.h
scene/2d/tile_map.h
+4
-4
No files found.
doc/classes/TileMap.xml
View file @
66b0b0c1
...
...
@@ -80,13 +80,13 @@
Returns a [Vector2] array with the positions of all cells containing a tile from the tileset (i.e. a tile index different from [code]-1[/code]).
</description>
</method>
<method
name=
"get_used_cells_by_i
d
"
qualifiers=
"const"
>
<method
name=
"get_used_cells_by_i
ndex
"
qualifiers=
"const"
>
<return
type=
"Vector2i[]"
>
</return>
<argument
index=
"0"
name=
"i
d
"
type=
"int"
>
<argument
index=
"0"
name=
"i
ndex
"
type=
"int"
>
</argument>
<description>
Returns an array of all cells with the given tile [code]i
d
[/code].
Returns an array of all cells with the given tile [code]i
ndex
[/code].
</description>
</method>
<method
name=
"get_used_rect"
>
...
...
@@ -273,7 +273,7 @@
<member
name=
"cell_tile_origin"
type=
"int"
setter=
"set_tile_origin"
getter=
"get_tile_origin"
enum=
"TileMap.TileOrigin"
default=
"0"
>
Position for tile origin. See [enum TileOrigin] for possible values.
</member>
<member
name=
"cell_y_sort"
type=
"bool"
setter=
"set_y_sort_
mode"
getter=
"is_y_sort_mode
_enabled"
default=
"false"
>
<member
name=
"cell_y_sort"
type=
"bool"
setter=
"set_y_sort_
enabled"
getter=
"is_y_sort
_enabled"
default=
"false"
>
If [code]true[/code], the TileMap's children will be drawn in order of their Y coordinate.
</member>
<member
name=
"centered_textures"
type=
"bool"
setter=
"set_centered_textures"
getter=
"is_centered_textures_enabled"
default=
"false"
>
...
...
scene/2d/tile_map.cpp
View file @
66b0b0c1
...
...
@@ -40,7 +40,7 @@
int
TileMap
::
_get_quadrant_size
()
const
{
if
(
y_sort_mode
)
if
(
use_y_sort
)
return
1
;
else
return
quadrant_size
;
...
...
@@ -1649,18 +1649,18 @@ Vector2 TileMap::world_to_map(const Vector2 &p_pos) const {
return
ret
.
floor
();
}
void
TileMap
::
set_y_sort_
mode
(
bool
p_enable
)
{
void
TileMap
::
set_y_sort_
enabled
(
bool
p_enable
)
{
_clear_quadrants
();
y_sort_mode
=
p_enable
;
RS
::
get_singleton
()
->
canvas_item_set_sort_children_by_y
(
get_canvas_item
(),
y_sort_mode
);
use_y_sort
=
p_enable
;
RS
::
get_singleton
()
->
canvas_item_set_sort_children_by_y
(
get_canvas_item
(),
use_y_sort
);
_recreate_quadrants
();
emit_signal
(
"settings_changed"
);
}
bool
TileMap
::
is_y_sort_
mode_
enabled
()
const
{
bool
TileMap
::
is_y_sort_enabled
()
const
{
return
y_sort_mode
;
return
use_y_sort
;
}
void
TileMap
::
set_compatibility_mode
(
bool
p_enable
)
{
...
...
@@ -1703,7 +1703,7 @@ TypedArray<Vector2i> TileMap::get_used_cells() const {
return
a
;
}
TypedArray
<
Vector2i
>
TileMap
::
get_used_cells_by_i
d
(
int
p_id
)
const
{
TypedArray
<
Vector2i
>
TileMap
::
get_used_cells_by_i
ndex
(
int
p_id
)
const
{
TypedArray
<
Vector2i
>
a
;
for
(
Map
<
PosKey
,
Cell
>::
Element
*
E
=
tile_map
.
front
();
E
;
E
=
E
->
next
())
{
...
...
@@ -1823,8 +1823,8 @@ void TileMap::_bind_methods() {
ClassDB
::
bind_method
(
D_METHOD
(
"set_clip_uv"
,
"enable"
),
&
TileMap
::
set_clip_uv
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_clip_uv"
),
&
TileMap
::
get_clip_uv
);
ClassDB
::
bind_method
(
D_METHOD
(
"set_y_sort_
mode"
,
"enable"
),
&
TileMap
::
set_y_sort_mode
);
ClassDB
::
bind_method
(
D_METHOD
(
"is_y_sort_
mode_enabled"
),
&
TileMap
::
is_y_sort_mode
_enabled
);
ClassDB
::
bind_method
(
D_METHOD
(
"set_y_sort_
enabled"
,
"enable"
),
&
TileMap
::
set_y_sort_enabled
);
ClassDB
::
bind_method
(
D_METHOD
(
"is_y_sort_
enabled"
),
&
TileMap
::
is_y_sort
_enabled
);
ClassDB
::
bind_method
(
D_METHOD
(
"set_compatibility_mode"
,
"enable"
),
&
TileMap
::
set_compatibility_mode
);
ClassDB
::
bind_method
(
D_METHOD
(
"is_compatibility_mode_enabled"
),
&
TileMap
::
is_compatibility_mode_enabled
);
...
...
@@ -1874,7 +1874,7 @@ void TileMap::_bind_methods() {
ClassDB
::
bind_method
(
D_METHOD
(
"clear"
),
&
TileMap
::
clear
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_used_cells"
),
&
TileMap
::
get_used_cells
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_used_cells_by_i
d"
,
"id"
),
&
TileMap
::
get_used_cells_by_id
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_used_cells_by_i
ndex"
,
"index"
),
&
TileMap
::
get_used_cells_by_index
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_used_rect"
),
&
TileMap
::
get_used_rect
);
ClassDB
::
bind_method
(
D_METHOD
(
"map_to_world"
,
"map_position"
,
"ignore_half_ofs"
),
&
TileMap
::
map_to_world
,
DEFVAL
(
false
));
...
...
@@ -1898,7 +1898,7 @@ void TileMap::_bind_methods() {
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
TRANSFORM2D
,
"cell_custom_transform"
),
"set_custom_transform"
,
"get_custom_transform"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
INT
,
"cell_half_offset"
,
PROPERTY_HINT_ENUM
,
"Offset X,Offset Y,Disabled,Offset Negative X,Offset Negative Y"
),
"set_half_offset"
,
"get_half_offset"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
INT
,
"cell_tile_origin"
,
PROPERTY_HINT_ENUM
,
"Top Left,Center,Bottom Left"
),
"set_tile_origin"
,
"get_tile_origin"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
BOOL
,
"cell_y_sort"
),
"set_y_sort_
mode"
,
"is_y_sort_mode
_enabled"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
BOOL
,
"cell_y_sort"
),
"set_y_sort_
enabled"
,
"is_y_sort
_enabled"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
BOOL
,
"compatibility_mode"
),
"set_compatibility_mode"
,
"is_compatibility_mode_enabled"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
BOOL
,
"centered_textures"
),
"set_centered_textures"
,
"is_centered_textures_enabled"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
BOOL
,
"cell_clip_uv"
),
"set_clip_uv"
,
"get_clip_uv"
);
...
...
@@ -1960,7 +1960,7 @@ TileMap::TileMap() {
collision_parent
=
nullptr
;
use_kinematic
=
false
;
navigation
=
nullptr
;
y_sort_mode
=
false
;
use_y_sort
=
false
;
compatibility_mode
=
false
;
centered_textures
=
false
;
occluder_light_mask
=
1
;
...
...
scene/2d/tile_map.h
View file @
66b0b0c1
...
...
@@ -187,7 +187,7 @@ private:
Rect2
used_size_cache
;
bool
used_size_cache_dirty
;
bool
quadrant_order_dirty
;
bool
y_sort_mode
;
bool
use_y_sort
;
bool
compatibility_mode
;
bool
centered_textures
;
bool
clip_uv
;
...
...
@@ -319,8 +319,8 @@ public:
Vector2
map_to_world
(
const
Vector2
&
p_pos
,
bool
p_ignore_ofs
=
false
)
const
;
Vector2
world_to_map
(
const
Vector2
&
p_pos
)
const
;
void
set_y_sort_
mode
(
bool
p_enable
);
bool
is_y_sort_
mode_
enabled
()
const
;
void
set_y_sort_
enabled
(
bool
p_enable
);
bool
is_y_sort_enabled
()
const
;
void
set_compatibility_mode
(
bool
p_enable
);
bool
is_compatibility_mode_enabled
()
const
;
...
...
@@ -329,7 +329,7 @@ public:
bool
is_centered_textures_enabled
()
const
;
TypedArray
<
Vector2i
>
get_used_cells
()
const
;
TypedArray
<
Vector2i
>
get_used_cells_by_i
d
(
int
p_id
)
const
;
TypedArray
<
Vector2i
>
get_used_cells_by_i
ndex
(
int
p_index
)
const
;
Rect2
get_used_rect
();
// Not const because of cache
void
set_occluder_light_mask
(
int
p_mask
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment