summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/image.cpp19
-rw-r--r--core/io/http_client.cpp1
-rw-r--r--core/variant_parser.cpp15
-rw-r--r--drivers/chibi/event_stream_chibi.cpp12
-rw-r--r--scene/2d/canvas_item.cpp7
-rw-r--r--scene/main/node.cpp4
-rw-r--r--scene/main/node.h2
-rw-r--r--scene/main/viewport.cpp17
-rw-r--r--scene/resources/packed_scene.cpp3
-rw-r--r--scene/resources/scene_format_text.cpp11
-rw-r--r--tools/editor/plugins/editor_preview_plugins.cpp10
-rw-r--r--tools/editor/plugins/sample_editor_plugin.cpp14
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/theme_editor_plugin.cpp83
-rw-r--r--tools/editor/plugins/theme_editor_plugin.h3
-rw-r--r--tools/editor/scene_tree_dock.cpp12
16 files changed, 146 insertions, 69 deletions
diff --git a/core/image.cpp b/core/image.cpp
index 57496683ef..d6ac3f28ea 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -1735,8 +1735,17 @@ Error Image::_decompress_bc() {
print_line("decompressing bc");
+ int wd=width,ht=height;
+ if (wd%4!=0) {
+ wd+=4-(wd%4);
+ }
+ if (ht%4!=0) {
+ ht+=4-(ht%4);
+ }
+
+
int mm;
- int size = _get_dst_image_size(width,height,FORMAT_RGBA,mm,mipmaps);
+ int size = _get_dst_image_size(wd,ht,FORMAT_RGBA,mm,mipmaps);
DVector<uint8_t> newdata;
newdata.resize(size);
@@ -1746,7 +1755,8 @@ Error Image::_decompress_bc() {
int rofs=0;
int wofs=0;
- int wd=width,ht=height;
+
+ //print_line("width: "+itos(wd)+" height: "+itos(ht));
for(int i=0;i<=mm;i++) {
@@ -2051,6 +2061,11 @@ Error Image::_decompress_bc() {
data=newdata;
format=FORMAT_RGBA;
+ if (wd!=width || ht!=height) {
+ //todo, crop
+ width=wd;
+ height=ht;
+ }
return OK;
}
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 3520680118..0dfae6584b 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -76,6 +76,7 @@ void HTTPClient::set_connection(const Ref<StreamPeer>& p_connection){
close();
connection=p_connection;
+ status=STATUS_CONNECTED;
}
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 886bea2910..dce873a306 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -1775,7 +1775,20 @@ Error VariantParser::parse_tag_assign_eof(Stream *p_stream, int &line, String &r
}
if (c>32) {
- if (c!='=') {
+ if (c=='"') { //quoted
+ p_stream->saved='"';
+ Token tk;
+ Error err = get_token(p_stream,tk,line,r_err_str);
+ if (err)
+ return err;
+ if (tk.type!=TK_STRING) {
+ r_err_str="Error reading quoted string";
+ return err;
+ }
+
+ what=tk.value;
+
+ } else if (c!='=') {
what+=String::chr(c);
} else {
r_assign=what;
diff --git a/drivers/chibi/event_stream_chibi.cpp b/drivers/chibi/event_stream_chibi.cpp
index 3449583d36..b88f4ee70e 100644
--- a/drivers/chibi/event_stream_chibi.cpp
+++ b/drivers/chibi/event_stream_chibi.cpp
@@ -616,7 +616,7 @@ void CPFileAccessWrapperImpl::store_dword(uint32_t p_dest){
Error EventStreamPlaybackChibi::_play() {
last_order=0;
- loops++;
+ loops=0;
player->play_start_song();
total_usec=0;
@@ -628,10 +628,12 @@ bool EventStreamPlaybackChibi::_update(AudioMixer* p_mixer, uint64_t p_usec){
total_usec+=p_usec;
mixer.process_usecs(p_usec,volume,pitch_scale,tempo_scale);
int order=player->get_current_order();
- if (order<last_order && !loop) {
- stop();
- } else {
- loops++;
+ if (order<last_order) {
+ if (!loop) {
+ stop();
+ } else {
+ loops++;
+ }
}
last_order=order;
return false;
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index fa9b040d92..eb37634b24 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -1003,11 +1003,14 @@ InputEvent CanvasItem::make_input_local(const InputEvent& p_event) const {
Vector2 CanvasItem::get_global_mouse_pos() const {
- return get_viewport_transform().affine_inverse().xform(Input::get_singleton()->get_mouse_pos());
+ ERR_FAIL_COND_V(!get_viewport(),Vector2());
+ return get_canvas_transform().affine_inverse().xform( get_viewport()->get_mouse_pos() );
}
Vector2 CanvasItem::get_local_mouse_pos() const{
- return (get_viewport_transform() * get_global_transform()).affine_inverse().xform(Input::get_singleton()->get_mouse_pos());
+ ERR_FAIL_COND_V(!get_viewport(),Vector2());
+
+ return get_global_transform().affine_inverse().xform( get_global_mouse_pos() );
}
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 50b0fe224e..edc97cbf46 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2081,6 +2081,10 @@ void Node::update_configuration_warning() {
}
+bool Node::is_owned_by_parent() const {
+ data.parent_owned;
+}
+
void Node::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_add_child_below_node","node:Node","child_node:Node","legible_unique_name"),&Node::add_child_below_node,DEFVAL(false));
diff --git a/scene/main/node.h b/scene/main/node.h
index a3b8d8de81..88334f32f0 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -313,6 +313,8 @@ public:
NodePath get_import_path() const;
#endif
+ bool is_owned_by_parent() const;
+
void get_argument_options(const StringName& p_function,int p_idx,List<String>*r_options) const;
void clear_internal_tree_resource_paths();
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 79502c74ce..a1df7062ea 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1574,6 +1574,14 @@ void Viewport::_gui_call_input(Control *p_control,const InputEvent& p_input) {
// _block();
+
+ //mouse wheel events can't be stopped
+ bool cant_stop_me_now = (p_input.type==InputEvent::MOUSE_BUTTON &&
+ (p_input.mouse_button.button_index==BUTTON_WHEEL_DOWN ||
+ p_input.mouse_button.button_index==BUTTON_WHEEL_UP ||
+ p_input.mouse_button.button_index==BUTTON_WHEEL_LEFT ||
+ p_input.mouse_button.button_index==BUTTON_WHEEL_RIGHT ) );
+
CanvasItem *ci=p_control;
while(ci) {
@@ -1589,7 +1597,7 @@ void Viewport::_gui_call_input(Control *p_control,const InputEvent& p_input) {
break;
if (gui.key_event_accepted)
break;
- if (control->data.stop_mouse && (p_input.type==InputEvent::MOUSE_BUTTON || p_input.type==InputEvent::MOUSE_MOTION))
+ if (!cant_stop_me_now && control->data.stop_mouse && (p_input.type==InputEvent::MOUSE_BUTTON || p_input.type==InputEvent::MOUSE_MOTION))
break;
}
@@ -1836,8 +1844,9 @@ void Viewport::_gui_input_event(InputEvent p_event) {
Size2 pos = mpos;
pos = gui.focus_inv_xform.xform(pos);
-
- gui.mouse_over->drop_data(pos,gui.drag_data);
+ if (gui.mouse_over->can_drop_data(pos,gui.drag_data)) {
+ gui.mouse_over->drop_data(pos,gui.drag_data);
+ }
gui.drag_data=Variant();
_propagate_viewport_notification(this,NOTIFICATION_DRAG_END);
//change mouse accordingly
@@ -2360,8 +2369,8 @@ void Viewport::input(const InputEvent& p_event) {
ERR_FAIL_COND(!is_inside_tree());
- get_tree()->_call_input_pause(input_group,"_input",p_event);
_gui_input_event(p_event);
+ get_tree()->_call_input_pause(input_group,"_input",p_event);
//get_tree()->call_group(SceneTree::GROUP_CALL_REVERSE|SceneTree::GROUP_CALL_REALTIME|SceneTree::GROUP_CALL_MULIILEVEL,gui_input_group,"_gui_input",p_event); //special one for GUI, as controls use their own process check
}
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 5ac7946391..ac528e6659 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -1413,8 +1413,7 @@ NodePath SceneState::get_node_path(int p_idx,bool p_for_parent) const {
}
}
- for(int i=0;i<base_path.get_name_count();i++) {
- StringName sn = base_path.get_name(i);
+ for(int i=base_path.get_name_count()-1;i>=0;i--) {
sub_path.insert(0,base_path.get_name(i));
}
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index a734f63ac2..c7e2fc4e73 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -1140,7 +1140,12 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant& p_variant,b
}
+static String _valprop(const String& p_name) {
+ if (p_name.find("\"")!=-1 || p_name.find("=")!=-1 || p_name.find(" ")!=-1)
+ return "\""+p_name.c_escape()+"\"";
+ return p_name;
+}
Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_resource,uint32_t p_flags) {
@@ -1296,7 +1301,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re
String vars;
VariantWriter::write_to_string(value,vars,_write_resources,this);
- f->store_string(name+" = "+vars+"\n");
+ f->store_string(_valprop(name)+" = "+vars+"\n");
}
@@ -1320,8 +1325,6 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re
Vector<StringName> groups = state->get_node_groups(i);
- if (instance.is_valid())
- print_line("for path "+String(path)+" instance "+instance->get_path());
String header="[node";
header+=" name=\""+String(name)+"\"";
@@ -1372,7 +1375,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re
String vars;
VariantWriter::write_to_string(state->get_node_property_value(i,j),vars,_write_resources,this);
- f->store_string(String(state->get_node_property_name(i,j))+" = "+vars+"\n");
+ f->store_string(_valprop(String(state->get_node_property_name(i,j)))+" = "+vars+"\n");
}
if (state->get_node_property_count(i)) {
diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp
index f5470451ba..a057e6c2a1 100644
--- a/tools/editor/plugins/editor_preview_plugins.cpp
+++ b/tools/editor/plugins/editor_preview_plugins.cpp
@@ -669,7 +669,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
for(int j=0;j<h;j++) {
float v = (j/(float)h) * 2.0 - 1.0;
- uint8_t* imgofs = &imgw[(j*w+i)*3];
+ uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3];
if (v>min[0] && v<max[0]) {
imgofs[0]=255;
imgofs[1]=150;
@@ -687,8 +687,8 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
float max[2]={-1e10,-1e10};
float min[2]={1e10,1e10};
int c=stereo?2:1;
- int from = i*len/w;
- int to = (i+1)*len/w;
+ int from = uint64_t(i)*len/w;
+ int to = (uint64_t(i)+1)*len/w;
if (to>=len)
to=len-1;
@@ -699,7 +699,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
for(int k=from;k<=to;k++) {
- float v = src[k*c+j]/32768.0;
+ float v = src[uint64_t(k)*c+j]/32768.0;
if (v>max[j])
max[j]=v;
if (v<min[j])
@@ -715,7 +715,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
for(int k=from;k<=to;k++) {
- float v = src[k*c+j]/128.0;
+ float v = src[uint64_t(k)*c+j]/128.0;
if (v>max[j])
max[j]=v;
if (v<min[j])
diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp
index a3891a648b..b094184a29 100644
--- a/tools/editor/plugins/sample_editor_plugin.cpp
+++ b/tools/editor/plugins/sample_editor_plugin.cpp
@@ -211,7 +211,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
for(int j=0;j<h;j++) {
float v = (j/(float)h) * 2.0 - 1.0;
- uint8_t* imgofs = &imgw[(j*w+i)*3];
+ uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3];
if (v>min[0] && v<max[0]) {
imgofs[0]=255;
imgofs[1]=150;
@@ -229,8 +229,8 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
float max[2]={-1e10,-1e10};
float min[2]={1e10,1e10};
int c=stereo?2:1;
- int from = i*len/w;
- int to = (i+1)*len/w;
+ int from = uint64_t(i)*len/w;
+ int to = (uint64_t(i)+1)*len/w;
if (to>=len)
to=len-1;
@@ -241,7 +241,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
for(int k=from;k<=to;k++) {
- float v = src[k*c+j]/32768.0;
+ float v = src[uint64_t(k)*c+j]/32768.0;
if (v>max[j])
max[j]=v;
if (v<min[j])
@@ -257,7 +257,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
for(int k=from;k<=to;k++) {
- float v = src[k*c+j]/128.0;
+ float v = src[uint64_t(k)*c+j]/128.0;
if (v>max[j])
max[j]=v;
if (v<min[j])
@@ -270,7 +270,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
if (!stereo) {
for(int j=0;j<h;j++) {
float v = (j/(float)h) * 2.0 - 1.0;
- uint8_t* imgofs = &imgw[(j*w+i)*3];
+ uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3];
if (v>min[0] && v<max[0]) {
imgofs[0]=255;
imgofs[1]=150;
@@ -297,7 +297,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0;
}
- uint8_t* imgofs = &imgw[(j*w+i)*3];
+ uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3];
if (v>min[half] && v<max[half]) {
imgofs[0]=255;
imgofs[1]=150;
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 4061bb9827..7de80e767b 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -2635,7 +2635,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save", TTR("Save"), KEY_MASK_ALT|KEY_MASK_CMD|KEY_S), FILE_SAVE);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_as", TTR("Save As..")), FILE_SAVE_AS);
- file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTR("Save All"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_S), FILE_SAVE_ALL);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTR("Save All"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_MASK_ALT|KEY_S), FILE_SAVE_ALL);
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Prev"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_LEFT), WINDOW_PREV);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_RIGHT), WINDOW_NEXT);
diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp
index 77097b11f6..5db331ba45 100644
--- a/tools/editor/plugins/theme_editor_plugin.cpp
+++ b/tools/editor/plugins/theme_editor_plugin.cpp
@@ -348,7 +348,7 @@ void ThemeEditor::_dialog_cbk() {
names.clear();
Theme::get_default()->get_icon_list(fromtype,&names);
for(List<StringName>::Element *E=names.front();E;E=E->next()) {
- theme->set_icon(E->get(),fromtype,Theme::get_default()->get_icon(E->get(),fromtype));
+ theme->set_icon(E->get(),fromtype,Ref<Texture>());
}
@@ -357,7 +357,7 @@ void ThemeEditor::_dialog_cbk() {
names.clear();
Theme::get_default()->get_stylebox_list(fromtype,&names);
for(List<StringName>::Element *E=names.front();E;E=E->next()) {
- theme->set_stylebox(E->get(),fromtype,Theme::get_default()->get_stylebox(E->get(),fromtype));
+ theme->set_stylebox(E->get(),fromtype,Ref<StyleBox>());
}
@@ -366,7 +366,7 @@ void ThemeEditor::_dialog_cbk() {
names.clear();
Theme::get_default()->get_font_list(fromtype,&names);
for(List<StringName>::Element *E=names.front();E;E=E->next()) {
- theme->set_font(E->get(),fromtype,Theme::get_default()->get_font(E->get(),fromtype));
+ theme->set_font(E->get(),fromtype,Ref<Font>());
}
}
@@ -537,7 +537,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
add_del_dialog->set_title(TTR("Add Item"));
add_del_dialog->get_ok()->set_text(TTR("Add"));
- add_del_dialog->popup_centered(Size2(490,85));
+ add_del_dialog->popup_centered(Size2(490,85)*EDSCALE);
base_theme=Theme::get_default();
@@ -545,7 +545,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
add_del_dialog->set_title(TTR("Add All Items"));
add_del_dialog->get_ok()->set_text(TTR("Add All"));
- add_del_dialog->popup_centered(Size2(240,85));
+ add_del_dialog->popup_centered(Size2(240,85)*EDSCALE);
base_theme=Theme::get_default();
@@ -559,7 +559,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
add_del_dialog->set_title(TTR("Remove Item"));
add_del_dialog->get_ok()->set_text(TTR("Remove"));
- add_del_dialog->popup_centered(Size2(490,85));
+ add_del_dialog->popup_centered(Size2(490,85)*EDSCALE);
base_theme=theme;
@@ -567,7 +567,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
add_del_dialog->set_title("Remove All Items");
add_del_dialog->get_ok()->set_text("Remove All");
- add_del_dialog->popup_centered(Size2(240,85));
+ add_del_dialog->popup_centered(Size2(240,85)*EDSCALE);
base_theme=Theme::get_default();
@@ -583,12 +583,14 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
List<StringName> types;
base_theme->get_type_list(&types);
+
type_menu->get_popup()->clear();;
if (p_option==0 || p_option==1) {//add
List<StringName> new_types;
theme->get_type_list(&new_types);
+
//uh kind of sucks
for(List<StringName>::Element *F=new_types.front();F;F=F->next()) {
@@ -606,8 +608,8 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
}
}
- types.sort();
-
+ //types.sort();
+ types.sort_custom<StringName::AlphCompare>();
for(List<StringName>::Element *E=types.front();E;E=E->next()) {
type_menu->get_popup()->add_item( E->get() );
@@ -641,15 +643,23 @@ ThemeEditor::ThemeEditor() {
time_left=0;
+ scroll = memnew( ScrollContainer );
+ add_child(scroll);
+ scroll->set_area_as_parent_rect(3);
+ scroll->set_margin(MARGIN_TOP,30*EDSCALE);
+ //scroll->set_enable_h_scroll(true);
+ scroll->set_enable_v_scroll(true);
+ scroll->set_enable_h_scroll(false);
+
Panel * panel = memnew( Panel );
- add_child(panel);
- panel->set_area_as_parent_rect(0);
- panel->set_margin(MARGIN_TOP,25);
+ scroll->add_child(panel);
+ panel->set_custom_minimum_size(Size2(500,800)*EDSCALE);
panel->set_theme(Theme::get_default());
+ panel->set_h_size_flags(SIZE_EXPAND_FILL);
main_vb= memnew( VBoxContainer );
panel->add_child(main_vb);
- main_vb->set_area_as_parent_rect(4);
+ main_vb->set_area_as_parent_rect(4*EDSCALE);
HBoxContainer *hb_menu = memnew(HBoxContainer);
@@ -667,7 +677,8 @@ ThemeEditor::ThemeEditor() {
theme_menu->get_popup()->add_item(TTR("Create Empty Template"),POPUP_CREATE_EMPTY);
theme_menu->get_popup()->add_item(TTR("Create Empty Editor Template"),POPUP_CREATE_EDITOR_EMPTY);
- hb_menu->add_child(theme_menu);
+ add_child(theme_menu);
+ theme_menu->set_pos(Vector2(3,3)*EDSCALE);
theme_menu->get_popup()->connect("item_pressed", this,"_theme_menu_cbk");
@@ -742,26 +753,26 @@ ThemeEditor::ThemeEditor() {
pb->set_val(50);
first_vb->add_child( pb);
Panel *pn=memnew( Panel );
- pn->set_custom_minimum_size(Size2(40,40));
+ pn->set_custom_minimum_size(Size2(40,40)*EDSCALE);
first_vb->add_child( pn);
- first_vb->add_constant_override("separation",10);
+ first_vb->add_constant_override("separation",10*EDSCALE);
VBoxContainer *second_vb = memnew( VBoxContainer );
second_vb->set_h_size_flags(SIZE_EXPAND_FILL);
main_hb->add_child(second_vb);
- second_vb->add_constant_override("separation",10);
+ second_vb->add_constant_override("separation",10*EDSCALE);
LineEdit *le = memnew( LineEdit );
le->set_text("LineEdit");
second_vb->add_child(le);
TextEdit *te = memnew( TextEdit );
te->set_text("TextEdit");
//te->set_v_size_flags(SIZE_EXPAND_FILL);
- te->set_custom_minimum_size(Size2(0,160));
+ te->set_custom_minimum_size(Size2(0,160)*EDSCALE);
second_vb->add_child(te);
Tree *test_tree = memnew(Tree);
second_vb->add_child(test_tree);
- test_tree->set_custom_minimum_size(Size2(0,160));
+ test_tree->set_custom_minimum_size(Size2(0,160)*EDSCALE);
TreeItem *item = test_tree->create_item();
@@ -789,7 +800,7 @@ ThemeEditor::ThemeEditor() {
main_hb->add_child(third_vb);
HBoxContainer *vhb = memnew( HBoxContainer );
- vhb->set_custom_minimum_size(Size2(0,160));
+ vhb->set_custom_minimum_size(Size2(0,160)*EDSCALE);
vhb->add_child(memnew(VSeparator));
vhb->add_child(memnew(VSlider));
vhb->add_child(memnew(VScrollBar));
@@ -797,7 +808,7 @@ ThemeEditor::ThemeEditor() {
TabContainer *tc = memnew( TabContainer );
third_vb->add_child(tc);
- tc->set_custom_minimum_size(Size2(0,160));
+ tc->set_custom_minimum_size(Size2(0,160)*EDSCALE);
Control *tcc = memnew( Control );
tcc->set_name(TTR("Tab 1"));
tc->add_child(tcc);
@@ -808,7 +819,7 @@ ThemeEditor::ThemeEditor() {
tcc->set_name(TTR("Tab 3"));
tc->add_child(tcc);
- main_hb->add_constant_override("separation",20);
+ main_hb->add_constant_override("separation",20*EDSCALE);
@@ -871,37 +882,37 @@ ThemeEditor::ThemeEditor() {
Label *l = memnew( Label );
- l->set_pos( Point2(5,5) );
+ l->set_pos( Point2(5,5)*EDSCALE );
l->set_text(TTR("Type:"));
add_del_dialog->add_child(l);
dtype_select_label=l;
type_edit = memnew( LineEdit );
- type_edit->set_pos(Point2(5,25));
- type_edit->set_size(Point2(150,5));
+ type_edit->set_pos(Point2(5,25)*EDSCALE);
+ type_edit->set_size(Point2(150,5)*EDSCALE);
add_del_dialog->add_child(type_edit);
type_menu = memnew( MenuButton );
- type_menu->set_pos(Point2(160,25));
- type_menu->set_size(Point2(30,5));
+ type_menu->set_pos(Point2(160,25)*EDSCALE);
+ type_menu->set_size(Point2(30,5)*EDSCALE);
type_menu->set_text("..");
add_del_dialog->add_child(type_menu);
type_menu->get_popup()->connect("item_pressed", this,"_type_menu_cbk");
l = memnew( Label );
- l->set_pos( Point2(200,5) );
+ l->set_pos( Point2(200,5)*EDSCALE );
l->set_text(TTR("Name:"));
add_del_dialog->add_child(l);
name_select_label=l;
name_edit = memnew( LineEdit );
- name_edit->set_pos(Point2(200,25));
- name_edit->set_size(Point2(150,5));
+ name_edit->set_pos(Point2(200,25)*EDSCALE);
+ name_edit->set_size(Point2(150,5)*EDSCALE);
add_del_dialog->add_child(name_edit);
name_menu = memnew( MenuButton );
- name_menu->set_pos(Point2(360,25));
- name_menu->set_size(Point2(30,5));
+ name_menu->set_pos(Point2(360,25)*EDSCALE);
+ name_menu->set_size(Point2(30,5)*EDSCALE);
name_menu->set_text("..");
add_del_dialog->add_child(name_menu);
@@ -910,7 +921,7 @@ ThemeEditor::ThemeEditor() {
name_menu->get_popup()->connect("item_pressed", this,"_name_menu_cbk");
type_select_label= memnew( Label );
- type_select_label->set_pos( Point2(400,5) );
+ type_select_label->set_pos( Point2(400,5)*EDSCALE );
type_select_label->set_text(TTR("Data Type:"));
add_del_dialog->add_child(type_select_label);
@@ -920,8 +931,8 @@ ThemeEditor::ThemeEditor() {
type_select->add_item(TTR("Font"));
type_select->add_item(TTR("Color"));
type_select->add_item(TTR("Constant"));
- type_select->set_pos( Point2( 400,25 ) );
- type_select->set_size( Point2( 80,5 ) );
+ type_select->set_pos( Point2( 400,25 )*EDSCALE );
+ type_select->set_size( Point2( 80,5 )*EDSCALE );
add_del_dialog->add_child(type_select);
@@ -974,7 +985,7 @@ ThemeEditorPlugin::ThemeEditorPlugin(EditorNode *p_node) {
editor=p_node;
theme_editor = memnew( ThemeEditor );
- theme_editor->set_custom_minimum_size(Size2(0,500));
+ theme_editor->set_custom_minimum_size(Size2(0,200));
// p_node->get_viewport()->add_child(theme_editor);
button=editor->add_bottom_panel_item("Theme",theme_editor);
diff --git a/tools/editor/plugins/theme_editor_plugin.h b/tools/editor/plugins/theme_editor_plugin.h
index 1384fa6b69..ea8f8c1d3c 100644
--- a/tools/editor/plugins/theme_editor_plugin.h
+++ b/tools/editor/plugins/theme_editor_plugin.h
@@ -35,16 +35,19 @@
#include "scene/gui/file_dialog.h"
#include "scene/gui/check_box.h"
#include "scene/gui/button_group.h"
+#include "scene/gui/scroll_container.h"
#include "tools/editor/editor_node.h"
+
class ThemeEditor : public Control {
OBJ_TYPE( ThemeEditor, Control );
+ ScrollContainer *scroll;
VBoxContainer *main_vb;
Ref<Theme> theme;
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index 69d6d97980..30ffdf6664 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -1388,6 +1388,13 @@ void SceneTreeDock::_create() {
}
String newname=n->get_name();
+
+ List<Node*> to_erase;
+ for(int i=0;i<n->get_child_count();i++) {
+ if (n->get_child(i)->get_owner()==NULL && n->is_owned_by_parent()) {
+ to_erase.push_back(n->get_child(i));
+ }
+ }
n->replace_by(newnode,true);
if (n==edited_scene) {
@@ -1408,6 +1415,11 @@ void SceneTreeDock::_create() {
memdelete(n);
+ while(to_erase.front()) {
+ memdelete(to_erase.front()->get());
+ to_erase.pop_front();
+ }
+
}