diff options
Diffstat (limited to 'scene')
| -rw-r--r-- | scene/gui/color_picker.cpp | 1 | ||||
| -rw-r--r-- | scene/gui/file_dialog.cpp | 7 | ||||
| -rw-r--r-- | scene/gui/line_edit.cpp | 1 | ||||
| -rw-r--r-- | scene/gui/range.cpp | 17 | ||||
| -rw-r--r-- | scene/gui/text_edit.cpp | 2 | ||||
| -rw-r--r-- | scene/gui/tree.cpp | 2 | ||||
| -rw-r--r-- | scene/main/http_request.cpp | 24 | ||||
| -rw-r--r-- | scene/main/instance_placeholder.cpp | 19 | ||||
| -rw-r--r-- | scene/main/instance_placeholder.h | 2 |
9 files changed, 53 insertions, 22 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 5e66544153..d6535ef511 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -660,6 +660,7 @@ void ColorPickerButton::set_color(const Color& p_color){ picker->set_color(p_color); update(); + emit_signal("color_changed",p_color); } Color ColorPickerButton::get_color() const{ diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index f942f15ed0..b0214b8648 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -403,11 +403,12 @@ void FileDialog::update_file_list() { while(!files.empty()) { bool match=patterns.empty(); + String match_str; for(List<String>::Element *E=patterns.front();E;E=E->next()) { if (files.front()->get().matchn(E->get())) { - + match_str=E->get(); match=true; break; } @@ -432,14 +433,14 @@ void FileDialog::update_file_list() { d["dir"]=false; ti->set_metadata(0,d); - if (file->get_text()==files.front()->get()) + if (file->get_text()==files.front()->get() || match_str==files.front()->get()) ti->select(0); } files.pop_front(); } - if (tree->get_root() && tree->get_root()->get_children()) + if (tree->get_root() && tree->get_root()->get_children() && tree->get_selected()==NULL) tree->get_root()->get_children()->select(0); files.clear(); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index eecc730f5c..0b06044b7c 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -918,6 +918,7 @@ void LineEdit::set_text(String p_text) { update(); cursor_pos=0; window_pos=0; + _text_changed(); } void LineEdit::clear() { diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index e056c55f71..ed58c4eb49 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -136,16 +136,25 @@ double Range::get_page() const { } void Range::set_unit_value(double p_value) { + + double v; + if (shared->exp_unit_value && get_min()>0) { double exp_min = Math::log(get_min())/Math::log(2); double exp_max = Math::log(get_max())/Math::log(2); - double v = Math::pow(2,exp_min+(exp_max-exp_min)*p_value); - - set_val( v ); + v = Math::pow(2,exp_min+(exp_max-exp_min)*p_value); } else { - set_val( (get_max() - get_min()) * p_value + get_min() ); + + double percent = (get_max() - get_min()) * p_value; + if (get_step() > 0) { + double steps = round(percent / get_step()); + v = steps * get_step() + get_min(); + } else { + v = percent + get_min(); + } } + set_val( v ); } double Range::get_unit_value() const { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 871a3ca68f..c585fff2a6 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3327,7 +3327,7 @@ void TextEdit::set_text(String p_text){ cursor_set_column(0); update(); setting_text=false; - + _text_changed_emit(); //get_range()->set(0); }; diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 912371142f..d974e09275 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1331,7 +1331,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2& int root_ofs = children_pos.x + (hide_folding?cache.hseparation:cache.item_margin); int parent_ofs = p_pos.x + (hide_folding?cache.hseparation:cache.item_margin); Point2i root_pos = Point2i(root_ofs, children_pos.y + label_h/2)-cache.offset+p_draw_ofs; - if (c->get_children() > 0) + if (c->get_children() != NULL) root_pos -= Point2i(cache.arrow->get_width(),0); Point2i parent_pos = Point2i(parent_ofs - cache.arrow->get_width()/2, p_pos.y + label_h/2 + cache.arrow->get_height()/2)-cache.offset+p_draw_ofs; diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index c713b5e4dc..4b6cbde859 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -35,7 +35,7 @@ void HTTPRequest::_redirect_request(const String& p_new_url) { Error HTTPRequest::_request() { - print_line("Requesting:\n\tURL: "+url+"\n\tString: "+request_string+"\n\tPort: "+itos(port)+"\n\tSSL: "+itos(use_ssl)+"\n\tValidate SSL: "+itos(validate_ssl)); + //print_line("Requesting:\n\tURL: "+url+"\n\tString: "+request_string+"\n\tPort: "+itos(port)+"\n\tSSL: "+itos(use_ssl)+"\n\tValidate SSL: "+itos(validate_ssl)); return client->connect(url,port,use_ssl,validate_ssl); } @@ -53,36 +53,36 @@ Error HTTPRequest::_parse_url(const String& p_url) { downloaded=0; redirections=0; - print_line("1 url: "+url); + //print_line("1 url: "+url); if (url.begins_with("http://")) { url=url.substr(7,url.length()-7); - print_line("no SSL"); + //print_line("no SSL"); } else if (url.begins_with("https://")) { url=url.substr(8,url.length()-8); use_ssl=true; port=443; - print_line("yes SSL"); + //print_line("yes SSL"); } else { ERR_EXPLAIN("Malformed URL"); ERR_FAIL_V(ERR_INVALID_PARAMETER); } - print_line("2 url: "+url); + //print_line("2 url: "+url); int slash_pos = url.find("/"); if (slash_pos!=-1) { request_string=url.substr(slash_pos,url.length()); url=url.substr(0,slash_pos); - print_line("request string: "+request_string); + //print_line("request string: "+request_string); } else { request_string="/"; - print_line("no request"); + //print_line("no request"); } - print_line("3 url: "+url); + //print_line("3 url: "+url); int colon_pos = url.find(":"); if (colon_pos!=-1) { @@ -91,7 +91,7 @@ Error HTTPRequest::_parse_url(const String& p_url) { ERR_FAIL_COND_V(port<1 || port > 65535,ERR_INVALID_PARAMETER); } - print_line("4 url: "+url); + //print_line("4 url: "+url); return OK; } @@ -224,7 +224,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) { response_headers.resize(0); downloaded=0; for (List<String>::Element *E=rheaders.front();E;E=E->next()) { - print_line("HEADER: "+E->get()); + //print_line("HEADER: "+E->get()); response_headers.push_back(E->get()); } @@ -245,7 +245,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) { } } - print_line("NEW LOCATION: "+new_request); + //print_line("NEW LOCATION: "+new_request); if (new_request!="") { //process redirect @@ -261,7 +261,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) { err = _request(); - print_line("new connection: "+itos(err)); + //print_line("new connection: "+itos(err)); if (err==OK) { request_sent=false; got_response=false; diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp index fb047ea5e4..15045a73d5 100644 --- a/scene/main/instance_placeholder.cpp +++ b/scene/main/instance_placeholder.cpp @@ -101,11 +101,28 @@ void InstancePlaceholder::replace_by_instance(const Ref<PackedScene> &p_custom_s base->remove_child(this); base->add_child(scene); base->move_child(scene,pos); - } +Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) { + + Dictionary ret; + StringArray order; + + for(List<PropSet>::Element *E=stored_values.front();E;E=E->next()) { + ret[E->get().name] = E->get().value; + if (p_with_order) + order.push_back(E->get().name); + }; + + if (p_with_order) + ret[".order"] = order; + + return ret; +}; + void InstancePlaceholder::_bind_methods() { + ObjectTypeDB::bind_method(_MD("get_stored_values","with_order"),&InstancePlaceholder::get_stored_values,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("replace_by_instance","custom_scene:PackedScene"),&InstancePlaceholder::replace_by_instance,DEFVAL(Variant())); ObjectTypeDB::bind_method(_MD("get_instance_path"),&InstancePlaceholder::get_instance_path); } diff --git a/scene/main/instance_placeholder.h b/scene/main/instance_placeholder.h index ef76686196..cacba49b39 100644 --- a/scene/main/instance_placeholder.h +++ b/scene/main/instance_placeholder.h @@ -57,6 +57,8 @@ public: void set_instance_path(const String& p_name); String get_instance_path() const; + Dictionary get_stored_values(bool p_with_order = false); + void replace_by_instance(const Ref<PackedScene>& p_custom_scene=Ref<PackedScene>()); InstancePlaceholder(); |