mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-07 00:25:54 +01:00
Renamed RTileMap ro TileMap and RTileSet to TileSet, as it does not need to be able to live alongside Godot's TileMap anymore.
This commit is contained in:
parent
4888a14fa0
commit
d0d2a709e8
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="RTileMap" inherits="Node2D" version="3.8">
|
||||
<class name="TileMap" inherits="Node2D" version="3.8">
|
||||
<brief_description>
|
||||
</brief_description>
|
||||
<description>
|
||||
@ -161,13 +161,13 @@
|
||||
</member>
|
||||
<member name="cell_custom_transform" type="Transform2D" setter="set_custom_transform" getter="get_custom_transform" default="Transform2D( 64, 0, 0, 64, 0, 0 )">
|
||||
</member>
|
||||
<member name="cell_half_offset" type="int" setter="set_half_offset" getter="get_half_offset" enum="RTileMap.HalfOffset" default="2">
|
||||
<member name="cell_half_offset" type="int" setter="set_half_offset" getter="get_half_offset" enum="TileMap.HalfOffset" default="2">
|
||||
</member>
|
||||
<member name="cell_quadrant_size" type="int" setter="set_quadrant_size" getter="get_quadrant_size" default="16">
|
||||
</member>
|
||||
<member name="cell_size" type="Vector2" setter="set_cell_size" getter="get_cell_size" default="Vector2( 64, 64 )">
|
||||
</member>
|
||||
<member name="cell_tile_origin" type="int" setter="set_tile_origin" getter="get_tile_origin" enum="RTileMap.TileOrigin" default="0">
|
||||
<member name="cell_tile_origin" type="int" setter="set_tile_origin" getter="get_tile_origin" enum="TileMap.TileOrigin" default="0">
|
||||
</member>
|
||||
<member name="cell_y_sort" type="bool" setter="set_y_sort_mode" getter="is_y_sort_mode_enabled" default="false">
|
||||
</member>
|
||||
@ -187,7 +187,7 @@
|
||||
</member>
|
||||
<member name="compatibility_mode" type="bool" setter="set_compatibility_mode" getter="is_compatibility_mode_enabled" default="false">
|
||||
</member>
|
||||
<member name="mode" type="int" setter="set_mode" getter="get_mode" enum="RTileMap.Mode" default="0">
|
||||
<member name="mode" type="int" setter="set_mode" getter="get_mode" enum="TileMap.Mode" default="0">
|
||||
</member>
|
||||
<member name="navigation_layers" type="int" setter="set_navigation_layers" getter="get_navigation_layers" default="1">
|
||||
</member>
|
||||
@ -195,7 +195,7 @@
|
||||
</member>
|
||||
<member name="show_collision" type="bool" setter="set_show_collision" getter="is_show_collision_enabled" default="false">
|
||||
</member>
|
||||
<member name="tile_set" type="RTileSet" setter="set_tileset" getter="get_tileset">
|
||||
<member name="tile_set" type="TileSet" setter="set_tileset" getter="get_tileset">
|
||||
</member>
|
||||
<member name="use_rao" type="bool" setter="set_use_rao" getter="get_use_rao" default="true">
|
||||
</member>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="RTileSet" inherits="Resource" version="3.8">
|
||||
<class name="TileSet" inherits="Resource" version="3.8">
|
||||
<brief_description>
|
||||
</brief_description>
|
||||
<description>
|
||||
@ -45,7 +45,7 @@
|
||||
</description>
|
||||
</method>
|
||||
<method name="autotile_get_bitmask_mode" qualifiers="const">
|
||||
<return type="int" enum="RTileSet.BitmaskMode" />
|
||||
<return type="int" enum="TileSet.BitmaskMode" />
|
||||
<argument index="0" name="id" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
@ -107,7 +107,7 @@
|
||||
<method name="autotile_set_bitmask_mode">
|
||||
<return type="void" />
|
||||
<argument index="0" name="id" type="int" />
|
||||
<argument index="1" name="mode" type="int" enum="RTileSet.BitmaskMode" />
|
||||
<argument index="1" name="mode" type="int" enum="TileSet.BitmaskMode" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
@ -327,7 +327,7 @@
|
||||
</description>
|
||||
</method>
|
||||
<method name="tile_get_tile_mode" qualifiers="const">
|
||||
<return type="int" enum="RTileSet.TileMode" />
|
||||
<return type="int" enum="TileSet.TileMode" />
|
||||
<argument index="0" name="id" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
@ -465,7 +465,7 @@
|
||||
<method name="tile_set_tile_mode">
|
||||
<return type="void" />
|
||||
<argument index="0" name="id" type="int" />
|
||||
<argument index="1" name="tilemode" type="int" enum="RTileSet.TileMode" />
|
||||
<argument index="1" name="tilemode" type="int" enum="TileSet.TileMode" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
@ -1,4 +1,4 @@
|
||||
# RTileMap
|
||||
# TileMap
|
||||
|
||||
Godot's TileMap but as an engine module, with a few smaller features added.
|
||||
|
||||
|
@ -32,12 +32,12 @@ SOFTWARE.
|
||||
|
||||
void register_rtile_map_types() {
|
||||
#ifdef TOOLS_ENABLED
|
||||
EditorPlugins::add_by_type<RTileMapEditorPlugin>();
|
||||
EditorPlugins::add_by_type<RTileSetEditorPlugin>();
|
||||
EditorPlugins::add_by_type<TileMapEditorPlugin>();
|
||||
EditorPlugins::add_by_type<TileSetEditorPlugin>();
|
||||
#endif
|
||||
|
||||
ClassDB::register_class<RTileMap>();
|
||||
ClassDB::register_class<RTileSet>();
|
||||
ClassDB::register_class<TileMap>();
|
||||
ClassDB::register_class<TileSet>();
|
||||
}
|
||||
|
||||
void unregister_rtile_map_types() {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -40,8 +40,8 @@
|
||||
|
||||
class CollisionObject2D;
|
||||
|
||||
class RTileMap : public Node2D {
|
||||
GDCLASS(RTileMap, Node2D);
|
||||
class TileMap : public Node2D {
|
||||
GDCLASS(TileMap, Node2D);
|
||||
|
||||
public:
|
||||
enum Mode {
|
||||
@ -70,7 +70,7 @@ private:
|
||||
FORMAT_2
|
||||
};
|
||||
|
||||
Ref<RTileSet> tile_set;
|
||||
Ref<TileSet> tile_set;
|
||||
Size2i cell_size;
|
||||
int quadrant_size;
|
||||
Mode mode;
|
||||
@ -214,7 +214,7 @@ private:
|
||||
|
||||
void _fix_cell_transform(Transform2D &xform, const Cell &p_cell, const Vector2 &p_offset, const Size2 &p_sc);
|
||||
|
||||
void _add_shape(int &shape_idx, const Quadrant &p_q, const Ref<Shape2D> &p_shape, const RTileSet::ShapeData &p_shape_data, const Transform2D &p_xform, const Vector2 &p_metadata);
|
||||
void _add_shape(int &shape_idx, const Quadrant &p_q, const Ref<Shape2D> &p_shape, const TileSet::ShapeData &p_shape_data, const Transform2D &p_xform, const Vector2 &p_metadata);
|
||||
|
||||
Map<PosKey, Quadrant>::Element *_create_quadrant(const PosKey &p_qk);
|
||||
void _erase_quadrant(Map<PosKey, Quadrant>::Element *Q);
|
||||
@ -258,8 +258,8 @@ public:
|
||||
virtual Rect2 _edit_get_rect() const;
|
||||
#endif
|
||||
|
||||
void set_tileset(const Ref<RTileSet> &p_tileset);
|
||||
Ref<RTileSet> get_tileset() const;
|
||||
void set_tileset(const Ref<TileSet> &p_tileset);
|
||||
Ref<TileSet> get_tileset() const;
|
||||
|
||||
void set_cell_size(const Size2 &p_size);
|
||||
Size2 get_cell_size() const;
|
||||
@ -371,12 +371,12 @@ public:
|
||||
void fix_invalid_tiles();
|
||||
void clear();
|
||||
|
||||
RTileMap();
|
||||
~RTileMap();
|
||||
TileMap();
|
||||
~TileMap();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(RTileMap::Mode);
|
||||
VARIANT_ENUM_CAST(RTileMap::HalfOffset);
|
||||
VARIANT_ENUM_CAST(RTileMap::TileOrigin);
|
||||
VARIANT_ENUM_CAST(TileMap::Mode);
|
||||
VARIANT_ENUM_CAST(TileMap::HalfOffset);
|
||||
VARIANT_ENUM_CAST(TileMap::TileOrigin);
|
||||
|
||||
#endif // TILE_MAP_H
|
||||
|
@ -42,13 +42,13 @@
|
||||
#include "scene/gui/slider.h"
|
||||
#include "scene/gui/split_container.h"
|
||||
|
||||
void RTileMapEditor::_node_removed(Node *p_node) {
|
||||
void TileMapEditor::_node_removed(Node *p_node) {
|
||||
if (p_node == node) {
|
||||
node = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_notification(int p_what) {
|
||||
void TileMapEditor::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_PROCESS: {
|
||||
if (bucket_queue.size()) {
|
||||
@ -96,7 +96,7 @@ void RTileMapEditor::_notification(int p_what) {
|
||||
if (tool == TOOL_PAINTING) {
|
||||
Vector<int> ids = get_selected_tiles();
|
||||
|
||||
if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) {
|
||||
if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
|
||||
_set_cell(over_tile, ids, flip_h, flip_v, transpose);
|
||||
_finish_undo();
|
||||
|
||||
@ -113,7 +113,7 @@ void RTileMapEditor::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_update_button_tool() {
|
||||
void TileMapEditor::_update_button_tool() {
|
||||
ToolButton *tb[4] = { paint_button, bucket_fill_button, picker_button, select_button };
|
||||
// Unpress all buttons
|
||||
for (int i = 0; i < 4; i++) {
|
||||
@ -144,7 +144,7 @@ void RTileMapEditor::_update_button_tool() {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_button_tool_select(int p_tool) {
|
||||
void TileMapEditor::_button_tool_select(int p_tool) {
|
||||
tool = (Tool)p_tool;
|
||||
_update_button_tool();
|
||||
switch (tool) {
|
||||
@ -157,7 +157,7 @@ void RTileMapEditor::_button_tool_select(int p_tool) {
|
||||
CanvasItemEditor::get_singleton()->update_viewport();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_menu_option(int p_option) {
|
||||
void TileMapEditor::_menu_option(int p_option) {
|
||||
switch (p_option) {
|
||||
case OPTION_COPY: {
|
||||
_update_copydata();
|
||||
@ -209,15 +209,15 @@ void RTileMapEditor::_menu_option(int p_option) {
|
||||
_update_button_tool();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_palette_selected(int index) {
|
||||
void TileMapEditor::_palette_selected(int index) {
|
||||
_update_palette();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_palette_multi_selected(int index, bool selected) {
|
||||
void TileMapEditor::_palette_multi_selected(int index, bool selected) {
|
||||
_update_palette();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_palette_input(const Ref<InputEvent> &p_event) {
|
||||
void TileMapEditor::_palette_input(const Ref<InputEvent> &p_event) {
|
||||
const Ref<InputEventMouseButton> mb = p_event;
|
||||
|
||||
// Zoom in/out using Ctrl + mouse wheel.
|
||||
@ -232,21 +232,21 @@ void RTileMapEditor::_palette_input(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_canvas_mouse_enter() {
|
||||
void TileMapEditor::_canvas_mouse_enter() {
|
||||
mouse_over = true;
|
||||
CanvasItemEditor::get_singleton()->update_viewport();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_canvas_mouse_exit() {
|
||||
void TileMapEditor::_canvas_mouse_exit() {
|
||||
mouse_over = false;
|
||||
CanvasItemEditor::get_singleton()->update_viewport();
|
||||
}
|
||||
|
||||
Vector<int> RTileMapEditor::get_selected_tiles() const {
|
||||
Vector<int> TileMapEditor::get_selected_tiles() const {
|
||||
Vector<int> items = palette->get_selected_items();
|
||||
|
||||
if (items.size() == 0) {
|
||||
items.push_back(RTileMap::INVALID_CELL);
|
||||
items.push_back(TileMap::INVALID_CELL);
|
||||
return items;
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ Vector<int> RTileMapEditor::get_selected_tiles() const {
|
||||
return items;
|
||||
}
|
||||
|
||||
void RTileMapEditor::set_selected_tiles(Vector<int> p_tiles) {
|
||||
void TileMapEditor::set_selected_tiles(Vector<int> p_tiles) {
|
||||
palette->unselect_all();
|
||||
|
||||
for (int i = p_tiles.size() - 1; i >= 0; i--) {
|
||||
@ -270,7 +270,7 @@ void RTileMapEditor::set_selected_tiles(Vector<int> p_tiles) {
|
||||
palette->ensure_current_is_visible();
|
||||
}
|
||||
|
||||
Dictionary RTileMapEditor::_create_cell_dictionary(int tile, bool flip_x, bool flip_y, bool transpose, Vector2 autotile_coord) {
|
||||
Dictionary TileMapEditor::_create_cell_dictionary(int tile, bool flip_x, bool flip_y, bool transpose, Vector2 autotile_coord) {
|
||||
Dictionary cell;
|
||||
|
||||
cell["id"] = tile;
|
||||
@ -282,7 +282,7 @@ Dictionary RTileMapEditor::_create_cell_dictionary(int tile, bool flip_x, bool f
|
||||
return cell;
|
||||
}
|
||||
|
||||
void RTileMapEditor::_create_set_cell_undo_redo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new) {
|
||||
void TileMapEditor::_create_set_cell_undo_redo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new) {
|
||||
Dictionary cell_old = _create_cell_dictionary(p_cell_old.idx, p_cell_old.xf, p_cell_old.yf, p_cell_old.tr, p_cell_old.ac);
|
||||
Dictionary cell_new = _create_cell_dictionary(p_cell_new.idx, p_cell_new.xf, p_cell_new.yf, p_cell_new.tr, p_cell_new.ac);
|
||||
|
||||
@ -290,12 +290,12 @@ void RTileMapEditor::_create_set_cell_undo_redo(const Vector2 &p_vec, const Cell
|
||||
undo_redo->add_do_method(node, "_set_celld", p_vec, cell_new);
|
||||
}
|
||||
|
||||
void RTileMapEditor::_start_undo(const String &p_action) {
|
||||
void TileMapEditor::_start_undo(const String &p_action) {
|
||||
undo_data.clear();
|
||||
undo_redo->create_action(p_action);
|
||||
}
|
||||
|
||||
void RTileMapEditor::_finish_undo() {
|
||||
void TileMapEditor::_finish_undo() {
|
||||
if (undo_data.size()) {
|
||||
for (Map<Point2i, CellOp>::Element *E = undo_data.front(); E; E = E->next()) {
|
||||
_create_set_cell_undo_redo(E->key(), E->get(), _get_op_from_cell(E->key()));
|
||||
@ -307,7 +307,7 @@ void RTileMapEditor::_finish_undo() {
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_set_cell(const Point2i &p_pos, Vector<int> p_values, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord) {
|
||||
void TileMapEditor::_set_cell(const Point2i &p_pos, Vector<int> p_values, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord) {
|
||||
ERR_FAIL_COND(!node);
|
||||
|
||||
if (p_values.size() == 0) {
|
||||
@ -357,12 +357,12 @@ void RTileMapEditor::_set_cell(const Point2i &p_pos, Vector<int> p_values, bool
|
||||
return;
|
||||
}
|
||||
|
||||
if (manual_autotile || (p_value != -1 && node->get_tileset()->has_tile(p_value) && node->get_tileset()->tile_get_tile_mode(p_value) == RTileSet::ATLAS_TILE)) {
|
||||
if (manual_autotile || (p_value != -1 && node->get_tileset()->has_tile(p_value) && node->get_tileset()->tile_get_tile_mode(p_value) == TileSet::ATLAS_TILE)) {
|
||||
if (current != -1) {
|
||||
node->set_cell_autotile_coord(p_pos.x, p_pos.y, position);
|
||||
} else if (node->get_tileset()->tile_get_tile_mode(p_value) == RTileSet::ATLAS_TILE && priority_atlastile) {
|
||||
} else if (node->get_tileset()->tile_get_tile_mode(p_value) == TileSet::ATLAS_TILE && priority_atlastile) {
|
||||
// BIND_CENTER is used to indicate that bitmask should not update for this tile cell.
|
||||
node->get_tileset()->autotile_set_bitmask(p_value, Vector2(p_pos.x, p_pos.y), RTileSet::BIND_CENTER);
|
||||
node->get_tileset()->autotile_set_bitmask(p_value, Vector2(p_pos.x, p_pos.y), TileSet::BIND_CENTER);
|
||||
node->update_cell_bitmask(p_pos.x, p_pos.y);
|
||||
}
|
||||
} else {
|
||||
@ -370,25 +370,25 @@ void RTileMapEditor::_set_cell(const Point2i &p_pos, Vector<int> p_values, bool
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_manual_toggled(bool p_enabled) {
|
||||
void TileMapEditor::_manual_toggled(bool p_enabled) {
|
||||
manual_autotile = p_enabled;
|
||||
_update_palette();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_priority_toggled(bool p_enabled) {
|
||||
void TileMapEditor::_priority_toggled(bool p_enabled) {
|
||||
priority_atlastile = p_enabled;
|
||||
_update_palette();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_text_entered(const String &p_text) {
|
||||
void TileMapEditor::_text_entered(const String &p_text) {
|
||||
canvas_item_editor_viewport->grab_focus();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_text_changed(const String &p_text) {
|
||||
void TileMapEditor::_text_changed(const String &p_text) {
|
||||
_update_palette();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
|
||||
void TileMapEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
|
||||
Ref<InputEventKey> k = p_ie;
|
||||
|
||||
if (k.is_valid() && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_PAGEUP || k->get_scancode() == KEY_PAGEDOWN)) {
|
||||
@ -397,7 +397,7 @@ void RTileMapEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
|
||||
}
|
||||
}
|
||||
|
||||
// Implementation detail of RTileMapEditor::_update_palette();
|
||||
// Implementation detail of TileMapEditor::_update_palette();
|
||||
// In modern C++ this could have been inside its body.
|
||||
namespace {
|
||||
struct _PaletteEntry {
|
||||
@ -412,7 +412,7 @@ struct _PaletteEntry {
|
||||
};
|
||||
} // namespace
|
||||
|
||||
void RTileMapEditor::_update_palette() {
|
||||
void TileMapEditor::_update_palette() {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
@ -428,7 +428,7 @@ void RTileMapEditor::_update_palette() {
|
||||
manual_palette->clear();
|
||||
manual_palette->hide();
|
||||
|
||||
Ref<RTileSet> tileset = node->get_tileset();
|
||||
Ref<TileSet> tileset = node->get_tileset();
|
||||
if (tileset.is_null()) {
|
||||
search_box->set_text("");
|
||||
search_box->set_editable(false);
|
||||
@ -503,7 +503,7 @@ void RTileMapEditor::_update_palette() {
|
||||
if (tex.is_valid()) {
|
||||
Rect2 region = tileset->tile_get_region(entries[i].id);
|
||||
|
||||
if (tileset->tile_get_tile_mode(entries[i].id) == RTileSet::AUTO_TILE || tileset->tile_get_tile_mode(entries[i].id) == RTileSet::ATLAS_TILE) {
|
||||
if (tileset->tile_get_tile_mode(entries[i].id) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(entries[i].id) == TileSet::ATLAS_TILE) {
|
||||
int spacing = tileset->autotile_get_spacing(entries[i].id);
|
||||
region.size = tileset->autotile_get_size(entries[i].id);
|
||||
region.position += (region.size + Vector2(spacing, spacing)) * tileset->autotile_get_icon_coordinate(entries[i].id);
|
||||
@ -535,7 +535,7 @@ void RTileMapEditor::_update_palette() {
|
||||
}
|
||||
|
||||
int sel_tile = selected.get(0);
|
||||
if (selected.get(0) != RTileMap::INVALID_CELL) {
|
||||
if (selected.get(0) != TileMap::INVALID_CELL) {
|
||||
set_selected_tiles(selected);
|
||||
sel_tile = selected.get(Math::rand() % selected.size());
|
||||
} else if (palette->get_item_count() > 0) {
|
||||
@ -543,7 +543,7 @@ void RTileMapEditor::_update_palette() {
|
||||
sel_tile = palette->get_selected_items().get(0);
|
||||
}
|
||||
|
||||
if (sel_tile != RTileMap::INVALID_CELL && tileset->has_tile(sel_tile) && ((manual_autotile && tileset->tile_get_tile_mode(sel_tile) == RTileSet::AUTO_TILE) || (!priority_atlastile && tileset->tile_get_tile_mode(sel_tile) == RTileSet::ATLAS_TILE))) {
|
||||
if (sel_tile != TileMap::INVALID_CELL && tileset->has_tile(sel_tile) && ((manual_autotile && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) || (!priority_atlastile && tileset->tile_get_tile_mode(sel_tile) == TileSet::ATLAS_TILE))) {
|
||||
const Map<Vector2, uint32_t> &tiles2 = tileset->autotile_get_bitmask_map(sel_tile);
|
||||
|
||||
Vector<Vector2> entries2;
|
||||
@ -593,7 +593,7 @@ void RTileMapEditor::_update_palette() {
|
||||
manual_palette->show();
|
||||
}
|
||||
|
||||
if (sel_tile != RTileMap::INVALID_CELL && tileset->has_tile(sel_tile) && tileset->tile_get_tile_mode(sel_tile) == RTileSet::AUTO_TILE) {
|
||||
if (sel_tile != TileMap::INVALID_CELL && tileset->has_tile(sel_tile) && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) {
|
||||
manual_button->show();
|
||||
priority_button->hide();
|
||||
} else {
|
||||
@ -602,10 +602,10 @@ void RTileMapEditor::_update_palette() {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_pick_tile(const Point2 &p_pos) {
|
||||
void TileMapEditor::_pick_tile(const Point2 &p_pos) {
|
||||
int id = node->get_cell(p_pos.x, p_pos.y);
|
||||
|
||||
if (id == RTileMap::INVALID_CELL || !node->get_tileset()->has_tile(id)) {
|
||||
if (id == TileMap::INVALID_CELL || !node->get_tileset()->has_tile(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -624,24 +624,24 @@ void RTileMapEditor::_pick_tile(const Point2 &p_pos) {
|
||||
set_selected_tiles(selected);
|
||||
_update_palette();
|
||||
|
||||
if ((manual_autotile && node->get_tileset()->tile_get_tile_mode(id) == RTileSet::AUTO_TILE) || (!priority_atlastile && node->get_tileset()->tile_get_tile_mode(id) == RTileSet::ATLAS_TILE)) {
|
||||
if ((manual_autotile && node->get_tileset()->tile_get_tile_mode(id) == TileSet::AUTO_TILE) || (!priority_atlastile && node->get_tileset()->tile_get_tile_mode(id) == TileSet::ATLAS_TILE)) {
|
||||
manual_palette->select(manual_palette->find_metadata((Point2)autotile_coord));
|
||||
}
|
||||
|
||||
CanvasItemEditor::get_singleton()->update_viewport();
|
||||
}
|
||||
|
||||
PoolVector<Vector2> RTileMapEditor::_bucket_fill(const Point2i &p_start, bool erase, bool preview) {
|
||||
PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool erase, bool preview) {
|
||||
int prev_id = node->get_cell(p_start.x, p_start.y);
|
||||
Vector<int> ids;
|
||||
ids.push_back(RTileMap::INVALID_CELL);
|
||||
ids.push_back(TileMap::INVALID_CELL);
|
||||
if (!erase) {
|
||||
ids = get_selected_tiles();
|
||||
|
||||
if (ids.size() == 0 || ids[0] == RTileMap::INVALID_CELL) {
|
||||
if (ids.size() == 0 || ids[0] == TileMap::INVALID_CELL) {
|
||||
return PoolVector<Vector2>();
|
||||
}
|
||||
} else if (prev_id == RTileMap::INVALID_CELL) {
|
||||
} else if (prev_id == TileMap::INVALID_CELL) {
|
||||
return PoolVector<Vector2>();
|
||||
}
|
||||
|
||||
@ -744,7 +744,7 @@ PoolVector<Vector2> RTileMapEditor::_bucket_fill(const Point2i &p_start, bool er
|
||||
return preview ? bucket_cache : points;
|
||||
}
|
||||
|
||||
void RTileMapEditor::_fill_points(const PoolVector<Vector2> &p_points, const Dictionary &p_op) {
|
||||
void TileMapEditor::_fill_points(const PoolVector<Vector2> &p_points, const Dictionary &p_op) {
|
||||
int len = p_points.size();
|
||||
PoolVector<Vector2>::Read pr = p_points.read();
|
||||
|
||||
@ -762,7 +762,7 @@ void RTileMapEditor::_fill_points(const PoolVector<Vector2> &p_points, const Dic
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_erase_points(const PoolVector<Vector2> &p_points) {
|
||||
void TileMapEditor::_erase_points(const PoolVector<Vector2> &p_points) {
|
||||
int len = p_points.size();
|
||||
PoolVector<Vector2>::Read pr = p_points.read();
|
||||
|
||||
@ -771,7 +771,7 @@ void RTileMapEditor::_erase_points(const PoolVector<Vector2> &p_points) {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_select(const Point2i &p_from, const Point2i &p_to) {
|
||||
void TileMapEditor::_select(const Point2i &p_from, const Point2i &p_to) {
|
||||
Point2i begin = p_from;
|
||||
Point2i end = p_to;
|
||||
|
||||
@ -788,7 +788,7 @@ void RTileMapEditor::_select(const Point2i &p_from, const Point2i &p_to) {
|
||||
CanvasItemEditor::get_singleton()->update_viewport();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_erase_selection() {
|
||||
void TileMapEditor::_erase_selection() {
|
||||
if (!selection_active) {
|
||||
return;
|
||||
}
|
||||
@ -800,7 +800,7 @@ void RTileMapEditor::_erase_selection() {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord, const Transform2D &p_xform) {
|
||||
void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord, const Transform2D &p_xform) {
|
||||
if (!node->get_tileset()->has_tile(p_cell)) {
|
||||
return;
|
||||
}
|
||||
@ -813,11 +813,11 @@ void RTileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &
|
||||
Vector2 tile_ofs = node->get_tileset()->tile_get_texture_offset(p_cell);
|
||||
|
||||
Rect2 r = node->get_tileset()->tile_get_region(p_cell);
|
||||
if (node->get_tileset()->tile_get_tile_mode(p_cell) == RTileSet::AUTO_TILE || node->get_tileset()->tile_get_tile_mode(p_cell) == RTileSet::ATLAS_TILE) {
|
||||
if (node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::AUTO_TILE || node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::ATLAS_TILE) {
|
||||
Vector2 offset;
|
||||
if (tool != TOOL_PASTING) {
|
||||
int selected = manual_palette->get_current();
|
||||
if ((manual_autotile || (node->get_tileset()->tile_get_tile_mode(p_cell) == RTileSet::ATLAS_TILE && !priority_atlastile)) && selected != -1) {
|
||||
if ((manual_autotile || (node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::ATLAS_TILE && !priority_atlastile)) && selected != -1) {
|
||||
offset = manual_palette->get_item_metadata(selected);
|
||||
} else {
|
||||
offset = node->get_tileset()->autotile_get_icon_coordinate(p_cell);
|
||||
@ -875,9 +875,9 @@ void RTileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &
|
||||
}
|
||||
|
||||
if (compatibility_mode_enabled && !centered_texture) {
|
||||
if (node->get_tile_origin() == RTileMap::TILE_ORIGIN_TOP_LEFT) {
|
||||
if (node->get_tile_origin() == TileMap::TILE_ORIGIN_TOP_LEFT) {
|
||||
rect.position += tile_ofs;
|
||||
} else if (node->get_tile_origin() == RTileMap::TILE_ORIGIN_BOTTOM_LEFT) {
|
||||
} else if (node->get_tile_origin() == TileMap::TILE_ORIGIN_BOTTOM_LEFT) {
|
||||
rect.position += tile_ofs;
|
||||
|
||||
if (p_transpose) {
|
||||
@ -894,7 +894,7 @@ void RTileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &
|
||||
}
|
||||
}
|
||||
|
||||
} else if (node->get_tile_origin() == RTileMap::TILE_ORIGIN_CENTER) {
|
||||
} else if (node->get_tile_origin() == TileMap::TILE_ORIGIN_CENTER) {
|
||||
rect.position += tile_ofs;
|
||||
|
||||
if (p_flip_h) {
|
||||
@ -926,7 +926,7 @@ void RTileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &
|
||||
p_viewport->draw_set_transform_matrix(old_transform);
|
||||
}
|
||||
|
||||
void RTileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord, const Transform2D &p_xform) {
|
||||
void TileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord, const Transform2D &p_xform) {
|
||||
PoolVector<Vector2> points = _bucket_fill(p_point, false, true);
|
||||
PoolVector<Vector2>::Read pr = points.read();
|
||||
int len = points.size();
|
||||
@ -936,14 +936,14 @@ void RTileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const P
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_clear_bucket_cache() {
|
||||
void TileMapEditor::_clear_bucket_cache() {
|
||||
if (bucket_cache_visited) {
|
||||
delete[] bucket_cache_visited;
|
||||
bucket_cache_visited = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_update_copydata() {
|
||||
void TileMapEditor::_update_copydata() {
|
||||
copydata.clear();
|
||||
|
||||
if (!selection_active) {
|
||||
@ -955,7 +955,7 @@ void RTileMapEditor::_update_copydata() {
|
||||
TileData tcd;
|
||||
|
||||
tcd.cell = node->get_cell(j, i);
|
||||
if (tcd.cell != RTileMap::INVALID_CELL) {
|
||||
if (tcd.cell != TileMap::INVALID_CELL) {
|
||||
tcd.pos = Point2i(j, i);
|
||||
tcd.flip_h = node->is_cell_x_flipped(j, i);
|
||||
tcd.flip_v = node->is_cell_y_flipped(j, i);
|
||||
@ -1011,7 +1011,7 @@ static inline Vector<Point2i> line(int x0, int x1, int y0, int y1) {
|
||||
return points;
|
||||
}
|
||||
|
||||
bool RTileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
if (!node || !node->get_tileset().is_valid() || !node->is_visible_in_tree() || CanvasItemEditor::get_singleton()->get_current_tool() != CanvasItemEditor::TOOL_SELECT) {
|
||||
return false;
|
||||
}
|
||||
@ -1069,7 +1069,7 @@ bool RTileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
if (tool == TOOL_PAINTING) {
|
||||
Vector<int> ids = get_selected_tiles();
|
||||
|
||||
if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) {
|
||||
if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
|
||||
tool = TOOL_PAINTING;
|
||||
|
||||
_start_undo(TTR("Paint TileMap"));
|
||||
@ -1090,7 +1090,7 @@ bool RTileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
if (tool == TOOL_PAINTING) {
|
||||
Vector<int> ids = get_selected_tiles();
|
||||
|
||||
if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) {
|
||||
if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
|
||||
_set_cell(over_tile, ids, flip_h, flip_v, transpose);
|
||||
_finish_undo();
|
||||
|
||||
@ -1099,7 +1099,7 @@ bool RTileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
} else if (tool == TOOL_LINE_PAINT) {
|
||||
Vector<int> ids = get_selected_tiles();
|
||||
|
||||
if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) {
|
||||
if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
|
||||
_start_undo(TTR("Line Draw"));
|
||||
for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
|
||||
_set_cell(E->key(), ids, flip_h, flip_v, transpose);
|
||||
@ -1113,7 +1113,7 @@ bool RTileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
} else if (tool == TOOL_RECTANGLE_PAINT) {
|
||||
Vector<int> ids = get_selected_tiles();
|
||||
|
||||
if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) {
|
||||
if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
|
||||
_start_undo(TTR("Rectangle Paint"));
|
||||
for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
|
||||
for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
|
||||
@ -1341,7 +1341,7 @@ bool RTileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
|
||||
paint_undo.clear();
|
||||
|
||||
if (ids.size() > 0 && ids[0] != RTileMap::INVALID_CELL) {
|
||||
if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
|
||||
Vector<Point2i> points = line(rectangle_begin.x, over_tile.x, rectangle_begin.y, over_tile.y);
|
||||
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
@ -1544,7 +1544,7 @@ bool RTileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
if (!node || CanvasItemEditor::get_singleton()->get_current_tool() != CanvasItemEditor::TOOL_SELECT) {
|
||||
return;
|
||||
}
|
||||
@ -1562,7 +1562,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
aabb.expand_to(node->world_to_map(xform_inv.xform(screen_size)));
|
||||
Rect2i si = aabb.grow(1.0);
|
||||
|
||||
if (node->get_half_offset() != RTileMap::HALF_OFFSET_X && node->get_half_offset() != RTileMap::HALF_OFFSET_NEGATIVE_X) {
|
||||
if (node->get_half_offset() != TileMap::HALF_OFFSET_X && node->get_half_offset() != TileMap::HALF_OFFSET_NEGATIVE_X) {
|
||||
int max_lines = 2000; //avoid crash if size too small
|
||||
|
||||
for (int i = (si.position.x) - 1; i <= (si.position.x + si.size.x); i++) {
|
||||
@ -1582,7 +1582,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
for (int j = (si.position.y) - 1; j <= (si.position.y + si.size.y); j++) {
|
||||
Vector2 ofs;
|
||||
if (ABS(j) & 1) {
|
||||
ofs = cell_xf[0] * (node->get_half_offset() == RTileMap::HALF_OFFSET_X ? 0.5 : -0.5);
|
||||
ofs = cell_xf[0] * (node->get_half_offset() == TileMap::HALF_OFFSET_X ? 0.5 : -0.5);
|
||||
}
|
||||
|
||||
Vector2 from = xform.xform(node->map_to_world(Vector2(i, j), true) + ofs);
|
||||
@ -1603,7 +1603,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
|
||||
int max_lines = 10000; //avoid crash if size too small
|
||||
|
||||
if (node->get_half_offset() != RTileMap::HALF_OFFSET_Y && node->get_half_offset() != RTileMap::HALF_OFFSET_NEGATIVE_Y) {
|
||||
if (node->get_half_offset() != TileMap::HALF_OFFSET_Y && node->get_half_offset() != TileMap::HALF_OFFSET_NEGATIVE_Y) {
|
||||
for (int i = (si.position.y) - 1; i <= (si.position.y + si.size.y); i++) {
|
||||
Vector2 from = xform.xform(node->map_to_world(Vector2(si.position.x, i)));
|
||||
Vector2 to = xform.xform(node->map_to_world(Vector2(si.position.x + si.size.x + 1, i)));
|
||||
@ -1620,7 +1620,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
for (int j = (si.position.x) - 1; j <= (si.position.x + si.size.x); j++) {
|
||||
Vector2 ofs;
|
||||
if (ABS(j) & 1) {
|
||||
ofs = cell_xf[1] * (node->get_half_offset() == RTileMap::HALF_OFFSET_Y ? 0.5 : -0.5);
|
||||
ofs = cell_xf[1] * (node->get_half_offset() == TileMap::HALF_OFFSET_Y ? 0.5 : -0.5);
|
||||
}
|
||||
|
||||
Vector2 from = xform.xform(node->map_to_world(Vector2(j, i), true) + ofs);
|
||||
@ -1659,22 +1659,22 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
};
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (node->get_half_offset() == RTileMap::HALF_OFFSET_X && ABS(over_tile.y) & 1) {
|
||||
if (node->get_half_offset() == TileMap::HALF_OFFSET_X && ABS(over_tile.y) & 1) {
|
||||
endpoints[i] += cell_xf[0] * 0.5;
|
||||
}
|
||||
if (node->get_half_offset() == RTileMap::HALF_OFFSET_NEGATIVE_X && ABS(over_tile.y) & 1) {
|
||||
if (node->get_half_offset() == TileMap::HALF_OFFSET_NEGATIVE_X && ABS(over_tile.y) & 1) {
|
||||
endpoints[i] += cell_xf[0] * -0.5;
|
||||
}
|
||||
if (node->get_half_offset() == RTileMap::HALF_OFFSET_Y && ABS(over_tile.x) & 1) {
|
||||
if (node->get_half_offset() == TileMap::HALF_OFFSET_Y && ABS(over_tile.x) & 1) {
|
||||
endpoints[i] += cell_xf[1] * 0.5;
|
||||
}
|
||||
if (node->get_half_offset() == RTileMap::HALF_OFFSET_NEGATIVE_Y && ABS(over_tile.x) & 1) {
|
||||
if (node->get_half_offset() == TileMap::HALF_OFFSET_NEGATIVE_Y && ABS(over_tile.x) & 1) {
|
||||
endpoints[i] += cell_xf[1] * -0.5;
|
||||
}
|
||||
endpoints[i] = xform.xform(endpoints[i]);
|
||||
}
|
||||
Color col;
|
||||
if (node->get_cell(over_tile.x, over_tile.y) != RTileMap::INVALID_CELL) {
|
||||
if (node->get_cell(over_tile.x, over_tile.y) != TileMap::INVALID_CELL) {
|
||||
col = Color(0.2, 0.8, 1.0, 0.8);
|
||||
} else {
|
||||
col = Color(1.0, 0.4, 0.2, 0.8);
|
||||
@ -1696,7 +1696,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
|
||||
Vector<int> ids = get_selected_tiles();
|
||||
|
||||
if (ids.size() == 1 && ids[0] == RTileMap::INVALID_CELL) {
|
||||
if (ids.size() == 1 && ids[0] == TileMap::INVALID_CELL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1707,7 +1707,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
} else if (tool == TOOL_RECTANGLE_PAINT) {
|
||||
Vector<int> ids = get_selected_tiles();
|
||||
|
||||
if (ids.size() == 1 && ids[0] == RTileMap::INVALID_CELL) {
|
||||
if (ids.size() == 1 && ids[0] == TileMap::INVALID_CELL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1721,7 +1721,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<RTileSet> ts = node->get_tileset();
|
||||
Ref<TileSet> ts = node->get_tileset();
|
||||
|
||||
if (ts.is_null()) {
|
||||
return;
|
||||
@ -1757,7 +1757,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
} else {
|
||||
Vector<int> st = get_selected_tiles();
|
||||
|
||||
if (st.size() == 1 && st[0] == RTileMap::INVALID_CELL) {
|
||||
if (st.size() == 1 && st[0] == TileMap::INVALID_CELL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1766,7 +1766,7 @@ void RTileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::edit(Node *p_tile_map) {
|
||||
void TileMapEditor::edit(Node *p_tile_map) {
|
||||
search_box->set_text("");
|
||||
|
||||
if (!canvas_item_editor_viewport) {
|
||||
@ -1778,7 +1778,7 @@ void RTileMapEditor::edit(Node *p_tile_map) {
|
||||
}
|
||||
|
||||
if (p_tile_map) {
|
||||
node = Object::cast_to<RTileMap>(p_tile_map);
|
||||
node = Object::cast_to<TileMap>(p_tile_map);
|
||||
if (!canvas_item_editor_viewport->is_connected("mouse_entered", this, "_canvas_mouse_enter")) {
|
||||
canvas_item_editor_viewport->connect("mouse_entered", this, "_canvas_mouse_enter");
|
||||
}
|
||||
@ -1808,12 +1808,12 @@ void RTileMapEditor::edit(Node *p_tile_map) {
|
||||
_clear_bucket_cache();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_tileset_settings_changed() {
|
||||
void TileMapEditor::_tileset_settings_changed() {
|
||||
_update_palette();
|
||||
CanvasItemEditor::get_singleton()->update_viewport();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_icon_size_changed(float p_value) {
|
||||
void TileMapEditor::_icon_size_changed(float p_value) {
|
||||
if (node) {
|
||||
palette->set_icon_scale(p_value);
|
||||
manual_palette->set_icon_scale(p_value);
|
||||
@ -1821,36 +1821,36 @@ void RTileMapEditor::_icon_size_changed(float p_value) {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_manual_toggled"), &RTileMapEditor::_manual_toggled);
|
||||
ClassDB::bind_method(D_METHOD("_priority_toggled"), &RTileMapEditor::_priority_toggled);
|
||||
ClassDB::bind_method(D_METHOD("_text_entered"), &RTileMapEditor::_text_entered);
|
||||
ClassDB::bind_method(D_METHOD("_text_changed"), &RTileMapEditor::_text_changed);
|
||||
ClassDB::bind_method(D_METHOD("_sbox_input"), &RTileMapEditor::_sbox_input);
|
||||
ClassDB::bind_method(D_METHOD("_button_tool_select"), &RTileMapEditor::_button_tool_select);
|
||||
ClassDB::bind_method(D_METHOD("_menu_option"), &RTileMapEditor::_menu_option);
|
||||
ClassDB::bind_method(D_METHOD("_canvas_mouse_enter"), &RTileMapEditor::_canvas_mouse_enter);
|
||||
ClassDB::bind_method(D_METHOD("_canvas_mouse_exit"), &RTileMapEditor::_canvas_mouse_exit);
|
||||
ClassDB::bind_method(D_METHOD("_tileset_settings_changed"), &RTileMapEditor::_tileset_settings_changed);
|
||||
ClassDB::bind_method(D_METHOD("_rotate"), &RTileMapEditor::_rotate);
|
||||
ClassDB::bind_method(D_METHOD("_flip_horizontal"), &RTileMapEditor::_flip_horizontal);
|
||||
ClassDB::bind_method(D_METHOD("_flip_vertical"), &RTileMapEditor::_flip_vertical);
|
||||
ClassDB::bind_method(D_METHOD("_clear_transform"), &RTileMapEditor::_clear_transform);
|
||||
ClassDB::bind_method(D_METHOD("_palette_selected"), &RTileMapEditor::_palette_selected);
|
||||
ClassDB::bind_method(D_METHOD("_palette_multi_selected"), &RTileMapEditor::_palette_multi_selected);
|
||||
ClassDB::bind_method(D_METHOD("_palette_input"), &RTileMapEditor::_palette_input);
|
||||
void TileMapEditor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_manual_toggled"), &TileMapEditor::_manual_toggled);
|
||||
ClassDB::bind_method(D_METHOD("_priority_toggled"), &TileMapEditor::_priority_toggled);
|
||||
ClassDB::bind_method(D_METHOD("_text_entered"), &TileMapEditor::_text_entered);
|
||||
ClassDB::bind_method(D_METHOD("_text_changed"), &TileMapEditor::_text_changed);
|
||||
ClassDB::bind_method(D_METHOD("_sbox_input"), &TileMapEditor::_sbox_input);
|
||||
ClassDB::bind_method(D_METHOD("_button_tool_select"), &TileMapEditor::_button_tool_select);
|
||||
ClassDB::bind_method(D_METHOD("_menu_option"), &TileMapEditor::_menu_option);
|
||||
ClassDB::bind_method(D_METHOD("_canvas_mouse_enter"), &TileMapEditor::_canvas_mouse_enter);
|
||||
ClassDB::bind_method(D_METHOD("_canvas_mouse_exit"), &TileMapEditor::_canvas_mouse_exit);
|
||||
ClassDB::bind_method(D_METHOD("_tileset_settings_changed"), &TileMapEditor::_tileset_settings_changed);
|
||||
ClassDB::bind_method(D_METHOD("_rotate"), &TileMapEditor::_rotate);
|
||||
ClassDB::bind_method(D_METHOD("_flip_horizontal"), &TileMapEditor::_flip_horizontal);
|
||||
ClassDB::bind_method(D_METHOD("_flip_vertical"), &TileMapEditor::_flip_vertical);
|
||||
ClassDB::bind_method(D_METHOD("_clear_transform"), &TileMapEditor::_clear_transform);
|
||||
ClassDB::bind_method(D_METHOD("_palette_selected"), &TileMapEditor::_palette_selected);
|
||||
ClassDB::bind_method(D_METHOD("_palette_multi_selected"), &TileMapEditor::_palette_multi_selected);
|
||||
ClassDB::bind_method(D_METHOD("_palette_input"), &TileMapEditor::_palette_input);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_fill_points"), &RTileMapEditor::_fill_points);
|
||||
ClassDB::bind_method(D_METHOD("_erase_points"), &RTileMapEditor::_erase_points);
|
||||
ClassDB::bind_method(D_METHOD("_fill_points"), &TileMapEditor::_fill_points);
|
||||
ClassDB::bind_method(D_METHOD("_erase_points"), &TileMapEditor::_erase_points);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_icon_size_changed"), &RTileMapEditor::_icon_size_changed);
|
||||
ClassDB::bind_method(D_METHOD("_node_removed"), &RTileMapEditor::_node_removed);
|
||||
ClassDB::bind_method(D_METHOD("_icon_size_changed"), &TileMapEditor::_icon_size_changed);
|
||||
ClassDB::bind_method(D_METHOD("_node_removed"), &TileMapEditor::_node_removed);
|
||||
}
|
||||
|
||||
RTileMapEditor::CellOp RTileMapEditor::_get_op_from_cell(const Point2i &p_pos) {
|
||||
TileMapEditor::CellOp TileMapEditor::_get_op_from_cell(const Point2i &p_pos) {
|
||||
CellOp op;
|
||||
op.idx = node->get_cell(p_pos.x, p_pos.y);
|
||||
if (op.idx != RTileMap::INVALID_CELL) {
|
||||
if (op.idx != TileMap::INVALID_CELL) {
|
||||
if (node->is_cell_x_flipped(p_pos.x, p_pos.y)) {
|
||||
op.xf = true;
|
||||
}
|
||||
@ -1865,7 +1865,7 @@ RTileMapEditor::CellOp RTileMapEditor::_get_op_from_cell(const Point2i &p_pos) {
|
||||
return op;
|
||||
}
|
||||
|
||||
void RTileMapEditor::_rotate(int steps) {
|
||||
void TileMapEditor::_rotate(int steps) {
|
||||
const bool normal_rotation_matrix[][3] = {
|
||||
{ false, false, false },
|
||||
{ true, true, false },
|
||||
@ -1911,24 +1911,24 @@ void RTileMapEditor::_rotate(int steps) {
|
||||
_update_palette();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_flip_horizontal() {
|
||||
void TileMapEditor::_flip_horizontal() {
|
||||
flip_h = !flip_h;
|
||||
_update_palette();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_flip_vertical() {
|
||||
void TileMapEditor::_flip_vertical() {
|
||||
flip_v = !flip_v;
|
||||
_update_palette();
|
||||
}
|
||||
|
||||
void RTileMapEditor::_clear_transform() {
|
||||
void TileMapEditor::_clear_transform() {
|
||||
transpose = false;
|
||||
flip_h = false;
|
||||
flip_v = false;
|
||||
_update_palette();
|
||||
}
|
||||
|
||||
RTileMapEditor::RTileMapEditor(EditorNode *p_editor) {
|
||||
TileMapEditor::TileMapEditor(EditorNode *p_editor) {
|
||||
node = nullptr;
|
||||
manual_autotile = false;
|
||||
priority_atlastile = false;
|
||||
@ -1949,7 +1949,7 @@ RTileMapEditor::RTileMapEditor(EditorNode *p_editor) {
|
||||
bucket_cache_visited = nullptr;
|
||||
|
||||
invalid_cell.resize(1);
|
||||
invalid_cell.write[0] = RTileMap::INVALID_CELL;
|
||||
invalid_cell.write[0] = TileMap::INVALID_CELL;
|
||||
|
||||
ED_SHORTCUT("tile_map_editor/erase_selection", TTR("Erase Selection"), KEY_DELETE);
|
||||
ED_SHORTCUT("tile_map_editor/find_tile", TTR("Find Tile"), KEY_MASK_CMD + KEY_F);
|
||||
@ -2083,7 +2083,7 @@ RTileMapEditor::RTileMapEditor(EditorNode *p_editor) {
|
||||
|
||||
// Menu.
|
||||
options = memnew(MenuButton);
|
||||
options->set_text("RTileMap");
|
||||
options->set_text("TileMap");
|
||||
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("TileMap", "EditorIcons"));
|
||||
options->set_process_unhandled_key_input(false);
|
||||
toolbar_right->add_child(options);
|
||||
@ -2134,7 +2134,7 @@ RTileMapEditor::RTileMapEditor(EditorNode *p_editor) {
|
||||
clear_transform_button->set_disabled(true);
|
||||
}
|
||||
|
||||
RTileMapEditor::~RTileMapEditor() {
|
||||
TileMapEditor::~TileMapEditor() {
|
||||
_clear_bucket_cache();
|
||||
copydata.clear();
|
||||
}
|
||||
@ -2143,7 +2143,7 @@ RTileMapEditor::~RTileMapEditor() {
|
||||
///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
void RTileMapEditorPlugin::_notification(int p_what) {
|
||||
void TileMapEditorPlugin::_notification(int p_what) {
|
||||
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||
switch ((int)EditorSettings::get_singleton()->get("editors/tile_map/editor_side")) {
|
||||
case 0: { // Left.
|
||||
@ -2156,15 +2156,15 @@ void RTileMapEditorPlugin::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileMapEditorPlugin::edit(Object *p_object) {
|
||||
void TileMapEditorPlugin::edit(Object *p_object) {
|
||||
tile_map_editor->edit(Object::cast_to<Node>(p_object));
|
||||
}
|
||||
|
||||
bool RTileMapEditorPlugin::handles(Object *p_object) const {
|
||||
return p_object->is_class("RTileMap");
|
||||
bool TileMapEditorPlugin::handles(Object *p_object) const {
|
||||
return p_object->is_class("TileMap");
|
||||
}
|
||||
|
||||
void RTileMapEditorPlugin::make_visible(bool p_visible) {
|
||||
void TileMapEditorPlugin::make_visible(bool p_visible) {
|
||||
if (p_visible) {
|
||||
tile_map_editor->show();
|
||||
tile_map_editor->get_toolbar()->show();
|
||||
@ -2184,7 +2184,7 @@ void RTileMapEditorPlugin::make_visible(bool p_visible) {
|
||||
}
|
||||
}
|
||||
|
||||
RTileMapEditorPlugin::RTileMapEditorPlugin(EditorNode *p_node) {
|
||||
TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) {
|
||||
EDITOR_DEF("editors/tile_map/preview_size", 64);
|
||||
EDITOR_DEF("editors/tile_map/palette_item_hseparation", 8);
|
||||
EDITOR_DEF("editors/tile_map/show_tile_names", true);
|
||||
@ -2194,7 +2194,7 @@ RTileMapEditorPlugin::RTileMapEditorPlugin(EditorNode *p_node) {
|
||||
EDITOR_DEF("editors/tile_map/editor_side", 1);
|
||||
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/tile_map/editor_side", PROPERTY_HINT_ENUM, "Left,Right"));
|
||||
|
||||
tile_map_editor = memnew(RTileMapEditor(p_node));
|
||||
tile_map_editor = memnew(TileMapEditor(p_node));
|
||||
switch ((int)EditorSettings::get_singleton()->get("editors/tile_map/editor_side")) {
|
||||
case 0: { // Left.
|
||||
add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE_LEFT, tile_map_editor);
|
||||
@ -2206,5 +2206,5 @@ RTileMapEditorPlugin::RTileMapEditorPlugin(EditorNode *p_node) {
|
||||
tile_map_editor->hide();
|
||||
}
|
||||
|
||||
RTileMapEditorPlugin::~RTileMapEditorPlugin() {
|
||||
TileMapEditorPlugin::~TileMapEditorPlugin() {
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ class PopupMenu;
|
||||
class ItemList;
|
||||
class VSeparator;
|
||||
|
||||
class RTileMapEditor : public VBoxContainer {
|
||||
GDCLASS(RTileMapEditor, VBoxContainer);
|
||||
class TileMapEditor : public VBoxContainer {
|
||||
GDCLASS(TileMapEditor, VBoxContainer);
|
||||
|
||||
enum Tool {
|
||||
|
||||
@ -71,7 +71,7 @@ class RTileMapEditor : public VBoxContainer {
|
||||
OPTION_CUT
|
||||
};
|
||||
|
||||
RTileMap *node;
|
||||
TileMap *node;
|
||||
bool manual_autotile;
|
||||
bool priority_atlastile;
|
||||
Vector2 manual_position;
|
||||
@ -138,7 +138,7 @@ class RTileMapEditor : public VBoxContainer {
|
||||
Vector2 ac;
|
||||
|
||||
CellOp() :
|
||||
idx(RTileMap::INVALID_CELL),
|
||||
idx(TileMap::INVALID_CELL),
|
||||
xf(false),
|
||||
yf(false),
|
||||
tr(false) {}
|
||||
@ -155,7 +155,7 @@ class RTileMapEditor : public VBoxContainer {
|
||||
Point2i autotile_coord;
|
||||
|
||||
TileData() :
|
||||
cell(RTileMap::INVALID_CELL),
|
||||
cell(TileMap::INVALID_CELL),
|
||||
flip_h(false),
|
||||
flip_v(false),
|
||||
transpose(false) {}
|
||||
@ -230,14 +230,14 @@ public:
|
||||
|
||||
void edit(Node *p_tile_map);
|
||||
|
||||
RTileMapEditor(EditorNode *p_editor);
|
||||
~RTileMapEditor();
|
||||
TileMapEditor(EditorNode *p_editor);
|
||||
~TileMapEditor();
|
||||
};
|
||||
|
||||
class RTileMapEditorPlugin : public EditorPlugin {
|
||||
GDCLASS(RTileMapEditorPlugin, EditorPlugin);
|
||||
class TileMapEditorPlugin : public EditorPlugin {
|
||||
GDCLASS(TileMapEditorPlugin, EditorPlugin);
|
||||
|
||||
RTileMapEditor *tile_map_editor;
|
||||
TileMapEditor *tile_map_editor;
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
@ -246,14 +246,14 @@ public:
|
||||
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) { return tile_map_editor->forward_gui_input(p_event); }
|
||||
virtual void forward_canvas_draw_over_viewport(Control *p_overlay) { tile_map_editor->forward_canvas_draw_over_viewport(p_overlay); }
|
||||
|
||||
virtual String get_name() const { return "RTileMap"; }
|
||||
virtual String get_name() const { return "TileMap"; }
|
||||
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);
|
||||
|
||||
RTileMapEditorPlugin(EditorNode *p_node);
|
||||
~RTileMapEditorPlugin();
|
||||
TileMapEditorPlugin(EditorNode *p_node);
|
||||
~TileMapEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // TILE_MAP_EDITOR_PLUGIN_H
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "core/variant/array.h"
|
||||
#include "core/config/engine.h"
|
||||
|
||||
bool RTileSet::_set(const StringName &p_name, const Variant &p_value) {
|
||||
bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
|
||||
String n = p_name;
|
||||
int slash = n.find("/");
|
||||
if (slash == -1) {
|
||||
@ -208,7 +208,7 @@ bool RTileSet::_set(const StringName &p_name, const Variant &p_value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RTileSet::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
bool TileSet::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
String n = p_name;
|
||||
int slash = n.find("/");
|
||||
if (slash == -1) {
|
||||
@ -323,7 +323,7 @@ bool RTileSet::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void RTileSet::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
|
||||
int id = E->key();
|
||||
String pre = itos(id) + "/";
|
||||
@ -368,154 +368,154 @@ void RTileSet::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileSet::create_tile(int p_id) {
|
||||
ERR_FAIL_COND_MSG(tile_map.has(p_id), vformat("The RTileSet already has a tile with ID '%d'.", p_id));
|
||||
void TileSet::create_tile(int p_id) {
|
||||
ERR_FAIL_COND_MSG(tile_map.has(p_id), vformat("The TileSet already has a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id] = TileData();
|
||||
tile_map[p_id].autotile_data = AutotileData();
|
||||
_change_notify("");
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
void RTileSet::autotile_set_bitmask_mode(int p_id, BitmaskMode p_mode) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::autotile_set_bitmask_mode(int p_id, BitmaskMode p_mode) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].autotile_data.bitmask_mode = p_mode;
|
||||
_change_notify("");
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
RTileSet::BitmaskMode RTileSet::autotile_get_bitmask_mode(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), BITMASK_2X2, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
TileSet::BitmaskMode TileSet::autotile_get_bitmask_mode(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), BITMASK_2X2, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].autotile_data.bitmask_mode;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_texture(int p_id, const Ref<Texture> &p_texture) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_texture(int p_id, const Ref<Texture> &p_texture) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].texture = p_texture;
|
||||
emit_changed();
|
||||
_change_notify("texture");
|
||||
}
|
||||
|
||||
Ref<Texture> RTileSet::tile_get_texture(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<Texture>(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Ref<Texture> TileSet::tile_get_texture(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<Texture>(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].texture;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_normal_map(int p_id, const Ref<Texture> &p_normal_map) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_normal_map(int p_id, const Ref<Texture> &p_normal_map) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].normal_map = p_normal_map;
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Ref<Texture> RTileSet::tile_get_normal_map(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<Texture>(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Ref<Texture> TileSet::tile_get_normal_map(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<Texture>(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].normal_map;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_material(int p_id, const Ref<ShaderMaterial> &p_material) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_material(int p_id, const Ref<ShaderMaterial> &p_material) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].material = p_material;
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Ref<ShaderMaterial> RTileSet::tile_get_material(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<ShaderMaterial>(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Ref<ShaderMaterial> TileSet::tile_get_material(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<ShaderMaterial>(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].material;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_modulate(int p_id, const Color &p_modulate) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_modulate(int p_id, const Color &p_modulate) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].modulate = p_modulate;
|
||||
emit_changed();
|
||||
_change_notify("modulate");
|
||||
}
|
||||
|
||||
Color RTileSet::tile_get_modulate(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Color(1, 1, 1), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Color TileSet::tile_get_modulate(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Color(1, 1, 1), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].modulate;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_texture_offset(int p_id, const Vector2 &p_offset) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_texture_offset(int p_id, const Vector2 &p_offset) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].offset = p_offset;
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Vector2 RTileSet::tile_get_texture_offset(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Vector2 TileSet::tile_get_texture_offset(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].offset;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_region(int p_id, const Rect2 &p_region) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_region(int p_id, const Rect2 &p_region) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].region = p_region;
|
||||
emit_changed();
|
||||
_change_notify("region");
|
||||
}
|
||||
|
||||
Rect2 RTileSet::tile_get_region(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Rect2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Rect2 TileSet::tile_get_region(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Rect2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].region;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_tile_mode(int p_id, TileMode p_tile_mode) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_tile_mode(int p_id, TileMode p_tile_mode) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].tile_mode = p_tile_mode;
|
||||
emit_changed();
|
||||
_change_notify("tile_mode");
|
||||
}
|
||||
|
||||
RTileSet::TileMode RTileSet::tile_get_tile_mode(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), SINGLE_TILE, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
TileSet::TileMode TileSet::tile_get_tile_mode(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), SINGLE_TILE, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].tile_mode;
|
||||
}
|
||||
|
||||
void RTileSet::autotile_set_icon_coordinate(int p_id, const Vector2 &coord) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::autotile_set_icon_coordinate(int p_id, const Vector2 &coord) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].autotile_data.icon_coord = coord;
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Vector2 RTileSet::autotile_get_icon_coordinate(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Vector2 TileSet::autotile_get_icon_coordinate(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].autotile_data.icon_coord;
|
||||
}
|
||||
|
||||
void RTileSet::autotile_set_spacing(int p_id, int p_spacing) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::autotile_set_spacing(int p_id, int p_spacing) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND(p_spacing < 0);
|
||||
tile_map[p_id].autotile_data.spacing = p_spacing;
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
int RTileSet::autotile_get_spacing(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
int TileSet::autotile_get_spacing(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].autotile_data.spacing;
|
||||
}
|
||||
|
||||
void RTileSet::autotile_set_size(int p_id, const Size2 &p_size) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::autotile_set_size(int p_id, const Size2 &p_size) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND(p_size.x <= 0 || p_size.y <= 0);
|
||||
tile_map[p_id].autotile_data.size = p_size;
|
||||
}
|
||||
|
||||
Size2 RTileSet::autotile_get_size(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Size2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Size2 TileSet::autotile_get_size(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Size2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].autotile_data.size;
|
||||
}
|
||||
|
||||
void RTileSet::autotile_clear_bitmask_map(int p_id) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::autotile_clear_bitmask_map(int p_id) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].autotile_data.flags.clear();
|
||||
}
|
||||
|
||||
void RTileSet::autotile_set_subtile_priority(int p_id, const Vector2 &p_coord, int p_priority) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::autotile_set_subtile_priority(int p_id, const Vector2 &p_coord, int p_priority) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND(p_priority <= 0);
|
||||
tile_map[p_id].autotile_data.priority_map[p_coord] = p_priority;
|
||||
}
|
||||
|
||||
int RTileSet::autotile_get_subtile_priority(int p_id, const Vector2 &p_coord) {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 1, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
int TileSet::autotile_get_subtile_priority(int p_id, const Vector2 &p_coord) {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 1, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
if (tile_map[p_id].autotile_data.priority_map.has(p_coord)) {
|
||||
return tile_map[p_id].autotile_data.priority_map[p_coord];
|
||||
}
|
||||
@ -523,20 +523,20 @@ int RTileSet::autotile_get_subtile_priority(int p_id, const Vector2 &p_coord) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const Map<Vector2, int> &RTileSet::autotile_get_priority_map(int p_id) const {
|
||||
const Map<Vector2, int> &TileSet::autotile_get_priority_map(int p_id) const {
|
||||
static Map<Vector2, int> dummy;
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].autotile_data.priority_map;
|
||||
}
|
||||
|
||||
void RTileSet::autotile_set_z_index(int p_id, const Vector2 &p_coord, int p_z_index) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::autotile_set_z_index(int p_id, const Vector2 &p_coord, int p_z_index) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].autotile_data.z_index_map[p_coord] = p_z_index;
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
int RTileSet::autotile_get_z_index(int p_id, const Vector2 &p_coord) {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 1, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
int TileSet::autotile_get_z_index(int p_id, const Vector2 &p_coord) {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 1, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
if (tile_map[p_id].autotile_data.z_index_map.has(p_coord)) {
|
||||
return tile_map[p_id].autotile_data.z_index_map[p_coord];
|
||||
}
|
||||
@ -544,14 +544,14 @@ int RTileSet::autotile_get_z_index(int p_id, const Vector2 &p_coord) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Map<Vector2, int> &RTileSet::autotile_get_z_index_map(int p_id) const {
|
||||
const Map<Vector2, int> &TileSet::autotile_get_z_index_map(int p_id) const {
|
||||
static Map<Vector2, int> dummy;
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].autotile_data.z_index_map;
|
||||
}
|
||||
|
||||
void RTileSet::autotile_set_bitmask(int p_id, const Vector2 &p_coord, uint32_t p_flag) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::autotile_set_bitmask(int p_id, const Vector2 &p_coord, uint32_t p_flag) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
if (p_flag == 0) {
|
||||
if (tile_map[p_id].autotile_data.flags.has(p_coord)) {
|
||||
tile_map[p_id].autotile_data.flags.erase(p_coord);
|
||||
@ -561,18 +561,18 @@ void RTileSet::autotile_set_bitmask(int p_id, const Vector2 &p_coord, uint32_t p
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t RTileSet::autotile_get_bitmask(int p_id, const Vector2 &p_coord) {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
uint32_t TileSet::autotile_get_bitmask(int p_id, const Vector2 &p_coord) {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
if (!tile_map[p_id].autotile_data.flags.has(p_coord)) {
|
||||
return 0;
|
||||
}
|
||||
return tile_map[p_id].autotile_data.flags[p_coord];
|
||||
}
|
||||
|
||||
const Map<Vector2, uint32_t> &RTileSet::autotile_get_bitmask_map(int p_id) {
|
||||
const Map<Vector2, uint32_t> &TileSet::autotile_get_bitmask_map(int p_id) {
|
||||
static Map<Vector2, uint32_t> dummy;
|
||||
static Map<Vector2, uint32_t> dummy_atlas;
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
if (tile_get_tile_mode(p_id) == ATLAS_TILE) {
|
||||
dummy_atlas = Map<Vector2, uint32_t>();
|
||||
Rect2 region = tile_get_region(p_id);
|
||||
@ -589,8 +589,8 @@ const Map<Vector2, uint32_t> &RTileSet::autotile_get_bitmask_map(int p_id) {
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 RTileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node, const Vector2 &p_tile_location) {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Vector2 TileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node, const Vector2 &p_tile_location) {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
//First try to forward selection to script
|
||||
if (p_tilemap_node->get_class_name() == "TileMap") {
|
||||
if (get_script_instance() != nullptr) {
|
||||
@ -650,8 +650,8 @@ Vector2 RTileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask,
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 RTileSet::atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node, const Vector2 &p_tile_location) {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Vector2 TileSet::atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node, const Vector2 &p_tile_location) {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
//First try to forward selection to script
|
||||
if (get_script_instance() != nullptr) {
|
||||
if (get_script_instance()->has_method("_forward_atlas_subtile_selection")) {
|
||||
@ -680,25 +680,25 @@ Vector2 RTileSet::atlastile_get_subtile_by_priority(int p_id, const Node *p_tile
|
||||
}
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_name(int p_id, const String &p_name) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_name(int p_id, const String &p_name) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].name = p_name;
|
||||
emit_changed();
|
||||
_change_notify("name");
|
||||
}
|
||||
|
||||
String RTileSet::tile_get_name(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), String(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
String TileSet::tile_get_name(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), String(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].name;
|
||||
}
|
||||
|
||||
void RTileSet::tile_clear_shapes(int p_id) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_clear_shapes(int p_id) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].shapes_data.clear();
|
||||
}
|
||||
|
||||
void RTileSet::tile_add_shape(int p_id, const Ref<Shape2D> &p_shape, const Transform2D &p_transform, bool p_one_way, const Vector2 &p_autotile_coord) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_add_shape(int p_id, const Ref<Shape2D> &p_shape, const Transform2D &p_transform, bool p_one_way, const Vector2 &p_autotile_coord) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
|
||||
ShapeData new_data = ShapeData();
|
||||
new_data.shape = p_shape;
|
||||
@ -709,13 +709,13 @@ void RTileSet::tile_add_shape(int p_id, const Ref<Shape2D> &p_shape, const Trans
|
||||
tile_map[p_id].shapes_data.push_back(new_data);
|
||||
}
|
||||
|
||||
int RTileSet::tile_get_shape_count(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
int TileSet::tile_get_shape_count(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].shapes_data.size();
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND(p_shape_id < 0);
|
||||
|
||||
if (p_shape_id >= tile_map[p_id].shapes_data.size()) {
|
||||
@ -726,8 +726,8 @@ void RTileSet::tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_sh
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Ref<Shape2D> RTileSet::tile_get_shape(int p_id, int p_shape_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<Shape2D>(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Ref<Shape2D> TileSet::tile_get_shape(int p_id, int p_shape_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<Shape2D>(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND_V(p_shape_id < 0, Ref<Shape2D>());
|
||||
|
||||
if (p_shape_id < tile_map[p_id].shapes_data.size()) {
|
||||
@ -737,8 +737,8 @@ Ref<Shape2D> RTileSet::tile_get_shape(int p_id, int p_shape_id) const {
|
||||
return Ref<Shape2D>();
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND(p_shape_id < 0);
|
||||
|
||||
if (p_shape_id >= tile_map[p_id].shapes_data.size()) {
|
||||
@ -748,8 +748,8 @@ void RTileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transfor
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Transform2D RTileSet::tile_get_shape_transform(int p_id, int p_shape_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Transform2D(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Transform2D TileSet::tile_get_shape_transform(int p_id, int p_shape_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Transform2D(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND_V(p_shape_id < 0, Transform2D());
|
||||
|
||||
if (p_shape_id < tile_map[p_id].shapes_data.size()) {
|
||||
@ -759,18 +759,18 @@ Transform2D RTileSet::tile_get_shape_transform(int p_id, int p_shape_id) const {
|
||||
return Transform2D();
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_shape_offset(int p_id, int p_shape_id, const Vector2 &p_offset) {
|
||||
void TileSet::tile_set_shape_offset(int p_id, int p_shape_id, const Vector2 &p_offset) {
|
||||
Transform2D transform = tile_get_shape_transform(p_id, p_shape_id);
|
||||
transform.set_origin(p_offset);
|
||||
tile_set_shape_transform(p_id, p_shape_id, transform);
|
||||
}
|
||||
|
||||
Vector2 RTileSet::tile_get_shape_offset(int p_id, int p_shape_id) const {
|
||||
Vector2 TileSet::tile_get_shape_offset(int p_id, int p_shape_id) const {
|
||||
return tile_get_shape_transform(p_id, p_shape_id).get_origin();
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_way) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_way) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND(p_shape_id < 0);
|
||||
|
||||
if (p_shape_id >= tile_map[p_id].shapes_data.size()) {
|
||||
@ -780,8 +780,8 @@ void RTileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
bool RTileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), false, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
bool TileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), false, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND_V(p_shape_id < 0, false);
|
||||
|
||||
if (p_shape_id < tile_map[p_id].shapes_data.size()) {
|
||||
@ -791,8 +791,8 @@ bool RTileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_shape_one_way_margin(int p_id, int p_shape_id, float p_margin) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_shape_one_way_margin(int p_id, int p_shape_id, float p_margin) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND(p_shape_id < 0);
|
||||
|
||||
if (p_shape_id >= tile_map[p_id].shapes_data.size()) {
|
||||
@ -802,8 +802,8 @@ void RTileSet::tile_set_shape_one_way_margin(int p_id, int p_shape_id, float p_m
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
float RTileSet::tile_get_shape_one_way_margin(int p_id, int p_shape_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
float TileSet::tile_get_shape_one_way_margin(int p_id, int p_shape_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND_V(p_shape_id < 0, 0);
|
||||
|
||||
if (p_shape_id < tile_map[p_id].shapes_data.size()) {
|
||||
@ -813,18 +813,18 @@ float RTileSet::tile_get_shape_one_way_margin(int p_id, int p_shape_id) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D> &p_light_occluder) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D> &p_light_occluder) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].occluder = p_light_occluder;
|
||||
}
|
||||
|
||||
Ref<OccluderPolygon2D> RTileSet::tile_get_light_occluder(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<OccluderPolygon2D>(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Ref<OccluderPolygon2D> TileSet::tile_get_light_occluder(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<OccluderPolygon2D>(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].occluder;
|
||||
}
|
||||
|
||||
void RTileSet::autotile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D> &p_light_occluder, const Vector2 &p_coord) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::autotile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D> &p_light_occluder, const Vector2 &p_coord) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
if (p_light_occluder.is_null()) {
|
||||
if (tile_map[p_id].autotile_data.occluder_map.has(p_coord)) {
|
||||
tile_map[p_id].autotile_data.occluder_map.erase(p_coord);
|
||||
@ -834,8 +834,8 @@ void RTileSet::autotile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D
|
||||
}
|
||||
}
|
||||
|
||||
Ref<OccluderPolygon2D> RTileSet::autotile_get_light_occluder(int p_id, const Vector2 &p_coord) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<OccluderPolygon2D>(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Ref<OccluderPolygon2D> TileSet::autotile_get_light_occluder(int p_id, const Vector2 &p_coord) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<OccluderPolygon2D>(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
|
||||
if (!tile_map[p_id].autotile_data.occluder_map.has(p_coord)) {
|
||||
return Ref<OccluderPolygon2D>();
|
||||
@ -844,34 +844,34 @@ Ref<OccluderPolygon2D> RTileSet::autotile_get_light_occluder(int p_id, const Vec
|
||||
}
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_navigation_polygon_offset(int p_id, const Vector2 &p_offset) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_navigation_polygon_offset(int p_id, const Vector2 &p_offset) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].navigation_polygon_offset = p_offset;
|
||||
}
|
||||
|
||||
Vector2 RTileSet::tile_get_navigation_polygon_offset(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Vector2 TileSet::tile_get_navigation_polygon_offset(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].navigation_polygon_offset;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_navigation_polygon(int p_id, const Ref<NavigationPolygon> &p_navigation_polygon) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_navigation_polygon(int p_id, const Ref<NavigationPolygon> &p_navigation_polygon) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].navigation_polygon = p_navigation_polygon;
|
||||
}
|
||||
|
||||
Ref<NavigationPolygon> RTileSet::tile_get_navigation_polygon(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<NavigationPolygon>(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Ref<NavigationPolygon> TileSet::tile_get_navigation_polygon(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<NavigationPolygon>(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].navigation_polygon;
|
||||
}
|
||||
|
||||
const Map<Vector2, Ref<OccluderPolygon2D>> &RTileSet::autotile_get_light_oclusion_map(int p_id) const {
|
||||
const Map<Vector2, Ref<OccluderPolygon2D>> &TileSet::autotile_get_light_oclusion_map(int p_id) const {
|
||||
static Map<Vector2, Ref<OccluderPolygon2D>> dummy;
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].autotile_data.occluder_map;
|
||||
}
|
||||
|
||||
void RTileSet::autotile_set_navigation_polygon(int p_id, const Ref<NavigationPolygon> &p_navigation_polygon, const Vector2 &p_coord) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::autotile_set_navigation_polygon(int p_id, const Ref<NavigationPolygon> &p_navigation_polygon, const Vector2 &p_coord) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
if (p_navigation_polygon.is_null()) {
|
||||
if (tile_map[p_id].autotile_data.navpoly_map.has(p_coord)) {
|
||||
tile_map[p_id].autotile_data.navpoly_map.erase(p_coord);
|
||||
@ -881,8 +881,8 @@ void RTileSet::autotile_set_navigation_polygon(int p_id, const Ref<NavigationPol
|
||||
}
|
||||
}
|
||||
|
||||
Ref<NavigationPolygon> RTileSet::autotile_get_navigation_polygon(int p_id, const Vector2 &p_coord) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<NavigationPolygon>(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Ref<NavigationPolygon> TileSet::autotile_get_navigation_polygon(int p_id, const Vector2 &p_coord) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref<NavigationPolygon>(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
if (!tile_map[p_id].autotile_data.navpoly_map.has(p_coord)) {
|
||||
return Ref<NavigationPolygon>();
|
||||
} else {
|
||||
@ -890,24 +890,24 @@ Ref<NavigationPolygon> RTileSet::autotile_get_navigation_polygon(int p_id, const
|
||||
}
|
||||
}
|
||||
|
||||
const Map<Vector2, Ref<NavigationPolygon>> &RTileSet::autotile_get_navigation_map(int p_id) const {
|
||||
const Map<Vector2, Ref<NavigationPolygon>> &TileSet::autotile_get_navigation_map(int p_id) const {
|
||||
static Map<Vector2, Ref<NavigationPolygon>> dummy;
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].autotile_data.navpoly_map;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_occluder_offset(int p_id, const Vector2 &p_offset) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_occluder_offset(int p_id, const Vector2 &p_offset) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].occluder_offset = p_offset;
|
||||
}
|
||||
|
||||
Vector2 RTileSet::tile_get_occluder_offset(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Vector2 TileSet::tile_get_occluder_offset(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector2(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].occluder_offset;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_shapes(int p_id, const Vector<ShapeData> &p_shapes) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_shapes(int p_id, const Vector<ShapeData> &p_shapes) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].shapes_data = p_shapes;
|
||||
for (int i = 0; i < p_shapes.size(); i++) {
|
||||
_decompose_convex_shape(p_shapes[i].shape);
|
||||
@ -915,24 +915,24 @@ void RTileSet::tile_set_shapes(int p_id, const Vector<ShapeData> &p_shapes) {
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Vector<RTileSet::ShapeData> RTileSet::tile_get_shapes(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector<ShapeData>(), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
Vector<TileSet::ShapeData> TileSet::tile_get_shapes(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Vector<ShapeData>(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
|
||||
return tile_map[p_id].shapes_data;
|
||||
}
|
||||
|
||||
int RTileSet::tile_get_z_index(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
int TileSet::tile_get_z_index(int p_id) const {
|
||||
ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), 0, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
return tile_map[p_id].z_index;
|
||||
}
|
||||
|
||||
void RTileSet::tile_set_z_index(int p_id, int p_z_index) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::tile_set_z_index(int p_id, int p_z_index) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map[p_id].z_index = p_z_index;
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
void RTileSet::_tile_set_shapes(int p_id, const Array &p_shapes) {
|
||||
void TileSet::_tile_set_shapes(int p_id, const Array &p_shapes) {
|
||||
ERR_FAIL_COND(!tile_map.has(p_id));
|
||||
Vector<ShapeData> shapes_data;
|
||||
Transform2D default_transform = tile_get_shape_transform(p_id, 0);
|
||||
@ -998,7 +998,7 @@ void RTileSet::_tile_set_shapes(int p_id, const Array &p_shapes) {
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Array RTileSet::_tile_get_shapes(int p_id) const {
|
||||
Array TileSet::_tile_get_shapes(int p_id) const {
|
||||
ERR_FAIL_COND_V(!tile_map.has(p_id), Array());
|
||||
Array arr;
|
||||
|
||||
@ -1016,7 +1016,7 @@ Array RTileSet::_tile_get_shapes(int p_id) const {
|
||||
return arr;
|
||||
}
|
||||
|
||||
Array RTileSet::_get_tiles_ids() const {
|
||||
Array TileSet::_get_tiles_ids() const {
|
||||
Array arr;
|
||||
|
||||
for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
|
||||
@ -1026,7 +1026,7 @@ Array RTileSet::_get_tiles_ids() const {
|
||||
return arr;
|
||||
}
|
||||
|
||||
void RTileSet::_decompose_convex_shape(Ref<Shape2D> p_shape) {
|
||||
void TileSet::_decompose_convex_shape(Ref<Shape2D> p_shape) {
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
return;
|
||||
}
|
||||
@ -1048,17 +1048,17 @@ void RTileSet::_decompose_convex_shape(Ref<Shape2D> p_shape) {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileSet::get_tile_list(List<int> *p_tiles) const {
|
||||
void TileSet::get_tile_list(List<int> *p_tiles) const {
|
||||
for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
|
||||
p_tiles->push_back(E->key());
|
||||
}
|
||||
}
|
||||
|
||||
bool RTileSet::has_tile(int p_id) const {
|
||||
bool TileSet::has_tile(int p_id) const {
|
||||
return tile_map.has(p_id);
|
||||
}
|
||||
|
||||
bool RTileSet::is_tile_bound(int p_drawn_id, int p_neighbor_id) {
|
||||
bool TileSet::is_tile_bound(int p_drawn_id, int p_neighbor_id) {
|
||||
if (p_drawn_id == p_neighbor_id) {
|
||||
return true;
|
||||
} else if (get_script_instance() != nullptr) {
|
||||
@ -1072,14 +1072,14 @@ bool RTileSet::is_tile_bound(int p_drawn_id, int p_neighbor_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void RTileSet::remove_tile(int p_id) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The RTileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
void TileSet::remove_tile(int p_id) {
|
||||
ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id));
|
||||
tile_map.erase(p_id);
|
||||
_change_notify("");
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
int RTileSet::get_last_unused_tile_id() const {
|
||||
int TileSet::get_last_unused_tile_id() const {
|
||||
if (tile_map.size()) {
|
||||
return tile_map.back()->key() + 1;
|
||||
} else {
|
||||
@ -1087,19 +1087,19 @@ int RTileSet::get_last_unused_tile_id() const {
|
||||
}
|
||||
}
|
||||
|
||||
void RTileSet::set_noise_params(const Ref<FastnoiseNoiseParams> &noise) {
|
||||
void TileSet::set_noise_params(const Ref<FastnoiseNoiseParams> &noise) {
|
||||
_noise_params = noise;
|
||||
}
|
||||
Ref<FastnoiseNoiseParams> RTileSet::get_noise_params() {
|
||||
Ref<FastnoiseNoiseParams> TileSet::get_noise_params() {
|
||||
return _noise_params;
|
||||
}
|
||||
void RTileSet::setup_noise(Ref<FastNoise> noise) {
|
||||
void TileSet::setup_noise(Ref<FastNoise> noise) {
|
||||
if (_noise_params.is_valid()) {
|
||||
_noise_params->setup_noise(noise);
|
||||
}
|
||||
}
|
||||
|
||||
int RTileSet::find_tile_by_name(const String &p_name) const {
|
||||
int TileSet::find_tile_by_name(const String &p_name) const {
|
||||
for (Map<int, TileData>::Element *E = tile_map.front(); E; E = E->next()) {
|
||||
if (p_name == E->get().name) {
|
||||
return E->key();
|
||||
@ -1108,89 +1108,89 @@ int RTileSet::find_tile_by_name(const String &p_name) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void RTileSet::clear() {
|
||||
void TileSet::clear() {
|
||||
tile_map.clear();
|
||||
_change_notify("");
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
void RTileSet::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("create_tile", "id"), &RTileSet::create_tile);
|
||||
ClassDB::bind_method(D_METHOD("autotile_clear_bitmask_map", "id"), &RTileSet::autotile_clear_bitmask_map);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_icon_coordinate", "id", "coord"), &RTileSet::autotile_set_icon_coordinate);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_icon_coordinate", "id"), &RTileSet::autotile_get_icon_coordinate);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_subtile_priority", "id", "coord", "priority"), &RTileSet::autotile_set_subtile_priority);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_subtile_priority", "id", "coord"), &RTileSet::autotile_get_subtile_priority);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_z_index", "id", "coord", "z_index"), &RTileSet::autotile_set_z_index);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_z_index", "id", "coord"), &RTileSet::autotile_get_z_index);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_light_occluder", "id", "light_occluder", "coord"), &RTileSet::autotile_set_light_occluder);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_light_occluder", "id", "coord"), &RTileSet::autotile_get_light_occluder);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_navigation_polygon", "id", "navigation_polygon", "coord"), &RTileSet::autotile_set_navigation_polygon);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_navigation_polygon", "id", "coord"), &RTileSet::autotile_get_navigation_polygon);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_bitmask", "id", "bitmask", "flag"), &RTileSet::autotile_set_bitmask);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_bitmask", "id", "coord"), &RTileSet::autotile_get_bitmask);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_bitmask_mode", "id", "mode"), &RTileSet::autotile_set_bitmask_mode);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_bitmask_mode", "id"), &RTileSet::autotile_get_bitmask_mode);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_spacing", "id", "spacing"), &RTileSet::autotile_set_spacing);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_spacing", "id"), &RTileSet::autotile_get_spacing);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_size", "id", "size"), &RTileSet::autotile_set_size);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_size", "id"), &RTileSet::autotile_get_size);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &RTileSet::tile_set_name);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &RTileSet::tile_get_name);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture"), &RTileSet::tile_set_texture);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_texture", "id"), &RTileSet::tile_get_texture);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map"), &RTileSet::tile_set_normal_map);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_normal_map", "id"), &RTileSet::tile_get_normal_map);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material"), &RTileSet::tile_set_material);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_material", "id"), &RTileSet::tile_get_material);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_modulate", "id", "color"), &RTileSet::tile_set_modulate);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_modulate", "id"), &RTileSet::tile_get_modulate);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_texture_offset", "id", "texture_offset"), &RTileSet::tile_set_texture_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_texture_offset", "id"), &RTileSet::tile_get_texture_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_region", "id", "region"), &RTileSet::tile_set_region);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_region", "id"), &RTileSet::tile_get_region);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape"), &RTileSet::tile_set_shape);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape", "id", "shape_id"), &RTileSet::tile_get_shape);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shape_offset", "id", "shape_id", "shape_offset"), &RTileSet::tile_set_shape_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape_offset", "id", "shape_id"), &RTileSet::tile_get_shape_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shape_transform", "id", "shape_id", "shape_transform"), &RTileSet::tile_set_shape_transform);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape_transform", "id", "shape_id"), &RTileSet::tile_get_shape_transform);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &RTileSet::tile_set_shape_one_way);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape_one_way", "id", "shape_id"), &RTileSet::tile_get_shape_one_way);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shape_one_way_margin", "id", "shape_id", "one_way"), &RTileSet::tile_set_shape_one_way_margin);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape_one_way_margin", "id", "shape_id"), &RTileSet::tile_get_shape_one_way_margin);
|
||||
ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape", "shape_transform", "one_way", "autotile_coord"), &RTileSet::tile_add_shape, DEFVAL(false), DEFVAL(Vector2()));
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &RTileSet::tile_get_shape_count);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &RTileSet::_tile_set_shapes);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &RTileSet::_tile_get_shapes);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_tile_mode", "id", "tilemode"), &RTileSet::tile_set_tile_mode);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_tile_mode", "id"), &RTileSet::tile_get_tile_mode);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon"), &RTileSet::tile_set_navigation_polygon);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon", "id"), &RTileSet::tile_get_navigation_polygon);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon_offset", "id", "navigation_polygon_offset"), &RTileSet::tile_set_navigation_polygon_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon_offset", "id"), &RTileSet::tile_get_navigation_polygon_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder"), &RTileSet::tile_set_light_occluder);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_light_occluder", "id"), &RTileSet::tile_get_light_occluder);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_occluder_offset", "id", "occluder_offset"), &RTileSet::tile_set_occluder_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_occluder_offset", "id"), &RTileSet::tile_get_occluder_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_z_index", "id", "z_index"), &RTileSet::tile_set_z_index);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_z_index", "id"), &RTileSet::tile_get_z_index);
|
||||
void TileSet::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("create_tile", "id"), &TileSet::create_tile);
|
||||
ClassDB::bind_method(D_METHOD("autotile_clear_bitmask_map", "id"), &TileSet::autotile_clear_bitmask_map);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_icon_coordinate", "id", "coord"), &TileSet::autotile_set_icon_coordinate);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_icon_coordinate", "id"), &TileSet::autotile_get_icon_coordinate);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_subtile_priority", "id", "coord", "priority"), &TileSet::autotile_set_subtile_priority);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_subtile_priority", "id", "coord"), &TileSet::autotile_get_subtile_priority);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_z_index", "id", "coord", "z_index"), &TileSet::autotile_set_z_index);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_z_index", "id", "coord"), &TileSet::autotile_get_z_index);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_light_occluder", "id", "light_occluder", "coord"), &TileSet::autotile_set_light_occluder);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_light_occluder", "id", "coord"), &TileSet::autotile_get_light_occluder);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_navigation_polygon", "id", "navigation_polygon", "coord"), &TileSet::autotile_set_navigation_polygon);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_navigation_polygon", "id", "coord"), &TileSet::autotile_get_navigation_polygon);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_bitmask", "id", "bitmask", "flag"), &TileSet::autotile_set_bitmask);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_bitmask", "id", "coord"), &TileSet::autotile_get_bitmask);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_bitmask_mode", "id", "mode"), &TileSet::autotile_set_bitmask_mode);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_bitmask_mode", "id"), &TileSet::autotile_get_bitmask_mode);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_spacing", "id", "spacing"), &TileSet::autotile_set_spacing);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_spacing", "id"), &TileSet::autotile_get_spacing);
|
||||
ClassDB::bind_method(D_METHOD("autotile_set_size", "id", "size"), &TileSet::autotile_set_size);
|
||||
ClassDB::bind_method(D_METHOD("autotile_get_size", "id"), &TileSet::autotile_get_size);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &TileSet::tile_set_name);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &TileSet::tile_get_name);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture"), &TileSet::tile_set_texture);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_texture", "id"), &TileSet::tile_get_texture);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map"), &TileSet::tile_set_normal_map);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_normal_map", "id"), &TileSet::tile_get_normal_map);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material"), &TileSet::tile_set_material);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_material", "id"), &TileSet::tile_get_material);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_modulate", "id", "color"), &TileSet::tile_set_modulate);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_modulate", "id"), &TileSet::tile_get_modulate);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_texture_offset", "id", "texture_offset"), &TileSet::tile_set_texture_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_texture_offset", "id"), &TileSet::tile_get_texture_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_region", "id", "region"), &TileSet::tile_set_region);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_region", "id"), &TileSet::tile_get_region);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shape", "id", "shape_id", "shape"), &TileSet::tile_set_shape);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape", "id", "shape_id"), &TileSet::tile_get_shape);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shape_offset", "id", "shape_id", "shape_offset"), &TileSet::tile_set_shape_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape_offset", "id", "shape_id"), &TileSet::tile_get_shape_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shape_transform", "id", "shape_id", "shape_transform"), &TileSet::tile_set_shape_transform);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape_transform", "id", "shape_id"), &TileSet::tile_get_shape_transform);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shape_one_way", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape_one_way", "id", "shape_id"), &TileSet::tile_get_shape_one_way);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shape_one_way_margin", "id", "shape_id", "one_way"), &TileSet::tile_set_shape_one_way_margin);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape_one_way_margin", "id", "shape_id"), &TileSet::tile_get_shape_one_way_margin);
|
||||
ClassDB::bind_method(D_METHOD("tile_add_shape", "id", "shape", "shape_transform", "one_way", "autotile_coord"), &TileSet::tile_add_shape, DEFVAL(false), DEFVAL(Vector2()));
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &TileSet::tile_get_shape_count);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &TileSet::_tile_set_shapes);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &TileSet::_tile_get_shapes);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_tile_mode", "id", "tilemode"), &TileSet::tile_set_tile_mode);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_tile_mode", "id"), &TileSet::tile_get_tile_mode);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon"), &TileSet::tile_set_navigation_polygon);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon", "id"), &TileSet::tile_get_navigation_polygon);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon_offset", "id", "navigation_polygon_offset"), &TileSet::tile_set_navigation_polygon_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon_offset", "id"), &TileSet::tile_get_navigation_polygon_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_light_occluder", "id", "light_occluder"), &TileSet::tile_set_light_occluder);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_light_occluder", "id"), &TileSet::tile_get_light_occluder);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_occluder_offset", "id", "occluder_offset"), &TileSet::tile_set_occluder_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_occluder_offset", "id"), &TileSet::tile_get_occluder_offset);
|
||||
ClassDB::bind_method(D_METHOD("tile_set_z_index", "id", "z_index"), &TileSet::tile_set_z_index);
|
||||
ClassDB::bind_method(D_METHOD("tile_get_z_index", "id"), &TileSet::tile_get_z_index);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("remove_tile", "id"), &RTileSet::remove_tile);
|
||||
ClassDB::bind_method(D_METHOD("clear"), &RTileSet::clear);
|
||||
ClassDB::bind_method(D_METHOD("get_last_unused_tile_id"), &RTileSet::get_last_unused_tile_id);
|
||||
ClassDB::bind_method(D_METHOD("find_tile_by_name", "name"), &RTileSet::find_tile_by_name);
|
||||
ClassDB::bind_method(D_METHOD("get_tiles_ids"), &RTileSet::_get_tiles_ids);
|
||||
ClassDB::bind_method(D_METHOD("remove_tile", "id"), &TileSet::remove_tile);
|
||||
ClassDB::bind_method(D_METHOD("clear"), &TileSet::clear);
|
||||
ClassDB::bind_method(D_METHOD("get_last_unused_tile_id"), &TileSet::get_last_unused_tile_id);
|
||||
ClassDB::bind_method(D_METHOD("find_tile_by_name", "name"), &TileSet::find_tile_by_name);
|
||||
ClassDB::bind_method(D_METHOD("get_tiles_ids"), &TileSet::_get_tiles_ids);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_noise_params", "noise"), &RTileSet::set_noise_params);
|
||||
ClassDB::bind_method(D_METHOD("get_noise_params"), &RTileSet::get_noise_params);
|
||||
ClassDB::bind_method(D_METHOD("set_noise_params", "noise"), &TileSet::set_noise_params);
|
||||
ClassDB::bind_method(D_METHOD("get_noise_params"), &TileSet::get_noise_params);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "FastnoiseNoiseParams"), "set_noise_params", "get_noise_params");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_noise", "noise"), &RTileSet::setup_noise);
|
||||
ClassDB::bind_method(D_METHOD("setup_noise", "noise"), &TileSet::setup_noise);
|
||||
|
||||
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_tile_bound", PropertyInfo(Variant::INT, "drawn_id"), PropertyInfo(Variant::INT, "neighbor_id")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_subtile_selection", PropertyInfo(Variant::INT, "autotile_id"), PropertyInfo(Variant::INT, "bitmask"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "RTileMap"), PropertyInfo(Variant::VECTOR2, "tile_location")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_atlas_subtile_selection", PropertyInfo(Variant::INT, "atlastile_id"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "RTileMap"), PropertyInfo(Variant::VECTOR2, "tile_location")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_subtile_selection", PropertyInfo(Variant::INT, "autotile_id"), PropertyInfo(Variant::INT, "bitmask"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "TileMap"), PropertyInfo(Variant::VECTOR2, "tile_location")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_atlas_subtile_selection", PropertyInfo(Variant::INT, "atlastile_id"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "TileMap"), PropertyInfo(Variant::VECTOR2, "tile_location")));
|
||||
|
||||
BIND_ENUM_CONSTANT(BITMASK_2X2);
|
||||
BIND_ENUM_CONSTANT(BITMASK_3X3_MINIMAL);
|
||||
@ -1211,5 +1211,5 @@ void RTileSet::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(ATLAS_TILE);
|
||||
}
|
||||
|
||||
RTileSet::RTileSet() {
|
||||
TileSet::TileSet() {
|
||||
}
|
||||
|
@ -40,8 +40,8 @@
|
||||
#include "scene/resources/shape_2d.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
class RTileSet : public Resource {
|
||||
GDCLASS(RTileSet, Resource);
|
||||
class TileSet : public Resource {
|
||||
GDCLASS(TileSet, Resource);
|
||||
|
||||
public:
|
||||
struct ShapeData {
|
||||
@ -266,11 +266,11 @@ public:
|
||||
Ref<FastnoiseNoiseParams> get_noise_params();
|
||||
void setup_noise(Ref<FastNoise> noise);
|
||||
|
||||
RTileSet();
|
||||
TileSet();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(RTileSet::AutotileBindings);
|
||||
VARIANT_ENUM_CAST(RTileSet::BitmaskMode);
|
||||
VARIANT_ENUM_CAST(RTileSet::TileMode);
|
||||
VARIANT_ENUM_CAST(TileSet::AutotileBindings);
|
||||
VARIANT_ENUM_CAST(TileSet::BitmaskMode);
|
||||
VARIANT_ENUM_CAST(TileSet::TileMode);
|
||||
|
||||
#endif // TILE_SET_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -52,11 +52,11 @@ class PopupMenu;
|
||||
class EditorFileDialog;
|
||||
class CheckBox;
|
||||
|
||||
class RTileSetEditor : public HSplitContainer {
|
||||
friend class RTileSetEditorPlugin;
|
||||
class TileSetEditor : public HSplitContainer {
|
||||
friend class TileSetEditorPlugin;
|
||||
friend class RTilesetEditorContext;
|
||||
|
||||
GDCLASS(RTileSetEditor, HSplitContainer);
|
||||
GDCLASS(TileSetEditor, HSplitContainer);
|
||||
|
||||
enum TextureToolButtons {
|
||||
TOOL_TILESET_ADD_TEXTURE,
|
||||
@ -112,7 +112,7 @@ class RTileSetEditor : public HSplitContainer {
|
||||
Ref<NavigationPolygon> navigation_shape;
|
||||
};
|
||||
|
||||
Ref<RTileSet> tileset;
|
||||
Ref<TileSet> tileset;
|
||||
RTilesetEditorContext *helper;
|
||||
EditorNode *editor;
|
||||
UndoRedo *undo_redo;
|
||||
@ -181,8 +181,8 @@ class RTileSetEditor : public HSplitContainer {
|
||||
|
||||
Ref<Texture> get_current_texture();
|
||||
|
||||
static void _import_node(Node *p_node, Ref<RTileSet> p_library);
|
||||
static void _import_scene(Node *p_scene, Ref<RTileSet> p_library, bool p_merge);
|
||||
static void _import_node(Node *p_node, Ref<TileSet> p_library);
|
||||
static void _import_scene(Node *p_scene, Ref<TileSet> p_library, bool p_merge);
|
||||
void _undo_redo_import_scene(Node *p_scene, bool p_merge);
|
||||
|
||||
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
|
||||
@ -194,11 +194,11 @@ protected:
|
||||
void _notification(int p_what);
|
||||
|
||||
public:
|
||||
void edit(const Ref<RTileSet> &p_tileset);
|
||||
static Error update_library_file(Node *p_base_scene, Ref<RTileSet> ml, bool p_merge = true);
|
||||
void edit(const Ref<TileSet> &p_tileset);
|
||||
static Error update_library_file(Node *p_base_scene, Ref<TileSet> ml, bool p_merge = true);
|
||||
|
||||
RTileSetEditor(EditorNode *p_editor);
|
||||
~RTileSetEditor();
|
||||
TileSetEditor(EditorNode *p_editor);
|
||||
~TileSetEditor();
|
||||
|
||||
private:
|
||||
void _on_tileset_toolbar_button_pressed(int p_index);
|
||||
@ -263,16 +263,16 @@ private:
|
||||
};
|
||||
|
||||
class RTilesetEditorContext : public Object {
|
||||
friend class RTileSetEditor;
|
||||
friend class TileSetEditor;
|
||||
GDCLASS(RTilesetEditorContext, Object);
|
||||
|
||||
Ref<RTileSet> tileset;
|
||||
RTileSetEditor *tileset_editor;
|
||||
Ref<TileSet> tileset;
|
||||
TileSetEditor *tileset_editor;
|
||||
bool snap_options_visible;
|
||||
|
||||
public:
|
||||
bool _hide_script_from_inspector() { return true; }
|
||||
void set_tileset(const Ref<RTileSet> &p_tileset);
|
||||
void set_tileset(const Ref<TileSet> &p_tileset);
|
||||
|
||||
private:
|
||||
void set_snap_options_visible(bool p_visible);
|
||||
@ -284,13 +284,13 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
RTilesetEditorContext(RTileSetEditor *p_tileset_editor);
|
||||
RTilesetEditorContext(TileSetEditor *p_tileset_editor);
|
||||
};
|
||||
|
||||
class RTileSetEditorPlugin : public EditorPlugin {
|
||||
GDCLASS(RTileSetEditorPlugin, EditorPlugin);
|
||||
class TileSetEditorPlugin : public EditorPlugin {
|
||||
GDCLASS(TileSetEditorPlugin, EditorPlugin);
|
||||
|
||||
RTileSetEditor *tileset_editor;
|
||||
TileSetEditor *tileset_editor;
|
||||
Button *tileset_editor_button;
|
||||
EditorNode *editor;
|
||||
|
||||
@ -299,7 +299,7 @@ class RTileSetEditorPlugin : public EditorPlugin {
|
||||
CheckBox *file_export_lib_apply_xforms;
|
||||
|
||||
public:
|
||||
virtual String get_name() const { return "RTileSet"; }
|
||||
virtual String get_name() const { return "TileSet"; }
|
||||
bool has_main_screen() const { return false; }
|
||||
virtual void edit(Object *p_node);
|
||||
virtual bool handles(Object *p_node) const;
|
||||
@ -307,7 +307,7 @@ public:
|
||||
void set_state(const Dictionary &p_state);
|
||||
Dictionary get_state() const;
|
||||
|
||||
RTileSetEditorPlugin(EditorNode *p_node);
|
||||
TileSetEditorPlugin(EditorNode *p_node);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
Loading…
Reference in New Issue
Block a user