summaryrefslogtreecommitdiff
path: root/scene/resources/texture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/texture.cpp')
-rw-r--r--scene/resources/texture.cpp509
1 files changed, 446 insertions, 63 deletions
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 462341a751..62feb7b37c 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -63,16 +63,15 @@ bool Texture::get_rect_region(const Rect2& p_rect, const Rect2& p_src_rect,Rect2
void Texture::_bind_methods() {
- ClassDB::bind_method(_MD("get_width"),&Texture::get_width);
- ClassDB::bind_method(_MD("get_height"),&Texture::get_height);
- ClassDB::bind_method(_MD("get_size"),&Texture::get_size);
- ClassDB::bind_method(_MD("get_rid"),&Texture::get_rid);
- ClassDB::bind_method(_MD("has_alpha"),&Texture::has_alpha);
- ClassDB::bind_method(_MD("set_flags","flags"),&Texture::set_flags);
- ClassDB::bind_method(_MD("get_flags"),&Texture::get_flags);
- ClassDB::bind_method(_MD("draw","canvas_item","pos","modulate","transpose"),&Texture::draw,DEFVAL(Color(1,1,1)),DEFVAL(false));
- ClassDB::bind_method(_MD("draw_rect","canvas_item","rect","tile","modulate","transpose"),&Texture::draw_rect,DEFVAL(Color(1,1,1)),DEFVAL(false));
- ClassDB::bind_method(_MD("draw_rect_region","canvas_item","rect","src_rect","modulate","transpose"),&Texture::draw_rect_region,DEFVAL(Color(1,1,1)),DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("get_width"),&Texture::get_width);
+ ClassDB::bind_method(D_METHOD("get_height"),&Texture::get_height);
+ ClassDB::bind_method(D_METHOD("get_size"),&Texture::get_size);
+ ClassDB::bind_method(D_METHOD("has_alpha"),&Texture::has_alpha);
+ ClassDB::bind_method(D_METHOD("set_flags","flags"),&Texture::set_flags);
+ ClassDB::bind_method(D_METHOD("get_flags"),&Texture::get_flags);
+ ClassDB::bind_method(D_METHOD("draw","canvas_item","pos","modulate","transpose"),&Texture::draw,DEFVAL(Color(1,1,1)),DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("draw_rect","canvas_item","rect","tile","modulate","transpose"),&Texture::draw_rect,DEFVAL(Color(1,1,1)),DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("draw_rect_region","canvas_item","rect","src_rect","modulate","transpose"),&Texture::draw_rect_region,DEFVAL(Color(1,1,1)),DEFVAL(false));
BIND_CONSTANT( FLAG_MIPMAPS );
BIND_CONSTANT( FLAG_REPEAT );
@@ -407,27 +406,27 @@ void ImageTexture::_set_data(Dictionary p_data) {
void ImageTexture::_bind_methods() {
- ClassDB::bind_method(_MD("create","width","height","format","flags"),&ImageTexture::create,DEFVAL(FLAGS_DEFAULT));
- ClassDB::bind_method(_MD("create_from_image","image","flags"),&ImageTexture::create_from_image,DEFVAL(FLAGS_DEFAULT));
- ClassDB::bind_method(_MD("get_format"),&ImageTexture::get_format);
- ClassDB::bind_method(_MD("load","path"),&ImageTexture::load);
- ClassDB::bind_method(_MD("set_data","image"),&ImageTexture::set_data);
- ClassDB::bind_method(_MD("get_data","cube_side"),&ImageTexture::get_data);
- ClassDB::bind_method(_MD("set_storage","mode"),&ImageTexture::set_storage);
- ClassDB::bind_method(_MD("get_storage"),&ImageTexture::get_storage);
- ClassDB::bind_method(_MD("set_lossy_storage_quality","quality"),&ImageTexture::set_lossy_storage_quality);
- ClassDB::bind_method(_MD("get_lossy_storage_quality"),&ImageTexture::get_lossy_storage_quality);
- ClassDB::bind_method(_MD("fix_alpha_edges"),&ImageTexture::fix_alpha_edges);
- ClassDB::bind_method(_MD("premultiply_alpha"),&ImageTexture::premultiply_alpha);
- ClassDB::bind_method(_MD("normal_to_xy"),&ImageTexture::normal_to_xy);
- ClassDB::bind_method(_MD("shrink_x2_and_keep_size"),&ImageTexture::shrink_x2_and_keep_size);
-
- ClassDB::bind_method(_MD("set_size_override","size"),&ImageTexture::set_size_override);
- ClassDB::set_method_flags(get_class_static(),_SCS("fix_alpha_edges"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
- ClassDB::set_method_flags(get_class_static(),_SCS("premultiply_alpha"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
- ClassDB::set_method_flags(get_class_static(),_SCS("normal_to_xy"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
- ClassDB::set_method_flags(get_class_static(),_SCS("shrink_x2_and_keep_size"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
- ClassDB::bind_method(_MD("_reload_hook","rid"),&ImageTexture::_reload_hook);
+ ClassDB::bind_method(D_METHOD("create","width","height","format","flags"),&ImageTexture::create,DEFVAL(FLAGS_DEFAULT));
+ ClassDB::bind_method(D_METHOD("create_from_image","image","flags"),&ImageTexture::create_from_image,DEFVAL(FLAGS_DEFAULT));
+ ClassDB::bind_method(D_METHOD("get_format"),&ImageTexture::get_format);
+ ClassDB::bind_method(D_METHOD("load","path"),&ImageTexture::load);
+ ClassDB::bind_method(D_METHOD("set_data","image"),&ImageTexture::set_data);
+ ClassDB::bind_method(D_METHOD("get_data","cube_side"),&ImageTexture::get_data);
+ ClassDB::bind_method(D_METHOD("set_storage","mode"),&ImageTexture::set_storage);
+ ClassDB::bind_method(D_METHOD("get_storage"),&ImageTexture::get_storage);
+ ClassDB::bind_method(D_METHOD("set_lossy_storage_quality","quality"),&ImageTexture::set_lossy_storage_quality);
+ ClassDB::bind_method(D_METHOD("get_lossy_storage_quality"),&ImageTexture::get_lossy_storage_quality);
+ ClassDB::bind_method(D_METHOD("fix_alpha_edges"),&ImageTexture::fix_alpha_edges);
+ ClassDB::bind_method(D_METHOD("premultiply_alpha"),&ImageTexture::premultiply_alpha);
+ ClassDB::bind_method(D_METHOD("normal_to_xy"),&ImageTexture::normal_to_xy);
+ ClassDB::bind_method(D_METHOD("shrink_x2_and_keep_size"),&ImageTexture::shrink_x2_and_keep_size);
+
+ ClassDB::bind_method(D_METHOD("set_size_override","size"),&ImageTexture::set_size_override);
+ ClassDB::set_method_flags(get_class_static(),_scs_create("fix_alpha_edges"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
+ ClassDB::set_method_flags(get_class_static(),_scs_create("premultiply_alpha"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
+ ClassDB::set_method_flags(get_class_static(),_scs_create("normal_to_xy"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
+ ClassDB::set_method_flags(get_class_static(),_scs_create("shrink_x2_and_keep_size"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
+ ClassDB::bind_method(D_METHOD("_reload_hook","rid"),&ImageTexture::_reload_hook);
BIND_CONSTANT( STORAGE_RAW );
@@ -454,6 +453,390 @@ ImageTexture::~ImageTexture() {
VisualServer::get_singleton()->free( texture );
}
+//////////////////////////////////////////
+
+
+void StreamTexture::_requested_3d(void* p_ud) {
+
+ StreamTexture *st = (StreamTexture *)p_ud;
+ Ref<StreamTexture> stex(st);
+ ERR_FAIL_COND(!request_3d_callback);
+ request_3d_callback(stex);
+}
+
+void StreamTexture::_requested_srgb(void* p_ud) {
+
+ StreamTexture *st = (StreamTexture *)p_ud;
+ Ref<StreamTexture> stex(st);
+ ERR_FAIL_COND(!request_srgb_callback);
+ request_srgb_callback(stex);
+
+}
+
+StreamTexture::TextureFormatRequestCallback StreamTexture::request_3d_callback=NULL;
+StreamTexture::TextureFormatRequestCallback StreamTexture::request_srgb_callback=NULL;
+
+
+uint32_t StreamTexture::get_flags() const {
+
+ return flags;
+}
+Image::Format StreamTexture::get_format() const {
+
+ return format;
+}
+
+
+Error StreamTexture::_load_data(const String& p_path,int &tw,int &th,int& flags,Image& image,int p_size_limit) {
+
+
+ FileAccess *f = FileAccess::open(p_path,FileAccess::READ);
+ ERR_FAIL_COND_V(!f,ERR_CANT_OPEN);
+
+ uint8_t header[4];
+ f->get_buffer(header,4);
+ if (header[0]!='G' || header[1]!='D' || header[2]!='S' || header[3]!='T') {
+ memdelete(f);
+ ERR_FAIL_COND_V(header[0]!='G' || header[1]!='D' || header[2]!='S' || header[3]!='T',ERR_FILE_CORRUPT);
+ }
+
+ tw = f->get_32();
+ th = f->get_32();
+ flags= f->get_32(); //texture flags!
+ uint32_t df = f->get_32(); //data format
+
+ print_line("width: "+itos(tw));
+ print_line("height: "+itos(th));
+ print_line("flags: "+itos(flags));
+ print_line("df: "+itos(df));
+
+
+ if (request_3d_callback && df&FORMAT_BIT_DETECT_3D) {
+ print_line("request detect 3D at "+p_path);
+ VS::get_singleton()->texture_set_detect_3d_callback(texture,_requested_3d,this);
+ } else {
+ print_line("not requesting detect 3D at "+p_path);
+ VS::get_singleton()->texture_set_detect_3d_callback(texture,NULL,NULL);
+ }
+
+ if (request_srgb_callback && df&FORMAT_BIT_DETECT_SRGB) {
+ print_line("request detect srgb at "+p_path);
+ VS::get_singleton()->texture_set_detect_srgb_callback(texture,_requested_srgb,this);
+ } else {
+ VS::get_singleton()->texture_set_detect_srgb_callback(texture,NULL,NULL);
+ print_line("not requesting detect srgb at "+p_path);
+ }
+
+ if (!(df&FORMAT_BIT_STREAM)) {
+ p_size_limit=0;
+ }
+
+
+ if (df&FORMAT_BIT_LOSSLESS || df&FORMAT_BIT_LOSSY) {
+ //look for a PNG or WEBP file inside
+
+ int sw=tw;
+ int sh=th;
+
+ uint32_t mipmaps = f->get_32();
+ uint32_t size = f->get_32();
+
+ print_line("mipmaps: "+itos(mipmaps));
+
+ while(mipmaps>1 && p_size_limit>0 && (sw>p_size_limit || sh>p_size_limit)) {
+
+ f->seek(f->get_pos()+size);
+ mipmaps = f->get_32();
+ size = f->get_32();
+
+ sw=MAX(sw>>1,1);
+ sh=MAX(sh>>1,1);
+ mipmaps--;
+ }
+
+ //mipmaps need to be read independently, they will be later combined
+ Vector<Image> mipmap_images;
+ int total_size=0;
+
+ for(int i=0;i<mipmaps;i++) {
+
+ if (i>0) {
+ size = f->get_32();
+ }
+
+ PoolVector<uint8_t> pv;
+ pv.resize(size);
+ {
+ PoolVector<uint8_t>::Write w = pv.write();
+ f->get_buffer(w.ptr(),size);
+ }
+
+ Image img;
+ if (df&FORMAT_BIT_LOSSLESS) {
+ img = Image::lossless_unpacker(pv);
+ } else {
+ img = Image::lossy_unpacker(pv);
+ }
+
+ if (img.empty()) {
+ memdelete(f);
+ ERR_FAIL_COND_V(img.empty(),ERR_FILE_CORRUPT);
+ }
+ total_size+=img.get_data().size();
+
+ mipmap_images.push_back(img);
+ }
+
+ print_line("mipmap read total: "+itos(mipmap_images.size()));
+
+
+ memdelete(f); //no longer needed
+
+ if (mipmap_images.size()==1) {
+
+ image=mipmap_images[0];
+ return OK;
+
+ } else {
+ PoolVector<uint8_t> img_data;
+ img_data.resize(total_size);
+
+ {
+ PoolVector<uint8_t>::Write w=img_data.write();
+
+ int ofs=0;
+ for(int i=0;i<mipmap_images.size();i++) {
+
+ PoolVector<uint8_t> id = mipmap_images[i].get_data();
+ int len = id.size();
+ PoolVector<uint8_t>::Read r = id.read();
+ copymem(&w[ofs],r.ptr(),len);
+ ofs+=len;
+ }
+ }
+
+ image = Image(sw,sh,true,mipmap_images[0].get_format(),img_data);
+ return OK;
+ }
+
+ } else {
+
+ //look for regular format
+ Image::Format format = (Image::Format)(df&FORMAT_MASK_IMAGE_FORMAT);
+ bool mipmaps = df&FORMAT_BIT_HAS_MIPMAPS;
+
+ if (!mipmaps) {
+ int size = Image::get_image_data_size(tw,th,format,0);
+
+ PoolVector<uint8_t> img_data;
+ img_data.resize(size);
+
+ {
+ PoolVector<uint8_t>::Write w=img_data.write();
+ f->get_buffer(w.ptr(),size);
+ }
+
+ memdelete(f);
+
+ image = Image(tw,th,false,format,img_data);
+ return OK;
+ } else {
+
+ int sw=tw;
+ int sh=th;
+
+ int mipmaps = Image::get_image_required_mipmaps(tw,th,format);
+ int total_size = Image::get_image_data_size(tw,th,format,mipmaps);
+ int idx=0;
+ int ofs=0;
+
+
+ while(mipmaps>1 && p_size_limit>0 && (sw>p_size_limit || sh>p_size_limit)) {
+
+ sw=MAX(sw>>1,1);
+ sh=MAX(sh>>1,1);
+ mipmaps--;
+ idx++;
+ }
+
+ if (idx>0) {
+ ofs=Image::get_image_data_size(tw,th,format,idx-1);
+ }
+
+ if (total_size - ofs <=0) {
+ memdelete(f);
+ ERR_FAIL_V(ERR_FILE_CORRUPT);
+ }
+
+ f->seek(f->get_pos()+ofs);
+
+
+ PoolVector<uint8_t> img_data;
+ img_data.resize(total_size - ofs);
+
+ {
+ PoolVector<uint8_t>::Write w=img_data.write();
+ int bytes = f->get_buffer(w.ptr(),total_size - ofs);
+ print_line("requested read: "+itos(total_size - ofs)+" but got: "+itos(bytes));
+
+ memdelete(f);
+
+ if (bytes != total_size - ofs) {
+ ERR_FAIL_V(ERR_FILE_CORRUPT);
+ }
+ }
+
+ image = Image(sw,sh,true,format,img_data);
+
+ return OK;
+ }
+ }
+
+ return ERR_BUG; //unreachable
+}
+
+Error StreamTexture::load(const String& p_path) {
+
+
+ int lw,lh,lflags;
+ Image image;
+ Error err = _load_data(p_path,lw,lh,lflags,image);
+ if (err)
+ return err;
+
+ VS::get_singleton()->texture_allocate(texture,image.get_width(),image.get_height(),image.get_format(),lflags);
+ VS::get_singleton()->texture_set_data(texture,image);
+
+ w=lw;
+ h=lh;
+ flags=lflags;
+ path_to_file=p_path;
+ format=image.get_format();
+
+ return OK;
+}
+String StreamTexture::get_load_path() const {
+
+ return path_to_file;
+}
+
+int StreamTexture::get_width() const {
+
+ return w;
+}
+int StreamTexture::get_height() const {
+
+ return h;
+}
+RID StreamTexture::get_rid() const {
+
+ return texture;
+}
+
+
+void StreamTexture::draw(RID p_canvas_item, const Point2& p_pos, const Color& p_modulate, bool p_transpose) const {
+
+ if ((w|h)==0)
+ return;
+ VisualServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item,Rect2( p_pos, Size2(w,h)),texture,false,p_modulate,p_transpose);
+
+}
+void StreamTexture::draw_rect(RID p_canvas_item,const Rect2& p_rect, bool p_tile,const Color& p_modulate, bool p_transpose) const {
+
+ if ((w|h)==0)
+ return;
+ VisualServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item,p_rect,texture,p_tile,p_modulate,p_transpose);
+
+}
+void StreamTexture::draw_rect_region(RID p_canvas_item,const Rect2& p_rect, const Rect2& p_src_rect,const Color& p_modulate, bool p_transpose) const{
+
+ if ((w|h)==0)
+ return;
+ VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item,p_rect,texture,p_src_rect,p_modulate,p_transpose);
+}
+
+bool StreamTexture::has_alpha() const {
+
+ return false;
+}
+
+Image StreamTexture::get_data() const {
+
+ return VS::get_singleton()->texture_get_data(texture);
+}
+
+void StreamTexture::set_flags(uint32_t p_flags){
+
+}
+
+void StreamTexture::reload_from_file() {
+
+#ifdef TOOLS_ENABLED
+ String ipath = get_import_path();
+ if (ipath.is_resource_file() && ipath!=path_to_file) {
+ path_to_file=ipath;
+ }
+#endif
+ load(path_to_file);
+}
+
+void StreamTexture::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("load","path"),&StreamTexture::load);
+ ClassDB::bind_method(D_METHOD("get_load_path"),&StreamTexture::get_load_path);
+
+ ADD_PROPERTY( PropertyInfo(Variant::STRING,"load_path",PROPERTY_HINT_FILE,"*.stex"),"load","get_load_path");
+}
+
+
+StreamTexture::StreamTexture() {
+
+ format=Image::FORMAT_MAX;
+ flags=0;
+ w=0;
+ h=0;
+
+ texture = VS::get_singleton()->texture_create();
+}
+
+StreamTexture::~StreamTexture() {
+
+ VS::get_singleton()->free(texture);
+}
+
+
+
+RES ResourceFormatLoaderStreamTexture::load(const String &p_path,const String& p_original_path,Error *r_error) {
+
+ Ref<StreamTexture> st;
+ st.instance();
+ Error err = st->load(p_path);
+ if (r_error)
+ *r_error=err;
+ if (err!=OK)
+ return RES();
+
+ return st;
+}
+
+void ResourceFormatLoaderStreamTexture::get_recognized_extensions(List<String> *p_extensions) const{
+
+ p_extensions->push_back("stex");
+}
+bool ResourceFormatLoaderStreamTexture::handles_type(const String& p_type) const{
+ return p_type=="StreamTexture";
+
+}
+String ResourceFormatLoaderStreamTexture::get_resource_type(const String &p_path) const{
+
+ if (p_path.get_extension().to_lower()=="stex")
+ return "StreamTexture";
+ return "";
+}
+
+
+
+
//////////////////////////////////////////
@@ -549,20 +932,20 @@ Rect2 AtlasTexture::get_margin() const {
void AtlasTexture::_bind_methods() {
- ClassDB::bind_method(_MD("set_atlas","atlas:Texture"),&AtlasTexture::set_atlas);
- ClassDB::bind_method(_MD("get_atlas:Texture"),&AtlasTexture::get_atlas);
+ ClassDB::bind_method(D_METHOD("set_atlas","atlas:Texture"),&AtlasTexture::set_atlas);
+ ClassDB::bind_method(D_METHOD("get_atlas:Texture"),&AtlasTexture::get_atlas);
- ClassDB::bind_method(_MD("set_region","region"),&AtlasTexture::set_region);
- ClassDB::bind_method(_MD("get_region"),&AtlasTexture::get_region);
+ ClassDB::bind_method(D_METHOD("set_region","region"),&AtlasTexture::set_region);
+ ClassDB::bind_method(D_METHOD("get_region"),&AtlasTexture::get_region);
- ClassDB::bind_method(_MD("set_margin","margin"),&AtlasTexture::set_margin);
- ClassDB::bind_method(_MD("get_margin"),&AtlasTexture::get_margin);
+ ClassDB::bind_method(D_METHOD("set_margin","margin"),&AtlasTexture::set_margin);
+ ClassDB::bind_method(D_METHOD("get_margin"),&AtlasTexture::get_margin);
ADD_SIGNAL(MethodInfo("atlas_changed"));
- ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "atlas", PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_atlas"),_SCS("get_atlas") );
- ADD_PROPERTY( PropertyInfo( Variant::RECT2, "region"), _SCS("set_region"),_SCS("get_region") );
- ADD_PROPERTY( PropertyInfo( Variant::RECT2, "margin"), _SCS("set_margin"),_SCS("get_margin") );
+ ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "atlas", PROPERTY_HINT_RESOURCE_TYPE,"Texture"), "set_atlas","get_atlas") ;
+ ADD_PROPERTY( PropertyInfo( Variant::RECT2, "region"), "set_region","get_region") ;
+ ADD_PROPERTY( PropertyInfo( Variant::RECT2, "margin"), "set_margin","get_margin") ;
}
@@ -804,20 +1187,20 @@ Ref<Texture> LargeTexture::get_piece_texture(int p_idx) const{
void LargeTexture::_bind_methods() {
- ClassDB::bind_method(_MD("add_piece","ofs","texture:Texture"),&LargeTexture::add_piece);
- ClassDB::bind_method(_MD("set_piece_offset", "idx", "ofs"),&LargeTexture::set_piece_offset);
- ClassDB::bind_method(_MD("set_piece_texture","idx", "texture:Texture"),&LargeTexture::set_piece_texture);
- ClassDB::bind_method(_MD("set_size","size"),&LargeTexture::set_size);
- ClassDB::bind_method(_MD("clear"),&LargeTexture::clear);
+ ClassDB::bind_method(D_METHOD("add_piece","ofs","texture:Texture"),&LargeTexture::add_piece);
+ ClassDB::bind_method(D_METHOD("set_piece_offset", "idx", "ofs"),&LargeTexture::set_piece_offset);
+ ClassDB::bind_method(D_METHOD("set_piece_texture","idx", "texture:Texture"),&LargeTexture::set_piece_texture);
+ ClassDB::bind_method(D_METHOD("set_size","size"),&LargeTexture::set_size);
+ ClassDB::bind_method(D_METHOD("clear"),&LargeTexture::clear);
- ClassDB::bind_method(_MD("get_piece_count"),&LargeTexture::get_piece_count);
- ClassDB::bind_method(_MD("get_piece_offset","idx"),&LargeTexture::get_piece_offset);
- ClassDB::bind_method(_MD("get_piece_texture:Texture","idx"),&LargeTexture::get_piece_texture);
+ ClassDB::bind_method(D_METHOD("get_piece_count"),&LargeTexture::get_piece_count);
+ ClassDB::bind_method(D_METHOD("get_piece_offset","idx"),&LargeTexture::get_piece_offset);
+ ClassDB::bind_method(D_METHOD("get_piece_texture:Texture","idx"),&LargeTexture::get_piece_texture);
- ClassDB::bind_method(_MD("_set_data","data"),&LargeTexture::_set_data);
- ClassDB::bind_method(_MD("_get_data"),&LargeTexture::_get_data);
+ ClassDB::bind_method(D_METHOD("_set_data","data"),&LargeTexture::_set_data);
+ ClassDB::bind_method(D_METHOD("_get_data"),&LargeTexture::_get_data);
- ADD_PROPERTY( PropertyInfo( Variant::ARRAY, "_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_data"),_SCS("_get_data") );
+ ADD_PROPERTY( PropertyInfo( Variant::ARRAY, "_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), "_set_data","_get_data") ;
}
@@ -1048,18 +1431,18 @@ void CubeMap::_get_property_list( List<PropertyInfo> *p_list) const {
void CubeMap::_bind_methods() {
- ClassDB::bind_method(_MD("get_width"),&CubeMap::get_width);
- ClassDB::bind_method(_MD("get_height"),&CubeMap::get_height);
- ClassDB::bind_method(_MD("get_rid"),&CubeMap::get_rid);
- ClassDB::bind_method(_MD("set_flags","flags"),&CubeMap::set_flags);
- ClassDB::bind_method(_MD("get_flags"),&CubeMap::get_flags);
-
- ClassDB::bind_method(_MD("set_side","side","image"),&CubeMap::set_side);
- ClassDB::bind_method(_MD("get_side","side"),&CubeMap::get_side);
- ClassDB::bind_method(_MD("set_storage","mode"),&CubeMap::set_storage);
- ClassDB::bind_method(_MD("get_storage"),&CubeMap::get_storage);
- ClassDB::bind_method(_MD("set_lossy_storage_quality","quality"),&CubeMap::set_lossy_storage_quality);
- ClassDB::bind_method(_MD("get_lossy_storage_quality"),&CubeMap::get_lossy_storage_quality);
+ ClassDB::bind_method(D_METHOD("get_width"),&CubeMap::get_width);
+ ClassDB::bind_method(D_METHOD("get_height"),&CubeMap::get_height);
+ //ClassDB::bind_method(D_METHOD("get_rid"),&CubeMap::get_rid);
+ ClassDB::bind_method(D_METHOD("set_flags","flags"),&CubeMap::set_flags);
+ ClassDB::bind_method(D_METHOD("get_flags"),&CubeMap::get_flags);
+
+ ClassDB::bind_method(D_METHOD("set_side","side","image"),&CubeMap::set_side);
+ ClassDB::bind_method(D_METHOD("get_side","side"),&CubeMap::get_side);
+ ClassDB::bind_method(D_METHOD("set_storage","mode"),&CubeMap::set_storage);
+ ClassDB::bind_method(D_METHOD("get_storage"),&CubeMap::get_storage);
+ ClassDB::bind_method(D_METHOD("set_lossy_storage_quality","quality"),&CubeMap::set_lossy_storage_quality);
+ ClassDB::bind_method(D_METHOD("get_lossy_storage_quality"),&CubeMap::get_lossy_storage_quality);
BIND_CONSTANT( STORAGE_RAW );