mirror of
https://github.com/Relintai/texture_packer.git
synced 2025-02-04 16:16:03 +01:00
Hackfix crash on 4.0.
This commit is contained in:
parent
b29b499adf
commit
e3047f7dfa
@ -22,6 +22,8 @@ SOFTWARE.
|
||||
|
||||
#include "packer_image_resource.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
int PackerImageResource::get_width() const {
|
||||
if (_image.is_valid()) {
|
||||
return _image->get_width();
|
||||
@ -62,8 +64,6 @@ bool PackerImageResource::get_rect_region(const Rect2 &p_rect, const Rect2 &p_sr
|
||||
}
|
||||
|
||||
void PackerImageResource::set_data(const Ref<Image> &p_image) {
|
||||
ERR_FAIL_COND(p_image.is_null());
|
||||
|
||||
_image = p_image;
|
||||
}
|
||||
|
||||
@ -73,7 +73,10 @@ Ref<Image> PackerImageResource::get_data() const {
|
||||
|
||||
void PackerImageResource::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_data", "image"), &PackerImageResource::set_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "Image"), "set_data", "get_data");
|
||||
#if VERSION_MAJOR < 4
|
||||
//for some reason this crashes on 4.0. Not yet sure why
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "Image", PROPERTY_USAGE_DEFAULT), "set_data", "get_data");
|
||||
#endif
|
||||
}
|
||||
|
||||
PackerImageResource::PackerImageResource() {
|
||||
|
@ -27,7 +27,6 @@ SOFTWARE.
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
class PackerImageResource : public Texture {
|
||||
|
||||
GDCLASS(PackerImageResource, Texture);
|
||||
|
||||
RES_BASE_EXTENSION("restex");
|
||||
|
Loading…
Reference in New Issue
Block a user