summaryrefslogtreecommitdiff
path: root/tools/editor/io_plugins
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-02-24 09:53:33 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-02-24 09:53:33 -0300
commit4b07eb8deb03ce8c7870d621cd03d04d45f4caaa (patch)
tree3314811f8a347ae60d951163c19d291b46381511 /tools/editor/io_plugins
parent51609ffc04290f8bd1ecbd9cf1639c0cc6368fac (diff)
-moved script to modules
Diffstat (limited to 'tools/editor/io_plugins')
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp53
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.h10
2 files changed, 63 insertions, 0 deletions
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
index 2e6e755136..067edee5a0 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -1190,3 +1190,56 @@ EditorTextureImportPlugin::EditorTextureImportPlugin(EditorNode *p_editor, Mode
editor->get_gui_base()->add_child(dialog);
}
+
+////////////////////////////
+
+
+ Vector<uint8_t> EditorTextureExportPlugin::custom_export(String& p_path,const Ref<EditorExportPlatform> &p_platform) {
+
+ Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_path);
+
+ if (rimd.is_valid()) {
+
+ if (rimd->get_editor()!="") {
+ Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor());
+ if (pl.is_valid()) {
+ Vector<uint8_t> ce = pl->custom_export(p_path,p_platform);
+ if (ce.size())
+ return ce;
+ }
+ }
+ } else if (EditorImportExport::get_singleton()->image_get_export_group(p_path)) {
+
+
+ Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture_2d");
+ if (pl.is_valid()) {
+ Vector<uint8_t> ce = pl->custom_export(p_path,p_platform);
+ if (ce.size()) {
+ p_path=p_path.basename()+".tex";
+ return ce;
+ }
+ }
+
+ } else if (EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE){
+
+ String xt = p_path.extension().to_lower();
+ if (EditorImportExport::get_singleton()->get_image_formats().has(xt)) { //should check for more I guess?
+
+ Ref<EditorImportPlugin> pl = EditorImportExport::get_singleton()->get_import_plugin_by_name("texture_2d");
+ if (pl.is_valid()) {
+ Vector<uint8_t> ce = pl->custom_export(p_path,p_platform);
+ if (ce.size()) {
+ p_path=p_path.basename()+".tex";
+ return ce;
+ }
+ }
+ }
+ }
+
+ return Vector<uint8_t>();
+}
+
+EditorTextureExportPlugin::EditorTextureExportPlugin() {
+
+
+}
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.h b/tools/editor/io_plugins/editor_texture_import_plugin.h
index 4a9dd6ae9d..b2950a889c 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.h
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.h
@@ -106,6 +106,16 @@ public:
};
+class EditorTextureExportPlugin : public EditorExportPlugin {
+
+ OBJ_TYPE( EditorTextureExportPlugin, EditorExportPlugin);
+
+
+public:
+
+ virtual Vector<uint8_t> custom_export(String& p_path,const Ref<EditorExportPlatform> &p_platform);
+ EditorTextureExportPlugin();
+};
class EditorImportTextureOptions : public VBoxContainer {
OBJ_TYPE( EditorImportTextureOptions, VBoxContainer );