diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2016-07-19 18:10:27 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2016-07-19 18:15:01 +0200 |
commit | 525fb01fd2f3059eef17b9e082bbde86bce50fb4 (patch) | |
tree | 71448566116b391f2bc80e1af724b6b9831d0fd8 | |
parent | c83aa5f86383bf89871f0a41752f5c6eeb148950 (diff) |
Revert "Homogeinize resource formats loaders/savers"
The text format definition needs to stay in `scene/` as it relies
on other scene components, and `core/` must stay self-contained.
This reverts commits a5e27503fd52589703d637d1245a023233a14a27
and 1492fd846073a4fa643365a8a5d4e021868c0e48.
-rw-r--r-- | core/register_core_types.cpp | 14 | ||||
-rw-r--r-- | scene/register_scene_types.cpp | 18 | ||||
-rw-r--r-- | scene/resources/scene_format_text.cpp (renamed from core/io/resource_format_text.cpp) | 2 | ||||
-rw-r--r-- | scene/resources/scene_format_text.h (renamed from core/io/resource_format_text.h) | 0 |
4 files changed, 19 insertions, 15 deletions
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 65427b1ea7..97bd5f2a32 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -42,7 +42,6 @@ #include "translation.h" #include "compressed_translation.h" #include "io/translation_loader_po.h" -#include "io/resource_format_text.h" #include "io/resource_format_xml.h" #include "io/resource_format_binary.h" #include "io/stream_peer_ssl.h" @@ -54,9 +53,6 @@ #include "input_map.h" #include "undo_redo.h" - -static ResourceFormatSaverText *resource_saver_text=NULL; -static ResourceFormatLoaderText *resource_loader_text=NULL; #ifdef XML_ENABLED static ResourceFormatSaverXML *resource_saver_xml=NULL; static ResourceFormatLoaderXML *resource_loader_xml=NULL; @@ -100,11 +96,6 @@ void register_core_types() { resource_format_po = memnew( TranslationLoaderPO ); ResourceLoader::add_resource_format_loader( resource_format_po ); - // Register text formats before to give them precedence on saving - resource_saver_text = memnew( ResourceFormatSaverText ); - ResourceSaver::add_resource_format_saver(resource_saver_text); - resource_loader_text = memnew( ResourceFormatLoaderText ); - ResourceLoader::add_resource_format_loader(resource_loader_text); resource_saver_binary = memnew( ResourceFormatSaverBinary ); ResourceSaver::add_resource_format_saver(resource_saver_binary); @@ -211,11 +202,6 @@ void unregister_core_types() { if (resource_loader_binary) memdelete(resource_loader_binary); - if (resource_saver_text) - memdelete(resource_saver_text); - if (resource_loader_text) - memdelete(resource_loader_text); - memdelete( resource_format_po ); diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index d848b9e5a5..c83ab88c73 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -222,6 +222,8 @@ #include "scene/3d/collision_polygon.h" #endif +#include "scene/resources/scene_format_text.h" + static ResourceFormatLoaderImage *resource_loader_image=NULL; static ResourceFormatLoaderWAV *resource_loader_wav=NULL; @@ -233,6 +235,9 @@ static ResourceFormatLoaderWAV *resource_loader_wav=NULL; static ResourceFormatLoaderTheme *resource_loader_theme=NULL; static ResourceFormatLoaderShader *resource_loader_shader=NULL; +static ResourceFormatSaverText *resource_saver_text=NULL; +static ResourceFormatLoaderText *resource_loader_text=NULL; + static ResourceFormatLoaderDynamicFont *resource_loader_dynamic_font=NULL; //static SceneStringNames *string_names; @@ -630,6 +635,13 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init + + resource_saver_text = memnew( ResourceFormatSaverText ); + ResourceSaver::add_resource_format_saver(resource_saver_text); + + resource_loader_text = memnew( ResourceFormatLoaderText ); + ResourceLoader::add_resource_format_loader(resource_loader_text); + } void unregister_scene_types() { @@ -649,5 +661,11 @@ void unregister_scene_types() { memdelete( resource_loader_theme ); memdelete( resource_loader_shader ); + if (resource_saver_text) { + memdelete(resource_saver_text); + } + if (resource_loader_text) { + memdelete(resource_loader_text); + } SceneStringNames::free(); } diff --git a/core/io/resource_format_text.cpp b/scene/resources/scene_format_text.cpp index ed4fbdfb73..95645107d4 100644 --- a/core/io/resource_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -26,7 +26,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "resource_format_text.h" +#include "scene_format_text.h" #include "globals.h" #include "version.h" diff --git a/core/io/resource_format_text.h b/scene/resources/scene_format_text.h index 6122a1f9d8..6122a1f9d8 100644 --- a/core/io/resource_format_text.h +++ b/scene/resources/scene_format_text.h |