summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/globals.cpp2
-rw-r--r--doc/base/classes.xml4
-rw-r--r--modules/gdscript/gd_functions.cpp4
-rw-r--r--modules/gdscript/gd_parser.cpp8
-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/scene_tree_dock.cpp30
-rw-r--r--tools/editor/scene_tree_dock.h1
10 files changed, 49 insertions, 17 deletions
diff --git a/core/globals.cpp b/core/globals.cpp
index b822f52f15..bef40ff330 100644
--- a/core/globals.cpp
+++ b/core/globals.cpp
@@ -54,7 +54,7 @@ String Globals::localize_path(const String& p_path) const {
if (resource_path=="")
return p_path; //not initialied yet
- if (p_path.begins_with("res://") || p_path.begins_with("user://"))
+ if (p_path.begins_with("res://") || p_path.begins_with("user://") || p_path.is_abs_path())
return p_path.simplify_path();
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index ea7d9e6ef4..0a323d5c8e 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -26253,7 +26253,7 @@
</methods>
<constants>
<constant name="PARAM_DIRECTION" value="0">
- Direction in radians at which the particles will be launched, Notice that when the direction is set to 0 the particles will be launched to the negative
+ Direction in degrees at which the particles will be launched, Notice that when the direction is set to 0 the particles will be launched to the negative
</constant>
<constant name="PARAM_SPREAD" value="1">
</constant>
@@ -26267,7 +26267,7 @@
Velocity at which the particles will orbit around the emitter center
</constant>
<constant name="PARAM_GRAVITY_DIRECTION" value="5">
- Direction in radians at which the particles will be attracted
+ Direction in degrees at which the particles will be attracted
</constant>
<constant name="PARAM_GRAVITY_STRENGTH" value="6">
Strength of the gravitation attraction for each particle
diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp
index e82eb83773..e224ce4718 100644
--- a/modules/gdscript/gd_functions.cpp
+++ b/modules/gdscript/gd_functions.cpp
@@ -840,10 +840,6 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument=0;
r_ret=Variant();
- } else if(((String)(*p_args[0])).begins_with("/")) {
- r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
- r_error.argument=0;
- r_ret=RTR("Paths cannot start with '/', absolute paths must start with 'res://', 'user://', or 'local://'");
} else {
r_ret=ResourceLoader::load(*p_args[0]);
}
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index e2d284ae02..434f918355 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -309,10 +309,6 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
_set_error("expected string constant as 'preload' argument.");
return NULL;
}
- if (path.begins_with("/")) {
- _set_error("Paths cannot start with '/', absolute paths must start with \'res://\', \'user://\', or \'local://\'");
- return NULL;
- }
if (!path.is_abs_path() && base_path!="")
path=base_path+"/"+path;
path = path.replace("///","//").simplify_path();
@@ -2122,10 +2118,6 @@ void GDParser::_parse_extends(ClassNode *p_class) {
_set_error("'extends' constant must be a string.");
return;
}
- if (((String)(constant)).begins_with("/")) {
- _set_error("Paths cannot start with '/', absolute paths must start with \'res://\', \'user://\', or \'local://\'");
- return;
- }
p_class->extends_file=constant;
tokenizer->advance();
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/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: