summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/resource_format_binary.cpp3
-rw-r--r--core/io/resource_format_xml.cpp4
-rw-r--r--core/print_string.cpp2
-rw-r--r--drivers/gles2/shader_gles2.h5
-rw-r--r--drivers/unix/os_unix.cpp4
-rw-r--r--main/main.cpp39
-rw-r--r--modules/gdscript/gd_script.h1
-rw-r--r--scene/gui/line_edit.cpp2
-rw-r--r--scene/gui/tabs.cpp323
-rw-r--r--scene/gui/tabs.h16
-rw-r--r--scene/resources/packed_scene.cpp10
-rw-r--r--scene/resources/packed_scene.h1
-rw-r--r--scene/resources/scene_format_text.cpp7
-rw-r--r--tools/editor/editor_data.cpp4
-rw-r--r--tools/editor/editor_import_export.cpp9
-rw-r--r--tools/editor/editor_node.cpp16
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp4
-rw-r--r--tools/editor/project_export.cpp1
20 files changed, 194 insertions, 261 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 796dcde3d0..c008c3f9a4 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -725,7 +725,8 @@ Error ResourceInteractiveLoaderBinary::poll(){
}
} else {
- path=res_path;
+ if (!ResourceCache::has(res_path))
+ path=res_path;
}
uint64_t offset = internal_resources[s].offset;
diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp
index 74813d24fa..8c8d79948a 100644
--- a/core/io/resource_format_xml.cpp
+++ b/core/io/resource_format_xml.cpp
@@ -1570,7 +1570,9 @@ Error ResourceInteractiveLoaderXML::poll() {
if (main) {
f->close();
resource=res;
- resource->set_path(res_path);
+ if (!ResourceCache::has(res_path)) {
+ resource->set_path(res_path);
+ }
error=ERR_FILE_EOF;
return error;
diff --git a/core/print_string.cpp b/core/print_string.cpp
index 37760a66ca..e364388b7b 100644
--- a/core/print_string.cpp
+++ b/core/print_string.cpp
@@ -66,7 +66,7 @@ void remove_print_handler(PrintHandlerList *p_handler) {
l=l->next;
}
- OS::get_singleton()->print("print hanlder list is %p\n",print_handler_list);
+ OS::get_singleton()->print("print handler list is %p\n",print_handler_list);
ERR_FAIL_COND(l==NULL);
_global_unlock();
diff --git a/drivers/gles2/shader_gles2.h b/drivers/gles2/shader_gles2.h
index 51520cc9da..68ae8af63f 100644
--- a/drivers/gles2/shader_gles2.h
+++ b/drivers/gles2/shader_gles2.h
@@ -205,6 +205,11 @@ private:
Plane val=p_value;
glUniform4f( p_uniform, val.normal.x,val.normal.y,val.normal.z,val.d );
} break;
+ case Variant::QUAT: {
+
+ Quat val=p_value;
+ glUniform4f( p_uniform, val.x,val.y,val.z,val.w );
+ } break;
case Variant::MATRIX32: {
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 8e3fba167f..a004a116e0 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -78,11 +78,11 @@ void OS_Unix::print_error(const char* p_function,const char* p_file,int p_line,c
break;
case ERR_WARNING:
print("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n",p_function,err_details);
- print("\E[0;33m At: %s:%i.\E[0m\n",p_file,p_line);
+ print("\E[0;33m At: %s:%i.\E[0m\n",p_file,p_line);
break;
case ERR_SCRIPT:
print("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n",p_function,err_details);
- print("\E[0;35m At: %s:%i.\E[0m\n",p_file,p_line);
+ print("\E[0;35m At: %s:%i.\E[0m\n",p_file,p_line);
break;
}
}
diff --git a/main/main.cpp b/main/main.cpp
index 752a248b2f..8319c415fc 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1327,6 +1327,30 @@ bool Main::start() {
//autoload
List<PropertyInfo> props;
Globals::get_singleton()->get_property_list(&props);
+
+ //first pass, add the constants so they exist before any script is loaded
+ for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
+
+ String s = E->get().name;
+ if (!s.begins_with("autoload/"))
+ continue;
+ String name = s.get_slicec('/',1);
+ String path = Globals::get_singleton()->get(s);
+ bool global_var=false;
+ if (path.begins_with("*")) {
+ global_var=true;
+ }
+
+ if (global_var) {
+ for(int i=0;i<ScriptServer::get_language_count();i++) {
+ ScriptServer::get_language(i)->add_global_constant(name,Variant());
+ }
+ }
+
+ }
+
+ //second pass, load into global constants
+ List<Node*> to_add;
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
String s = E->get().name;
@@ -1350,12 +1374,13 @@ bool Main::start() {
} else if (res->is_type("Script")) {
Ref<Script> s = res;
StringName ibt = s->get_instance_base_type();
+ bool valid_type = ObjectTypeDB::is_type(ibt,"Node");
ERR_EXPLAIN("Script does not inherit a Node: "+path);
- ERR_CONTINUE( !ObjectTypeDB::is_type(ibt,"Node") );
+ ERR_CONTINUE( !valid_type );
Object *obj = ObjectTypeDB::instance(ibt);
- ERR_EXPLAIN("Cannot instance node for autoload type: "+String(ibt));
+ ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: "+String(ibt));
ERR_CONTINUE( obj==NULL );
n = obj->cast_to<Node>();
@@ -1366,7 +1391,9 @@ bool Main::start() {
ERR_CONTINUE(!n);
n->set_name(name);
- sml->get_root()->add_child(n);
+ //defer so references are all valid on _ready()
+ //sml->get_root()->add_child(n);
+ to_add.push_back(n);
if (global_var) {
for(int i=0;i<ScriptServer::get_language_count();i++) {
@@ -1374,9 +1401,15 @@ bool Main::start() {
}
}
+ }
+
+ for(List<Node*>::Element *E=to_add.front();E;E=E->next()) {
+ sml->get_root()->add_child(E->get());
}
+
+
}
Node *scene=NULL;
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index cf8f762a86..a69f99314a 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -534,6 +534,7 @@ public:
virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const;
virtual void add_global_constant(const StringName& p_variable,const Variant& p_value);
+
/* DEBUGGER FUNCTIONS */
virtual String debug_get_error() const;
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 49ea077a30..fdced3f62f 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -330,6 +330,8 @@ void LineEdit::_input_event(InputEvent p_event) {
append_at_cursor(ucodestr);
emit_signal("text_changed",text);
_change_notify("text");
+
+ accept_event();
}
} else {
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index bb64a57212..a26acc9c05 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -65,8 +65,8 @@ Size2 Tabs::get_minimum_size() const {
ms.height=MAX(bms.height+tab_bg->get_minimum_size().height,ms.height);
}
- if (tabs[i].close_button.is_valid()) {
- Ref<Texture> cb=tabs[i].close_button;
+ if (cb_displaypolicy==CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy==CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i==current)) {
+ Ref<Texture> cb=get_icon("close");
Size2 bms = cb->get_size();//+get_stylebox("button")->get_minimum_size();
bms.width+=get_constant("hseparation");
ms.width+=bms.width;
@@ -108,14 +108,6 @@ void Tabs::_input_event(const InputEvent& p_event) {
for(int i=0;i<tabs.size();i++) {
// test hovering tab to display close button if policy says so
- if (cb_displaypolicy == SHOW_HOVER) {
- int ofs=tabs[i].ofs_cache;
- int size = tabs[i].ofs_cache;
- if (pos.x >=tabs[i].ofs_cache && pos.x<tabs[i].ofs_cache+tabs[i].size_cache) {
- hover=i;
- }
- }
-
// test hovering right button and close button
if (tabs[i].rb_rect.has_point(pos)) {
@@ -260,6 +252,7 @@ void Tabs::_notification(int p_what) {
Ref<Font> font = get_font("font");
Color color_fg = get_color("font_color_fg");
Color color_bg = get_color("font_color_bg");
+ Ref<Texture> close=get_icon("close");
int h = get_size().height;
@@ -278,37 +271,10 @@ void Tabs::_notification(int p_what) {
for(int i=0;i<tabs.size();i++) {
-
- Ref<Texture> tex = tabs[i].icon;
- if (tex.is_valid()) {
- if (tabs[i].text!="")
- mw+=get_constant("hseparation");
-
- }
+ int sz = get_tab_width(i);
tabs[i].ofs_cache=mw;
-
- mw+=font->get_string_size(tabs[i].text).width;
- if (current==i)
- mw+=tab_fg->get_minimum_size().width;
- else
- mw+=tab_bg->get_minimum_size().width;
-
- if (tabs[i].right_button.is_valid()) {
- Ref<Texture> rb=tabs[i].right_button;
- Size2 bms = rb->get_size();//+get_stylebox("button")->get_minimum_size();
- bms.width+=get_constant("hseparation");
-
- mw+=bms.width;
- }
-
- if (tabs[i].close_button.is_valid()) {
- Ref<Texture> cb=tabs[i].close_button;
- Size2 bms = cb->get_size();//+get_stylebox("button")->get_minimum_size();
- bms.width+=get_constant("hseparation");
- mw+=bms.width;
- }
-
+ mw+=sz;
}
@@ -372,56 +338,15 @@ void Tabs::_notification(int p_what) {
}
- // Close button
- switch (cb_displaypolicy) {
- case SHOW_ALWAYS: {
- if (tabs[i].close_button.is_valid()) {
- Ref<StyleBox> style = get_stylebox("button");
- Ref<Texture> rb=tabs[i].close_button;
- lsize+=get_constant("hseparation");
- //lsize+=style->get_margin(MARGIN_LEFT);
- lsize+=rb->get_width();
- //lsize+=style->get_margin(MARGIN_RIGHT);
-
- }
- } break;
- case SHOW_ACTIVE_ONLY: {
- if (i==current) {
- if (tabs[i].close_button.is_valid()) {
- Ref<StyleBox> style = get_stylebox("button");
- Ref<Texture> rb=tabs[i].close_button;
-
- lsize+=get_constant("hseparation");
- //lsize+=style->get_margin(MARGIN_LEFT);
- lsize+=rb->get_width();
- //lsize+=style->get_margin(MARGIN_RIGHT);
-
- }
- }
- } break;
- case SHOW_HOVER: {
- if (i==current || i==hover) {
- if (tabs[i].close_button.is_valid()) {
- Ref<StyleBox> style = get_stylebox("button");
- Ref<Texture> rb=tabs[i].close_button;
-
- lsize+=get_constant("hseparation");
- //lsize+=style->get_margin(MARGIN_LEFT);
- lsize+=rb->get_width();
- //lsize+=style->get_margin(MARGIN_RIGHT);
-
- }
- }
- } break;
- case SHOW_NEVER: // by default, never show close button
- default: {
- // do nothing
- } break;
+ if (cb_displaypolicy==CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy==CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i==current)) {
+ lsize+=get_constant("hseparation");
+ //lsize+=style->get_margin(MARGIN_LEFT);
+ lsize+=close->get_width();
+ //lsize+=style->get_margin(MARGIN_RIGHT);
}
-
if (w+lsize > limit) {
max_drawn_tab=i-1;
missing_right=true;
@@ -495,100 +420,31 @@ void Tabs::_notification(int p_what) {
}
+ if (cb_displaypolicy==CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy==CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i==current)) {
+ Ref<StyleBox> style = get_stylebox("button");
+ Ref<Texture> cb=close;
- // Close button
- switch (cb_displaypolicy) {
- case SHOW_ALWAYS: {
- if (tabs[i].close_button.is_valid()) {
- Ref<StyleBox> style = get_stylebox("button");
- Ref<Texture> cb=tabs[i].close_button;
-
- w+=get_constant("hseparation");
-
- Rect2 cb_rect;
- cb_rect.size=style->get_minimum_size()+cb->get_size();
- cb_rect.pos.x=w;
- cb_rect.pos.y=sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-(cb_rect.size.y))/2;
-
- if (cb_hover==i) {
- if (cb_pressing)
- get_stylebox("button_pressed")->draw(ci,cb_rect);
- else
- style->draw(ci,cb_rect);
- }
+ w+=get_constant("hseparation");
- //w+=style->get_margin(MARGIN_LEFT);
+ Rect2 cb_rect;
+ cb_rect.size=style->get_minimum_size()+cb->get_size();
+ cb_rect.pos.x=w;
+ cb_rect.pos.y=sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-(cb_rect.size.y))/2;
- cb->draw(ci,Point2i( w,cb_rect.pos.y+style->get_margin(MARGIN_TOP) ));
- w+=cb->get_width();
- //w+=style->get_margin(MARGIN_RIGHT);
- tabs[i].cb_rect=cb_rect;
- }
- } break;
- case SHOW_ACTIVE_ONLY: {
- if (current==i) {
- if (tabs[i].close_button.is_valid()) {
- Ref<StyleBox> style = get_stylebox("button");
- Ref<Texture> cb=tabs[i].close_button;
-
- w+=get_constant("hseparation");
-
- Rect2 cb_rect;
- cb_rect.size=style->get_minimum_size()+cb->get_size();
- cb_rect.pos.x=w;
- cb_rect.pos.y=sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-(cb_rect.size.y))/2;
-
- if (cb_hover==i) {
- if (cb_pressing)
- get_stylebox("button_pressed")->draw(ci,cb_rect);
- else
- style->draw(ci,cb_rect);
- }
-
- //w+=style->get_margin(MARGIN_LEFT);
-
- cb->draw(ci,Point2i( w,cb_rect.pos.y+style->get_margin(MARGIN_TOP) ));
- w+=cb->get_width();
- //w+=style->get_margin(MARGIN_RIGHT);
- tabs[i].cb_rect=cb_rect;
- }
- }
- } break;
- case SHOW_HOVER: {
- if (current==i || hover==i) {
- if (tabs[i].close_button.is_valid()) {
- Ref<StyleBox> style = get_stylebox("button");
- Ref<Texture> cb=tabs[i].close_button;
-
- w+=get_constant("hseparation");
-
- Rect2 cb_rect;
- cb_rect.size=style->get_minimum_size()+cb->get_size();
- cb_rect.pos.x=w;
- cb_rect.pos.y=sb->get_margin(MARGIN_TOP)+((sb_rect.size.y-sb_ms.y)-(cb_rect.size.y))/2;
-
- if (cb_hover==i) {
- if (cb_pressing)
- get_stylebox("button_pressed")->draw(ci,cb_rect);
- else
- style->draw(ci,cb_rect);
- }
-
- //w+=style->get_margin(MARGIN_LEFT);
-
- cb->draw(ci,Point2i( w,cb_rect.pos.y+style->get_margin(MARGIN_TOP) ));
- w+=cb->get_width();
- //w+=style->get_margin(MARGIN_RIGHT);
- tabs[i].cb_rect=cb_rect;
- }
+ if (cb_hover==i) {
+ if (cb_pressing)
+ get_stylebox("button_pressed")->draw(ci,cb_rect);
+ else
+ style->draw(ci,cb_rect);
}
- } break;
- case SHOW_NEVER:
- default: {
- // show nothing
- } break;
+ //w+=style->get_margin(MARGIN_LEFT);
+
+ cb->draw(ci,Point2i( w,cb_rect.pos.y+style->get_margin(MARGIN_TOP) ));
+ w+=cb->get_width();
+ //w+=style->get_margin(MARGIN_RIGHT);
+ tabs[i].cb_rect=cb_rect;
}
w+=sb->get_margin(MARGIN_RIGHT);
@@ -695,20 +551,6 @@ Ref<Texture> Tabs::get_tab_right_button(int p_tab) const{
}
-void Tabs::set_tab_close_button(int p_tab, const Ref<Texture>& p_close_button) {
- ERR_FAIL_INDEX(p_tab, tabs.size());
- tabs[p_tab].close_button=p_close_button;
- update();
- minimum_size_changed();
-}
-
-
-Ref<Texture> Tabs::get_tab_close_button(int p_tab) const{
-
- ERR_FAIL_INDEX_V(p_tab,tabs.size(),Ref<Texture>());
- return tabs[p_tab].close_button;
-
-}
void Tabs::add_tab(const String& p_str,const Ref<Texture>& p_icon) {
@@ -716,8 +558,6 @@ void Tabs::add_tab(const String& p_str,const Ref<Texture>& p_icon) {
t.text=p_str;
t.icon=p_icon;
- t.close_button = get_icon("close");
-
tabs.push_back(t);
update();
@@ -749,10 +589,6 @@ void Tabs::remove_tab(int p_idx) {
}
-void Tabs::set_tab_close_display_policy(CloseButtonDisplayPolicy p_cb_displaypolicy) {
- cb_displaypolicy = p_cb_displaypolicy;
-}
-
void Tabs::set_tab_align(TabAlign p_align) {
@@ -765,6 +601,49 @@ Tabs::TabAlign Tabs::get_tab_align() const {
return tab_align;
}
+int Tabs::get_tab_width(int p_idx) const {
+
+ ERR_FAIL_INDEX_V(p_idx,tabs.size(),0);
+
+ Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
+ Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
+ Ref<Font> font = get_font("font");
+ Ref<Texture> close=get_icon("close");
+
+ int x=0;
+
+ Ref<Texture> tex = tabs[p_idx].icon;
+ if (tex.is_valid()) {
+ if (tabs[p_idx].text!="")
+ x+=get_constant("hseparation");
+
+ }
+
+
+ x+=font->get_string_size(tabs[p_idx].text).width;
+ if (current==p_idx)
+ x+=tab_fg->get_minimum_size().width;
+ else
+ x+=tab_bg->get_minimum_size().width;
+
+ if (tabs[p_idx].right_button.is_valid()) {
+ print_line("has right");
+ Ref<Texture> rb=tabs[p_idx].right_button;
+ Size2 bms = rb->get_size();//+get_stylebox("button")->get_minimum_size();
+ bms.width+=get_constant("hseparation");
+
+ x+=bms.width;
+ }
+
+ if (cb_displaypolicy==CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy==CLOSE_BUTTON_SHOW_ACTIVE_ONLY && p_idx==current)) {
+
+ Size2 bms = close->get_size();//+get_stylebox("button")->get_minimum_size();
+ bms.width+=get_constant("hseparation");
+ x+=bms.width;
+ }
+
+ return x;
+}
void Tabs::ensure_tab_visible(int p_idx) {
@@ -773,16 +652,12 @@ void Tabs::ensure_tab_visible(int p_idx) {
ERR_FAIL_INDEX(p_idx,tabs.size());
- if (p_idx<offset) {
+ if (p_idx<=offset) {
offset=p_idx;
update();
return;
}
- Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
- Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
- Ref<Font> font = get_font("font");
-
Ref<Texture> incr = get_icon("increment");
Ref<Texture> decr = get_icon("decrement");
@@ -796,49 +671,25 @@ void Tabs::ensure_tab_visible(int p_idx) {
if (i<offset)
continue;
- Ref<Texture> tex = tabs[i].icon;
- if (tex.is_valid()) {
- if (tabs[i].text!="")
- x+=get_constant("hseparation");
-
- }
-
+ int sz = get_tab_width(i);
tabs[i].x_cache=x;
-
- x+=font->get_string_size(tabs[i].text).width;
- if (current==i)
- x+=tab_fg->get_minimum_size().width;
- else
- x+=tab_bg->get_minimum_size().width;
-
- if (tabs[i].right_button.is_valid()) {
- Ref<Texture> rb=tabs[i].right_button;
- Size2 bms = rb->get_size();//+get_stylebox("button")->get_minimum_size();
- bms.width+=get_constant("hseparation");
-
- x+=bms.width;
- }
-
- if (tabs[i].close_button.is_valid()) {
- Ref<Texture> cb=tabs[i].close_button;
- Size2 bms = cb->get_size();//+get_stylebox("button")->get_minimum_size();
- bms.width+=get_constant("hseparation");
- x+=bms.width;
- }
-
- tabs[i].x_size_cache=x-tabs[i].x_cache;
-
-
+ tabs[i].x_size_cache=sz;
+ x+=sz;
}
- while(offset<tabs.size() && ( (tabs[p_idx].x_cache + tabs[p_idx].x_size_cache) - tabs[offset].x_cache) < limit) {
+ while(offset<tabs.size() && ( (tabs[p_idx].x_cache + tabs[p_idx].x_size_cache) - tabs[offset].x_cache) > limit) {
offset++;
}
update();
}
+void Tabs::set_tab_close_display_policy(CloseButtonDisplayPolicy p_policy) {
+ cb_displaypolicy=p_policy;
+ update();
+}
+
void Tabs::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_input_event"),&Tabs::_input_event);
@@ -866,10 +717,10 @@ void Tabs::_bind_methods() {
BIND_CONSTANT( ALIGN_CENTER );
BIND_CONSTANT( ALIGN_RIGHT );
- BIND_CONSTANT( SHOW_ACTIVE_ONLY );
- BIND_CONSTANT( SHOW_ALWAYS );
- BIND_CONSTANT( SHOW_HOVER );
- BIND_CONSTANT( SHOW_NEVER );
+ BIND_CONSTANT( CLOSE_BUTTON_SHOW_ACTIVE_ONLY );
+ BIND_CONSTANT( CLOSE_BUTTON_SHOW_ALWAYS );
+ BIND_CONSTANT( CLOSE_BUTTON_SHOW_NEVER );
+
}
@@ -883,7 +734,7 @@ Tabs::Tabs() {
cb_hover=-1;
cb_pressing=false;
- cb_displaypolicy = SHOW_NEVER; // Default : no close button
+ cb_displaypolicy = CLOSE_BUTTON_SHOW_NEVER; // Default : no close button
offset=0;
max_drawn_tab=0;
diff --git a/scene/gui/tabs.h b/scene/gui/tabs.h
index 82035291ec..7f85280853 100644
--- a/scene/gui/tabs.h
+++ b/scene/gui/tabs.h
@@ -45,10 +45,9 @@ public:
enum CloseButtonDisplayPolicy {
- SHOW_ALWAYS,
- SHOW_ACTIVE_ONLY,
- SHOW_HOVER,
- SHOW_NEVER
+ CLOSE_BUTTON_SHOW_NEVER,
+ CLOSE_BUTTON_SHOW_ACTIVE_ONLY,
+ CLOSE_BUTTON_SHOW_ALWAYS,
};
private:
@@ -64,7 +63,6 @@ private:
Ref<Texture> right_button;
Rect2 rb_rect;
- Ref<Texture> close_button;
Rect2 cb_rect;
};
@@ -89,6 +87,8 @@ private:
int hover; // hovered tab
+ int get_tab_width(int p_idx) const;
+
protected:
void _input_event(const InputEvent& p_event);
@@ -108,13 +108,11 @@ public:
void set_tab_right_button(int p_tab,const Ref<Texture>& p_right_button);
Ref<Texture> get_tab_right_button(int p_tab) const;
- void set_tab_close_button(int p_tab, const Ref<Texture>& p_close_button);
- Ref<Texture> get_tab_close_button(int p_tab) const;
- void set_tab_close_display_policy(CloseButtonDisplayPolicy p_cb_displaypolicy);
-
void set_tab_align(TabAlign p_align);
TabAlign get_tab_align() const;
+ void set_tab_close_display_policy(CloseButtonDisplayPolicy p_policy);
+
int get_tab_count() const;
void set_current_tab(int p_current);
int get_current_tab() const;
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index d2795bddb8..03127620f7 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -1597,6 +1597,16 @@ Node *PackedScene::instance(bool p_gen_edit_state) const {
return s;
}
+void PackedScene::replace_state(Ref<SceneState> p_by) {
+
+ state=p_by;
+ state->set_path(get_path());
+#ifdef TOOLS_ENABLED
+ state->set_last_modified_time(get_last_modified_time());
+#endif
+
+}
+
void PackedScene::recreate_state() {
state = Ref<SceneState>( memnew( SceneState ));
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index 415357b61f..00a812f16a 100644
--- a/scene/resources/packed_scene.h
+++ b/scene/resources/packed_scene.h
@@ -198,6 +198,7 @@ public:
Node *instance(bool p_gen_edit_state=false) const;
void recreate_state();
+ void replace_state(Ref<SceneState> p_by);
virtual void set_path(const String& p_path,bool p_take_over=false);
#ifdef TOOLS_ENABLED
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index 2552f682fa..5450b9e2ac 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -302,6 +302,10 @@ Error ResourceInteractiveLoaderText::poll() {
if (error) {
if (error!=ERR_FILE_EOF) {
_printerr();
+ } else {
+ if (!ResourceCache::has(res_path)) {
+ resource->set_path(res_path);
+ }
}
return error;
}
@@ -403,6 +407,9 @@ Error ResourceInteractiveLoaderText::poll() {
_printerr();
} else {
resource=packed_scene;
+ if (!ResourceCache::has(res_path)) {
+ packed_scene->set_path(res_path);
+ }
}
return error;
}
diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp
index d79c1ff466..5e613c658b 100644
--- a/tools/editor/editor_data.cpp
+++ b/tools/editor/editor_data.cpp
@@ -499,8 +499,8 @@ void EditorData::remove_scene(int p_idx){
bool EditorData::_find_updated_instances(Node* p_root,Node *p_node,Set<String> &checked_paths) {
- if (p_root!=p_node && p_node->get_owner()!=p_root && !p_root->is_editable_instance(p_node->get_owner()))
- return false;
+// if (p_root!=p_node && p_node->get_owner()!=p_root && !p_root->is_editable_instance(p_node->get_owner()))
+// return false;
Ref<SceneState> ss;
diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp
index fde3d4e278..5203ace125 100644
--- a/tools/editor/editor_import_export.cpp
+++ b/tools/editor/editor_import_export.cpp
@@ -1849,6 +1849,15 @@ void EditorImportExport::load_config() {
if (cf->has_section("convert_samples")) {
+ if (cf->has_section_key("convert_samples","action")) {
+ String action = cf->get_value("convert_samples","action");
+ if (action=="none") {
+ sample_action=SAMPLE_ACTION_NONE;
+ } else if (action=="compress_ram") {
+ sample_action=SAMPLE_ACTION_COMPRESS_RAM;
+ }
+ }
+
if (cf->has_section_key("convert_samples","max_hz"))
sample_action_max_hz=cf->get_value("convert_samples","max_hz");
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 54356c00ad..dc6e832829 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -143,6 +143,7 @@ void EditorNode::_update_scene_tabs() {
}
scene_tabs->set_current_tab(editor_data.get_edited_scene());
+ scene_tabs->ensure_tab_visible(editor_data.get_edited_scene());
}
@@ -3622,7 +3623,18 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo
add_io_error(txt);
}
- sdata->set_path(lpath,true); //take over path
+ if (ResourceCache::has(lpath)) {
+ //used from somewhere else? no problem! update state and replace sdata
+ Ref<PackedScene> ps = Ref<PackedScene>( ResourceCache::get(lpath)->cast_to<PackedScene>() );
+ if (ps.is_valid()) {
+ ps->replace_state( sdata->get_state() );
+ ps->set_last_modified_time( sdata->get_last_modified_time() );
+ sdata=ps;
+ }
+
+ } else {
+ sdata->set_path(lpath,true); //take over path
+ }
Node*new_scene=sdata->instance(true);
@@ -5055,7 +5067,7 @@ EditorNode::EditorNode() {
scene_tabs=memnew( Tabs );
scene_tabs->add_tab("unsaved");
scene_tabs->set_tab_align(Tabs::ALIGN_CENTER);
- scene_tabs->set_tab_close_display_policy(Tabs::SHOW_ACTIVE_ONLY);
+ scene_tabs->set_tab_close_display_policy(Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY);
scene_tabs->connect("tab_changed",this,"_scene_tab_changed");
scene_tabs->connect("right_button_pressed",this,"_scene_tab_script_edited");
scene_tabs->connect("tab_close", this, "_scene_tab_closed");
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 56ed95fb16..2eaf017d08 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -194,7 +194,7 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2& mouse_pos) {
void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) {
- if (!is_visible())
+ if (!is_visible() || window_has_modal_stack())
return;
if (p_ev.key.mod.control)
// prevent to change tool mode when control key is pressed
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index fc0d68b2f8..8adfe9d2cf 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -2331,7 +2331,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
script_list = memnew( ItemList );
script_split->add_child(script_list);
- script_list->set_custom_minimum_size(Size2(70,0));
+ script_list->set_custom_minimum_size(Size2(0,0));
script_split->set_split_offset(70);
tab_container = memnew( TabContainer );
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 29d2a7774c..e47dcbf30f 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -3529,10 +3529,10 @@ void SpatialEditor::_instance_scene() {
void SpatialEditor::_unhandled_key_input(InputEvent p_event) {
- if (!is_visible())
+ if (!is_visible() || window_has_modal_stack())
return;
- {
+ {
EditorNode *en = editor;
EditorPlugin *over_plugin = en->get_editor_plugin_over();
diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp
index d034edc80d..7690d31e7b 100644
--- a/tools/editor/project_export.cpp
+++ b/tools/editor/project_export.cpp
@@ -258,6 +258,7 @@ void ProjectExportDialog::_sample_convert_edited(int what) {
EditorImportExport::get_singleton()->sample_set_action( EditorImportExport::SampleAction(sample_mode->get_selected()));
EditorImportExport::get_singleton()->sample_set_max_hz( sample_max_hz->get_val() );
EditorImportExport::get_singleton()->sample_set_trim( sample_trim->is_pressed() );
+ _save_export_cfg();
}