summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/globals.cpp20
-rw-r--r--core/globals.h7
-rw-r--r--drivers/theora/video_stream_theora.cpp8
-rw-r--r--drivers/theora/video_stream_theora.h1
-rw-r--r--scene/gui/split_container.cpp1
-rw-r--r--tools/editor/project_settings.cpp28
-rw-r--r--tools/editor/project_settings.h2
-rw-r--r--tools/editor/property_editor.cpp171
-rw-r--r--tools/editor/property_editor.h25
-rw-r--r--tools/editor/settings_config_dialog.cpp12
-rw-r--r--tools/editor/settings_config_dialog.h2
11 files changed, 251 insertions, 26 deletions
diff --git a/core/globals.cpp b/core/globals.cpp
index fd0f2dbe14..eed37c2308 100644
--- a/core/globals.cpp
+++ b/core/globals.cpp
@@ -132,8 +132,12 @@ bool Globals::_set(const StringName& p_name, const Variant& p_value) {
if (props.has(p_name)) {
if (!props[p_name].overrided)
props[p_name].variant=p_value;
+
+ if (props[p_name].order>=NO_ORDER_BASE && registering_order) {
+ props[p_name].order=last_order++;
+ }
} else {
- props[p_name]=VariantContainer(p_value,last_order++);
+ props[p_name]=VariantContainer(p_value,last_order++ + registering_order?0:NO_ORDER_BASE);
}
}
@@ -741,6 +745,10 @@ static Variant _decode_variant(const String& p_string) {
return Variant();
}
+void Globals::set_registering_order(bool p_enable) {
+
+ registering_order=p_enable;
+}
Error Globals::_load_settings_binary(const String p_path) {
@@ -760,6 +768,8 @@ Error Globals::_load_settings_binary(const String p_path) {
ERR_FAIL_V(ERR_FILE_CORRUPT;)
}
+ set_registering_order(false);
+
uint32_t count=f->get_32();
for(int i=0;i<count;i++) {
@@ -784,6 +794,9 @@ Error Globals::_load_settings_binary(const String p_path) {
set_persisting(key,true);
}
+ set_registering_order(true);
+
+
return OK;
}
Error Globals::_load_settings(const String p_path) {
@@ -802,6 +815,8 @@ Error Globals::_load_settings(const String p_path) {
String section;
String subpath;
+ set_registering_order(false);
+
int line_count = 0;
while(!f->eof_reached()) {
@@ -877,6 +892,7 @@ Error Globals::_load_settings(const String p_path) {
memdelete(f);
+ set_registering_order(true);
return OK;
}
@@ -1388,7 +1404,7 @@ Globals::Globals() {
singleton=this;
last_order=0;
disable_platform_override=false;
-
+ registering_order=true;
Array va;
diff --git a/core/globals.h b/core/globals.h
index 25c7f96be2..bfa400988f 100644
--- a/core/globals.h
+++ b/core/globals.h
@@ -54,6 +54,10 @@ public:
protected:
+ enum {
+ NO_ORDER_BASE=1<<18
+ };
+
struct VariantContainer {
int order;
bool persist;
@@ -64,6 +68,7 @@ protected:
VariantContainer(const Variant& p_variant, int p_order, bool p_persist=false) { variant=p_variant; order=p_order; hide_from_editor=false; persist=p_persist; overrided=false; }
};
+ bool registering_order;
int last_order;
Map<StringName,VariantContainer> props;
String resource_path;
@@ -134,6 +139,8 @@ public:
bool is_using_datapack() const;
+ void set_registering_order(bool p_registering);
+
Globals();
~Globals();
diff --git a/drivers/theora/video_stream_theora.cpp b/drivers/theora/video_stream_theora.cpp
index 3fad19b476..3c214ce48a 100644
--- a/drivers/theora/video_stream_theora.cpp
+++ b/drivers/theora/video_stream_theora.cpp
@@ -476,11 +476,13 @@ Ref<Texture> VideoStreamPlaybackTheora::get_texture() {
void VideoStreamPlaybackTheora::update(float p_delta) {
- if (!playing) {
+ if (!playing || paused) {
//printf("not playing\n");
return;
};
+
+
#ifdef THEORA_USE_THREAD_STREAMING
thread_sem->post();
#endif
@@ -730,12 +732,13 @@ bool VideoStreamPlaybackTheora::is_playing() const {
void VideoStreamPlaybackTheora::set_paused(bool p_paused) {
+ paused=p_paused;
//pau = !p_paused;
};
bool VideoStreamPlaybackTheora::is_paused(bool p_paused) const {
- return playing;
+ return paused;
};
void VideoStreamPlaybackTheora::set_loop(bool p_enable) {
@@ -830,6 +833,7 @@ VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
playing = false;
frames_pending = 0;
videobuf_time = 0;
+ paused=false;
buffering=false;
texture = Ref<ImageTexture>( memnew(ImageTexture ));
diff --git a/drivers/theora/video_stream_theora.h b/drivers/theora/video_stream_theora.h
index c15ef31cfc..3e144c0125 100644
--- a/drivers/theora/video_stream_theora.h
+++ b/drivers/theora/video_stream_theora.h
@@ -69,6 +69,7 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
AudioMixCallback mix_callback;
void* mix_udata;
+ bool paused;
#ifdef THEORA_USE_THREAD_STREAMING
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index 49067bb3a0..a525eb121d 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -451,6 +451,7 @@ SplitContainer::SplitContainer(bool p_vertical) {
dragging=false;
collapsed=false;
dragger_visible=true;
+
}
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index b9a28312e2..879fe1bda5 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -519,7 +519,7 @@ void ProjectSettings::popup_project_settings() {
void ProjectSettings::_item_selected() {
- TreeItem *ti = globals_editor->get_scene_tree()->get_selected();
+ TreeItem *ti = globals_editor->get_property_editor()->get_scene_tree()->get_selected();
if (!ti)
return;
if (!ti->get_parent())
@@ -563,7 +563,7 @@ void ProjectSettings::_item_add() {
String name = catname+"/"+propname;
Globals::get_singleton()->set(name,value);
- globals_editor->update_tree();
+ globals_editor->get_property_editor()->update_tree();
}
void ProjectSettings::_item_del() {
@@ -575,7 +575,7 @@ void ProjectSettings::_item_del() {
String name = catname+"/"+propname;
Globals::get_singleton()->set(name,Variant());
- globals_editor->update_tree();
+ globals_editor->get_property_editor()->update_tree();
}
@@ -695,7 +695,7 @@ void ProjectSettings::_settings_prop_edited(const String& p_name) {
Globals::get_singleton()->set_persisting(p_name,true);
// globals_editor->update_property(p_name);
- globals_editor->update_tree();
+ globals_editor->get_property_editor()->update_tree();
}
_settings_changed();
}
@@ -730,7 +730,7 @@ void ProjectSettings::_copy_to_platform(int p_which) {
name = catname+"/"+propname;
Globals::get_singleton()->set(name,value);
- globals_editor->update_tree();
+ globals_editor->get_property_editor()->update_tree();
}
@@ -1234,7 +1234,7 @@ void ProjectSettings::_update_autoload() {
void ProjectSettings::_toggle_search_bar(bool p_pressed) {
- globals_editor->set_use_filter(p_pressed);
+ globals_editor->get_property_editor()->set_use_filter(p_pressed);
if (p_pressed) {
@@ -1255,7 +1255,7 @@ void ProjectSettings::_clear_search_box() {
return;
search_box->clear();
- globals_editor->update_tree();
+ globals_editor->get_property_editor()->update_tree();
}
void ProjectSettings::_bind_methods() {
@@ -1398,15 +1398,15 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
search_bar->add_child(clear_button);
clear_button->connect("pressed",this,"_clear_search_box");
- globals_editor = memnew( PropertyEditor );
+ globals_editor = memnew( SectionedPropertyEditor );
props_base->add_child(globals_editor);
- globals_editor->hide_top_label();
+ //globals_editor->hide_top_label();
globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- globals_editor->register_text_enter(search_box);
- globals_editor->set_capitalize_paths(false);
- globals_editor->get_scene_tree()->connect("cell_selected",this,"_item_selected");
- globals_editor->connect("property_toggled",this,"_item_checked");
- globals_editor->connect("property_edited",this,"_settings_prop_edited");
+ globals_editor->get_property_editor()->register_text_enter(search_box);
+ globals_editor->get_property_editor()->set_capitalize_paths(false);
+ globals_editor->get_property_editor()->get_scene_tree()->connect("cell_selected",this,"_item_selected");
+ globals_editor->get_property_editor()->connect("property_toggled",this,"_item_checked");
+ globals_editor->get_property_editor()->connect("property_edited",this,"_settings_prop_edited");
/*
Button *save = memnew( Button );
diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h
index 225a556eb8..f201f5c48f 100644
--- a/tools/editor/project_settings.h
+++ b/tools/editor/project_settings.h
@@ -46,7 +46,7 @@ class ProjectSettings : public AcceptDialog {
EditorData *data;
UndoRedo *undo_redo;
- PropertyEditor *globals_editor;
+ SectionedPropertyEditor *globals_editor;
HBoxContainer *search_bar;
ToolButton *search_button;
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index c44cfa3d6e..1893c175a1 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -3638,3 +3638,174 @@ PropertyEditor::~PropertyEditor()
}
+/////////////////////////////
+
+
+
+
+
+class SectionedPropertyEditorFilter : public Object {
+
+ OBJ_TYPE( SectionedPropertyEditorFilter, Object );
+
+ Object *edited;
+ String section;
+
+ bool _set(const StringName& p_name, const Variant& p_value) {
+
+ if (!edited)
+ return false;
+
+ String name=p_name;
+ if (section!="") {
+ name=section+"/"+name;
+ }
+
+ bool valid;
+ edited->set(name,p_value,&valid);
+ return valid;
+ }
+
+ bool _get(const StringName& p_name,Variant &r_ret) const{
+
+ if (!edited)
+ return false;
+
+ String name=p_name;
+ if (section!="") {
+ name=section+"/"+name;
+ }
+
+ bool valid=false;
+
+ r_ret=edited->get(name,&valid);
+ return valid;
+
+
+ }
+ void _get_property_list(List<PropertyInfo> *p_list) const{
+
+ if (!edited)
+ return;
+
+ List<PropertyInfo> pinfo;
+ edited->get_property_list(&pinfo);
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+
+ PropertyInfo pi=E->get();
+ int sp = pi.name.find("/");
+ if (sp!=-1) {
+ String ss = pi.name.substr(0,sp);
+
+ if (ss==section) {
+ pi.name=pi.name.substr(sp+1,pi.name.length());
+ p_list->push_back(pi);
+ }
+ } else {
+ if (section=="")
+ p_list->push_back(pi);
+ }
+ }
+
+ }
+public:
+
+ void set_section(const String& p_section) {
+
+ section=p_section;
+ _change_notify();
+ }
+
+ void set_edited(Object* p_edited) {
+ edited=p_edited;
+ _change_notify();
+ }
+
+ SectionedPropertyEditorFilter() {
+ edited=NULL;
+ }
+
+};
+
+
+void SectionedPropertyEditor::_bind_methods() {
+
+ ObjectTypeDB::bind_method("_section_selected",&SectionedPropertyEditor::_section_selected);
+}
+
+void SectionedPropertyEditor::_section_selected(int p_which) {
+
+ filter->set_section( sections->get_item_metadata(p_which) );
+}
+
+void SectionedPropertyEditor::edit(Object* p_object) {
+
+ List<PropertyInfo> pinfo;
+ if (p_object)
+ p_object->get_property_list(&pinfo);
+ sections->clear();
+
+ Set<String> existing_sections;
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+
+ PropertyInfo pi=E->get();
+ if (pi.usage&PROPERTY_USAGE_CATEGORY)
+ continue;
+ if (pi.name.find(":")!=-1 || pi.name=="script/script")
+ continue;
+ int sp = pi.name.find("/");
+ if (sp!=-1) {
+ String sname=pi.name.substr(0,sp);
+ if (!existing_sections.has(sname)) {
+ existing_sections.insert(sname);
+ sections->add_item(sname.capitalize());
+ sections->set_item_metadata(sections->get_item_count()-1,sname);
+ }
+
+ } else {
+ if (!existing_sections.has("")) {
+ existing_sections.insert("");
+ sections->add_item("Global");
+ sections->set_item_metadata(sections->get_item_count()-1,"");
+ }
+ }
+
+
+ }
+
+ //sections->sort_items_by_text();
+
+
+ filter->set_edited(p_object);
+ editor->edit(filter);
+
+ sections->select(0);
+ _section_selected(0);
+
+}
+
+PropertyEditor *SectionedPropertyEditor::get_property_editor() {
+
+ return editor;
+}
+
+SectionedPropertyEditor::SectionedPropertyEditor() {
+
+ sections = memnew( ItemList );
+ add_child(sections);
+ sections->set_custom_minimum_size(Size2(160,0));
+ filter = memnew( SectionedPropertyEditorFilter );
+ editor = memnew( PropertyEditor );
+ editor->get_scene_tree()->set_column_titles_visible(false);
+ add_child(editor);
+ editor->set_h_size_flags(SIZE_EXPAND_FILL);
+ editor->hide_top_label();
+
+ sections->connect("item_selected",this,"_section_selected");
+
+}
+
+SectionedPropertyEditor::~SectionedPropertyEditor() {
+
+ memdelete(filter);
+}
diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h
index e933d7ab3b..7579ba7ded 100644
--- a/tools/editor/property_editor.h
+++ b/tools/editor/property_editor.h
@@ -39,6 +39,7 @@
#include "scene/gui/texture_frame.h"
#include "scene/gui/text_edit.h"
#include "scene/gui/check_button.h"
+#include "scene/gui/split_container.h"
#include "scene_tree_editor.h"
/**
@@ -247,4 +248,28 @@ public:
};
+
+class SectionedPropertyEditorFilter;
+
+class SectionedPropertyEditor : public HBoxContainer {
+
+
+ OBJ_TYPE(SectionedPropertyEditor,HBoxContainer);
+ ItemList *sections;
+ SectionedPropertyEditorFilter *filter;
+ PropertyEditor *editor;
+
+
+ static void _bind_methods();
+ void _section_selected(int p_which);
+
+public:
+
+ PropertyEditor *get_property_editor();
+ void edit(Object* p_object);
+
+ SectionedPropertyEditor();
+ ~SectionedPropertyEditor();
+};
+
#endif
diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp
index 6d8f849427..d3c9e39cbb 100644
--- a/tools/editor/settings_config_dialog.cpp
+++ b/tools/editor/settings_config_dialog.cpp
@@ -71,7 +71,7 @@ void EditorSettingsDialog::popup_edit_settings() {
return;
property_editor->edit(EditorSettings::get_singleton());
- property_editor->update_tree();
+ property_editor->get_property_editor()->update_tree();
search_box->select_all();
search_box->grab_focus();
@@ -254,7 +254,7 @@ void EditorSettingsDialog::_clear_search_box() {
return;
search_box->clear();
- property_editor->update_tree();
+ property_editor->get_property_editor()->update_tree();
}
void EditorSettingsDialog::_notification(int p_what) {
@@ -306,10 +306,10 @@ EditorSettingsDialog::EditorSettingsDialog() {
hbc->add_child(clear_button);
clear_button->connect("pressed",this,"_clear_search_box");
- property_editor = memnew( PropertyEditor );
- property_editor->hide_top_label();
- property_editor->set_use_filter(true);
- property_editor->register_text_enter(search_box);
+ property_editor = memnew( SectionedPropertyEditor );
+ //property_editor->hide_top_label();
+ property_editor->get_property_editor()->set_use_filter(true);
+ property_editor->get_property_editor()->register_text_enter(search_box);
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(property_editor);
diff --git a/tools/editor/settings_config_dialog.h b/tools/editor/settings_config_dialog.h
index 50159cf488..4934c8c97b 100644
--- a/tools/editor/settings_config_dialog.h
+++ b/tools/editor/settings_config_dialog.h
@@ -53,7 +53,7 @@ class EditorSettingsDialog : public AcceptDialog {
Tree *plugins;
LineEdit *search_box;
ToolButton *clear_button;
- PropertyEditor *property_editor;
+ SectionedPropertyEditor *property_editor;
Timer *timer;