diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-01-06 16:36:49 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2018-01-06 16:38:36 -0300 |
commit | 50b975548dcd65a9506e7fb449d40404320c0983 (patch) | |
tree | abc9f7287fb6a0d539de897ca69c318c0cbdb8f7 | |
parent | b6989d0b511ef4003d33f5987a5dafc45cb3a1cf (diff) |
Removed PBM bitmap loader, added abiliy to importi mages as bitmap. Fixes #14828
-rw-r--r-- | core/io/resource_import.cpp | 36 | ||||
-rw-r--r-- | core/io/resource_import.h | 4 | ||||
-rw-r--r-- | editor/editor_node.cpp | 5 | ||||
-rw-r--r-- | editor/import/resource_importer_bitmask.cpp | 91 | ||||
-rw-r--r-- | editor/import/resource_importer_bitmask.h | 29 | ||||
-rw-r--r-- | modules/gdnative/gdnative.cpp | 2 | ||||
-rw-r--r-- | modules/pbm/SCsub | 8 | ||||
-rw-r--r-- | modules/pbm/bitmap_loader_pbm.cpp | 237 | ||||
-rw-r--r-- | modules/pbm/bitmap_loader_pbm.h | 48 | ||||
-rw-r--r-- | modules/pbm/config.py | 5 | ||||
-rw-r--r-- | modules/pbm/register_types.cpp | 46 | ||||
-rw-r--r-- | modules/pbm/register_types.h | 32 | ||||
-rw-r--r-- | scene/resources/bit_mask.h | 1 |
13 files changed, 145 insertions, 399 deletions
diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp index 58de944e6c..cfe6655504 100644 --- a/core/io/resource_import.cpp +++ b/core/io/resource_import.cpp @@ -138,9 +138,9 @@ void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extension Set<String> found; - for (Set<Ref<ResourceImporter> >::Element *E = importers.front(); E; E = E->next()) { + for (int i = 0; i < importers.size(); i++) { List<String> local_exts; - E->get()->get_recognized_extensions(&local_exts); + importers[i]->get_recognized_extensions(&local_exts); for (List<String>::Element *F = local_exts.front(); F; F = F->next()) { if (!found.has(F->get())) { p_extensions->push_back(F->get()); @@ -158,8 +158,8 @@ void ResourceFormatImporter::get_recognized_extensions_for_type(const String &p_ Set<String> found; - for (Set<Ref<ResourceImporter> >::Element *E = importers.front(); E; E = E->next()) { - String res_type = E->get()->get_resource_type(); + for (int i = 0; i < importers.size(); i++) { + String res_type = importers[i]->get_resource_type(); if (res_type == String()) continue; @@ -167,7 +167,7 @@ void ResourceFormatImporter::get_recognized_extensions_for_type(const String &p_ continue; List<String> local_exts; - E->get()->get_recognized_extensions(&local_exts); + importers[i]->get_recognized_extensions(&local_exts); for (List<String>::Element *F = local_exts.front(); F; F = F->next()) { if (!found.has(F->get())) { p_extensions->push_back(F->get()); @@ -212,9 +212,9 @@ int ResourceFormatImporter::get_import_order(const String &p_path) const { bool ResourceFormatImporter::handles_type(const String &p_type) const { - for (Set<Ref<ResourceImporter> >::Element *E = importers.front(); E; E = E->next()) { + for (int i = 0; i < importers.size(); i++) { - String res_type = E->get()->get_resource_type(); + String res_type = importers[i]->get_resource_type(); if (res_type == String()) continue; if (ClassDB::is_parent_class(res_type, p_type)) @@ -319,9 +319,9 @@ void ResourceFormatImporter::get_dependencies(const String &p_path, List<String> Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_name(const String &p_name) const { - for (Set<Ref<ResourceImporter> >::Element *E = importers.front(); E; E = E->next()) { - if (E->get()->get_importer_name() == p_name) { - return E->get(); + for (int i = 0; i < importers.size(); i++) { + if (importers[i]->get_importer_name() == p_name) { + return importers[i]; } } @@ -330,12 +330,12 @@ Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_name(const String void ResourceFormatImporter::get_importers_for_extension(const String &p_extension, List<Ref<ResourceImporter> > *r_importers) { - for (Set<Ref<ResourceImporter> >::Element *E = importers.front(); E; E = E->next()) { + for (int i = 0; i < importers.size(); i++) { List<String> local_exts; - E->get()->get_recognized_extensions(&local_exts); + importers[i]->get_recognized_extensions(&local_exts); for (List<String>::Element *F = local_exts.front(); F; F = F->next()) { if (p_extension.to_lower() == F->get()) { - r_importers->push_back(E->get()); + r_importers->push_back(importers[i]); } } } @@ -346,14 +346,14 @@ Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_extension(const St Ref<ResourceImporter> importer; float priority = 0; - for (Set<Ref<ResourceImporter> >::Element *E = importers.front(); E; E = E->next()) { + for (int i = 0; i < importers.size(); i++) { List<String> local_exts; - E->get()->get_recognized_extensions(&local_exts); + importers[i]->get_recognized_extensions(&local_exts); for (List<String>::Element *F = local_exts.front(); F; F = F->next()) { - if (p_extension.to_lower() == F->get() && E->get()->get_priority() > priority) { - importer = E->get(); - priority = E->get()->get_priority(); + if (p_extension.to_lower() == F->get() && importers[i]->get_priority() > priority) { + importer = importers[i]; + priority = importers[i]->get_priority(); } } } diff --git a/core/io/resource_import.h b/core/io/resource_import.h index 1b681bd97a..80e0743eda 100644 --- a/core/io/resource_import.h +++ b/core/io/resource_import.h @@ -46,7 +46,7 @@ class ResourceFormatImporter : public ResourceFormatLoader { static ResourceFormatImporter *singleton; - Set<Ref<ResourceImporter> > importers; + Vector<Ref<ResourceImporter> > importers; public: static ResourceFormatImporter *get_singleton() { return singleton; } @@ -65,7 +65,7 @@ public: String get_internal_resource_path(const String &p_path) const; void get_internal_resource_path_list(const String &p_path, List<String> *r_paths); - void add_importer(const Ref<ResourceImporter> &p_importer) { importers.insert(p_importer); } + void add_importer(const Ref<ResourceImporter> &p_importer) { importers.push_back(p_importer); } void remove_importer(const Ref<ResourceImporter> &p_importer) { importers.erase(p_importer); } Ref<ResourceImporter> get_importer_by_name(const String &p_name) const; Ref<ResourceImporter> get_importer_by_extension(const String &p_extension) const; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 8609697518..70047bc60c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -60,6 +60,7 @@ #include "editor/editor_themes.h" #include "editor/import/editor_import_collada.h" #include "editor/import/editor_scene_importer_gltf.h" +#include "editor/import/resource_importer_bitmask.h" #include "editor/import/resource_importer_csv_translation.h" #include "editor/import/resource_importer_obj.h" #include "editor/import/resource_importer_scene.h" @@ -4815,6 +4816,10 @@ EditorNode::EditorNode() { import_gltf.instance(); import_scene->add_importer(import_gltf); } + + Ref<ResourceImporterBitMap> import_bitmap; + import_bitmap.instance(); + ResourceFormatImporter::get_singleton()->add_importer(import_bitmap); } _pvrtc_register_compressors(); diff --git a/editor/import/resource_importer_bitmask.cpp b/editor/import/resource_importer_bitmask.cpp new file mode 100644 index 0000000000..3d2959c598 --- /dev/null +++ b/editor/import/resource_importer_bitmask.cpp @@ -0,0 +1,91 @@ +#include "resource_importer_bitmask.h" +#include "core/image.h" +#include "editor/editor_file_system.h" +#include "editor/editor_node.h" +#include "io/config_file.h" +#include "io/image_loader.h" +#include "scene/resources/bit_mask.h" +#include "scene/resources/texture.h" + +String ResourceImporterBitMap::get_importer_name() const { + + return "bitmap"; +} + +String ResourceImporterBitMap::get_visible_name() const { + + return "BitMap"; +} +void ResourceImporterBitMap::get_recognized_extensions(List<String> *p_extensions) const { + + ImageLoader::get_recognized_extensions(p_extensions); +} +String ResourceImporterBitMap::get_save_extension() const { + return "res"; +} + +String ResourceImporterBitMap::get_resource_type() const { + + return "BitMap"; +} + +bool ResourceImporterBitMap::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const { + + return true; +} + +int ResourceImporterBitMap::get_preset_count() const { + return 0; +} +String ResourceImporterBitMap::get_preset_name(int p_idx) const { + + return String(); +} + +void ResourceImporterBitMap::get_import_options(List<ImportOption> *r_options, int p_preset) const { + + r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "create_from", PROPERTY_HINT_ENUM, "Black & White,Alpha"), 0)); + r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "threshold", PROPERTY_HINT_RANGE, "0,1,0.01"), 0.5)); +} + +Error ResourceImporterBitMap::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files) { + + int create_from = p_options["create_from"]; + float threshold = p_options["threshold"]; + Ref<Image> image; + image.instance(); + Error err = ImageLoader::load_image(p_source_file, image); + if (err != OK) + return err; + + int w = image->get_width(); + int h = image->get_height(); + + Ref<BitMap> bitmap; + bitmap.instance(); + bitmap->create(Size2(w, h)); + image->lock(); + + for (int i = 0; i < h; i++) { + for (int j = 0; j < w; j++) { + + bool bit; + Color c = image->get_pixel(j, i); + if (create_from == 0) { //b&W + bit = c.get_v() > threshold; + } else { + bit = c.a > threshold; + } + + bitmap->set_bit(Vector2(i, j), bit); + } + } + + return ResourceSaver::save(p_save_path + ".res", bitmap); +} + +ResourceImporterBitMap::ResourceImporterBitMap() { +} + +ResourceImporterBitMap::~ResourceImporterBitMap() { +} diff --git a/editor/import/resource_importer_bitmask.h b/editor/import/resource_importer_bitmask.h new file mode 100644 index 0000000000..8a3cafa7ce --- /dev/null +++ b/editor/import/resource_importer_bitmask.h @@ -0,0 +1,29 @@ +#ifndef RESOURCE_IMPORTER_BITMASK_H +#define RESOURCE_IMPORTER_BITMASK_H + +#include "image.h" +#include "io/resource_import.h" + +class StreamBitMap; + +class ResourceImporterBitMap : public ResourceImporter { + GDCLASS(ResourceImporterBitMap, ResourceImporter) + +public: + virtual String get_importer_name() const; + virtual String get_visible_name() const; + virtual void get_recognized_extensions(List<String> *p_extensions) const; + virtual String get_save_extension() const; + virtual String get_resource_type() const; + + virtual int get_preset_count() const; + virtual String get_preset_name(int p_idx) const; + + virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const; + virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL); + + ResourceImporterBitMap(); + ~ResourceImporterBitMap(); +}; +#endif // RESOURCE_IMPORTER_BITMASK_H diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index dec42dc17a..1379083b42 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -399,7 +399,6 @@ RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_or } void GDNativeLibraryResourceLoader::get_recognized_extensions(List<String> *p_extensions) const { - p_extensions->clear(); p_extensions->push_back("gdnlib"); } @@ -438,7 +437,6 @@ bool GDNativeLibraryResourceSaver::recognize(const RES &p_resource) const { void GDNativeLibraryResourceSaver::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const { if (Object::cast_to<GDNativeLibrary>(*p_resource) != NULL) { - p_extensions->clear(); p_extensions->push_back("gdnlib"); } } diff --git a/modules/pbm/SCsub b/modules/pbm/SCsub deleted file mode 100644 index fa328be025..0000000000 --- a/modules/pbm/SCsub +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python - -Import('env') -Import('env_modules') - -env_pbm = env_modules.Clone() - -env_pbm.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/pbm/bitmap_loader_pbm.cpp b/modules/pbm/bitmap_loader_pbm.cpp deleted file mode 100644 index 805528ebfe..0000000000 --- a/modules/pbm/bitmap_loader_pbm.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/*************************************************************************/ -/* bitmap_loader_pbm.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "bitmap_loader_pbm.h" -#include "os/file_access.h" -#include "scene/resources/bit_mask.h" - -static bool _get_token(FileAccessRef &f, uint8_t &saved, PoolVector<uint8_t> &r_token, bool p_binary = false, bool p_single_chunk = false) { - - int token_max = r_token.size(); - PoolVector<uint8_t>::Write w; - if (token_max) - w = r_token.write(); - int ofs = 0; - bool lf = false; - - while (true) { - - uint8_t b; - if (saved) { - b = saved; - saved = 0; - } else { - b = f->get_8(); - } - if (f->eof_reached()) { - if (ofs) { - w = PoolVector<uint8_t>::Write(); - r_token.resize(ofs); - return true; - } else { - return false; - } - } - - if (!ofs && !p_binary && b == '#') { - //skip comment - while (b != '\n') { - if (f->eof_reached()) { - return false; - } - - b = f->get_8(); - } - - lf = true; - - } else if (b <= 32 && !(p_binary && (ofs || lf))) { - - if (b == '\n') { - lf = true; - } - - if (ofs && !p_single_chunk) { - w = PoolVector<uint8_t>::Write(); - r_token.resize(ofs); - saved = b; - - return true; - } - } else { - - bool resized = false; - while (ofs >= token_max) { - if (token_max) - token_max <<= 1; - else - token_max = 1; - resized = true; - } - if (resized) { - // Note: Certain C++ static analyzers might point out that the following assigment is unnecessary. - // This is wrong since PoolVector<class T>::Write has an operator= method where the lhs gets updated under certain conditions. - // See core/dvector.h. - w = PoolVector<uint8_t>::Write(); - r_token.resize(token_max); - w = r_token.write(); - } - w[ofs++] = b; - } - } - - return false; -} - -static int _get_number_from_token(PoolVector<uint8_t> &r_token) { - - int len = r_token.size(); - PoolVector<uint8_t>::Read r = r_token.read(); - return String::to_int((const char *)r.ptr(), len); -} - -RES ResourceFormatPBM::load(const String &p_path, const String &p_original_path, Error *r_error) { - -#define _RETURN(m_err) \ - { \ - if (r_error) \ - *r_error = m_err; \ - ERR_FAIL_V(RES()); \ - } - - FileAccessRef f = FileAccess::open(p_path, FileAccess::READ); - uint8_t saved = 0; - if (!f) - _RETURN(ERR_CANT_OPEN); - - PoolVector<uint8_t> token; - - if (!_get_token(f, saved, token)) { - _RETURN(ERR_PARSE_ERROR); - } - - if (token.size() != 2) { - _RETURN(ERR_FILE_CORRUPT); - } - if (token[0] != 'P') { - _RETURN(ERR_FILE_CORRUPT); - } - if (token[1] != '1' && token[1] != '4') { - _RETURN(ERR_FILE_CORRUPT); - } - - bool bits = token[1] == '4'; - - if (!_get_token(f, saved, token)) { - _RETURN(ERR_PARSE_ERROR); - } - - int width = _get_number_from_token(token); - if (width <= 0) { - _RETURN(ERR_FILE_CORRUPT); - } - - if (!_get_token(f, saved, token)) { - _RETURN(ERR_PARSE_ERROR); - } - - int height = _get_number_from_token(token); - if (height <= 0) { - _RETURN(ERR_FILE_CORRUPT); - } - - Ref<BitMap> bm; - bm.instance(); - bm->create(Size2i(width, height)); - - if (!bits) { - - int required_bytes = width * height; - if (!_get_token(f, saved, token, false, true)) { - _RETURN(ERR_PARSE_ERROR); - } - - if (token.size() < required_bytes) { - _RETURN(ERR_FILE_CORRUPT); - } - - PoolVector<uint8_t>::Read r = token.read(); - - for (int i = 0; i < height; i++) { - for (int j = 0; j < width; j++) { - - char num = r[i * width + j]; - bm->set_bit(Point2i(j, i), num == '0'); - } - } - - } else { - //a single, entire token of bits! - if (!_get_token(f, saved, token, true)) { - _RETURN(ERR_PARSE_ERROR); - } - int required_bytes = Math::ceil((width * height) / 8.0); - if (token.size() < required_bytes) { - _RETURN(ERR_FILE_CORRUPT); - } - - PoolVector<uint8_t>::Read r = token.read(); - int bitwidth = width; - if (bitwidth % 8) - bitwidth += 8 - (bitwidth % 8); - - for (int i = 0; i < height; i++) { - for (int j = 0; j < width; j++) { - - int ofs = bitwidth * i + j; - - uint8_t byte = r[ofs / 8]; - bool bit = (byte >> (7 - (ofs % 8))) & 1; - - bm->set_bit(Point2i(j, i), !bit); - } - } - } - - return bm; -} - -void ResourceFormatPBM::get_recognized_extensions(List<String> *p_extensions) const { - p_extensions->push_back("pbm"); -} -bool ResourceFormatPBM::handles_type(const String &p_type) const { - return p_type == "BitMap"; -} -String ResourceFormatPBM::get_resource_type(const String &p_path) const { - - if (p_path.get_extension().to_lower() == "pbm") - return "BitMap"; - return ""; -} diff --git a/modules/pbm/bitmap_loader_pbm.h b/modules/pbm/bitmap_loader_pbm.h deleted file mode 100644 index a93c482ece..0000000000 --- a/modules/pbm/bitmap_loader_pbm.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************/ -/* bitmap_loader_pbm.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef BITMAP_LOADER_PBM_H -#define BITMAP_LOADER_PBM_H - -#include "io/resource_loader.h" - -/** - @author Juan Linietsky <reduzio@gmail.com> -*/ -class ResourceFormatPBM : public ResourceFormatLoader { - -public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; -}; - -#endif diff --git a/modules/pbm/config.py b/modules/pbm/config.py deleted file mode 100644 index 5f133eba90..0000000000 --- a/modules/pbm/config.py +++ /dev/null @@ -1,5 +0,0 @@ -def can_build(platform): - return True - -def configure(env): - pass diff --git a/modules/pbm/register_types.cpp b/modules/pbm/register_types.cpp deleted file mode 100644 index 37d8915fd6..0000000000 --- a/modules/pbm/register_types.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************/ -/* register_types.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "register_types.h" - -#include "bitmap_loader_pbm.h" - -static ResourceFormatPBM *pbm_loader = NULL; - -void register_pbm_types() { - - pbm_loader = memnew(ResourceFormatPBM); - ResourceLoader::add_resource_format_loader(pbm_loader); -} - -void unregister_pbm_types() { - - memdelete(pbm_loader); -} diff --git a/modules/pbm/register_types.h b/modules/pbm/register_types.h deleted file mode 100644 index 408c7da275..0000000000 --- a/modules/pbm/register_types.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************/ -/* register_types.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -void register_pbm_types(); -void unregister_pbm_types(); diff --git a/scene/resources/bit_mask.h b/scene/resources/bit_mask.h index 676ec47ed3..cf126ef96b 100644 --- a/scene/resources/bit_mask.h +++ b/scene/resources/bit_mask.h @@ -39,7 +39,6 @@ class BitMap : public Resource { GDCLASS(BitMap, Resource); OBJ_SAVE_TYPE(BitMap); - RES_BASE_EXTENSION("pbm"); Vector<uint8_t> bitmask; int width; |