summaryrefslogtreecommitdiff
path: root/tools/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/editor_node.cpp')
-rw-r--r--tools/editor/editor_node.cpp119
1 files changed, 20 insertions, 99 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 1132db5991..5e946e0ecc 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -743,100 +743,6 @@ void EditorNode::_set_scene_metadata(const String& p_file) {
}
-static Error _fix_object_paths(Object* obj, Node* root, String save_path) {
-
- Globals* g = Globals::get_singleton();
-
- String import_dir = root->get_meta("__editor_import_file__");
- import_dir = import_dir.get_base_dir();
- import_dir = DirAccess::normalize_path(import_dir);
- if (import_dir[import_dir.length()-1] != '/') {
- import_dir = import_dir + "/";
- };
-
- String resource_dir = DirAccess::normalize_path(g->get_resource_path());
- if (resource_dir[resource_dir.length()-1] != '/') {
- resource_dir = resource_dir + "/";
- };
-
-
- List<PropertyInfo> list;
- obj->get_property_list(&list, false);
-
- List<PropertyInfo>::Element *E = list.front();
-
- while (E) {
-
- Variant v = obj->get(E->get().name);
- if (v.get_type() == Variant::OBJECT) {
-
- Ref<Resource> res = (RefPtr)v;
- if (res.is_null()) {
- E = E->next();
- continue;
- }
-
- if (res->get_path() != "") {
-
- String res_path = res->get_path();
- res_path = Globals::get_singleton()->globalize_path(res_path);
- res_path = DirAccess::normalize_path(res_path);
-
- if (res_path.find(resource_dir) != 0) {
-
- // path of resource is not inside engine's resource path
-
- String new_path;
-
- if (res_path.find(import_dir) == 0) {
-
- // path of resource is relative to path of import file
- new_path = save_path + "/" + res_path.substr(import_dir.length(), res_path.length() - import_dir.length());
-
- } else {
-
- // path of resource is not relative to import file
- new_path = save_path + "/" + res_path.get_file();
- };
-
- res->set_path(g->localize_path(new_path));
- DirAccess* d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- d->make_dir_recursive(new_path.get_base_dir());
- printf("copying from %ls to %ls\n", res_path.c_str(), new_path.c_str());
- Error err = d->copy(res_path, new_path);
- memdelete(d);
- ERR_FAIL_COND_V(err != OK, err);
- }
-
- } else {
-
- _fix_object_paths(res.operator->(), root, save_path);
- };
- };
-
-
- E = E->next();
- };
-
- return OK;
-};
-
-static Error _fix_imported_scene_paths(Node* node, Node* root, String save_path) {
-
- if (node == root || node->get_owner() == root) {
- Error e = _fix_object_paths(node, root, save_path);
- ERR_FAIL_COND_V(e != OK, e);
- };
-
- for (int i=0; i<node->get_child_count(); i++) {
-
- Error e = _fix_imported_scene_paths(node->get_child(i), root, save_path);
- ERR_FAIL_COND_V(e != OK, e);
- };
-
- return OK;
-};
-
bool EditorNode::_find_and_save_resource(RES res,Map<RES,bool>& processed,int32_t flags) {
@@ -5318,15 +5224,18 @@ EditorNode::EditorNode() {
ObjectTypeDB::set_type_enabled("CollisionShape",true);
ObjectTypeDB::set_type_enabled("CollisionShape2D",true);
ObjectTypeDB::set_type_enabled("CollisionPolygon2D",true);
- //ObjectTypeDB::set_type_enabled("BodyVolumeConvexPolygon",true);
+
+ Control *theme_base = memnew( Control );
+ add_child(theme_base);
+ theme_base->set_area_as_parent_rect();
gui_base = memnew( Panel );
- add_child(gui_base);
+ theme_base->add_child(gui_base);
gui_base->set_area_as_parent_rect();
theme = Ref<Theme>( memnew( Theme ) );
- gui_base->set_theme( theme );
+ theme_base->set_theme( theme );
editor_register_icons(theme);
editor_register_fonts(theme);
@@ -5341,6 +5250,8 @@ EditorNode::EditorNode() {
}
}
+
+
Ref<StyleBoxTexture> focus_sbt=memnew( StyleBoxTexture );
focus_sbt->set_texture(theme->get_icon("EditorFocus","EditorIcons"));
for(int i=0;i<4;i++) {
@@ -5351,6 +5262,16 @@ EditorNode::EditorNode() {
theme->set_stylebox("EditorFocus","EditorStyles",focus_sbt);
+ String custom_theme = EditorSettings::get_singleton()->get("global/custom_theme");
+ if (custom_theme!="") {
+ Ref<Theme> theme = ResourceLoader::load(custom_theme);
+ if (theme.is_valid()) {
+ gui_base->set_theme(theme);
+ }
+ }
+
+
+
resource_preview = memnew( EditorResourcePreview );
add_child(resource_preview);
progress_dialog = memnew( ProgressDialog );
@@ -6540,12 +6461,12 @@ EditorNode::EditorNode() {
{
List<StringName> tl;
StringName ei = "EditorIcons";
- gui_base->get_theme()->get_icon_list(ei,&tl);
+ theme_base->get_theme()->get_icon_list(ei,&tl);
for(List<StringName>::Element *E=tl.front();E;E=E->next()) {
if (!ObjectTypeDB::type_exists(E->get()))
continue;
- icon_type_cache[E->get()]=gui_base->get_theme()->get_icon(E->get(),ei);
+ icon_type_cache[E->get()]=theme_base->get_theme()->get_icon(E->get(),ei);
}
}