summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/gdscript/gd_tokenizer.cpp10
-rw-r--r--scene/gui/graph_edit.cpp11
-rw-r--r--scene/gui/graph_node.cpp1
-rw-r--r--scene/gui/text_edit.cpp11
-rw-r--r--scene/gui/text_edit.h3
-rw-r--r--tools/editor/code_editor.cpp1
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/icons/2x/icon_load.pngbin228 -> 503 bytes
-rw-r--r--tools/editor/icons/2x/icon_open.pngbin228 -> 0 bytes
-rw-r--r--tools/editor/icons/icon_load.pngbin170 -> 301 bytes
-rw-r--r--tools/editor/icons/icon_open.pngbin170 -> 0 bytes
-rw-r--r--tools/editor/icons/source/icon_load.svg85
-rw-r--r--tools/editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--tools/editor/scene_tree_dock.cpp30
-rw-r--r--tools/editor/scene_tree_dock.h1
15 files changed, 144 insertions, 13 deletions
diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp
index 383a092d96..39c4530d96 100644
--- a/modules/gdscript/gd_tokenizer.cpp
+++ b/modules/gdscript/gd_tokenizer.cpp
@@ -282,7 +282,7 @@ void GDTokenizerText::_advance() {
case '\n': {
line++;
INCPOS(1);
- column=0;
+ column=1;
int i=0;
while(GETCHAR(i)==' ' || GETCHAR(i)=='\t') {
i++;
@@ -303,7 +303,7 @@ void GDTokenizerText::_advance() {
}
}
INCPOS(1);
- column=0;
+ column=1;
line++;
int i=0;
while(GETCHAR(i)==' ' || GETCHAR(i)=='\t') {
@@ -335,7 +335,7 @@ void GDTokenizerText::_advance() {
break;
} else if (_code[pos]=='\n') {
new_line++;
- new_col=0;
+ new_col=1;
} else {
new_col++;
}
@@ -358,7 +358,7 @@ void GDTokenizerText::_advance() {
}
}
INCPOS(1);
- column=0;
+ column=1;
line++;
continue;
@@ -654,7 +654,7 @@ void GDTokenizerText::_advance() {
} else {
if (CharType(GETCHAR(i))=='\n') {
line++;
- column=0;
+ column=1;
}
str+=CharType(GETCHAR(i));
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 4eecabd10c..acc3ec3b2e 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -151,7 +151,7 @@ void GraphEdit::_update_scroll_offset() {
}
}
- connections_layer->set_pos(-Point2(h_scroll->get_val(),v_scroll->get_val())*zoom);
+ connections_layer->set_pos(-Point2(h_scroll->get_val(),v_scroll->get_val()));
set_block_minimum_size_adjust(false);
awaiting_scroll_offset_update=false;
@@ -650,8 +650,8 @@ void GraphEdit::_draw_cos_line(CanvasItem* p_where,const Vector2& p_from, const
cp_offset=MAX(MIN(cp_len-diff,cp_neg_len),-diff*0.5);
}
- Vector2 c1 = Vector2(cp_offset,0);
- Vector2 c2 = Vector2(-cp_offset,0);
+ Vector2 c1 = Vector2(cp_offset*zoom,0);
+ Vector2 c2 = Vector2(-cp_offset*zoom,0);
int lines=0;
_bake_segment2d(p_where,0,1,p_from,c1,p_to,c2,0,3,9,8,p_color,p_to_color,lines);
@@ -726,9 +726,9 @@ void GraphEdit::_connections_layer_draw() {
continue;
}
- Vector2 frompos=gfrom->get_connection_output_pos(E->get().from_port)+gfrom->get_offset();
+ Vector2 frompos=gfrom->get_connection_output_pos(E->get().from_port)+gfrom->get_offset()*zoom;
Color color = gfrom->get_connection_output_color(E->get().from_port);
- Vector2 topos=gto->get_connection_input_pos(E->get().to_port)+gto->get_offset();
+ Vector2 topos=gto->get_connection_input_pos(E->get().to_port)+gto->get_offset()*zoom;
Color tocolor = gto->get_connection_input_color(E->get().to_port);
_draw_cos_line(connections_layer,frompos,topos,color,tocolor);
@@ -1052,6 +1052,7 @@ void GraphEdit::set_zoom(float p_zoom) {
top_layer->update();
_update_scroll();
+ connections_layer->update();
if (is_visible()) {
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 213c5f62c0..eec973ebef 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -769,6 +769,7 @@ void GraphNode::_bind_methods() {
ADD_PROPERTY( PropertyInfo(Variant::STRING,"title"),_SCS("set_title"),_SCS("get_title"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"show_close"),_SCS("set_show_close_button"),_SCS("is_close_button_visible"));
+ ADD_PROPERTY( PropertyInfo(Variant::BOOL,"resizeable"),_SCS("set_resizeable"),_SCS("is_resizeable"));
ADD_SIGNAL(MethodInfo("offset_changed"));
ADD_SIGNAL(MethodInfo("dragged",PropertyInfo(Variant::VECTOR2,"from"),PropertyInfo(Variant::VECTOR2,"to")));
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index a68d3c13a7..f1a2823e8f 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -693,6 +693,8 @@ void TextEdit::_notification(int p_what) {
// get the highlighted words
String highlighted_text = get_selection_text();
+ String line_num_padding = line_numbers_zero_padded ? "0" : " ";
+
for (int i=0;i<visible_rows;i++) {
int line=i+cursor.line_ofs;
@@ -758,7 +760,7 @@ void TextEdit::_notification(int p_what) {
if (cache.line_number_w) {
String fc = String::num(line+1);
while (fc.length() < line_number_char_count) {
- fc="0"+fc;
+ fc=line_num_padding+fc;
}
cache.font->draw(ci,Point2(cache.style_normal->get_margin(MARGIN_LEFT)+cache.breakpoint_gutter_width,ofs_y+cache.font->get_ascent()),fc,cache.line_number_color);
@@ -4520,6 +4522,12 @@ void TextEdit::set_show_line_numbers(bool p_show) {
update();
}
+void TextEdit::set_line_numbers_zero_padded(bool p_zero_padded) {
+
+ line_numbers_zero_padded=p_zero_padded;
+ update();
+}
+
bool TextEdit::is_show_line_numbers_enabled() const {
return line_numbers;
}
@@ -4811,6 +4819,7 @@ TextEdit::TextEdit() {
completion_line_ofs=0;
tooltip_obj=NULL;
line_numbers=false;
+ line_numbers_zero_padded=false;
line_length_guideline=false;
line_length_guideline_col=80;
draw_breakpoint_gutter=false;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index e6401e2b92..7820fefdd2 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -232,6 +232,7 @@ class TextEdit : public Control {
bool text_changed_dirty;
bool undo_enabled;
bool line_numbers;
+ bool line_numbers_zero_padded;
bool line_length_guideline;
int line_length_guideline_col;
bool draw_breakpoint_gutter;
@@ -489,6 +490,8 @@ public:
void set_show_line_numbers(bool p_show);
bool is_show_line_numbers_enabled() const;
+ void set_line_numbers_zero_padded(bool p_zero_padded);
+
void set_show_line_length_guideline(bool p_show);
void set_line_length_guideline_column(int p_column);
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index ffcb344497..626f86d33d 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -1112,6 +1112,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size"));
text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs"));
text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers"));
+ text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers_zero_padded"));
text_editor->set_show_line_length_guideline(EditorSettings::get_singleton()->get("text_editor/show_line_length_guideline"));
text_editor->set_line_length_guideline_column(EditorSettings::get_singleton()->get("text_editor/line_length_guideline_column"));
text_editor->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting"));
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 0ab42c5adb..bdbf20e348 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -546,6 +546,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["text_editor/tab_size"]=PropertyInfo(Variant::INT,"text_editor/tab_size",PROPERTY_HINT_RANGE,"1, 64, 1"); // size of 0 crashes.
set("text_editor/draw_tabs", true);
+ set("text_editor/line_numbers_zero_padded", false);
+
set("text_editor/show_line_numbers", true);
set("text_editor/show_breakpoint_gutter", true);
diff --git a/tools/editor/icons/2x/icon_load.png b/tools/editor/icons/2x/icon_load.png
index 2e797c448b..729eedd2dd 100644
--- a/tools/editor/icons/2x/icon_load.png
+++ b/tools/editor/icons/2x/icon_load.png
Binary files differ
diff --git a/tools/editor/icons/2x/icon_open.png b/tools/editor/icons/2x/icon_open.png
deleted file mode 100644
index 2e797c448b..0000000000
--- a/tools/editor/icons/2x/icon_open.png
+++ /dev/null
Binary files differ
diff --git a/tools/editor/icons/icon_load.png b/tools/editor/icons/icon_load.png
index cc05e98ebb..98da8135f2 100644
--- a/tools/editor/icons/icon_load.png
+++ b/tools/editor/icons/icon_load.png
Binary files differ
diff --git a/tools/editor/icons/icon_open.png b/tools/editor/icons/icon_open.png
deleted file mode 100644
index cc05e98ebb..0000000000
--- a/tools/editor/icons/icon_open.png
+++ /dev/null
Binary files differ
diff --git a/tools/editor/icons/source/icon_load.svg b/tools/editor/icons/source/icon_load.svg
new file mode 100644
index 0000000000..f8e78fb4ea
--- /dev/null
+++ b/tools/editor/icons/source/icon_load.svg
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/godotengine/godot/tools/editor/icons/2x/icon_load.png"
+ inkscape:export-xdpi="180"
+ inkscape:export-ydpi="180"
+ sodipodi:docname="icon_load.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.627417"
+ inkscape:cx="12.685427"
+ inkscape:cy="1.6294402"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1119"
+ inkscape:window-x="0"
+ inkscape:window-y="26"
+ inkscape:window-maximized="1"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true"
+ showguides="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336"
+ spacingx="0.5"
+ spacingy="0.5"
+ empspacing="2" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <path
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+ d="M 1.5000703,2 C 1.0834036,2 0.7251221,2.1928844 0.4590547,2.4589844 0.1929873,2.7250844 7.03e-5,3.0834 7.03e-5,3.5 l 0.5,8.5 c 0.041565,0.581917 0.1536332,1.110716 0.5214844,1.478516 C 1.3894058,13.846416 1.916737,14 2.5000703,14 l 0.5,0 0.5,0 9.9997657,0 c 0.231666,-10e-5 0.432919,-0.159266 0.486328,-0.384766 l 2,-7.4999996 C 16.060474,5.8013344 15.822456,5.5002 15.499836,5.5 L 4.7559297,5.5 C 4.5236856,5.5003 4.3126587,5.6584963 4.2696015,5.8867188 L 3.0383769,12.412759 C 2.9838992,12.701515 2.7130529,12.963778 2.2988984,12.972656 1.7175274,12.985119 1.5058274,12.46121 1.5000703,12 l -0.5,-8.5 c 0,-0.083 0.057083,-0.2249844 0.1660156,-0.3339844 C 1.2750185,3.0571156 1.416737,3 1.5000703,3 L 12.499836,3 c 0.08333,0 0.225052,0.057016 0.333984,0.1660156 0.108933,0.109 0.224913,0.2750776 0.166016,0.3339844 l 0,1 1,0 0,-1 c 0,-0.4166 -0.192917,-0.7749156 -0.458984,-1.0410156 C 13.274784,2.1928844 12.916503,2 12.499836,2 Z"
+ transform="translate(0,1036.3622)"
+ id="path8167"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sscccscccccccssscccssssccssss" />
+ </g>
+</svg>
diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp
index b4d54c6b1e..d6d452dd72 100644
--- a/tools/editor/plugins/animation_player_editor_plugin.cpp
+++ b/tools/editor/plugins/animation_player_editor_plugin.cpp
@@ -666,7 +666,7 @@ void AnimationPlayerEditor::set_state(const Dictionary& p_state) {
return;
Node *n = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["player"]);
- if (n && n->cast_to<AnimationPlayer>()) {
+ if (n && n->cast_to<AnimationPlayer>() && EditorNode::get_singleton()->get_editor_selection()->is_selected(n)) {
player=n->cast_to<AnimationPlayer>();
_update_player();
show();
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index 342e6b98c8..56f10ff7f8 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -238,6 +238,34 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String>& p_files,Node*
}
+void SceneTreeDock::_replace_with_branch_scene(const String& p_file,Node* base) {
+ Ref<PackedScene> sdata = ResourceLoader::load(p_file);
+ if (!sdata.is_valid()) {
+ accept->get_ok()->set_text(TTR("Ugh"));
+ accept->set_text(vformat(TTR("Error loading scene from %s"),p_file));
+ accept->popup_centered_minsize();
+ return;
+ }
+
+ Node *instanced_scene=sdata->instance(true);
+ if (!instanced_scene) {
+ accept->get_ok()->set_text(TTR("Ugh"));
+ accept->set_text(vformat(TTR("Error instancing scene from %s"),p_file));
+ accept->popup_centered_minsize();
+ return;
+ }
+
+ Node *parent = base->get_parent();
+ int pos = base->get_index();
+ memdelete(base);
+ parent->add_child(instanced_scene);
+ parent->move_child(instanced_scene, pos);
+ instanced_scene->set_owner(edited_scene);
+ editor_selection->clear();
+ editor_selection->add_node(instanced_scene);
+ scene_tree->set_selected(instanced_scene);
+}
+
bool SceneTreeDock::_cyclical_dependency_exists(const String& p_target_scene_path, Node* p_desired_node) {
int childCount = p_desired_node->get_child_count();
@@ -1513,7 +1541,7 @@ void SceneTreeDock::_new_scene_from(String p_file) {
accept->popup_centered_minsize();
return;
}
-
+ _replace_with_branch_scene(p_file, base);
} else {
accept->get_ok()->set_text(TTR("I see.."));
accept->set_text(TTR("Error duplicating scene to save it."));
diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h
index 971013a568..8933a03883 100644
--- a/tools/editor/scene_tree_dock.h
+++ b/tools/editor/scene_tree_dock.h
@@ -153,6 +153,7 @@ class SceneTreeDock : public VBoxContainer {
void _filter_changed(const String& p_filter);
void _perform_instance_scenes(const Vector<String>& p_files,Node* parent,int p_pos);
+ void _replace_with_branch_scene(const String& p_file,Node* base);
protected: