summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/material_editor_plugin.cpp6
-rw-r--r--editor/plugins/material_editor_plugin.h6
-rw-r--r--editor/plugins/script_editor_plugin.cpp9
-rw-r--r--editor/plugins/script_text_editor.cpp10
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp157
-rw-r--r--editor/plugins/texture_region_editor_plugin.h3
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp42
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp32
8 files changed, 161 insertions, 104 deletions
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index 27a16fd3dd..f282d391ff 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -429,7 +429,7 @@ bool SpatialMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) c
Ref<SpatialMaterial> mat = p_resource;
return mat.is_valid();
}
-Ref<Resource> SpatialMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) {
+Ref<Resource> SpatialMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
Ref<SpatialMaterial> mat = p_resource;
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
@@ -475,7 +475,7 @@ bool ParticlesMaterialConversionPlugin::handles(const Ref<Resource> &p_resource)
Ref<ParticlesMaterial> mat = p_resource;
return mat.is_valid();
}
-Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) {
+Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
Ref<ParticlesMaterial> mat = p_resource;
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
@@ -513,7 +513,7 @@ bool CanvasItemMaterialConversionPlugin::handles(const Ref<Resource> &p_resource
Ref<CanvasItemMaterial> mat = p_resource;
return mat.is_valid();
}
-Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) {
+Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
Ref<CanvasItemMaterial> mat = p_resource;
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h
index 80a5c535b8..31a927d83f 100644
--- a/editor/plugins/material_editor_plugin.h
+++ b/editor/plugins/material_editor_plugin.h
@@ -109,7 +109,7 @@ class SpatialMaterialConversionPlugin : public EditorResourceConversionPlugin {
public:
virtual String converts_to() const;
virtual bool handles(const Ref<Resource> &p_resource) const;
- virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
+ virtual Ref<Resource> convert(const Ref<Resource> &p_resource) const;
};
class ParticlesMaterialConversionPlugin : public EditorResourceConversionPlugin {
@@ -117,7 +117,7 @@ class ParticlesMaterialConversionPlugin : public EditorResourceConversionPlugin
public:
virtual String converts_to() const;
virtual bool handles(const Ref<Resource> &p_resource) const;
- virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
+ virtual Ref<Resource> convert(const Ref<Resource> &p_resource) const;
};
class CanvasItemMaterialConversionPlugin : public EditorResourceConversionPlugin {
@@ -125,7 +125,7 @@ class CanvasItemMaterialConversionPlugin : public EditorResourceConversionPlugin
public:
virtual String converts_to() const;
virtual bool handles(const Ref<Resource> &p_resource) const;
- virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
+ virtual Ref<Resource> convert(const Ref<Resource> &p_resource) const;
};
#endif // MATERIAL_EDITOR_PLUGIN_H
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 1bb7c98114..fa034c97c0 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1692,7 +1692,6 @@ void ScriptEditor::_update_script_names() {
if (restoring_layout)
return;
- waiting_update_names = false;
Set<Ref<Script> > used;
Node *edited = EditorNode::get_singleton()->get_edited_scene();
if (edited) {
@@ -1816,8 +1815,12 @@ void ScriptEditor::_update_script_names() {
}
}
- _update_members_overview();
- _update_help_overview();
+ if (!waiting_update_names) {
+ _update_members_overview();
+ _update_help_overview();
+ } else {
+ waiting_update_names = false;
+ }
_update_members_overview_visibility();
_update_help_overview_visibility();
_update_script_colors();
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 4e7047ee38..66705f85bf 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1549,10 +1549,11 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/unfold_all_lines", TTR("Unfold All Lines"), 0);
#ifdef OSX_ENABLED
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_C);
+ ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CTRL | KEY_SPACE);
#else
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD | KEY_B);
-#endif
ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CMD | KEY_SPACE);
+#endif
ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T);
ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent To Spaces"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Y);
ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent To Tabs"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_X);
@@ -1575,15 +1576,20 @@ void ScriptTextEditor::register_editor() {
#ifdef OSX_ENABLED
ED_SHORTCUT("script_text_editor/find_next", TTR("Find Next"), KEY_MASK_CMD | KEY_G);
ED_SHORTCUT("script_text_editor/find_previous", TTR("Find Previous"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G);
+ ED_SHORTCUT("script_text_editor/replace", TTR("Replace..."), KEY_MASK_ALT | KEY_MASK_CMD | KEY_F);
#else
ED_SHORTCUT("script_text_editor/find_next", TTR("Find Next"), KEY_F3);
ED_SHORTCUT("script_text_editor/find_previous", TTR("Find Previous"), KEY_MASK_SHIFT | KEY_F3);
-#endif
ED_SHORTCUT("script_text_editor/replace", TTR("Replace..."), KEY_MASK_CMD | KEY_R);
+#endif
ED_SHORTCUT("script_text_editor/find_in_files", TTR("Find in files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F);
+#ifdef OSX_ENABLED
+ ED_SHORTCUT("script_text_editor/goto_function", TTR("Goto Function..."), KEY_MASK_CTRL | KEY_MASK_CMD | KEY_J);
+#else
ED_SHORTCUT("script_text_editor/goto_function", TTR("Goto Function..."), KEY_MASK_ALT | KEY_MASK_CMD | KEY_F);
+#endif
ED_SHORTCUT("script_text_editor/goto_line", TTR("Goto Line..."), KEY_MASK_CMD | KEY_L);
#ifdef OSX_ENABLED
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 4a9cbfe535..4390b94ece 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -356,8 +356,6 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
undo_redo->add_do_method(atlas_tex.ptr(), "set_region", atlas_tex->get_region());
undo_redo->add_undo_method(atlas_tex.ptr(), "set_region", rect_prev);
} else if (node_ninepatch) {
- // FIXME: Is this intentional?
- } else if (node_ninepatch) {
undo_redo->add_do_method(node_ninepatch, "set_region_rect", node_ninepatch->get_region_rect());
undo_redo->add_undo_method(node_ninepatch, "set_region_rect", rect_prev);
} else if (obj_styleBox.is_valid()) {
@@ -521,6 +519,10 @@ void TextureRegionEditor::_set_snap_mode(int p_mode) {
else
hb_grid->hide();
+ if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) {
+ _update_autoslice();
+ }
+
edit_draw->update();
}
@@ -562,7 +564,8 @@ void TextureRegionEditor::_zoom_in() {
}
void TextureRegionEditor::_zoom_reset() {
- if (draw_zoom == 1) return;
+ if (draw_zoom == 1)
+ return;
draw_zoom = 1;
edit_draw->update();
}
@@ -585,25 +588,91 @@ void TextureRegionEditor::apply_rect(const Rect2 &rect) {
atlas_tex->set_region(rect);
}
-void TextureRegionEditor::_notification(int p_what) {
- switch (p_what) {
- case NOTIFICATION_PROCESS: {
- if (node_sprite) {
- if (node_sprite->is_region()) {
+void TextureRegionEditor::_update_autoslice() {
+ autoslice_is_dirty = false;
+ autoslice_cache.clear();
- set_process(false);
- EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
+ Ref<Texture> texture = NULL;
+ if (node_sprite)
+ texture = node_sprite->get_texture();
+ else if (node_ninepatch)
+ texture = node_ninepatch->get_texture();
+ else if (obj_styleBox.is_valid())
+ texture = obj_styleBox->get_texture();
+ else if (atlas_tex.is_valid())
+ texture = atlas_tex->get_atlas();
+
+ if (texture.is_null()) {
+ return;
+ }
+
+ for (int y = 0; y < texture->get_height(); y++) {
+ for (int x = 0; x < texture->get_width(); x++) {
+ if (texture->is_pixel_opaque(x, y)) {
+ bool found = false;
+ for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) {
+ Rect2 grown = E->get().grow(1.5);
+ if (grown.has_point(Point2(x, y))) {
+ E->get().expand_to(Point2(x, y));
+ E->get().expand_to(Point2(x + 1, y + 1));
+ x = E->get().position.x + E->get().size.x - 1;
+ bool merged = true;
+ while (merged) {
+ merged = false;
+ bool queue_erase = false;
+ for (List<Rect2>::Element *F = autoslice_cache.front(); F; F = F->next()) {
+ if (queue_erase) {
+ autoslice_cache.erase(F->prev());
+ queue_erase = false;
+ }
+ if (F == E)
+ continue;
+ if (E->get().grow(1).intersects(F->get())) {
+ E->get().expand_to(F->get().position);
+ E->get().expand_to(F->get().position + F->get().size);
+ if (F->prev()) {
+ F = F->prev();
+ autoslice_cache.erase(F->next());
+ } else {
+ queue_erase = true;
+ // Can't delete the first rect in the list.
+ }
+ merged = true;
+ }
+ }
+ }
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ Rect2 new_rect(x, y, 1, 1);
+ autoslice_cache.push_back(new_rect);
}
- } else {
- set_process(false);
}
- } break;
- case NOTIFICATION_THEME_CHANGED:
+ }
+ }
+ cache_map[texture->get_rid()] = autoslice_cache;
+}
+
+void TextureRegionEditor::_notification(int p_what) {
+ switch (p_what) {
case NOTIFICATION_READY: {
zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons"));
zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));
zoom_in->set_icon(get_icon("ZoomMore", "EditorIcons"));
} break;
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+ if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) {
+ _update_autoslice();
+ }
+ } break;
+ case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
+ // This happens when the user leaves the Editor and returns,
+ // he/she could have changed the textures, so the cache is cleared
+ cache_map.clear();
+ _edit_region();
+ } break;
}
}
@@ -709,57 +778,15 @@ void TextureRegionEditor::_edit_region() {
return;
}
- autoslice_cache.clear();
- Ref<Image> i;
- i.instance();
- if (i->load(texture->get_path()) == OK) {
- BitMap bm;
- bm.create_from_image_alpha(i);
- for (int y = 0; y < i->get_height(); y++) {
- for (int x = 0; x < i->get_width(); x++) {
- if (bm.get_bit(Point2(x, y))) {
- bool found = false;
- for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) {
- Rect2 grown = E->get().grow(1.5);
- if (grown.has_point(Point2(x, y))) {
- E->get().expand_to(Point2(x, y));
- E->get().expand_to(Point2(x + 1, y + 1));
- x = E->get().position.x + E->get().size.x - 1;
- bool merged = true;
- while (merged) {
- merged = false;
- bool queue_erase = false;
- for (List<Rect2>::Element *F = autoslice_cache.front(); F; F = F->next()) {
- if (queue_erase) {
- autoslice_cache.erase(F->prev());
- queue_erase = false;
- }
- if (F == E)
- continue;
- if (E->get().grow(1).intersects(F->get())) {
- E->get().expand_to(F->get().position);
- E->get().expand_to(F->get().position + F->get().size);
- if (F->prev()) {
- F = F->prev();
- autoslice_cache.erase(F->next());
- } else {
- queue_erase = true;
- //Can't delete the first rect in the list.
- }
- merged = true;
- }
- }
- }
- found = true;
- break;
- }
- }
- if (!found) {
- Rect2 new_rect(x, y, 1, 1);
- autoslice_cache.push_back(new_rect);
- }
- }
- }
+ if (cache_map.has(texture->get_rid())) {
+ autoslice_cache = cache_map[texture->get_rid()];
+ autoslice_is_dirty = false;
+ return;
+ } else {
+ if (is_visible() && snap_mode == SNAP_AUTOSLICE) {
+ _update_autoslice();
+ } else {
+ autoslice_is_dirty = true;
}
}
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index 670cc86bbb..61ef769f89 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -92,7 +92,9 @@ class TextureRegionEditor : public Control {
Rect2 rect_prev;
float prev_margin;
int edited_margin;
+ Map<RID, List<Rect2> > cache_map;
List<Rect2> autoslice_cache;
+ bool autoslice_is_dirty;
bool drag;
bool creating;
@@ -110,6 +112,7 @@ class TextureRegionEditor : public Control {
void _zoom_reset();
void _zoom_out();
void apply_rect(const Rect2 &rect);
+ void _update_autoslice();
protected:
void _notification(int p_what);
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 34dd36692c..598f7034d8 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -457,36 +457,38 @@ void TileMapEditor::_update_palette() {
palette->select(0);
}
- if ((manual_autotile && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) || tileset->tile_get_tile_mode(sel_tile) == TileSet::ATLAS_TILE) {
+ if (sel_tile != TileMap::INVALID_CELL) {
+ if ((manual_autotile && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) || tileset->tile_get_tile_mode(sel_tile) == TileSet::ATLAS_TILE) {
- const Map<Vector2, uint16_t> &tiles = tileset->autotile_get_bitmask_map(sel_tile);
+ const Map<Vector2, uint16_t> &tiles = tileset->autotile_get_bitmask_map(sel_tile);
- Vector<Vector2> entries;
- for (const Map<Vector2, uint16_t>::Element *E = tiles.front(); E; E = E->next()) {
- entries.push_back(E->key());
- }
- entries.sort();
+ Vector<Vector2> entries;
+ for (const Map<Vector2, uint16_t>::Element *E = tiles.front(); E; E = E->next()) {
+ entries.push_back(E->key());
+ }
+ entries.sort();
- Ref<Texture> tex = tileset->tile_get_texture(sel_tile);
+ Ref<Texture> tex = tileset->tile_get_texture(sel_tile);
- for (int i = 0; i < entries.size(); i++) {
+ for (int i = 0; i < entries.size(); i++) {
- manual_palette->add_item(String());
+ manual_palette->add_item(String());
- if (tex.is_valid()) {
+ if (tex.is_valid()) {
- Rect2 region = tileset->tile_get_region(sel_tile);
- int spacing = tileset->autotile_get_spacing(sel_tile);
- region.size = tileset->autotile_get_size(sel_tile); // !!
- region.position += (region.size + Vector2(spacing, spacing)) * entries[i];
+ Rect2 region = tileset->tile_get_region(sel_tile);
+ int spacing = tileset->autotile_get_spacing(sel_tile);
+ region.size = tileset->autotile_get_size(sel_tile); // !!
+ region.position += (region.size + Vector2(spacing, spacing)) * entries[i];
- if (!region.has_no_area())
- manual_palette->set_item_icon_region(manual_palette->get_item_count() - 1, region);
+ if (!region.has_no_area())
+ manual_palette->set_item_icon_region(manual_palette->get_item_count() - 1, region);
- manual_palette->set_item_icon(manual_palette->get_item_count() - 1, tex);
- }
+ manual_palette->set_item_icon(manual_palette->get_item_count() - 1, tex);
+ }
- manual_palette->set_item_metadata(manual_palette->get_item_count() - 1, entries[i]);
+ manual_palette->set_item_metadata(manual_palette->get_item_count() - 1, entries[i]);
+ }
}
}
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 55a04a51b3..f981ead7eb 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -498,7 +498,7 @@ void TileSetEditor::_on_tileset_toolbar_button_pressed(int p_index) {
} break;
case TOOL_TILESET_REMOVE_TEXTURE: {
if (get_current_texture().is_valid()) {
- cd->set_text(TTR("Remove Selected Textue and ALL TILES wich uses it?"));
+ cd->set_text(TTR("Remove selected texture and ALL TILES which use it?"));
cd->popup_centered(Size2(300, 60));
} else {
err_dialog->set_text(TTR("You haven't selected a texture to remove."));
@@ -1715,16 +1715,18 @@ void TileSetEditor::draw_polygon_shapes() {
Vector<Vector2> polygon;
Vector<Color> colors;
+ Vector2 anchor = WORKSPACE_MARGIN;
+ anchor += tileset->tile_get_region(get_current_tile()).position;
for (int j = 0; j < shape->get_polygon().size(); j++) {
- polygon.push_back(shape->get_polygon()[j]);
+ polygon.push_back(shape->get_polygon()[j] + anchor);
colors.push_back(c_bg);
}
workspace->draw_polygon(polygon, colors);
for (int j = 0; j < shape->get_polygon().size() - 1; j++) {
- workspace->draw_line(shape->get_polygon()[j], shape->get_polygon()[j + 1], c_border, 1, true);
+ workspace->draw_line(shape->get_polygon()[j] + anchor, shape->get_polygon()[j + 1] + anchor, c_border, 1, true);
}
- workspace->draw_line(shape->get_polygon()[shape->get_polygon().size() - 1], shape->get_polygon()[0], c_border, 1, true);
+ workspace->draw_line(shape->get_polygon()[shape->get_polygon().size() - 1] + anchor, shape->get_polygon()[0] + anchor, c_border, 1, true);
if (shape == edited_occlusion_shape) {
draw_handles = true;
}
@@ -1788,10 +1790,11 @@ void TileSetEditor::draw_polygon_shapes() {
Vector<Vector2> polygon;
Vector<Color> colors;
-
+ Vector2 anchor = WORKSPACE_MARGIN;
+ anchor += tileset->tile_get_region(get_current_tile()).position;
PoolVector<Vector2> vertices = shape->get_vertices();
for (int j = 0; j < shape->get_polygon(0).size(); j++) {
- polygon.push_back(vertices[shape->get_polygon(0)[j]]);
+ polygon.push_back(vertices[shape->get_polygon(0)[j]] + anchor);
colors.push_back(c_bg);
}
workspace->draw_polygon(polygon, colors);
@@ -1799,7 +1802,7 @@ void TileSetEditor::draw_polygon_shapes() {
if (shape->get_polygon_count() > 0) {
PoolVector<Vector2> vertices = shape->get_vertices();
for (int j = 0; j < shape->get_polygon(0).size() - 1; j++) {
- workspace->draw_line(vertices[shape->get_polygon(0)[j]], vertices[shape->get_polygon(0)[j + 1]], c_border, 1, true);
+ workspace->draw_line(vertices[shape->get_polygon(0)[j]] + anchor, vertices[shape->get_polygon(0)[j + 1]] + anchor, c_border, 1, true);
}
if (shape == edited_navigation_shape) {
draw_handles = true;
@@ -1954,6 +1957,8 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) {
void TileSetEditor::select_coord(const Vector2 &coord) {
current_shape = PoolVector2Array();
+ if (get_current_tile() == -1)
+ return;
Rect2 current_tile_region = tileset->tile_get_region(get_current_tile());
current_tile_region.position += WORKSPACE_MARGIN;
if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) {
@@ -2038,8 +2043,10 @@ Vector2 TileSetEditor::snap_point(const Vector2 &point) {
anchor += tileset->tile_get_region(get_current_tile()).position;
anchor += WORKSPACE_MARGIN;
Rect2 region(anchor, tile_size);
- if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE)
+ if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) {
region.position = tileset->tile_get_region(get_current_tile()).position + WORKSPACE_MARGIN;
+ region.size = tileset->tile_get_region(get_current_tile()).size;
+ }
if (tools[TOOL_GRID_SNAP]->is_pressed()) {
p.x = Math::snap_scalar_seperation(snap_offset.x, snap_step.x, p.x, snap_separation.x);
@@ -2254,6 +2261,9 @@ bool TilesetEditorContext::_set(const StringName &p_name, const Variant &p_value
tileset_editor->workspace_overlay->update();
}
return v;
+ } else if (name == "tileset_script") {
+ tileset->set_script(p_value);
+ return true;
}
tileset_editor->err_dialog->set_text(TTR("This property can't be changed."));
@@ -2302,6 +2312,9 @@ bool TilesetEditorContext::_get(const StringName &p_name, Variant &r_ret) const
} else if (name == "selected_occlusion") {
r_ret = tileset_editor->edited_occlusion_shape;
v = true;
+ } else if (name == "tileset_script") {
+ r_ret = tileset->get_script();
+ v = true;
}
return v;
}
@@ -2346,6 +2359,9 @@ void TilesetEditorContext::_get_property_list(List<PropertyInfo> *p_list) const
if (tileset_editor->edit_mode == TileSetEditor::EDITMODE_OCCLUSION && tileset_editor->edited_occlusion_shape.is_valid()) {
p_list->push_back(PropertyInfo(Variant::OBJECT, "selected_occlusion", PROPERTY_HINT_RESOURCE_TYPE, tileset_editor->edited_occlusion_shape->get_class()));
}
+ if (!tileset.is_null()) {
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "tileset_script", PROPERTY_HINT_RESOURCE_TYPE, "Script"));
+ }
}
TilesetEditorContext::TilesetEditorContext(TileSetEditor *p_tileset_editor) {