summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-03-09 02:34:56 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-03-09 02:34:56 -0300
commit09489e3a78de39bb4d8690f3c65f8a5e7a56a95e (patch)
treeb6207118763b8f1ec81c9d5b7e483813363253c2 /tools
parent2c2894ceb674927a35d2798b3e63adabdb020077 (diff)
lot of work on 2D lighting and isometric maps
added a new demo, isometric_light that does full isometric sorting, lights, shadows, etc.
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp101
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.h11
-rw-r--r--tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp1
-rw-r--r--tools/editor/plugins/light_occluder_2d_editor_plugin.cpp6
-rw-r--r--tools/editor/plugins/navigation_polygon_editor_plugin.cpp6
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.cpp40
-rw-r--r--tools/editor/plugins/tile_set_editor_plugin.cpp170
-rw-r--r--tools/editor/plugins/tile_set_editor_plugin.h2
-rw-r--r--tools/editor/property_editor.cpp6
9 files changed, 240 insertions, 103 deletions
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 514f4b6525..fdec72332e 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -87,7 +87,7 @@ Dictionary CanvasItemEditor::get_state() const {
state["ofs"]=Point2(h_scroll->get_val(),v_scroll->get_val());
// state["ofs"]=-transform.get_origin();
state["use_snap"]=is_snap_active();
- state["snap"]=snap;
+ state["snap_vec"]=Vector2(get_snap());
state["pixel_snap"]=pixel_snap;
return state;
}
@@ -111,7 +111,15 @@ void CanvasItemEditor::set_state(const Dictionary& p_state){
}
if (state.has("snap")) {
- snap=state["snap"];
+ snap_x->set_val(state["snap"]);
+ snap_y->set_val(state["snap"]);
+ }
+
+ if (state.has("snap_vec")) {
+ Vector2 sv = state["snap_vec"];
+ snap_x->set_val(sv.x);
+ snap_y->set_val(sv.y);
+ viewport->update();
}
if (state.has("pixel_snap")) {
@@ -300,7 +308,7 @@ void CanvasItemEditor::_key_move(const Vector2& p_dir, bool p_snap, KeyMoveMODE
Vector2 drag = p_dir;
if (p_snap)
- drag*=snap;
+ drag*=get_snap();
undo_redo->add_undo_method(canvas_item,"edit_set_state",canvas_item->edit_get_state());
@@ -554,6 +562,13 @@ void CanvasItemEditor::_append_canvas_item(CanvasItem *c) {
}
+void CanvasItemEditor::_snap_changed(double) {
+
+ viewport->update();
+}
+
+
+
void CanvasItemEditor::_dialog_value_changed(double) {
if (updating_value_dialog)
@@ -563,7 +578,7 @@ void CanvasItemEditor::_dialog_value_changed(double) {
case SNAP_CONFIGURE: {
- snap=dialog_val->get_val();
+ // snap=dialog_val->get_val();
viewport->update();
} break;
case ZOOM_SET: {
@@ -1165,7 +1180,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
continue;
}
- if (pixel_snap || (is_snap_active() && snap>0)) {
+ if (pixel_snap || (is_snap_active() && get_snap().x>0 && get_snap().y>0)) {
if (drag!=DRAG_ALL) {
dfrom=drag_point_from;
@@ -1174,14 +1189,14 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
Vector2 newpos = drag_point_from + (dto-dfrom);
Vector2 disp;
- if (!is_snap_active() || snap<1) {
+ if (!is_snap_active() || get_snap().x<1 || get_snap().y<1) {
disp.x = Math::fposmod(newpos.x,1);
disp.y = Math::fposmod(newpos.y,1);
} else {
- disp.x = Math::fposmod(newpos.x,snap);
- disp.y = Math::fposmod(newpos.y,snap);
+ disp.x = Math::fposmod(newpos.x,get_snap().x);
+ disp.y = Math::fposmod(newpos.y,get_snap().y);
}
dto-=disp;
}
@@ -1477,7 +1492,7 @@ void CanvasItemEditor::_viewport_draw() {
_update_scrollbars();
RID ci=viewport->get_canvas_item();
- if (snap>0 && is_snap_active() && true ) {
+ if (get_snap().x>0 && get_snap().y>0 && is_snap_active() && true ) {
Size2 s = viewport->get_size();
@@ -1485,7 +1500,7 @@ void CanvasItemEditor::_viewport_draw() {
Matrix32 xform = transform.affine_inverse();
for(int i=0;i<s.width;i++) {
- int cell = Math::fast_ftoi(Math::floor(xform.xform(Vector2(i,0)).x/snap));
+ int cell = Math::fast_ftoi(Math::floor(xform.xform(Vector2(i,0)).x/get_snap().x));
if (i==0)
last_cell=cell;
if (last_cell!=cell)
@@ -1495,7 +1510,7 @@ void CanvasItemEditor::_viewport_draw() {
for(int i=0;i<s.height;i++) {
- int cell = Math::fast_ftoi(Math::floor(xform.xform(Vector2(0,i)).y/snap));
+ int cell = Math::fast_ftoi(Math::floor(xform.xform(Vector2(0,i)).y/get_snap().y));
if (i==0)
last_cell=cell;
if (last_cell!=cell)
@@ -1809,6 +1824,8 @@ void CanvasItemEditor::_notification(int p_what) {
group_button->set_icon(get_icon("Group","EditorIcons"));
ungroup_button->set_icon(get_icon("Ungroup","EditorIcons"));
key_insert_button->set_icon(get_icon("Key","EditorIcons"));
+ snap_x->connect("value_changed",this,"_snap_changed");
+ snap_y->connect("value_changed",this,"_snap_changed");
}
@@ -2002,7 +2019,7 @@ Point2 CanvasItemEditor::snapify(const Point2& p_pos) const {
Vector2 pos = p_pos;
- if (!active || snap<1) {
+ if (!active || get_snap().x<1 || get_snap().y<1) {
if (pixel_snap) {
@@ -2014,8 +2031,8 @@ Point2 CanvasItemEditor::snapify(const Point2& p_pos) const {
}
- pos.x=Math::stepify(pos.x,snap);
- pos.y=Math::stepify(pos.y,snap);
+ pos.x=Math::stepify(pos.x,get_snap().x);
+ pos.y=Math::stepify(pos.y,get_snap().y);
return pos;
@@ -2038,15 +2055,46 @@ void CanvasItemEditor::_popup_callback(int p_op) {
int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_PIXEL);
edit_menu->get_popup()->set_item_checked(idx,pixel_snap);
} break;
+ case SNAP_OBJECT_CENTERS: {
+
+ List<Node*> &selection = editor_selection->get_selected_node_list();
+
+ undo_redo->create_action("Snap Object Centers");
+ for(List<Node*>::Element *E=selection.front();E;E=E->next()) {
+
+ CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
+ if (!canvas_item)
+ continue;
+ if (!canvas_item->is_visible())
+ continue;
+ Node2D* node = canvas_item->cast_to<Node2D>();
+ if (!node)
+ continue;
+
+ Matrix32 gtrans = node->get_global_transform();
+ gtrans.elements[2]=snapify(gtrans.elements[2]);
+
+ undo_redo->add_do_method(node,"set_global_transform",gtrans);
+ undo_redo->add_undo_method(node,"set_global_transform",node->get_global_transform());
+ }
+
+ undo_redo->add_do_method(viewport,"update");
+ undo_redo->add_undo_method(viewport,"update");
+ undo_redo->commit_action();
+
+ } break;
case SNAP_CONFIGURE: {
updating_value_dialog=true;
+ snap_dialog->popup_centered_minsize();
+/*
dialog_label->set_text("Snap (Pixels):");
dialog_val->set_min(1);
dialog_val->set_step(1);
dialog_val->set_max(4096);
dialog_val->set_val(snap);
value_dialog->popup_centered(Size2(200,85));
+ */
updating_value_dialog=false;
} break;
@@ -2604,6 +2652,7 @@ void CanvasItemEditor::_bind_methods() {
ObjectTypeDB::bind_method("_unhandled_key_input",&CanvasItemEditor::_unhandled_key_input);
ObjectTypeDB::bind_method("_viewport_draw",&CanvasItemEditor::_viewport_draw);
ObjectTypeDB::bind_method("_viewport_input_event",&CanvasItemEditor::_viewport_input_event);
+ ObjectTypeDB::bind_method("_snap_changed",&CanvasItemEditor::_snap_changed);
ADD_SIGNAL( MethodInfo("item_lock_status_changed") );
ADD_SIGNAL( MethodInfo("item_group_status_changed") );
@@ -2812,6 +2861,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p->add_item("Configure Snap..",SNAP_CONFIGURE);
p->add_separator();
p->add_check_item("Use Pixel Snap",SNAP_USE_PIXEL);
+ p->add_item("Snap Selected Object Centers",SNAP_OBJECT_CENTERS);
p->add_separator();
p->add_item("Expand to Parent",EXPAND_TO_PARENT,KEY_MASK_CMD|KEY_P);
p->add_separator();
@@ -2918,12 +2968,33 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
dialog_val->connect("value_changed",this,"_dialog_value_changed");
select_sb = Ref<StyleBoxTexture>( memnew( StyleBoxTexture) );
+ snap_dialog = memnew( AcceptDialog );
+ VBoxContainer *snap_vb = memnew( VBoxContainer );
+ snap_dialog->add_child(snap_vb);
+ snap_dialog->set_child_rect(snap_vb);
+ snap_dialog->set_title("Snap Configuration");
+ snap_x = memnew( SpinBox );
+ snap_x->set_custom_minimum_size(Size2(250,0));
+ snap_y = memnew( SpinBox );
+ snap_x->set_min(1);
+ snap_x->set_max(4096);
+ snap_x->set_step(1);
+ snap_x->set_val(10);
+ snap_y->set_min(1);
+ snap_y->set_max(4096);
+ snap_y->set_step(1);
+ snap_y->set_val(10);
+ snap_vb->add_margin_child("Snap X",snap_x);
+ snap_vb->add_margin_child("Snap Y",snap_y);
+ add_child(snap_dialog);
+
+
key_pos=true;
key_rot=true;
key_scale=false;
zoom=1;
- snap=10;
+ //snap=10;
updating_value_dialog=false;
box_selecting=false;
//zoom=0.5;
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h
index 6648d486e8..9160742826 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.h
+++ b/tools/editor/plugins/canvas_item_editor_plugin.h
@@ -77,6 +77,7 @@ class CanvasItemEditor : public VBoxContainer {
SNAP_USE,
SNAP_CONFIGURE,
SNAP_USE_PIXEL,
+ SNAP_OBJECT_CENTERS,
ZOOM_IN,
ZOOM_OUT,
ZOOM_RESET,
@@ -143,7 +144,6 @@ class CanvasItemEditor : public VBoxContainer {
Matrix32 transform;
float zoom;
- int snap;
bool pixel_snap;
bool box_selecting;
Point2 box_selecting_to;
@@ -250,7 +250,11 @@ class CanvasItemEditor : public VBoxContainer {
AcceptDialog *value_dialog;
Label *dialog_label;
SpinBox *dialog_val;
-
+
+ AcceptDialog *snap_dialog;
+ SpinBox *snap_x;
+ SpinBox *snap_y;
+
CanvasItem *ref_item;
void _add_canvas_item(CanvasItem *p_canvas_item);
@@ -289,6 +293,7 @@ class CanvasItemEditor : public VBoxContainer {
void _viewport_input_event(const InputEvent& p_event);
void _viewport_draw();
+ void _snap_changed(double);
HSplitContainer *palette_split;
VSplitContainer *bottom_split;
@@ -335,7 +340,7 @@ protected:
public:
bool is_snap_active() const;
- int get_snap() const { return snap; }
+ Size2i get_snap() const { return Size2i(snap_x->get_val(),snap_y->get_val()); }
Matrix32 get_canvas_transform() const { return transform; }
diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
index dab6df9a39..9a0d5b4066 100644
--- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
@@ -369,6 +369,7 @@ void CollisionPolygon2DEditor::edit(Node *p_collision_polygon) {
wip.clear();
wip_active=false;
edited_point=-1;
+ canvas_item_editor->get_viewport_control()->update();
} else {
node=NULL;
diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
index c1fb81b66a..5fa3d8ac8f 100644
--- a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -96,7 +96,7 @@ bool LightOccluder2DEditor::forward_input_event(const InputEvent& p_event) {
create_poly->set_text("No OccluderPolygon2D resource on this node.\nCreate and assign one?");
create_poly->popup_centered_minsize();
}
- return false;
+ return (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==1);
}
switch(p_event.type) {
@@ -389,7 +389,7 @@ void LightOccluder2DEditor::edit(Node *p_collision_polygon) {
wip.clear();
wip_active=false;
edited_point=-1;
-
+ canvas_item_editor->get_viewport_control()->update();
} else {
node=NULL;
@@ -402,6 +402,8 @@ void LightOccluder2DEditor::edit(Node *p_collision_polygon) {
void LightOccluder2DEditor::_create_poly() {
+ if (!node)
+ return;
undo_redo->create_action("Create Occluder Polygon");
undo_redo->add_do_method(node,"set_occluder_polygon",Ref<OccluderPolygon2D>(memnew( OccluderPolygon2D)));
undo_redo->add_undo_method(node,"set_occluder_polygon",Variant(REF()));
diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
index 599d18c8bb..163accfdd3 100644
--- a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
+++ b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
@@ -36,6 +36,9 @@ void NavigationPolygonEditor::_node_removed(Node *p_node) {
void NavigationPolygonEditor::_create_nav() {
+ if (!node)
+ return;
+
undo_redo->create_action("Create Navigation Polygon");
undo_redo->add_do_method(node,"set_navigation_polygon",Ref<NavigationPolygon>(memnew( NavigationPolygon)));
undo_redo->add_undo_method(node,"set_navigation_polygon",Variant(REF()));
@@ -107,7 +110,7 @@ bool NavigationPolygonEditor::forward_input_event(const InputEvent& p_event) {
create_nav->set_text("No NavigationPolygon resource on this node.\nCreate and assign one?");
create_nav->popup_centered_minsize();
}
- return false;
+ return (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==1);;
}
@@ -445,6 +448,7 @@ void NavigationPolygonEditor::edit(Node *p_collision_polygon) {
wip.clear();
wip_active=false;
edited_point=-1;
+ canvas_item_editor->get_viewport_control()->update();
} else {
node=NULL;
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp
index 47727a00c2..79e43f9012 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_map_editor_plugin.cpp
@@ -640,19 +640,53 @@ void TileMapEditor::_canvas_draw() {
Ref<Texture> t = ts->tile_get_texture(st);
if (t.is_valid()) {
- Vector2 from = xform.xform(ts->tile_get_texture_offset(st)+node->map_to_world(over_tile)+node->get_cell_draw_offset());
+ Vector2 from = node->map_to_world(over_tile)+node->get_cell_draw_offset();
Rect2 r = ts->tile_get_region(st);
Size2 sc = xform.get_scale();
if (mirror_x->is_pressed())
sc.x*=-1.0;
if (mirror_y->is_pressed())
sc.y*=-1.0;
+
+ Rect2 rect;
+ if (r==Rect2()) {
+ rect=Rect2(from,t->get_size());
+ } else {
+
+ rect=Rect2(from,r.get_size());
+ }
+
+
+ if (node->get_tile_origin()==TileMap::TILE_ORIGIN_TOP_LEFT) {
+ rect.pos+=ts->tile_get_texture_offset(st);
+
+ } else if (node->get_tile_origin()==TileMap::TILE_ORIGIN_CENTER) {
+ rect.pos+=node->get_cell_size()/2;
+ Vector2 s = r.size;
+
+ Vector2 center = (s/2) - ts->tile_get_texture_offset(st);
+
+
+ if (mirror_x->is_pressed())
+ rect.pos.x-=s.x-center.x;
+ else
+ rect.pos.x-=center.x;
+
+ if (mirror_y->is_pressed())
+ rect.pos.y-=s.y-center.y;
+ else
+ rect.pos.y-=center.y;
+ }
+
+ rect.pos=xform.xform(rect.pos);
+ rect.size*=sc;
+
if (r==Rect2()) {
- canvas_item_editor->draw_texture_rect(t,Rect2(from,t->get_size()*sc),false,Color(1,1,1,0.5),transpose->is_pressed());
+ canvas_item_editor->draw_texture_rect(t,rect,false,Color(1,1,1,0.5),transpose->is_pressed());
} else {
- canvas_item_editor->draw_texture_rect_region(t,Rect2(from,r.get_size()*sc),r,Color(1,1,1,0.5),transpose->is_pressed());
+ canvas_item_editor->draw_texture_rect_region(t,rect,r,Color(1,1,1,0.5),transpose->is_pressed());
}
}
}
diff --git a/tools/editor/plugins/tile_set_editor_plugin.cpp b/tools/editor/plugins/tile_set_editor_plugin.cpp
index a51caf7d54..8ff7720934 100644
--- a/tools/editor/plugins/tile_set_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_set_editor_plugin.cpp
@@ -37,83 +37,103 @@ void TileSetEditor::edit(const Ref<TileSet>& p_tileset) {
void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_merge) {
if (!p_merge)
- p_library->clear();
+ p_library->clear();
for(int i=0;i<scene->get_child_count();i++) {
- Node *child = scene->get_child(i);
+ Node *child = scene->get_child(i);
- if (!child->cast_to<Sprite>()) {
- if (child->get_child_count()>0) {
- child=child->get_child(0);
- if (!child->cast_to<Sprite>()) {
- continue;
- }
+ if (!child->cast_to<Sprite>()) {
+ if (child->get_child_count()>0) {
+ child=child->get_child(0);
+ if (!child->cast_to<Sprite>()) {
+ continue;
+ }
- } else
- continue;
+ } else
+ continue;
- }
+ }
- Sprite *mi = child->cast_to<Sprite>();
- Ref<Texture> texture=mi->get_texture();
- if (texture.is_null())
+ Sprite *mi = child->cast_to<Sprite>();
+ Ref<Texture> texture=mi->get_texture();
+ Ref<CanvasItemMaterial> material=mi->get_material();
+
+ if (texture.is_null())
continue;
- int id = p_library->find_tile_by_name(mi->get_name());
- if (id<0) {
-
- id=p_library->get_last_unused_tile_id();
- p_library->create_tile(id);
- p_library->tile_set_name(id,mi->get_name());
- }
-
-
- p_library->tile_set_texture(id,texture);
- Vector2 phys_offset;
-
- if (mi->is_centered()) {
- Size2 s;
- if (mi->is_region()) {
- s=mi->get_region_rect().size;
- } else {
- s=texture->get_size();
- }
- phys_offset+=-s/2;
- }
- if (mi->is_region()) {
- p_library->tile_set_region(id,mi->get_region_rect());
- }
-
- Vector<Ref<Shape2D> >collisions;
-
- for(int j=0;j<mi->get_child_count();j++) {
-
- Node *child2 = mi->get_child(j);
- if (!child2->cast_to<StaticBody2D>())
- continue;
- StaticBody2D *sb = child2->cast_to<StaticBody2D>();
- if (sb->get_shape_count()==0)
- continue;
- Ref<Shape2D> collision=sb->get_shape(0);
- if (collision.is_valid()) {
- collisions.push_back(collision);
+ int id = p_library->find_tile_by_name(mi->get_name());
+ if (id<0) {
+
+ id=p_library->get_last_unused_tile_id();
+ p_library->create_tile(id);
+ p_library->tile_set_name(id,mi->get_name());
+ }
+
+
+
+ p_library->tile_set_texture(id,texture);
+ p_library->tile_set_material(id,material);
+
+ Vector2 phys_offset;
+
+ if (mi->is_centered()) {
+ Size2 s;
+ if (mi->is_region()) {
+ s=mi->get_region_rect().size;
+ } else {
+ s=texture->get_size();
+ }
+ phys_offset+=-s/2;
+ }
+ if (mi->is_region()) {
+ p_library->tile_set_region(id,mi->get_region_rect());
+ }
+
+ Vector<Ref<Shape2D> >collisions;
+ Ref<NavigationPolygon> nav_poly;
+ Ref<OccluderPolygon2D> occluder;
+
+ for(int j=0;j<mi->get_child_count();j++) {
+
+ Node *child2 = mi->get_child(j);
+
+ if (child2->cast_to<NavigationPolygonInstance>())
+ nav_poly=child2->cast_to<NavigationPolygonInstance>()->get_navigation_polygon();
+
+ if (child2->cast_to<LightOccluder2D>())
+ occluder=child2->cast_to<LightOccluder2D>()->get_occluder_polygon();
+
+ if (!child2->cast_to<StaticBody2D>())
+ continue;
+ StaticBody2D *sb = child2->cast_to<StaticBody2D>();
+ if (sb->get_shape_count()==0)
+ continue;
+ Ref<Shape2D> collision=sb->get_shape(0);
+ if (collision.is_valid()) {
+ collisions.push_back(collision);
}
- }
+ }
- if (collisions.size()) {
+ if (collisions.size()) {
- p_library->tile_set_shapes(id,collisions);
- p_library->tile_set_shape_offset(id,-phys_offset);
- } else {
- p_library->tile_set_shape_offset(id,Vector2());
+ p_library->tile_set_shapes(id,collisions);
+ p_library->tile_set_shape_offset(id,-phys_offset);
+ } else {
+ p_library->tile_set_shape_offset(id,Vector2());
+
+ }
+
+ p_library->tile_set_texture_offset(id,mi->get_offset());
+ p_library->tile_set_navigation_polygon(id,nav_poly);
+ p_library->tile_set_light_occluder(id,occluder);
+ p_library->tile_set_occluder_offset(id,-phys_offset);
+ p_library->tile_set_navigation_polygon_offset(id,-phys_offset);
- }
- p_library->tile_set_texture_offset(id,mi->get_offset());
}
}
@@ -121,23 +141,23 @@ void TileSetEditor::_menu_confirm() {
switch(option) {
- case MENU_OPTION_REMOVE_ITEM: {
+ case MENU_OPTION_REMOVE_ITEM: {
- tileset->remove_tile(to_erase);
- } break;
- case MENU_OPTION_MERGE_FROM_SCENE:
- case MENU_OPTION_CREATE_FROM_SCENE: {
+ tileset->remove_tile(to_erase);
+ } break;
+ case MENU_OPTION_MERGE_FROM_SCENE:
+ case MENU_OPTION_CREATE_FROM_SCENE: {
- EditorNode *en = editor;
- Node * scene = en->get_edited_scene();
- if (!scene)
- break;
+ EditorNode *en = editor;
+ Node * scene = en->get_edited_scene();
+ if (!scene)
+ break;
- _import_scene(scene,tileset,option==MENU_OPTION_MERGE_FROM_SCENE);
+ _import_scene(scene,tileset,option==MENU_OPTION_MERGE_FROM_SCENE);
- } break;
+ } break;
}
}
@@ -165,11 +185,11 @@ void TileSetEditor::_menu_cbk(int p_option) {
cd->set_text("Create from scene?");
cd->popup_centered(Size2(300,60));
} break;
- case MENU_OPTION_MERGE_FROM_SCENE: {
+ case MENU_OPTION_MERGE_FROM_SCENE: {
- cd->set_text("Merge from scene?");
- cd->popup_centered(Size2(300,60));
- } break;
+ cd->set_text("Merge from scene?");
+ cd->popup_centered(Size2(300,60));
+ } break;
}
}
diff --git a/tools/editor/plugins/tile_set_editor_plugin.h b/tools/editor/plugins/tile_set_editor_plugin.h
index 2531ec55bf..1248b4e007 100644
--- a/tools/editor/plugins/tile_set_editor_plugin.h
+++ b/tools/editor/plugins/tile_set_editor_plugin.h
@@ -56,7 +56,7 @@ class TileSetEditor : public Control {
int option;
void _menu_cbk(int p_option);
- void _menu_confirm();
+ void _menu_confirm();
static void _import_scene(Node *p_scene, Ref<TileSet> p_library, bool p_merge);
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 25c39b3173..fb4c134263 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -1860,7 +1860,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
if (has_icon(res->get_type(),"EditorIcons")) {
- p_item->set_icon(1,get_icon(res->get_type(),"EditorIcons"));
+ p_item->set_icon(0,get_icon(res->get_type(),"EditorIcons"));
} else {
Dictionary d = p_item->get_metadata(0);
@@ -1870,10 +1870,10 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
if (has_icon(hint_text,"EditorIcons")) {
- p_item->set_icon(1,get_icon(hint_text,"EditorIcons"));
+ p_item->set_icon(0,get_icon(hint_text,"EditorIcons"));
} else {
- p_item->set_icon(1,get_icon("Object","EditorIcons"));
+ p_item->set_icon(0,get_icon("Object","EditorIcons"));
}
}