summaryrefslogtreecommitdiff
path: root/tools/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r--tools/editor/plugins/animation_player_editor_plugin.cpp9
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp60
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp21
-rw-r--r--tools/editor/plugins/script_editor_plugin.h2
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp4
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.cpp19
6 files changed, 96 insertions, 19 deletions
diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp
index 43b4276d45..32afd86970 100644
--- a/tools/editor/plugins/animation_player_editor_plugin.cpp
+++ b/tools/editor/plugins/animation_player_editor_plugin.cpp
@@ -128,16 +128,9 @@ void AnimationPlayerEditor::_notification(int p_what) {
anim_editor_load->set_hover_texture( get_icon("AnimGetHl","EditorIcons"));
anim_editor_store->set_hover_texture( get_icon("AnimSetHl","EditorIcons"));
*/
- }
-
- if (p_what==NOTIFICATION_READY) {
get_tree()->connect("node_removed",this,"_node_removed");
}
-
- if (p_what==NOTIFICATION_DRAW) {
-
- }
}
void AnimationPlayerEditor::_autoplay_pressed() {
@@ -1305,7 +1298,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
frame = memnew( SpinBox );
hb->add_child(frame);
- frame->set_custom_minimum_size(Size2(80,0));
+ frame->set_custom_minimum_size(Size2(60,0));
frame->set_stretch_ratio(2);
frame->set_tooltip("Animation position (in seconds).");
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index a259fa0fcc..ef2df539e8 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -603,6 +603,9 @@ bool CanvasItemEditor::_select(CanvasItem *item, Point2 p_click_pos, bool p_appe
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -643,6 +646,9 @@ void CanvasItemEditor::_key_move(const Vector2& p_dir, bool p_snap, KeyMoveMODE
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -702,6 +708,9 @@ Point2 CanvasItemEditor::_find_topleftmost_point() {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
@@ -731,6 +740,9 @@ int CanvasItemEditor::get_item_count() {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
ic++;
};
@@ -749,6 +761,8 @@ CanvasItem *CanvasItemEditor::get_single_item() {
CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
if (single_item)
return NULL; //morethan one
@@ -1102,6 +1116,9 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
@@ -1194,6 +1211,9 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -1400,6 +1420,9 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -1507,6 +1530,9 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -1881,6 +1907,8 @@ void CanvasItemEditor::_viewport_draw() {
CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -2104,6 +2132,9 @@ void CanvasItemEditor::_notification(int p_what) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
if (canvas_item->cast_to<Control>())
has_control=true;
else
@@ -2509,6 +2540,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
canvas_item->set_meta("_edit_lock_",true);
emit_signal("item_lock_status_changed");
}
@@ -2524,6 +2558,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
canvas_item->set_meta("_edit_lock_",Variant());
emit_signal("item_lock_status_changed");
@@ -2542,6 +2579,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
canvas_item->set_meta("_edit_group_",true);
emit_signal("item_group_status_changed");
}
@@ -2557,6 +2597,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
canvas_item->set_meta("_edit_group_",Variant());
emit_signal("item_group_status_changed");
}
@@ -2575,6 +2618,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
Control *c = canvas_item->cast_to<Control>();
if (!c)
@@ -2693,6 +2739,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
if (canvas_item->cast_to<Node2D>()) {
Node2D *n2d = canvas_item->cast_to<Node2D>();
@@ -2803,6 +2852,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
if (canvas_item->cast_to<Node2D>()) {
@@ -2853,6 +2904,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
if (canvas_item->cast_to<Node2D>()) {
Node2D *n2d = canvas_item->cast_to<Node2D>();
@@ -2887,6 +2941,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) {
CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>();
if (!canvas_item) continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
// counting invisible items, for now
//if (!canvas_item->is_visible()) continue;
@@ -2979,6 +3036,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
canvas_item->set_meta("_edit_ik_",true);
@@ -3469,6 +3528,7 @@ CanvasItemEditorPlugin::CanvasItemEditorPlugin(EditorNode *p_node) {
editor=p_node;
canvas_item_editor = memnew( CanvasItemEditor(editor) );
+ canvas_item_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
editor->get_viewport()->add_child(canvas_item_editor);
canvas_item_editor->set_area_as_parent_rect();
canvas_item_editor->hide();
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 34d7e89760..bef74ebcfe 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -935,6 +935,9 @@ void ScriptEditor::_menu_option(int p_option) {
if (!_test_script_times_on_disk())
return;
+ save_all_scripts();
+
+#if 0
for(int i=0;i<tab_container->get_child_count();i++) {
ScriptTextEditor *ste = tab_container->get_child(i)->cast_to<ScriptTextEditor>();
@@ -951,7 +954,7 @@ void ScriptEditor::_menu_option(int p_option) {
editor->save_resource( script );
}
-
+#endif
} break;
case SEARCH_HELP: {
@@ -1694,7 +1697,7 @@ void ScriptEditor::ensure_select_current() {
Ref<Script> script = ste->get_edited_script();
- if (!grab_focus_block && is_inside_tree())
+ if (!grab_focus_block && is_visible())
ste->get_text_edit()->grab_focus();
edit_menu->show();
@@ -1938,9 +1941,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script) {
}
}
-void ScriptEditor::save_external_data() {
-
- apply_scripts();
+void ScriptEditor::save_all_scripts() {
for(int i=0;i<tab_container->get_child_count();i++) {
@@ -1949,9 +1950,13 @@ void ScriptEditor::save_external_data() {
if (!ste)
continue;
+ if (ste->get_text_edit()->get_version()==ste->get_text_edit()->get_saved_version())
+ continue;
+
Ref<Script> script = ste->get_edited_script();
if (script->get_path()!="" && script->get_path().find("local://")==-1 &&script->get_path().find("::")==-1) {
//external script, save it
+ ste->apply_code();
editor->save_resource(script);
//ResourceSaver::save(script->get_path(),script);
}
@@ -2063,7 +2068,7 @@ void ScriptEditor::_editor_settings_changed() {
void ScriptEditor::_autosave_scripts() {
print_line("autosaving");
- save_external_data();
+ save_all_scripts();
}
void ScriptEditor::_tree_changed() {
@@ -2628,7 +2633,7 @@ void ScriptEditorPlugin::clear() {
void ScriptEditorPlugin::save_external_data() {
- script_editor->save_external_data();
+ script_editor->save_all_scripts();
}
void ScriptEditorPlugin::apply_changes() {
@@ -2672,7 +2677,7 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
editor=p_node;
script_editor = memnew( ScriptEditor(p_node) );
editor->get_viewport()->add_child(script_editor);
- script_editor->set_area_as_parent_rect();
+ script_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
script_editor->hide();
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index c52da41a43..5664b26580 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -295,7 +295,7 @@ public:
void swap_lines(TextEdit *tx, int line1, int line2);
- void save_external_data();
+ void save_all_scripts();
void set_window_layout(Ref<ConfigFile> p_layout);
void get_window_layout(Ref<ConfigFile> p_layout);
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 236d69dfb3..cf92473919 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -4217,8 +4217,10 @@ SpatialEditorPlugin::SpatialEditorPlugin(EditorNode *p_node) {
editor=p_node;
spatial_editor = memnew( SpatialEditor(p_node) );
+ spatial_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
editor->get_viewport()->add_child(spatial_editor);
- spatial_editor->set_area_as_parent_rect();
+
+ //spatial_editor->set_area_as_parent_rect();
spatial_editor->hide();
spatial_editor->connect("transform_key_request",editor,"_transform_keyed");
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp
index 29326a2222..acacd37f66 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_map_editor_plugin.cpp
@@ -533,6 +533,8 @@ void TileMapEditor::_canvas_draw() {
if (node->get_half_offset()!=TileMap::HALF_OFFSET_X) {
+ int max_lines=2000; //avoid crash if size too smal
+
for(int i=(si.pos.x)-1;i<=(si.pos.x+si.size.x);i++) {
Vector2 from = xform.xform(node->map_to_world(Vector2(i,si.pos.y)));
@@ -540,10 +542,12 @@ void TileMapEditor::_canvas_draw() {
Color col=i==0?Color(1,0.8,0.2,0.5):Color(1,0.3,0.1,0.2);
canvas_item_editor->draw_line(from,to,col,1);
-
+ if (max_lines--==0)
+ break;
}
} else {
+ int max_lines=10000; //avoid crash if size too smal
for(int i=(si.pos.x)-1;i<=(si.pos.x+si.size.x);i++) {
@@ -558,11 +562,17 @@ void TileMapEditor::_canvas_draw() {
Vector2 to = xform.xform(node->map_to_world(Vector2(i,j+1),true)+ofs);
Color col=i==0?Color(1,0.8,0.2,0.5):Color(1,0.3,0.1,0.2);
canvas_item_editor->draw_line(from,to,col,1);
+
+ if (max_lines--==0)
+ break;
+
}
}
}
+ int max_lines=10000; //avoid crash if size too smal
+
if (node->get_half_offset()!=TileMap::HALF_OFFSET_Y) {
for(int i=(si.pos.y)-1;i<=(si.pos.y+si.size.y);i++) {
@@ -573,6 +583,9 @@ void TileMapEditor::_canvas_draw() {
Color col=i==0?Color(1,0.8,0.2,0.5):Color(1,0.3,0.1,0.2);
canvas_item_editor->draw_line(from,to,col,1);
+ if (max_lines--==0)
+ break;
+
}
} else {
@@ -590,6 +603,10 @@ void TileMapEditor::_canvas_draw() {
Vector2 to = xform.xform(node->map_to_world(Vector2(j+1,i),true)+ofs);
Color col=i==0?Color(1,0.8,0.2,0.5):Color(1,0.3,0.1,0.2);
canvas_item_editor->draw_line(from,to,col,1);
+
+ if (max_lines--==0)
+ break;
+
}
}