mirror of
https://github.com/godotengine/godot
synced 2024-09-05 14:59:59 +00:00
Removed PBM bitmap loader, added abiliy to importi mages as bitmap. Fixes #14828
This commit is contained in:
parent
b6989d0b51
commit
50b975548d
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
91
editor/import/resource_importer_bitmask.cpp
Normal file
91
editor/import/resource_importer_bitmask.cpp
Normal file
|
@ -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() {
|
||||
}
|
29
editor/import/resource_importer_bitmask.h
Normal file
29
editor/import/resource_importer_bitmask.h
Normal file
|
@ -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
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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")
|
|
@ -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 "";
|
||||
}
|
|
@ -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
|
|
@ -1,5 +0,0 @@
|
|||
def can_build(platform):
|
||||
return True
|
||||
|
||||
def configure(env):
|
||||
pass
|
|
@ -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);
|
||||
}
|
|
@ -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();
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue