summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/editor_import_export.cpp22
-rw-r--r--tools/editor/editor_import_export.h4
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/editor_node.h2
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp23
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp3
-rw-r--r--tools/editor/project_export.cpp14
-rw-r--r--tools/editor/project_export.h3
-rw-r--r--tools/editor/property_editor.cpp53
-rw-r--r--tools/editor/property_editor.h2
-rw-r--r--tools/editor/scene_tree_editor.cpp3
-rw-r--r--tools/editor/scenes_dock.cpp2
13 files changed, 120 insertions, 15 deletions
diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp
index 22b611fdcc..1a5dd73040 100644
--- a/tools/editor/editor_import_export.cpp
+++ b/tools/editor/editor_import_export.cpp
@@ -492,6 +492,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func
int group_format=0;
float group_lossy_quality=EditorImportExport::get_singleton()->image_export_group_get_lossy_quality(E->get());
int group_shrink=EditorImportExport::get_singleton()->image_export_group_get_shrink(E->get());
+ group_shrink*=EditorImportExport::get_singleton()->get_export_image_shrink();
switch(EditorImportExport::get_singleton()->image_export_group_get_image_action(E->get())) {
case EditorImportExport::IMAGE_ACTION_NONE: {
@@ -1186,6 +1187,16 @@ EditorImportExport::ImageAction EditorImportExport::get_export_image_action() co
return image_action;
}
+void EditorImportExport::set_export_image_shrink(int p_shrink) {
+
+ image_shrink=p_shrink;
+}
+
+int EditorImportExport::get_export_image_shrink() const{
+
+ return image_shrink;
+}
+
void EditorImportExport::set_export_image_quality(float p_quality){
@@ -1336,6 +1347,10 @@ void EditorImportExport::load_config() {
image_action=IMAGE_ACTION_COMPRESS_DISK;
image_action_compress_quality = cf->get_value(ci,"compress_quality");
+ if (cf->has_section_key(ci,"shrink"))
+ image_shrink = cf->get_value(ci,"shrink");
+ else
+ image_shrink=1;
String formats=cf->get_value(ci,"formats");
Vector<String> f = formats.split(",");
image_formats.clear();
@@ -1382,8 +1397,6 @@ void EditorImportExport::load_config() {
List<String> keys;
cf->get_section_keys(s,&keys);
for(List<String>::Element *F=keys.front();F;F=F->next()) {
- print_line("sk: "+F->get());
-
ep->set(F->get(),cf->get_value(s,F->get()));
}
}
@@ -1494,6 +1507,7 @@ void EditorImportExport::save_config() {
case IMAGE_ACTION_COMPRESS_DISK: cf->set_value("convert_images","action","compress_disk"); break;
}
+ cf->set_value("convert_images","shrink",image_shrink);
cf->set_value("convert_images","compress_quality",image_action_compress_quality);
String formats;
@@ -1562,9 +1576,7 @@ EditorImportExport::EditorImportExport() {
image_action=IMAGE_ACTION_NONE;
image_action_compress_quality=0.7;
image_formats.insert("png");
-
-
-
+ image_shrink=1;
}
diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h
index 17f2592ad5..94fbaba842 100644
--- a/tools/editor/editor_import_export.h
+++ b/tools/editor/editor_import_export.h
@@ -243,6 +243,7 @@ protected:
Map<String,int> by_idx;
ImageAction image_action;
float image_action_compress_quality;
+ int image_shrink;
Set<String> image_formats;
ExportFilter export_filter;
@@ -288,6 +289,9 @@ public:
void set_export_image_action(ImageAction p_action);
ImageAction get_export_image_action() const;
+ void set_export_image_shrink(int p_shrink);
+ int get_export_image_shrink() const;
+
void set_export_image_quality(float p_quality);
float get_export_image_quality() const;
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 2f7b6759b9..d8f9dcc947 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -3458,8 +3458,8 @@ EditorNode::EditorNode() {
p->add_item("Run Script",FILE_RUN_SCRIPT,KEY_MASK_CMD+KEY_R);
p->add_separator();
p->add_item("Project Settings",RUN_SETTINGS);
- p->add_item("Project Manager",RUN_PROJECT_MANAGER);
p->add_separator();
+ p->add_item("Quit to Project List",RUN_PROJECT_MANAGER);
p->add_item("Quit",FILE_QUIT,KEY_MASK_CMD+KEY_Q);
recent_scenes = memnew( PopupMenu );
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 87f17247c3..e35467e788 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -410,6 +410,8 @@ public:
static void add_editor_plugin(EditorPlugin *p_editor);
static void remove_editor_plugin(EditorPlugin *p_editor);
+ static EditorNode * get_singleton() { return singleton; }
+
void edit_node(Node *p_node);
void edit_resource(const Ref<Resource>& p_resource);
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
index 067edee5a0..90dcbb97e0 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -610,7 +610,7 @@ String EditorTextureImportPlugin::get_visible_name() const {
} break;
case MODE_ATLAS: {
- return "Atlas Teture";
+ return "Atlas Texture";
} break;
}
@@ -899,6 +899,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
}
}
+
if (format==IMAGE_FORMAT_COMPRESS_DISK_LOSSLESS || format==IMAGE_FORMAT_COMPRESS_DISK_LOSSY) {
Image image=texture->get_data();
@@ -952,6 +953,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
} else {
+ print_line("compress...");
Image image=texture->get_data();
ERR_FAIL_COND_V(image.empty(),ERR_INVALID_DATA);
@@ -988,13 +990,17 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
}
+ print_line("COMPRESSED TO: "+itos(image.get_format()));
texture->create_from_image(image,tex_flags);
+
if (shrink>1) {
texture->set_size_override(Size2(orig_w,orig_h));
}
- Error err = ResourceSaver::save(p_path,texture);
+ uint32_t save_flags=ResourceSaver::FLAG_COMPRESS;
+
+ Error err = ResourceSaver::save(p_path,texture,save_flags);
if (err!=OK) {
EditorNode::add_io_error("Couldn't save converted texture: "+p_path);
return err;
@@ -1021,6 +1027,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
int group_format=0;
float group_lossy_quality=EditorImportExport::get_singleton()->image_export_group_get_lossy_quality(group);
int group_shrink=EditorImportExport::get_singleton()->image_export_group_get_shrink(group);
+ group_shrink*=EditorImportExport::get_singleton()->get_export_image_shrink();
switch(EditorImportExport::get_singleton()->image_export_group_get_image_action(group)) {
case EditorImportExport::IMAGE_ACTION_NONE: {
@@ -1062,6 +1069,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
flags|=IMAGE_FLAG_FIX_BORDER_ALPHA;
+ print_line("group format"+itos(group_format));
rimd->set_option("format",group_format);
rimd->set_option("flags",flags);
rimd->set_option("quality",group_lossy_quality);
@@ -1090,6 +1098,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
flags|=IMAGE_FLAG_FIX_BORDER_ALPHA;
+ rimd->set_option("shrink",EditorImportExport::get_singleton()->get_export_image_shrink());
rimd->set_option("flags",flags);
rimd->set_option("quality",EditorImportExport::get_singleton()->get_export_image_quality());
rimd->set_option("atlas",false);
@@ -1108,18 +1117,21 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
}
uint32_t flags = rimd->get_option("flags");
+ uint8_t shrink = rimd->has_option("shrink") ? rimd->get_option("shrink"): Variant(1);
+ uint8_t format = rimd->get_option("format");
+ uint8_t comp = (format==EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_RAM)?uint8_t(p_platform->get_image_compression()):uint8_t(255);
MD5_CTX ctx;
uint8_t f4[4];
encode_uint32(flags,&f4[0]);
- uint8_t ic = p_platform->get_image_compression();
MD5Init(&ctx);
String gp = Globals::get_singleton()->globalize_path(p_path);
CharString cs = gp.utf8();
MD5Update(&ctx,(unsigned char*)cs.get_data(),cs.length());
MD5Update(&ctx,f4,4);
- MD5Update(&ctx,&ic,1);
-
+ MD5Update(&ctx,&format,1);
+ MD5Update(&ctx,&comp,1);
+ MD5Update(&ctx,&shrink,1);
MD5Final(&ctx);
uint64_t sd=0;
@@ -1137,6 +1149,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
uint64_t d = f->get_line().strip_edges().to_int64();
sd = FileAccess::get_modified_time(p_path);
+
if (d==sd) {
valid=true;
} else {
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 1a17916394..a01565a046 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -1507,7 +1507,7 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("external_editor/use_external_editor",false);
EDITOR_DEF("external_editor/exec_path","");
- EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_FILE));
+ EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_GLOBAL_FILE));
EDITOR_DEF("external_editor/exec_flags","");
}
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index be7214aaa7..0014c5a68a 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -1407,6 +1407,9 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
} break;
+ case KEY_F: {
+ _menu_option(VIEW_CENTER_TO_SELECTION);
+ } break;
}
diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp
index 192fcaa908..eae5dacb27 100644
--- a/tools/editor/project_export.cpp
+++ b/tools/editor/project_export.cpp
@@ -207,6 +207,12 @@ void ProjectExportDialog::_quality_edited(float what) {
_save_export_cfg();
}
+void ProjectExportDialog::_shrink_edited(float what) {
+
+ EditorImportExport::get_singleton()->set_export_image_shrink(what);
+ _save_export_cfg();
+}
+
void ProjectExportDialog::_image_export_edited(int what) {
EditorImportExport::get_singleton()->set_export_image_action(EditorImportExport::ImageAction(what));
@@ -270,7 +276,9 @@ void ProjectExportDialog::_notification(int p_what) {
image_action->select(EditorImportExport::get_singleton()->get_export_image_action());
image_quality->set_val(EditorImportExport::get_singleton()->get_export_image_quality());
+ image_shrink->set_val(EditorImportExport::get_singleton()->get_export_image_quality());
image_quality->connect("value_changed",this,"_quality_edited");
+ image_shrink->connect("value_changed",this,"_shrink_edited");
image_action->connect("item_selected",this,"_image_export_edited");
for(int i=0;i<formats.size();i++) {
@@ -966,6 +974,7 @@ void ProjectExportDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_export_action"),&ProjectExportDialog::_export_action);
ObjectTypeDB::bind_method(_MD("_export_action_pck"),&ProjectExportDialog::_export_action_pck);
ObjectTypeDB::bind_method(_MD("_quality_edited"),&ProjectExportDialog::_quality_edited);
+ ObjectTypeDB::bind_method(_MD("_shrink_edited"),&ProjectExportDialog::_shrink_edited);
ObjectTypeDB::bind_method(_MD("_image_export_edited"),&ProjectExportDialog::_image_export_edited);
ObjectTypeDB::bind_method(_MD("_format_toggled"),&ProjectExportDialog::_format_toggled);
ObjectTypeDB::bind_method(_MD("_group_changed"),&ProjectExportDialog::_group_changed);
@@ -1090,6 +1099,11 @@ ProjectExportDialog::ProjectExportDialog(EditorNode *p_editor) {
image_quality->set_max(1);
image_quality->set_step(0.01);
image_vb->add_margin_child("Compress for Disk (Lossy) Quality:",qhb);
+ image_shrink = memnew( SpinBox );
+ image_shrink->set_min(1);
+ image_shrink->set_max(8);
+ image_shrink->set_step(1);
+ image_vb->add_margin_child("Shrink All Images:",image_shrink);
sections->add_child(image_vb);
image_formats=memnew(Tree);
diff --git a/tools/editor/project_export.h b/tools/editor/project_export.h
index 25709babb9..6ceffadc62 100644
--- a/tools/editor/project_export.h
+++ b/tools/editor/project_export.h
@@ -110,6 +110,7 @@ private:
VBoxContainer *image_vb;
OptionButton *image_action;
HSlider *image_quality;
+ SpinBox *image_shrink;
Tree *image_formats;
Vector<TreeItem*> formats;
@@ -150,6 +151,8 @@ private:
void _quality_edited(float what);
void _image_export_edited(int what);
+ void _shrink_edited(float what);
+
void _update_group_list();
void _select_group(const String& p_by_name);
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 6b34e3f555..1cce161d08 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -51,7 +51,7 @@ void CustomPropertyEditor::_notification(int p_what) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( 10,10,60, get_size().height-20 ), v );
}*/
- }
+ }
}
@@ -1397,6 +1397,53 @@ void CustomPropertyEditor::_modified(String p_string) {
updating=false;
}
+void CustomPropertyEditor::_focus_enter() {
+ switch(type) {
+ case Variant::REAL:
+ case Variant::STRING:
+ case Variant::VECTOR2:
+ case Variant::RECT2:
+ case Variant::VECTOR3:
+ case Variant::PLANE:
+ case Variant::QUAT:
+ case Variant::_AABB:
+ case Variant::MATRIX32:
+ case Variant::MATRIX3:
+ case Variant::TRANSFORM: {
+ for (int i=0;i<MAX_VALUE_EDITORS;++i) {
+ if (value_editor[i]->has_focus()) {
+ value_editor[i]->select_all();
+ break;
+ }
+ }
+ } break;
+ default: {}
+ }
+
+}
+
+void CustomPropertyEditor::_focus_exit() {
+ switch(type) {
+ case Variant::REAL:
+ case Variant::STRING:
+ case Variant::VECTOR2:
+ case Variant::RECT2:
+ case Variant::VECTOR3:
+ case Variant::PLANE:
+ case Variant::QUAT:
+ case Variant::_AABB:
+ case Variant::MATRIX32:
+ case Variant::MATRIX3:
+ case Variant::TRANSFORM: {
+ for (int i=0;i<MAX_VALUE_EDITORS;++i) {
+ value_editor[i]->select(0, 0);
+ }
+ } break;
+ default: {}
+ }
+
+}
+
void CustomPropertyEditor::config_action_buttons(const List<String>& p_strings) {
int w=100;
@@ -1456,6 +1503,8 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns,int
void CustomPropertyEditor::_bind_methods() {
+ ObjectTypeDB::bind_method("_focus_enter", &CustomPropertyEditor::_focus_enter);
+ ObjectTypeDB::bind_method("_focus_exit", &CustomPropertyEditor::_focus_exit);
ObjectTypeDB::bind_method("_modified",&CustomPropertyEditor::_modified);
ObjectTypeDB::bind_method("_scroll_modified",&CustomPropertyEditor::_scroll_modified);
ObjectTypeDB::bind_method("_action_pressed",&CustomPropertyEditor::_action_pressed);
@@ -1487,6 +1536,8 @@ CustomPropertyEditor::CustomPropertyEditor() {
value_editor[i]->hide();
value_label[i]->hide();
value_editor[i]->connect("text_entered", this,"_modified");
+ value_editor[i]->connect("focus_enter", this, "_focus_enter");
+ value_editor[i]->connect("focus_exit", this, "_focus_exit");
}
for(int i=0;i<4;i++) {
diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h
index fc0330c25d..7ee14679c1 100644
--- a/tools/editor/property_editor.h
+++ b/tools/editor/property_editor.h
@@ -105,6 +105,8 @@ class CustomPropertyEditor : public Popup {
void _file_selected(String p_file);
void _scroll_modified(double p_value);
void _modified(String p_string);
+ void _focus_enter();
+ void _focus_exit();
void _action_pressed(int p_which);
void _type_create_selected(int p_idx);
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp
index 89b7e54195..1d2c864c99 100644
--- a/tools/editor/scene_tree_editor.cpp
+++ b/tools/editor/scene_tree_editor.cpp
@@ -706,7 +706,8 @@ void SceneTreeDialog::_cancel() {
void SceneTreeDialog::_select() {
if (tree->get_selected()) {
- emit_signal("selected",tree->get_selected()->get_path());
+ Node *scene = EditorNode::get_singleton()->get_edited_scene();
+ emit_signal("selected","/root/" + scene->get_parent()->get_path_to(tree->get_selected()));
hide();
}
}
diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp
index 02daa3c245..86331faa1d 100644
--- a/tools/editor/scenes_dock.cpp
+++ b/tools/editor/scenes_dock.cpp
@@ -181,7 +181,7 @@ void ScenesDock::_instance_pressed() {
if (!sel)
return;
String path = sel->get_metadata(0);
- emit_signal("instance","res://"+path);
+ emit_signal("instance",path);
}
void ScenesDock::_open_pressed(){