diff options
Diffstat (limited to 'scene/3d/sprite_3d.cpp')
-rw-r--r-- | scene/3d/sprite_3d.cpp | 160 |
1 files changed, 81 insertions, 79 deletions
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index a2a96d7d0e..5adb7050f8 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -246,55 +246,55 @@ SpriteBase3D::AlphaCutMode SpriteBase3D::get_alpha_cut_mode() const{ void SpriteBase3D::_bind_methods() { - ClassDB::bind_method(_MD("set_centered","centered"),&SpriteBase3D::set_centered); - ClassDB::bind_method(_MD("is_centered"),&SpriteBase3D::is_centered); + ClassDB::bind_method(D_METHOD("set_centered","centered"),&SpriteBase3D::set_centered); + ClassDB::bind_method(D_METHOD("is_centered"),&SpriteBase3D::is_centered); - ClassDB::bind_method(_MD("set_offset","offset"),&SpriteBase3D::set_offset); - ClassDB::bind_method(_MD("get_offset"),&SpriteBase3D::get_offset); + ClassDB::bind_method(D_METHOD("set_offset","offset"),&SpriteBase3D::set_offset); + ClassDB::bind_method(D_METHOD("get_offset"),&SpriteBase3D::get_offset); - ClassDB::bind_method(_MD("set_flip_h","flip_h"),&SpriteBase3D::set_flip_h); - ClassDB::bind_method(_MD("is_flipped_h"),&SpriteBase3D::is_flipped_h); + ClassDB::bind_method(D_METHOD("set_flip_h","flip_h"),&SpriteBase3D::set_flip_h); + ClassDB::bind_method(D_METHOD("is_flipped_h"),&SpriteBase3D::is_flipped_h); - ClassDB::bind_method(_MD("set_flip_v","flip_v"),&SpriteBase3D::set_flip_v); - ClassDB::bind_method(_MD("is_flipped_v"),&SpriteBase3D::is_flipped_v); + ClassDB::bind_method(D_METHOD("set_flip_v","flip_v"),&SpriteBase3D::set_flip_v); + ClassDB::bind_method(D_METHOD("is_flipped_v"),&SpriteBase3D::is_flipped_v); - ClassDB::bind_method(_MD("set_modulate","modulate"),&SpriteBase3D::set_modulate); - ClassDB::bind_method(_MD("get_modulate"),&SpriteBase3D::get_modulate); + ClassDB::bind_method(D_METHOD("set_modulate","modulate"),&SpriteBase3D::set_modulate); + ClassDB::bind_method(D_METHOD("get_modulate"),&SpriteBase3D::get_modulate); - ClassDB::bind_method(_MD("set_opacity","opacity"),&SpriteBase3D::set_opacity); - ClassDB::bind_method(_MD("get_opacity"),&SpriteBase3D::get_opacity); + ClassDB::bind_method(D_METHOD("set_opacity","opacity"),&SpriteBase3D::set_opacity); + ClassDB::bind_method(D_METHOD("get_opacity"),&SpriteBase3D::get_opacity); - ClassDB::bind_method(_MD("set_pixel_size","pixel_size"),&SpriteBase3D::set_pixel_size); - ClassDB::bind_method(_MD("get_pixel_size"),&SpriteBase3D::get_pixel_size); + ClassDB::bind_method(D_METHOD("set_pixel_size","pixel_size"),&SpriteBase3D::set_pixel_size); + ClassDB::bind_method(D_METHOD("get_pixel_size"),&SpriteBase3D::get_pixel_size); - ClassDB::bind_method(_MD("set_axis","axis"),&SpriteBase3D::set_axis); - ClassDB::bind_method(_MD("get_axis"),&SpriteBase3D::get_axis); + ClassDB::bind_method(D_METHOD("set_axis","axis"),&SpriteBase3D::set_axis); + ClassDB::bind_method(D_METHOD("get_axis"),&SpriteBase3D::get_axis); - ClassDB::bind_method(_MD("set_draw_flag","flag","enabled"),&SpriteBase3D::set_draw_flag); - ClassDB::bind_method(_MD("get_draw_flag","flag"),&SpriteBase3D::get_draw_flag); + ClassDB::bind_method(D_METHOD("set_draw_flag","flag","enabled"),&SpriteBase3D::set_draw_flag); + ClassDB::bind_method(D_METHOD("get_draw_flag","flag"),&SpriteBase3D::get_draw_flag); - ClassDB::bind_method(_MD("set_alpha_cut_mode","mode"),&SpriteBase3D::set_alpha_cut_mode); - ClassDB::bind_method(_MD("get_alpha_cut_mode"),&SpriteBase3D::get_alpha_cut_mode); + ClassDB::bind_method(D_METHOD("set_alpha_cut_mode","mode"),&SpriteBase3D::set_alpha_cut_mode); + ClassDB::bind_method(D_METHOD("get_alpha_cut_mode"),&SpriteBase3D::get_alpha_cut_mode); - ClassDB::bind_method(_MD("get_item_rect"),&SpriteBase3D::get_item_rect); + ClassDB::bind_method(D_METHOD("get_item_rect"),&SpriteBase3D::get_item_rect); - ClassDB::bind_method(_MD("_queue_update"),&SpriteBase3D::_queue_update); - ClassDB::bind_method(_MD("_im_update"),&SpriteBase3D::_im_update); + ClassDB::bind_method(D_METHOD("_queue_update"),&SpriteBase3D::_queue_update); + ClassDB::bind_method(D_METHOD("_im_update"),&SpriteBase3D::_im_update); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered")); - ADD_PROPERTY( PropertyInfo( Variant::VECTOR2, "offset"), _SCS("set_offset"),_SCS("get_offset")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flip_h"), _SCS("set_flip_h"),_SCS("is_flipped_h")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flip_v"), _SCS("set_flip_v"),_SCS("is_flipped_v")); - ADD_PROPERTY( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate")); - ADD_PROPERTY( PropertyInfo( Variant::REAL, "opacity",PROPERTY_HINT_RANGE,"0,1,0.01"), _SCS("set_opacity"),_SCS("get_opacity")); - ADD_PROPERTY( PropertyInfo( Variant::REAL, "pixel_size",PROPERTY_HINT_RANGE,"0.0001,128,0.0001"), _SCS("set_pixel_size"),_SCS("get_pixel_size")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "axis",PROPERTY_HINT_ENUM,"X-Axis,Y-Axis,Z-Axis"), _SCS("set_axis"),_SCS("get_axis")); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "centered"), "set_centered","is_centered"); + ADD_PROPERTY( PropertyInfo( Variant::VECTOR2, "offset"), "set_offset","get_offset"); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flip_h"), "set_flip_h","is_flipped_h"); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flip_v"), "set_flip_v","is_flipped_v"); + ADD_PROPERTY( PropertyInfo( Variant::COLOR, "modulate"), "set_modulate","get_modulate"); + ADD_PROPERTY( PropertyInfo( Variant::REAL, "opacity",PROPERTY_HINT_RANGE,"0,1,0.01"), "set_opacity","get_opacity"); + ADD_PROPERTY( PropertyInfo( Variant::REAL, "pixel_size",PROPERTY_HINT_RANGE,"0.0001,128,0.0001"), "set_pixel_size","get_pixel_size"); + ADD_PROPERTY( PropertyInfo( Variant::INT, "axis",PROPERTY_HINT_ENUM,"X-Axis,Y-Axis,Z-Axis"), "set_axis","get_axis"); ADD_GROUP("Flags",""); - ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "transparent"), _SCS("set_draw_flag"),_SCS("get_draw_flag"),FLAG_TRANSPARENT); - ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "shaded"), _SCS("set_draw_flag"),_SCS("get_draw_flag"),FLAG_SHADED); - ADD_PROPERTY( PropertyInfo( Variant::INT, "alpha_cut",PROPERTY_HINT_ENUM,"Disabled,Discard,Opaque Pre-Pass"), _SCS("set_alpha_cut_mode"),_SCS("get_alpha_cut_mode")); + ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "transparent"), "set_draw_flag","get_draw_flag",FLAG_TRANSPARENT); + ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "shaded"), "set_draw_flag","get_draw_flag",FLAG_SHADED); + ADD_PROPERTY( PropertyInfo( Variant::INT, "alpha_cut",PROPERTY_HINT_ENUM,"Disabled,Discard,Opaque Pre-Pass"), "set_alpha_cut_mode","get_alpha_cut_mode"); BIND_CONSTANT( FLAG_TRANSPARENT ); @@ -563,8 +563,10 @@ Rect2 Sprite3D::get_item_rect() const { if (texture.is_null()) return Rect2(0,0,1,1); - //if (texture.is_null()) - // return CanvasItem::get_item_rect(); + /* + if (texture.is_null()) + return CanvasItem::get_item_rect(); + */ Size2i s; @@ -599,30 +601,30 @@ void Sprite3D::_validate_property(PropertyInfo& property) const { void Sprite3D::_bind_methods() { - ClassDB::bind_method(_MD("set_texture","texture:Texture"),&Sprite3D::set_texture); - ClassDB::bind_method(_MD("get_texture:Texture"),&Sprite3D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture","texture:Texture"),&Sprite3D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture:Texture"),&Sprite3D::get_texture); - ClassDB::bind_method(_MD("set_region","enabled"),&Sprite3D::set_region); - ClassDB::bind_method(_MD("is_region"),&Sprite3D::is_region); + ClassDB::bind_method(D_METHOD("set_region","enabled"),&Sprite3D::set_region); + ClassDB::bind_method(D_METHOD("is_region"),&Sprite3D::is_region); - ClassDB::bind_method(_MD("set_region_rect","rect"),&Sprite3D::set_region_rect); - ClassDB::bind_method(_MD("get_region_rect"),&Sprite3D::get_region_rect); + ClassDB::bind_method(D_METHOD("set_region_rect","rect"),&Sprite3D::set_region_rect); + ClassDB::bind_method(D_METHOD("get_region_rect"),&Sprite3D::get_region_rect); - ClassDB::bind_method(_MD("set_frame","frame"),&Sprite3D::set_frame); - ClassDB::bind_method(_MD("get_frame"),&Sprite3D::get_frame); + ClassDB::bind_method(D_METHOD("set_frame","frame"),&Sprite3D::set_frame); + ClassDB::bind_method(D_METHOD("get_frame"),&Sprite3D::get_frame); - ClassDB::bind_method(_MD("set_vframes","vframes"),&Sprite3D::set_vframes); - ClassDB::bind_method(_MD("get_vframes"),&Sprite3D::get_vframes); + ClassDB::bind_method(D_METHOD("set_vframes","vframes"),&Sprite3D::set_vframes); + ClassDB::bind_method(D_METHOD("get_vframes"),&Sprite3D::get_vframes); - ClassDB::bind_method(_MD("set_hframes","hframes"),&Sprite3D::set_hframes); - ClassDB::bind_method(_MD("get_hframes"),&Sprite3D::get_hframes); + ClassDB::bind_method(D_METHOD("set_hframes","hframes"),&Sprite3D::set_hframes); + ClassDB::bind_method(D_METHOD("get_hframes"),&Sprite3D::get_hframes); - ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_texture"),_SCS("get_texture")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "vframes",PROPERTY_HINT_RANGE,"1,16384,1"), _SCS("set_vframes"),_SCS("get_vframes")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "hframes",PROPERTY_HINT_RANGE,"1,16384,1"), _SCS("set_hframes"),_SCS("get_hframes")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), _SCS("set_frame"),_SCS("get_frame")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "region"), _SCS("set_region"),_SCS("is_region")); - ADD_PROPERTY( PropertyInfo( Variant::RECT2, "region_rect"), _SCS("set_region_rect"),_SCS("get_region_rect")); + ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE,"Texture"), "set_texture","get_texture"); + ADD_PROPERTY( PropertyInfo( Variant::INT, "vframes",PROPERTY_HINT_RANGE,"1,16384,1"), "set_vframes","get_vframes"); + ADD_PROPERTY( PropertyInfo( Variant::INT, "hframes",PROPERTY_HINT_RANGE,"1,16384,1"), "set_hframes","get_hframes"); + ADD_PROPERTY( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), "set_frame","get_frame"); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "region"), "set_region","is_region"); + ADD_PROPERTY( PropertyInfo( Variant::RECT2, "region_rect"), "set_region_rect","get_region_rect"); ADD_SIGNAL(MethodInfo("frame_changed")); @@ -762,13 +764,13 @@ void AnimatedSprite3D::_draw() { void AnimatedSprite3D::_bind_methods(){ - ClassDB::bind_method(_MD("set_sprite_frames","sprite_frames:SpriteFrames"),&AnimatedSprite3D::set_sprite_frames); - ClassDB::bind_method(_MD("get_sprite_frames:Texture"),&AnimatedSprite3D::get_sprite_frames); - ClassDB::bind_method(_MD("set_frame","frame"),&AnimatedSprite3D::set_frame); - ClassDB::bind_method(_MD("get_frame"),&AnimatedSprite3D::get_frame); + ClassDB::bind_method(D_METHOD("set_sprite_frames","sprite_frames:SpriteFrames"),&AnimatedSprite3D::set_sprite_frames); + ClassDB::bind_method(D_METHOD("get_sprite_frames:Texture"),&AnimatedSprite3D::get_sprite_frames); + ClassDB::bind_method(D_METHOD("set_frame","frame"),&AnimatedSprite3D::set_frame); + ClassDB::bind_method(D_METHOD("get_frame"),&AnimatedSprite3D::get_frame); - ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "frames", PROPERTY_HINT_RESOURCE_TYPE,"SpriteFrames"), _SCS("set_sprite_frames"),_SCS("get_sprite_frames")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), _SCS("set_frame"),_SCS("get_frame")); + ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "frames", PROPERTY_HINT_RESOURCE_TYPE,"SpriteFrames"), "set_sprite_frames","get_sprite_frames"); + ADD_PROPERTY( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), "set_frame","get_frame"); ADD_SIGNAL(MethodInfo("frame_changed")); @@ -1130,7 +1132,7 @@ void AnimatedSprite3D::_notification(int p_what) { //texture->draw_rect(ci,dst_rect,false,modulate); texture->draw_rect_region(ci,dst_rect,Rect2(Vector2(),texture->get_size()),modulate); -// VisualServer::get_singleton()->canvas_item_add_texture_rect_region(ci,dst_rect,texture->get_rid(),src_rect,modulate); + //VisualServer::get_singleton()->canvas_item_add_texture_rect_region(ci,dst_rect,texture->get_rid(),src_rect,modulate); } break; #endif @@ -1188,7 +1190,7 @@ void AnimatedSprite3D::set_frame(int p_frame) { frame=p_frame; _reset_timeout(); - _queue_update();; + _queue_update(); _change_notify("frame"); emit_signal(SceneStringNames::get_singleton()->frame_changed); @@ -1291,7 +1293,7 @@ void AnimatedSprite3D::set_animation(const StringName& p_animation){ _reset_timeout(); set_frame(0); _change_notify(); - _queue_update();; + _queue_update(); } StringName AnimatedSprite3D::get_animation() const{ @@ -1310,31 +1312,31 @@ String AnimatedSprite3D::get_configuration_warning() const { void AnimatedSprite3D::_bind_methods() { - ClassDB::bind_method(_MD("set_sprite_frames","sprite_frames:SpriteFrames"),&AnimatedSprite3D::set_sprite_frames); - ClassDB::bind_method(_MD("get_sprite_frames:SpriteFrames"),&AnimatedSprite3D::get_sprite_frames); + ClassDB::bind_method(D_METHOD("set_sprite_frames","sprite_frames:SpriteFrames"),&AnimatedSprite3D::set_sprite_frames); + ClassDB::bind_method(D_METHOD("get_sprite_frames:SpriteFrames"),&AnimatedSprite3D::get_sprite_frames); - ClassDB::bind_method(_MD("set_animation","animation"),&AnimatedSprite3D::set_animation); - ClassDB::bind_method(_MD("get_animation"),&AnimatedSprite3D::get_animation); + ClassDB::bind_method(D_METHOD("set_animation","animation"),&AnimatedSprite3D::set_animation); + ClassDB::bind_method(D_METHOD("get_animation"),&AnimatedSprite3D::get_animation); - ClassDB::bind_method(_MD("_set_playing","playing"),&AnimatedSprite3D::_set_playing); - ClassDB::bind_method(_MD("_is_playing"),&AnimatedSprite3D::_is_playing); + ClassDB::bind_method(D_METHOD("_set_playing","playing"),&AnimatedSprite3D::_set_playing); + ClassDB::bind_method(D_METHOD("_is_playing"),&AnimatedSprite3D::_is_playing); - ClassDB::bind_method(_MD("play","anim"),&AnimatedSprite3D::play,DEFVAL(StringName())); - ClassDB::bind_method(_MD("stop"),&AnimatedSprite3D::stop); - ClassDB::bind_method(_MD("is_playing"),&AnimatedSprite3D::is_playing); + ClassDB::bind_method(D_METHOD("play","anim"),&AnimatedSprite3D::play,DEFVAL(StringName())); + ClassDB::bind_method(D_METHOD("stop"),&AnimatedSprite3D::stop); + ClassDB::bind_method(D_METHOD("is_playing"),&AnimatedSprite3D::is_playing); - ClassDB::bind_method(_MD("set_frame","frame"),&AnimatedSprite3D::set_frame); - ClassDB::bind_method(_MD("get_frame"),&AnimatedSprite3D::get_frame); + ClassDB::bind_method(D_METHOD("set_frame","frame"),&AnimatedSprite3D::set_frame); + ClassDB::bind_method(D_METHOD("get_frame"),&AnimatedSprite3D::get_frame); - ClassDB::bind_method(_MD("_res_changed"),&AnimatedSprite3D::_res_changed); + ClassDB::bind_method(D_METHOD("_res_changed"),&AnimatedSprite3D::_res_changed); ADD_SIGNAL(MethodInfo("frame_changed")); - ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "frames",PROPERTY_HINT_RESOURCE_TYPE,"SpriteFrames"), _SCS("set_sprite_frames"),_SCS("get_sprite_frames")); - ADD_PROPERTY( PropertyInfo( Variant::STRING, "animation"), _SCS("set_animation"),_SCS("get_animation")); - ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), _SCS("set_frame"),_SCS("get_frame")); - ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "playing"), _SCS("_set_playing"),_SCS("_is_playing")); + ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "frames",PROPERTY_HINT_RESOURCE_TYPE,"SpriteFrames"), "set_sprite_frames","get_sprite_frames"); + ADD_PROPERTY( PropertyInfo( Variant::STRING, "animation"), "set_animation","get_animation"); + ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), "set_frame","get_frame"); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "playing"), "_set_playing","_is_playing"); } |