diff options
Diffstat (limited to 'scene/2d')
33 files changed, 267 insertions, 267 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index bde3f50754..4300c25e9f 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -332,7 +332,7 @@ void AnimatedSprite::_validate_property(PropertyInfo& property) const { void AnimatedSprite::_notification(int p_what) { switch(p_what) { - case NOTIFICATION_PROCESS: { + case NOTIFICATION_INTERNAL_PROCESS: { if (frames.is_null()) return; @@ -363,7 +363,7 @@ void AnimatedSprite::_notification(int p_what) { } else { frame++; if (frame==fc-1) { - emit_signal(SceneStringNames::get_singleton()->finished); + emit_signal(SceneStringNames::get_singleton()->animation_finished); } } @@ -428,7 +428,7 @@ void AnimatedSprite::_notification(int p_what) { dst_rect.size.y=-dst_rect.size.y; //texture->draw_rect(ci,dst_rect,false,modulate); - texture->draw_rect_region(ci,dst_rect,Rect2(Vector2(),texture->get_size()),modulate); + texture->draw_rect_region(ci,dst_rect,Rect2(Vector2(),texture->get_size())); // VisualServer::get_singleton()->canvas_item_add_texture_rect_region(ci,dst_rect,texture->get_rid(),src_rect,modulate); } break; @@ -544,17 +544,6 @@ bool AnimatedSprite::is_flipped_v() const { } -void AnimatedSprite::set_modulate(const Color& p_color) { - - modulate=p_color; - update(); -} - -Color AnimatedSprite::get_modulate() const{ - - return modulate; -} - Rect2 AnimatedSprite::get_item_rect() const { @@ -593,7 +582,7 @@ void AnimatedSprite::_set_playing(bool p_playing) { return; playing=p_playing; _reset_timeout(); - set_process(playing); + set_process_internal(playing); } bool AnimatedSprite::_is_playing() const { @@ -692,14 +681,11 @@ void AnimatedSprite::_bind_methods() { ClassDB::bind_method(_MD("set_frame","frame"),&AnimatedSprite::set_frame); ClassDB::bind_method(_MD("get_frame"),&AnimatedSprite::get_frame); - ClassDB::bind_method(_MD("set_modulate","modulate"),&AnimatedSprite::set_modulate); - ClassDB::bind_method(_MD("get_modulate"),&AnimatedSprite::get_modulate); - ClassDB::bind_method(_MD("_res_changed"),&AnimatedSprite::_res_changed); ADD_SIGNAL(MethodInfo("frame_changed")); - ADD_SIGNAL(MethodInfo("finished")); + ADD_SIGNAL(MethodInfo("animation_finished")); 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")); @@ -709,7 +695,7 @@ void AnimatedSprite::_bind_methods() { ADD_PROPERTYNZ( PropertyInfo( Variant::VECTOR2, "offset"), _SCS("set_offset"),_SCS("get_offset")); ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "flip_h"), _SCS("set_flip_h"),_SCS("is_flipped_h")); ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "flip_v"), _SCS("set_flip_v"),_SCS("is_flipped_v")); - ADD_PROPERTYNO( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate")); + } @@ -722,7 +708,6 @@ AnimatedSprite::AnimatedSprite() { frame=0; playing=false; animation="default"; - modulate=Color(1,1,1,1); timeout=0; diff --git a/scene/2d/animated_sprite.h b/scene/2d/animated_sprite.h index f546de038b..fbeea7f69b 100644 --- a/scene/2d/animated_sprite.h +++ b/scene/2d/animated_sprite.h @@ -124,7 +124,6 @@ class AnimatedSprite : public Node2D { bool hflip; bool vflip; - Color modulate; void _res_changed(); diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index c1d0d9ab50..883118dc41 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -666,8 +666,9 @@ void Area2D::_bind_methods() { ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"priority",PROPERTY_HINT_RANGE,"0,128,1"),_SCS("set_priority"),_SCS("get_priority")); ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"monitoring"),_SCS("set_enable_monitoring"),_SCS("is_monitoring_enabled")); ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"monitorable"),_SCS("set_monitorable"),_SCS("is_monitorable")); - ADD_PROPERTYNO( PropertyInfo(Variant::INT,"collision/layers",PROPERTY_HINT_ALL_FLAGS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); - ADD_PROPERTYNO( PropertyInfo(Variant::INT,"collision/mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); + ADD_GROUP("Collision","collision_"); + ADD_PROPERTYNO( PropertyInfo(Variant::INT,"collision_layers",PROPERTY_HINT_LAYERS_2D_PHYSICS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); + ADD_PROPERTYNO( PropertyInfo(Variant::INT,"collision_mask",PROPERTY_HINT_LAYERS_2D_PHYSICS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); } diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index e3ac5e3c2b..3276f3f004 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -656,25 +656,26 @@ void Camera2D::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::BOOL,"current"),_SCS("_set_current"),_SCS("is_current")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"zoom"),_SCS("set_zoom"),_SCS("get_zoom") ); - ADD_PROPERTYI( PropertyInfo(Variant::INT,"limit/left"),_SCS("set_limit"),_SCS("get_limit"),MARGIN_LEFT); - ADD_PROPERTYI( PropertyInfo(Variant::INT,"limit/top"),_SCS("set_limit"),_SCS("get_limit"),MARGIN_TOP); - ADD_PROPERTYI( PropertyInfo(Variant::INT,"limit/right"),_SCS("set_limit"),_SCS("get_limit"),MARGIN_RIGHT); - ADD_PROPERTYI( PropertyInfo(Variant::INT,"limit/bottom"),_SCS("set_limit"),_SCS("get_limit"),MARGIN_BOTTOM); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"limit/smoothed"),_SCS("set_limit_smoothing_enabled"),_SCS("is_limit_smoothing_enabled") ); - - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"drag_margin/h_enabled"),_SCS("set_h_drag_enabled"),_SCS("is_h_drag_enabled") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"drag_margin/v_enabled"),_SCS("set_v_drag_enabled"),_SCS("is_v_drag_enabled") ); - - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"smoothing/enable"),_SCS("set_enable_follow_smoothing"),_SCS("is_follow_smoothing_enabled") ); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"smoothing/speed"),_SCS("set_follow_smoothing"),_SCS("get_follow_smoothing") ); - - //compatibility - ADD_PROPERTY( PropertyInfo(Variant::REAL,"smoothing",PROPERTY_HINT_NONE,"",0),_SCS("_set_old_smoothing"),_SCS("get_follow_smoothing") ); - - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"drag_margin/left",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_drag_margin"),_SCS("get_drag_margin"),MARGIN_LEFT); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"drag_margin/top",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_drag_margin"),_SCS("get_drag_margin"),MARGIN_TOP); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"drag_margin/right",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_drag_margin"),_SCS("get_drag_margin"),MARGIN_RIGHT); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"drag_margin/bottom",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_drag_margin"),_SCS("get_drag_margin"),MARGIN_BOTTOM); + ADD_GROUP("Limit","limit_"); + ADD_PROPERTYI( PropertyInfo(Variant::INT,"limit_left"),_SCS("set_limit"),_SCS("get_limit"),MARGIN_LEFT); + ADD_PROPERTYI( PropertyInfo(Variant::INT,"limit_top"),_SCS("set_limit"),_SCS("get_limit"),MARGIN_TOP); + ADD_PROPERTYI( PropertyInfo(Variant::INT,"limit_right"),_SCS("set_limit"),_SCS("get_limit"),MARGIN_RIGHT); + ADD_PROPERTYI( PropertyInfo(Variant::INT,"limit_bottom"),_SCS("set_limit"),_SCS("get_limit"),MARGIN_BOTTOM); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"limit_smoothed"),_SCS("set_limit_smoothing_enabled"),_SCS("is_limit_smoothing_enabled") ); + + ADD_GROUP("Draw Margin","draw_margin_"); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"drag_margin_h_enabled"),_SCS("set_h_drag_enabled"),_SCS("is_h_drag_enabled") ); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"drag_margin_v_enabled"),_SCS("set_v_drag_enabled"),_SCS("is_v_drag_enabled") ); + + ADD_GROUP("Smoothing","smoothing_"); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"smoothing_enabled"),_SCS("set_enable_follow_smoothing"),_SCS("is_follow_smoothing_enabled") ); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"smoothing_speed"),_SCS("set_follow_smoothing"),_SCS("get_follow_smoothing") ); + + ADD_GROUP("Drag Margin","drag_margin_"); + ADD_PROPERTYI( PropertyInfo(Variant::REAL,"drag_margin_left",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_drag_margin"),_SCS("get_drag_margin"),MARGIN_LEFT); + ADD_PROPERTYI( PropertyInfo(Variant::REAL,"drag_margin_top",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_drag_margin"),_SCS("get_drag_margin"),MARGIN_TOP); + ADD_PROPERTYI( PropertyInfo(Variant::REAL,"drag_margin_right",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_drag_margin"),_SCS("get_drag_margin"),MARGIN_RIGHT); + ADD_PROPERTYI( PropertyInfo(Variant::REAL,"drag_margin_bottom",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_drag_margin"),_SCS("get_drag_margin"),MARGIN_BOTTOM); BIND_CONSTANT( ANCHOR_MODE_DRAG_CENTER ); diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 1f4804990f..d42743afc2 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -1005,11 +1005,11 @@ void CanvasItem::_bind_methods() { ADD_GROUP("Visibility",""); ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"visible"), _SCS("_set_visible_"),_SCS("_is_visible_") ); - ADD_PROPERTYNO( PropertyInfo(Variant::REAL,"modulate",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_modulate"),_SCS("get_modulate") ); - ADD_PROPERTYNO( PropertyInfo(Variant::REAL,"self_modulate",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_self_modulate"),_SCS("get_self_modulate") ); + ADD_PROPERTYNO( PropertyInfo(Variant::COLOR,"modulate"), _SCS("set_modulate"),_SCS("get_modulate") ); + ADD_PROPERTYNO( PropertyInfo(Variant::COLOR,"self_modulate"), _SCS("set_self_modulate"),_SCS("get_self_modulate") ); ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"show_behind_parent"), _SCS("set_draw_behind_parent"),_SCS("is_draw_behind_parent_enabled") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"show_on_top",PROPERTY_HINT_NONE,"",0), _SCS("_set_on_top"),_SCS("_is_on_top") ); //compatibility - ADD_PROPERTYNO( PropertyInfo(Variant::INT,"light_mask",PROPERTY_HINT_ALL_FLAGS), _SCS("set_light_mask"),_SCS("get_light_mask") ); + ADD_PROPERTYNO( PropertyInfo(Variant::INT,"light_mask",PROPERTY_HINT_LAYERS_2D_RENDER), _SCS("set_light_mask"),_SCS("get_light_mask") ); ADD_GROUP("Material",""); ADD_PROPERTYNZ( PropertyInfo(Variant::OBJECT,"material",PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemMaterial"), _SCS("set_material"),_SCS("get_material") ); diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index e4900e38ec..90ca59d780 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -242,7 +242,9 @@ void CollisionObject2D::_bind_methods() { ADD_SIGNAL( MethodInfo("mouse_enter")); ADD_SIGNAL( MethodInfo("mouse_exit")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"input/pickable"),_SCS("set_pickable"),_SCS("is_pickable")); + ADD_GROUP("Pickable","input_"); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"input_pickable"),_SCS("set_pickable"),_SCS("is_pickable")); + ADD_GROUP("",""); } diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 4b7a918023..46baa7c184 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -68,16 +68,16 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) { Ref<ConcavePolygonShape2D> concave = memnew( ConcavePolygonShape2D ); - DVector<Vector2> segments; + PoolVector<Vector2> segments; segments.resize(polygon.size()*2); - DVector<Vector2>::Write w=segments.write(); + PoolVector<Vector2>::Write w=segments.write(); for(int i=0;i<polygon.size();i++) { w[(i<<1)+0]=polygon[i]; w[(i<<1)+1]=polygon[(i+1)%polygon.size()]; } - w=DVector<Vector2>::Write(); + w=PoolVector<Vector2>::Write(); concave->set_segments(segments); co->add_shape(concave,get_transform()); diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp index e315a45838..0d83509f37 100644 --- a/scene/2d/joints_2d.cpp +++ b/scene/2d/joints_2d.cpp @@ -142,8 +142,8 @@ void Joint2D::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::NODE_PATH, "node_a"), _SCS("set_node_a"),_SCS("get_node_a") ); ADD_PROPERTY( PropertyInfo( Variant::NODE_PATH, "node_b"), _SCS("set_node_b"),_SCS("get_node_b") ); - ADD_PROPERTY( PropertyInfo( Variant::REAL, "bias/bias",PROPERTY_HINT_RANGE,"0,0.9,0.001"), _SCS("set_bias"),_SCS("get_bias") ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "collision/exclude_nodes"), _SCS("set_exclude_nodes_from_collision"),_SCS("get_exclude_nodes_from_collision") ); + ADD_PROPERTY( PropertyInfo( Variant::REAL, "bias",PROPERTY_HINT_RANGE,"0,0.9,0.001"), _SCS("set_bias"),_SCS("get_bias") ); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "disable_collision"), _SCS("set_exclude_nodes_from_collision"),_SCS("get_exclude_nodes_from_collision") ); } diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index b5ecec4a84..b9dc8fe130 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -436,18 +436,21 @@ void Light2D::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::COLOR,"color"),_SCS("set_color"),_SCS("get_color")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"energy",PROPERTY_HINT_RANGE,"0.01,100,0.01"),_SCS("set_energy"),_SCS("get_energy")); ADD_PROPERTY( PropertyInfo(Variant::INT,"mode",PROPERTY_HINT_ENUM,"Add,Sub,Mix,Mask"),_SCS("set_mode"),_SCS("get_mode")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"range/height",PROPERTY_HINT_RANGE,"-100,100,0.1"),_SCS("set_height"),_SCS("get_height")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"range/z_min",PROPERTY_HINT_RANGE,itos(VS::CANVAS_ITEM_Z_MIN)+","+itos(VS::CANVAS_ITEM_Z_MAX)+",1"),_SCS("set_z_range_min"),_SCS("get_z_range_min")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"range/z_max",PROPERTY_HINT_RANGE,itos(VS::CANVAS_ITEM_Z_MIN)+","+itos(VS::CANVAS_ITEM_Z_MAX)+",1"),_SCS("set_z_range_max"),_SCS("get_z_range_max")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"range/layer_min",PROPERTY_HINT_RANGE,"-512,512,1"),_SCS("set_layer_range_min"),_SCS("get_layer_range_min")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"range/layer_max",PROPERTY_HINT_RANGE,"-512,512,1"),_SCS("set_layer_range_max"),_SCS("get_layer_range_max")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"range/item_cull_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_item_cull_mask"),_SCS("get_item_cull_mask")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"shadow/enabled"),_SCS("set_shadow_enabled"),_SCS("is_shadow_enabled")); - ADD_PROPERTY( PropertyInfo(Variant::COLOR,"shadow/color"),_SCS("set_shadow_color"),_SCS("get_shadow_color")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/buffer_size",PROPERTY_HINT_RANGE,"32,16384,1"),_SCS("set_shadow_buffer_size"),_SCS("get_shadow_buffer_size")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"shadow/gradient_length",PROPERTY_HINT_RANGE,"1,4096,0.1"),_SCS("set_shadow_gradient_length"),_SCS("get_shadow_gradient_length")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"shadow/filter",PROPERTY_HINT_ENUM,"None,PCF3,PCF5,PCF9,PCF13"),_SCS("set_shadow_filter"),_SCS("get_shadow_filter")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/item_cull_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_item_shadow_cull_mask"),_SCS("get_item_shadow_cull_mask")); + ADD_GROUP("Range","range_"); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"range_height",PROPERTY_HINT_RANGE,"-100,100,0.1"),_SCS("set_height"),_SCS("get_height")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"range_z_min",PROPERTY_HINT_RANGE,itos(VS::CANVAS_ITEM_Z_MIN)+","+itos(VS::CANVAS_ITEM_Z_MAX)+",1"),_SCS("set_z_range_min"),_SCS("get_z_range_min")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"range_z_max",PROPERTY_HINT_RANGE,itos(VS::CANVAS_ITEM_Z_MIN)+","+itos(VS::CANVAS_ITEM_Z_MAX)+",1"),_SCS("set_z_range_max"),_SCS("get_z_range_max")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"range_layer_min",PROPERTY_HINT_RANGE,"-512,512,1"),_SCS("set_layer_range_min"),_SCS("get_layer_range_min")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"range_layer_max",PROPERTY_HINT_RANGE,"-512,512,1"),_SCS("set_layer_range_max"),_SCS("get_layer_range_max")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"range_item_cull_mask",PROPERTY_HINT_LAYERS_2D_RENDER),_SCS("set_item_cull_mask"),_SCS("get_item_cull_mask")); + + ADD_GROUP("Shadow","shadow_"); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"shadow_enabled"),_SCS("set_shadow_enabled"),_SCS("is_shadow_enabled")); + ADD_PROPERTY( PropertyInfo(Variant::COLOR,"shadow_color"),_SCS("set_shadow_color"),_SCS("get_shadow_color")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow_buffer_size",PROPERTY_HINT_RANGE,"32,16384,1"),_SCS("set_shadow_buffer_size"),_SCS("get_shadow_buffer_size")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"shadow_gradient_length",PROPERTY_HINT_RANGE,"1,4096,0.1"),_SCS("set_shadow_gradient_length"),_SCS("get_shadow_gradient_length")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"shadow_filter",PROPERTY_HINT_ENUM,"None,PCF3,PCF5,PCF9,PCF13"),_SCS("set_shadow_filter"),_SCS("get_shadow_filter")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow_item_cull_mask",PROPERTY_HINT_LAYERS_2D_RENDER),_SCS("set_item_shadow_cull_mask"),_SCS("get_item_shadow_cull_mask")); BIND_CONSTANT( MODE_ADD ); BIND_CONSTANT( MODE_SUB ); diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index ac1fb16d78..b7b280d902 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -29,14 +29,14 @@ #include "light_occluder_2d.h" -void OccluderPolygon2D::set_polygon(const DVector<Vector2>& p_polygon) { +void OccluderPolygon2D::set_polygon(const PoolVector<Vector2>& p_polygon) { polygon=p_polygon; VS::get_singleton()->canvas_occluder_polygon_set_shape(occ_polygon,p_polygon,closed); emit_changed(); } -DVector<Vector2> OccluderPolygon2D::get_polygon() const{ +PoolVector<Vector2> OccluderPolygon2D::get_polygon() const{ return polygon; } @@ -141,7 +141,7 @@ void LightOccluder2D::_notification(int p_what) { if (occluder_polygon.is_valid()) { - DVector<Vector2> poly = occluder_polygon->get_polygon(); + PoolVector<Vector2> poly = occluder_polygon->get_polygon(); if (poly.size()) { if (occluder_polygon->is_closed()) { @@ -151,7 +151,7 @@ void LightOccluder2D::_notification(int p_what) { } else { int ps=poly.size(); - DVector<Vector2>::Read r = poly.read(); + PoolVector<Vector2>::Read r = poly.read(); for(int i=0;i<ps-1;i++) { draw_line(r[i],r[i+1],Color(0,0,0,0.6),3); @@ -235,7 +235,7 @@ void LightOccluder2D::_bind_methods() { #endif ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"occluder",PROPERTY_HINT_RESOURCE_TYPE,"OccluderPolygon2D"),_SCS("set_occluder_polygon"),_SCS("get_occluder_polygon")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"light_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_occluder_light_mask"),_SCS("get_occluder_light_mask")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"light_mask",PROPERTY_HINT_LAYERS_2D_RENDER),_SCS("set_occluder_light_mask"),_SCS("get_occluder_light_mask")); } LightOccluder2D::LightOccluder2D() { diff --git a/scene/2d/light_occluder_2d.h b/scene/2d/light_occluder_2d.h index 1d7430689f..777785cd1d 100644 --- a/scene/2d/light_occluder_2d.h +++ b/scene/2d/light_occluder_2d.h @@ -45,7 +45,7 @@ private: RID occ_polygon; - DVector<Vector2> polygon; + PoolVector<Vector2> polygon; bool closed; CullMode cull; @@ -54,8 +54,8 @@ protected: static void _bind_methods(); public: - void set_polygon(const DVector<Vector2>& p_polygon); - DVector<Vector2> get_polygon() const; + void set_polygon(const PoolVector<Vector2>& p_polygon); + PoolVector<Vector2> get_polygon() const; void set_closed(bool p_closed); bool is_closed() const; diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp index 1a7d01c762..be68c61bd8 100644 --- a/scene/2d/navigation2d.cpp +++ b/scene/2d/navigation2d.cpp @@ -36,12 +36,12 @@ void Navigation2D::_navpoly_link(int p_id) { NavMesh &nm=navpoly_map[p_id]; ERR_FAIL_COND(nm.linked); - DVector<Vector2> vertices=nm.navpoly->get_vertices(); + PoolVector<Vector2> vertices=nm.navpoly->get_vertices(); int len = vertices.size(); if (len==0) return; - DVector<Vector2>::Read r=vertices.read(); + PoolVector<Vector2>::Read r=vertices.read(); for(int i=0;i<nm.navpoly->get_polygon_count();i++) { diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index a11f2240f9..add3a183ef 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -31,12 +31,12 @@ #include "triangulator.h" #include "core_string_names.h" -void NavigationPolygon::set_vertices(const DVector<Vector2>& p_vertices) { +void NavigationPolygon::set_vertices(const PoolVector<Vector2>& p_vertices) { vertices=p_vertices; } -DVector<Vector2> NavigationPolygon::get_vertices() const{ +PoolVector<Vector2> NavigationPolygon::get_vertices() const{ return vertices; } @@ -89,7 +89,7 @@ void NavigationPolygon::add_polygon(const Vector<int>& p_polygon){ } -void NavigationPolygon::add_outline_at_index(const DVector<Vector2>& p_outline,int p_index) { +void NavigationPolygon::add_outline_at_index(const PoolVector<Vector2>& p_outline,int p_index) { outlines.insert(p_index,p_outline); } @@ -108,7 +108,7 @@ void NavigationPolygon::clear_polygons(){ polygons.clear(); } -void NavigationPolygon::add_outline(const DVector<Vector2>& p_outline) { +void NavigationPolygon::add_outline(const PoolVector<Vector2>& p_outline) { outlines.push_back(p_outline); } @@ -118,7 +118,7 @@ int NavigationPolygon::get_outline_count() const{ return outlines.size(); } -void NavigationPolygon::set_outline(int p_idx,const DVector<Vector2>& p_outline) { +void NavigationPolygon::set_outline(int p_idx,const PoolVector<Vector2>& p_outline) { ERR_FAIL_INDEX(p_idx,outlines.size()); outlines[p_idx]=p_outline; } @@ -130,8 +130,8 @@ void NavigationPolygon::remove_outline(int p_idx) { } -DVector<Vector2> NavigationPolygon::get_outline(int p_idx) const { - ERR_FAIL_INDEX_V(p_idx,outlines.size(),DVector<Vector2>()); +PoolVector<Vector2> NavigationPolygon::get_outline(int p_idx) const { + ERR_FAIL_INDEX_V(p_idx,outlines.size(),PoolVector<Vector2>()); return outlines[p_idx]; } @@ -147,11 +147,11 @@ void NavigationPolygon::make_polygons_from_outlines(){ for(int i=0;i<outlines.size();i++) { - DVector<Vector2> ol = outlines[i]; + PoolVector<Vector2> ol = outlines[i]; int olsize = ol.size(); if (olsize<3) continue; - DVector<Vector2>::Read r=ol.read(); + PoolVector<Vector2>::Read r=ol.read(); for(int j=0;j<olsize;j++) { outside_point.x = MAX( r[j].x, outside_point.x ); outside_point.y = MAX( r[j].y, outside_point.y ); @@ -165,11 +165,11 @@ void NavigationPolygon::make_polygons_from_outlines(){ for(int i=0;i<outlines.size();i++) { - DVector<Vector2> ol = outlines[i]; + PoolVector<Vector2> ol = outlines[i]; int olsize = ol.size(); if (olsize<3) continue; - DVector<Vector2>::Read r=ol.read(); + PoolVector<Vector2>::Read r=ol.read(); int interscount=0; //test if this is an outer outline @@ -178,11 +178,11 @@ void NavigationPolygon::make_polygons_from_outlines(){ if (i==k) continue; //no self intersect - DVector<Vector2> ol2 = outlines[k]; + PoolVector<Vector2> ol2 = outlines[k]; int olsize2 = ol2.size(); if (olsize2<3) continue; - DVector<Vector2>::Read r2=ol2.read(); + PoolVector<Vector2>::Read r2=ol2.read(); for(int l=0;l<olsize2;l++) { @@ -368,7 +368,7 @@ void NavigationPolygonInstance::_notification(int p_what) { if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) { - DVector<Vector2> verts=navpoly->get_vertices(); + PoolVector<Vector2> verts=navpoly->get_vertices(); int vsize = verts.size(); if (vsize<3) return; @@ -385,7 +385,7 @@ void NavigationPolygonInstance::_notification(int p_what) { vertices.resize(vsize); colors.resize(vsize); { - DVector<Vector2>::Read vr = verts.read(); + PoolVector<Vector2>::Read vr = verts.read(); for(int i=0;i<vsize;i++) { vertices[i]=vr[i]; colors[i]=color; diff --git a/scene/2d/navigation_polygon.h b/scene/2d/navigation_polygon.h index edf3dcadc3..7f1762b6f5 100644 --- a/scene/2d/navigation_polygon.h +++ b/scene/2d/navigation_polygon.h @@ -36,12 +36,12 @@ class NavigationPolygon : public Resource { GDCLASS( NavigationPolygon, Resource ); - DVector<Vector2> vertices; + PoolVector<Vector2> vertices; struct Polygon { Vector<int> indices; }; Vector<Polygon> polygons; - Vector< DVector<Vector2> > outlines; + Vector< PoolVector<Vector2> > outlines; protected: @@ -57,16 +57,16 @@ public: - void set_vertices(const DVector<Vector2>& p_vertices); - DVector<Vector2> get_vertices() const; + void set_vertices(const PoolVector<Vector2>& p_vertices); + PoolVector<Vector2> get_vertices() const; void add_polygon(const Vector<int>& p_polygon); int get_polygon_count() const; - void add_outline(const DVector<Vector2>& p_outline); - void add_outline_at_index(const DVector<Vector2>& p_outline,int p_index); - void set_outline(int p_idx,const DVector<Vector2>& p_outline); - DVector<Vector2> get_outline(int p_idx) const; + void add_outline(const PoolVector<Vector2>& p_outline); + void add_outline_at_index(const PoolVector<Vector2>& p_outline,int p_index); + void set_outline(int p_idx,const PoolVector<Vector2>& p_outline); + PoolVector<Vector2> get_outline(int p_idx) const; void remove_outline(int p_idx); int get_outline_count() const; diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 11cc07d275..800435d4c3 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -51,8 +51,8 @@ bool Node2D::edit_has_pivot() const { Variant Node2D::edit_get_state() const { Array state; - state.push_back(get_pos()); - state.push_back(get_rot()); + state.push_back(get_position()); + state.push_back(get_rotation()); state.push_back(get_scale()); return state; @@ -137,7 +137,7 @@ void Node2D::_update_transform() { _notify_transform(); } -void Node2D::set_pos(const Point2& p_pos) { +void Node2D::set_position(const Point2& p_pos) { if (_xform_dirty) ((Node2D*)this)->_update_xform_values(); @@ -148,7 +148,7 @@ void Node2D::set_pos(const Point2& p_pos) { } -void Node2D::set_rot(float p_radians) { +void Node2D::set_rotation(float p_radians) { if (_xform_dirty) ((Node2D*)this)->_update_xform_values(); @@ -157,9 +157,9 @@ void Node2D::set_rot(float p_radians) { _change_notify("transform/rot"); } -void Node2D::set_rotd(float p_degrees) { +void Node2D::set_rotation_in_degrees(float p_degrees) { - set_rot(Math::deg2rad(p_degrees)); + set_rotation(Math::deg2rad(p_degrees)); } // Kept for compatibility after rename to set_rotd. @@ -167,7 +167,7 @@ void Node2D::set_rotd(float p_degrees) { void Node2D::_set_rotd(float p_degrees) { WARN_PRINT("Deprecated method Node2D._set_rotd(): This method was renamed to set_rotd. Please adapt your code accordingly, as the old method will be obsoleted."); - set_rotd(p_degrees); + set_rotation_in_degrees(p_degrees); } void Node2D::set_scale(const Size2& p_scale) { @@ -184,28 +184,28 @@ void Node2D::set_scale(const Size2& p_scale) { } -Point2 Node2D::get_pos() const { +Point2 Node2D::get_position() const { if (_xform_dirty) ((Node2D*)this)->_update_xform_values(); return pos; } -float Node2D::get_rot() const { +float Node2D::get_rotation() const { if (_xform_dirty) ((Node2D*)this)->_update_xform_values(); return angle; } -float Node2D::get_rotd() const { +float Node2D::get_rotation_in_degrees() const { - return Math::rad2deg(get_rot()); + return Math::rad2deg(get_rotation()); } // Kept for compatibility after rename to get_rotd. // Could be removed after a couple releases. float Node2D::_get_rotd() const { WARN_PRINT("Deprecated method Node2D._get_rotd(): This method was renamed to get_rotd. Please adapt your code accordingly, as the old method will be obsoleted."); - return get_rotd(); + return get_rotation_in_degrees(); } Size2 Node2D::get_scale() const { if (_xform_dirty) @@ -240,17 +240,17 @@ Rect2 Node2D::get_item_rect() const { void Node2D::rotate(float p_radians) { - set_rot( get_rot() + p_radians); + set_rotation( get_rotation() + p_radians); } void Node2D::translate(const Vector2& p_amount) { - set_pos( get_pos() + p_amount ); + set_position( get_position() + p_amount ); } void Node2D::global_translate(const Vector2& p_amount) { - set_global_pos( get_global_pos() + p_amount ); + set_global_position( get_global_position() + p_amount ); } void Node2D::scale(const Size2& p_amount) { @@ -265,7 +265,7 @@ void Node2D::move_x(float p_delta,bool p_scaled){ Vector2 m = t[0]; if (!p_scaled) m.normalize(); - set_pos(t[2]+m*p_delta); + set_position(t[2]+m*p_delta); } void Node2D::move_y(float p_delta,bool p_scaled){ @@ -274,53 +274,53 @@ void Node2D::move_y(float p_delta,bool p_scaled){ Vector2 m = t[1]; if (!p_scaled) m.normalize(); - set_pos(t[2]+m*p_delta); + set_position(t[2]+m*p_delta); } -Point2 Node2D::get_global_pos() const { +Point2 Node2D::get_global_position() const { return get_global_transform().get_origin(); } -void Node2D::set_global_pos(const Point2& p_pos) { +void Node2D::set_global_position(const Point2& p_pos) { Matrix32 inv; CanvasItem *pi = get_parent_item(); if (pi) { inv = pi->get_global_transform().affine_inverse(); - set_pos(inv.xform(p_pos)); + set_position(inv.xform(p_pos)); } else { - set_pos(p_pos); + set_position(p_pos); } } -float Node2D::get_global_rot() const { +float Node2D::get_global_rotation() const { return get_global_transform().get_rotation(); } -void Node2D::set_global_rot(float p_radians) { +void Node2D::set_global_rotation(float p_radians) { CanvasItem *pi = get_parent_item(); if (pi) { const float parent_global_rot = pi->get_global_transform().get_rotation(); - set_rot(p_radians - parent_global_rot); + set_rotation(p_radians - parent_global_rot); } else { - set_rot(p_radians); + set_rotation(p_radians); } } -float Node2D::get_global_rotd() const { +float Node2D::get_global_rotation_in_degrees() const { - return Math::rad2deg(get_global_rot()); + return Math::rad2deg(get_global_rotation()); } -void Node2D::set_global_rotd(float p_degrees) { +void Node2D::set_global_rotation_in_degrees(float p_degrees) { - set_global_rot(Math::deg2rad(p_degrees)); + set_global_rotation(Math::deg2rad(p_degrees)); } @@ -426,14 +426,14 @@ void Node2D::_bind_methods() { ClassDB::bind_method(_MD("_get_rotd"),&Node2D::_get_rotd); ClassDB::bind_method(_MD("_set_rotd","degrees"),&Node2D::_set_rotd); - ClassDB::bind_method(_MD("set_pos","pos"),&Node2D::set_pos); - ClassDB::bind_method(_MD("set_rot","radians"),&Node2D::set_rot); - ClassDB::bind_method(_MD("set_rotd","degrees"),&Node2D::set_rotd); + ClassDB::bind_method(_MD("set_position","pos"),&Node2D::set_position); + ClassDB::bind_method(_MD("set_rotation","radians"),&Node2D::set_rotation); + ClassDB::bind_method(_MD("set_rotation_in_degrees","degrees"),&Node2D::set_rotation_in_degrees); ClassDB::bind_method(_MD("set_scale","scale"),&Node2D::set_scale); - ClassDB::bind_method(_MD("get_pos"),&Node2D::get_pos); - ClassDB::bind_method(_MD("get_rot"),&Node2D::get_rot); - ClassDB::bind_method(_MD("get_rotd"),&Node2D::get_rotd); + ClassDB::bind_method(_MD("get_position"),&Node2D::get_position); + ClassDB::bind_method(_MD("get_rotation"),&Node2D::get_rotation); + ClassDB::bind_method(_MD("get_rotation_in_degrees"),&Node2D::get_rotation_in_degrees); ClassDB::bind_method(_MD("get_scale"),&Node2D::get_scale); ClassDB::bind_method(_MD("rotate","radians"),&Node2D::rotate); @@ -443,12 +443,12 @@ void Node2D::_bind_methods() { ClassDB::bind_method(_MD("global_translate","offset"),&Node2D::global_translate); ClassDB::bind_method(_MD("scale","ratio"),&Node2D::scale); - ClassDB::bind_method(_MD("set_global_pos","pos"),&Node2D::set_global_pos); - ClassDB::bind_method(_MD("get_global_pos"),&Node2D::get_global_pos); - ClassDB::bind_method(_MD("set_global_rot","radians"),&Node2D::set_global_rot); - ClassDB::bind_method(_MD("get_global_rot"),&Node2D::get_global_rot); - ClassDB::bind_method(_MD("set_global_rotd","degrees"),&Node2D::set_global_rotd); - ClassDB::bind_method(_MD("get_global_rotd"),&Node2D::get_global_rotd); + ClassDB::bind_method(_MD("set_global_position","pos"),&Node2D::set_global_position); + ClassDB::bind_method(_MD("get_global_position"),&Node2D::get_global_position); + ClassDB::bind_method(_MD("set_global_rotation","radians"),&Node2D::set_global_rotation); + ClassDB::bind_method(_MD("get_global_rotation"),&Node2D::get_global_rotation); + ClassDB::bind_method(_MD("set_global_rotation_in_degrees","degrees"),&Node2D::set_global_rotation_in_degrees); + ClassDB::bind_method(_MD("get_global_rotation_in_degrees"),&Node2D::get_global_rotation_in_degrees); ClassDB::bind_method(_MD("set_global_scale","scale"),&Node2D::set_global_scale); ClassDB::bind_method(_MD("get_global_scale"),&Node2D::get_global_scale); @@ -468,11 +468,22 @@ void Node2D::_bind_methods() { ClassDB::bind_method(_MD("get_relative_transform_to_parent","parent"),&Node2D::get_relative_transform_to_parent); - ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2,"transform/pos"),_SCS("set_pos"),_SCS("get_pos")); - ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"transform/rot",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("set_rotd"),_SCS("get_rotd")); - ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2,"transform/scale"),_SCS("set_scale"),_SCS("get_scale")); - ADD_PROPERTYNZ(PropertyInfo(Variant::INT,"z/z",PROPERTY_HINT_RANGE,itos(VS::CANVAS_ITEM_Z_MIN)+","+itos(VS::CANVAS_ITEM_Z_MAX)+",1"),_SCS("set_z"),_SCS("get_z")); - ADD_PROPERTYNO(PropertyInfo(Variant::BOOL,"z/relative"),_SCS("set_z_as_relative"),_SCS("is_z_relative")); + ADD_GROUP("Transform",""); + ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2,"position"),_SCS("set_position"),_SCS("get_position")); + ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"rotation",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_rotation"),_SCS("get_rotation")); + ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"rotation_deg",PROPERTY_HINT_RANGE,"-1440,1440,0.1",PROPERTY_USAGE_EDITOR),_SCS("set_rotation_in_degrees"),_SCS("get_rotation_in_degrees")); + ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2,"scale"),_SCS("set_scale"),_SCS("get_scale")); + ADD_PROPERTY(PropertyInfo(Variant::MATRIX32,"transform",PROPERTY_HINT_NONE,"",0),_SCS("set_transform"),_SCS("get_transform")); + + ADD_PROPERTY(PropertyInfo(Variant::REAL,"global_position",PROPERTY_HINT_NONE,"",0),_SCS("set_global_position"),_SCS("get_global_position")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"global_rotation",PROPERTY_HINT_NONE,"",0),_SCS("set_global_rotation"),_SCS("get_global_rotation")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"global_rotation_deg",PROPERTY_HINT_NONE,"",0),_SCS("set_global_rotation_in_degrees"),_SCS("get_global_rotation_in_degrees")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"global_scale",PROPERTY_HINT_NONE,"",0),_SCS("set_global_scale"),_SCS("get_global_scale")); + ADD_PROPERTY(PropertyInfo(Variant::MATRIX32,"global_transform",PROPERTY_HINT_NONE,"",0),_SCS("set_global_transform"),_SCS("get_global_transform")); + + ADD_GROUP("Z",""); + ADD_PROPERTYNZ(PropertyInfo(Variant::INT,"z",PROPERTY_HINT_RANGE,itos(VS::CANVAS_ITEM_Z_MIN)+","+itos(VS::CANVAS_ITEM_Z_MAX)+",1"),_SCS("set_z"),_SCS("get_z")); + ADD_PROPERTYNO(PropertyInfo(Variant::BOOL,"z_as_relative"),_SCS("set_z_as_relative"),_SCS("is_z_relative")); } diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index 514b7b24a8..15dfd703fe 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -69,9 +69,9 @@ public: virtual Point2 edit_get_pivot() const; virtual bool edit_has_pivot() const; - void set_pos(const Point2& p_pos); - void set_rot(float p_radians); - void set_rotd(float p_degrees); + void set_position(const Point2& p_pos); + void set_rotation(float p_radians); + void set_rotation_in_degrees(float p_degrees); void set_scale(const Size2& p_scale); void rotate(float p_radians); @@ -81,22 +81,22 @@ public: void global_translate(const Vector2& p_amount); void scale(const Size2& p_amount); - Point2 get_pos() const; - float get_rot() const; - float get_rotd() const; + Point2 get_position() const; + float get_rotation() const; + float get_rotation_in_degrees() const; Size2 get_scale() const; - Point2 get_global_pos() const; - float get_global_rot() const; - float get_global_rotd() const; + Point2 get_global_position() const; + float get_global_rotation() const; + float get_global_rotation_in_degrees() const; Size2 get_global_scale() const; virtual Rect2 get_item_rect() const; void set_transform(const Matrix32& p_transform); void set_global_transform(const Matrix32& p_transform); - void set_global_pos(const Point2& p_pos); - void set_global_rot(float p_radians); - void set_global_rotd(float p_degrees); + void set_global_position(const Point2& p_pos); + void set_global_rotation(float p_radians); + void set_global_rotation_in_degrees(float p_degrees); void set_global_scale(const Size2& p_scale); void set_z(int p_z); diff --git a/scene/2d/parallax_background.cpp b/scene/2d/parallax_background.cpp index 326e46dd2d..022e31760b 100644 --- a/scene/2d/parallax_background.cpp +++ b/scene/2d/parallax_background.cpp @@ -204,12 +204,13 @@ void ParallaxBackground::_bind_methods() { ClassDB::bind_method(_MD("is_ignore_camera_zoom"), &ParallaxBackground::is_ignore_camera_zoom); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll/offset"),_SCS("set_scroll_offset"),_SCS("get_scroll_offset")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll/base_offset"),_SCS("set_scroll_base_offset"),_SCS("get_scroll_base_offset")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll/base_scale"),_SCS("set_scroll_base_scale"),_SCS("get_scroll_base_scale")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll/limit_begin"),_SCS("set_limit_begin"),_SCS("get_limit_begin")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll/limit_end"),_SCS("set_limit_end"),_SCS("get_limit_end")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL, "scroll/ignore_camera_zoom"), _SCS("set_ignore_camera_zoom"), _SCS("is_ignore_camera_zoom")); + ADD_GROUP("Scroll","scroll_"); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll_offset"),_SCS("set_scroll_offset"),_SCS("get_scroll_offset")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll_base_offset"),_SCS("set_scroll_base_offset"),_SCS("get_scroll_base_offset")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll_base_scale"),_SCS("set_scroll_base_scale"),_SCS("get_scroll_base_scale")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll_limit_begin"),_SCS("set_limit_begin"),_SCS("get_limit_begin")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scroll_limit_end"),_SCS("set_limit_end"),_SCS("get_limit_end")); + ADD_PROPERTY( PropertyInfo(Variant::BOOL, "scroll_ignore_camera_zoom"), _SCS("set_ignore_camera_zoom"), _SCS("is_ignore_camera_zoom")); } diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp index 4ba64c9f6c..9aa6640727 100644 --- a/scene/2d/parallax_layer.cpp +++ b/scene/2d/parallax_layer.cpp @@ -107,7 +107,7 @@ void ParallaxLayer::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - orig_offset=get_pos(); + orig_offset=get_position(); orig_scale=get_scale(); _update_mirroring(); } break; @@ -132,7 +132,7 @@ void ParallaxLayer::set_base_offset_and_scale(const Point2& p_offset,float p_sca new_ofs.y -= den*ceil(new_ofs.y/den); } - set_pos(new_ofs); + set_position(new_ofs); set_scale(Vector2(1,1)*p_scale); @@ -157,9 +157,10 @@ void ParallaxLayer::_bind_methods() { ClassDB::bind_method(_MD("set_mirroring","mirror"),&ParallaxLayer::set_mirroring); ClassDB::bind_method(_MD("get_mirroring"),&ParallaxLayer::get_mirroring); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"motion/scale"),_SCS("set_motion_scale"),_SCS("get_motion_scale")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"motion/offset"),_SCS("set_motion_offset"),_SCS("get_motion_offset")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"motion/mirroring"),_SCS("set_mirroring"),_SCS("get_mirroring")); + ADD_GROUP("Motion","motion_"); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"motion_scale"),_SCS("set_motion_scale"),_SCS("get_motion_scale")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"motion_offset"),_SCS("set_motion_offset"),_SCS("get_motion_offset")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"motion_mirroring"),_SCS("set_mirroring"),_SCS("get_mirroring")); } diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index ddaaecb43c..f8747d54b7 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -276,7 +276,7 @@ void Particles2D::_process_particles(float p_delta) { active_count=0; - DVector<Point2>::Read r; + PoolVector<Point2>::Read r; int emission_point_count=0; if (emission_points.size()) { @@ -299,7 +299,7 @@ void Particles2D::_process_particles(float p_delta) { } for (Set<ParticleAttractor2D*>::Element *E=attractors.front();E;E=E->next()) { - attractor_cache[idx].pos=m.xform( E->get()->get_global_pos() ); + attractor_cache[idx].pos=m.xform( E->get()->get_global_position() ); attractor_cache[idx].attractor=E->get(); idx++; } @@ -992,12 +992,12 @@ int Particles2D::get_v_frames() const{ -void Particles2D::set_emission_points(const DVector<Vector2>& p_points) { +void Particles2D::set_emission_points(const PoolVector<Vector2>& p_points) { emission_points=p_points; } -DVector<Vector2> Particles2D::get_emission_points() const{ +PoolVector<Vector2> Particles2D::get_emission_points() const{ return emission_points; } diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h index 9b740dad7d..91f42c5222 100644 --- a/scene/2d/particles_2d.h +++ b/scene/2d/particles_2d.h @@ -151,7 +151,7 @@ private: Point2 emissor_offset; Vector2 initial_velocity; Vector2 extents; - DVector<Vector2> emission_points; + PoolVector<Vector2> emission_points; float time; int active_count; @@ -245,8 +245,8 @@ public: void set_initial_velocity(const Vector2& p_velocity); Vector2 get_initial_velocity() const; - void set_emission_points(const DVector<Vector2>& p_points); - DVector<Vector2> get_emission_points() const; + void set_emission_points(const PoolVector<Vector2>& p_points); + PoolVector<Vector2> get_emission_points() const; void pre_process(float p_delta); void reset(); diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 112bd2f02b..0508a715eb 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -124,7 +124,7 @@ void PathFollow2D::_update_transform() { pos+=n*h_offset; pos+=t*v_offset; - set_rot(t.angle()); + set_rotation(t.angle()); } else { @@ -132,7 +132,7 @@ void PathFollow2D::_update_transform() { pos.y+=v_offset; } - set_pos(pos); + set_position(pos); } diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index a20834e7e3..6be5689f1d 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -101,9 +101,11 @@ void PhysicsBody2D::_bind_methods() { ClassDB::bind_method(_MD("get_one_way_collision_max_depth"),&PhysicsBody2D::get_one_way_collision_max_depth); ClassDB::bind_method(_MD("add_collision_exception_with","body:PhysicsBody2D"),&PhysicsBody2D::add_collision_exception_with); ClassDB::bind_method(_MD("remove_collision_exception_with","body:PhysicsBody2D"),&PhysicsBody2D::remove_collision_exception_with); - ADD_PROPERTY(PropertyInfo(Variant::INT,"layers",PROPERTY_HINT_ALL_FLAGS,"",0),_SCS("_set_layers"),_SCS("_get_layers")); //for backwards compat - ADD_PROPERTY(PropertyInfo(Variant::INT,"collision/layers",PROPERTY_HINT_ALL_FLAGS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); - ADD_PROPERTY(PropertyInfo(Variant::INT,"collision/mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"layers",PROPERTY_HINT_LAYERS_2D_PHYSICS,"",0),_SCS("_set_layers"),_SCS("_get_layers")); //for backwards compat + ADD_GROUP("Collision","collision_"); + ADD_PROPERTY(PropertyInfo(Variant::INT,"collision_layers",PROPERTY_HINT_LAYERS_2D_PHYSICS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"collision_mask",PROPERTY_HINT_LAYERS_2D_PHYSICS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); + ADD_GROUP("",""); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2,"one_way_collision/direction"),_SCS("set_one_way_collision_direction"),_SCS("get_one_way_collision_direction")); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"one_way_collision/max_depth"),_SCS("set_one_way_collision_max_depth"),_SCS("get_one_way_collision_max_depth")); } @@ -963,10 +965,12 @@ void RigidBody2D::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::BOOL,"contact_monitor"),_SCS("set_contact_monitor"),_SCS("is_contact_monitor_enabled")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"sleeping"),_SCS("set_sleeping"),_SCS("is_sleeping")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"can_sleep"),_SCS("set_can_sleep"),_SCS("is_able_to_sleep")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"velocity/linear"),_SCS("set_linear_velocity"),_SCS("get_linear_velocity")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"velocity/angular"),_SCS("set_angular_velocity"),_SCS("get_angular_velocity")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"damp_override/linear",PROPERTY_HINT_RANGE,"-1,128,0.01"),_SCS("set_linear_damp"),_SCS("get_linear_damp")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"damp_override/angular",PROPERTY_HINT_RANGE,"-1,128,0.01"),_SCS("set_angular_damp"),_SCS("get_angular_damp")); + ADD_GROUP("Linear","linear_"); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"linear_velocity"),_SCS("set_linear_velocity"),_SCS("get_linear_velocity")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"linear_damp",PROPERTY_HINT_RANGE,"-1,128,0.01"),_SCS("set_linear_damp"),_SCS("get_linear_damp")); + ADD_GROUP("Angular","angular_"); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"angular_velocity"),_SCS("set_angular_velocity"),_SCS("get_angular_velocity")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"angular_damp",PROPERTY_HINT_RANGE,"-1,128,0.01"),_SCS("set_angular_damp"),_SCS("get_angular_damp")); ADD_SIGNAL( MethodInfo("body_enter_shape",PropertyInfo(Variant::INT,"body_id"),PropertyInfo(Variant::OBJECT,"body"),PropertyInfo(Variant::INT,"body_shape"),PropertyInfo(Variant::INT,"local_shape"))); ADD_SIGNAL( MethodInfo("body_exit_shape",PropertyInfo(Variant::INT,"body_id"),PropertyInfo(Variant::OBJECT,"body"),PropertyInfo(Variant::INT,"body_shape"),PropertyInfo(Variant::INT,"local_shape"))); @@ -1311,7 +1315,7 @@ Array KinematicBody2D::get_move_and_slide_colliders() const{ Vector2 KinematicBody2D::move_to(const Vector2& p_position) { - return move(p_position-get_global_pos()); + return move(p_position-get_global_position()); } bool KinematicBody2D::test_move(const Matrix32& p_from,const Vector2& p_motion) { diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index c7ba58b9e8..948c8b0818 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -33,7 +33,7 @@ Rect2 Polygon2D::get_item_rect() const { if (rect_cache_dirty){ int l =polygon.size(); - DVector<Vector2>::Read r = polygon.read(); + PoolVector<Vector2>::Read r = polygon.read(); item_rect=Rect2(); for(int i=0;i<l;i++) { Vector2 pos = r[i] + offset; @@ -84,7 +84,7 @@ void Polygon2D::_notification(int p_what) { int len = points.size(); { - DVector<Vector2>::Read polyr =polygon.read(); + PoolVector<Vector2>::Read polyr =polygon.read(); for(int i=0;i<len;i++) { points[i]=polyr[i]+offset; } @@ -157,7 +157,7 @@ void Polygon2D::_notification(int p_what) { if (points.size()==uv.size()) { - DVector<Vector2>::Read uvr = uv.read(); + PoolVector<Vector2>::Read uvr = uv.read(); for(int i=0;i<len;i++) { uvs[i]=texmat.xform(uvr[i])/tex_size; @@ -176,7 +176,7 @@ void Polygon2D::_notification(int p_what) { int color_len=vertex_colors.size(); colors.resize(len); { - DVector<Color>::Read color_r=vertex_colors.read(); + PoolVector<Color>::Read color_r=vertex_colors.read(); for(int i=0;i<color_len && i<len;i++){ colors[i]=color_r[i]; } @@ -194,25 +194,25 @@ void Polygon2D::_notification(int p_what) { } -void Polygon2D::set_polygon(const DVector<Vector2>& p_polygon) { +void Polygon2D::set_polygon(const PoolVector<Vector2>& p_polygon) { polygon=p_polygon; rect_cache_dirty=true; update(); } -DVector<Vector2> Polygon2D::get_polygon() const{ +PoolVector<Vector2> Polygon2D::get_polygon() const{ return polygon; } -void Polygon2D::set_uv(const DVector<Vector2>& p_uv) { +void Polygon2D::set_uv(const PoolVector<Vector2>& p_uv) { uv=p_uv; update(); } -DVector<Vector2> Polygon2D::get_uv() const{ +PoolVector<Vector2> Polygon2D::get_uv() const{ return uv; } @@ -227,12 +227,12 @@ Color Polygon2D::get_color() const{ return color; } -void Polygon2D::set_vertex_colors(const DVector<Color>& p_colors){ +void Polygon2D::set_vertex_colors(const PoolVector<Color>& p_colors){ vertex_colors=p_colors; update(); } -DVector<Color> Polygon2D::get_vertex_colors() const{ +PoolVector<Color> Polygon2D::get_vertex_colors() const{ return vertex_colors; } @@ -377,12 +377,16 @@ void Polygon2D::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::COLOR,"color"),_SCS("set_color"),_SCS("get_color")); ADD_PROPERTY( PropertyInfo(Variant::COLOR_ARRAY,"vertex_colors"),_SCS("set_vertex_colors"),_SCS("get_vertex_colors")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"offset"),_SCS("set_offset"),_SCS("get_offset")); - ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"texture/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"texture/offset"),_SCS("set_texture_offset"),_SCS("get_texture_offset")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"texture/scale"),_SCS("set_texture_scale"),_SCS("get_texture_scale")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"texture/rotation",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("_set_texture_rotationd"),_SCS("_get_texture_rotationd")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"invert/enable"),_SCS("set_invert"),_SCS("get_invert")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"invert/border",PROPERTY_HINT_RANGE,"0.1,16384,0.1"),_SCS("set_invert_border"),_SCS("get_invert_border")); + ADD_GROUP("Texture",""); + ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture")); + ADD_GROUP("Texture","texture_"); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"texture_offset"),_SCS("set_texture_offset"),_SCS("get_texture_offset")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"texture_scale"),_SCS("set_texture_scale"),_SCS("get_texture_scale")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"texture_rotation",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("_set_texture_rotationd"),_SCS("_get_texture_rotationd")); + + ADD_GROUP("Invert","invert_"); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"invert_enable"),_SCS("set_invert"),_SCS("get_invert")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"invert_border",PROPERTY_HINT_RANGE,"0.1,16384,0.1"),_SCS("set_invert_border"),_SCS("get_invert_border")); } diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h index 6327021295..8434dae40c 100644 --- a/scene/2d/polygon_2d.h +++ b/scene/2d/polygon_2d.h @@ -35,9 +35,9 @@ class Polygon2D : public Node2D { GDCLASS(Polygon2D,Node2D); - DVector<Vector2> polygon; - DVector<Vector2> uv; - DVector<Color> vertex_colors; + PoolVector<Vector2> polygon; + PoolVector<Vector2> uv; + PoolVector<Color> vertex_colors; Color color; Ref<Texture> texture; Size2 tex_scale; @@ -60,17 +60,17 @@ protected: static void _bind_methods(); public: - void set_polygon(const DVector<Vector2>& p_polygon); - DVector<Vector2> get_polygon() const; + void set_polygon(const PoolVector<Vector2>& p_polygon); + PoolVector<Vector2> get_polygon() const; - void set_uv(const DVector<Vector2>& p_uv); - DVector<Vector2> get_uv() const; + void set_uv(const PoolVector<Vector2>& p_uv); + PoolVector<Vector2> get_uv() const; void set_color(const Color& p_color); Color get_color() const; - void set_vertex_colors(const DVector<Color>& p_colors); - DVector<Color> get_vertex_colors() const; + void set_vertex_colors(const PoolVector<Color>& p_colors); + PoolVector<Color> get_vertex_colors() const; void set_texture(const Ref<Texture>& p_texture); Ref<Texture> get_texture() const; diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index 144e7b391b..572575e4ec 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -297,7 +297,7 @@ void RayCast2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL,"enabled"),_SCS("set_enabled"),_SCS("is_enabled")); ADD_PROPERTY(PropertyInfo(Variant::BOOL,"exclude_parent"),_SCS("set_exclude_parent_body"),_SCS("get_exclude_parent_body")); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"cast_to"),_SCS("set_cast_to"),_SCS("get_cast_to")); - ADD_PROPERTY(PropertyInfo(Variant::INT,"layer_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"layer_mask",PROPERTY_HINT_LAYERS_2D_PHYSICS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); ADD_PROPERTY(PropertyInfo(Variant::INT,"type_mask",PROPERTY_HINT_FLAGS,"Static,Kinematic,Rigid,Character,Area"),_SCS("set_type_mask"),_SCS("get_type_mask")); } diff --git a/scene/2d/sample_player_2d.cpp b/scene/2d/sample_player_2d.cpp index b96470879c..62eabea98e 100644 --- a/scene/2d/sample_player_2d.cpp +++ b/scene/2d/sample_player_2d.cpp @@ -241,9 +241,10 @@ void SamplePlayer2D::_bind_methods() { BIND_CONSTANT( INVALID_VOICE ); BIND_CONSTANT( NEXT_VOICE ); - ADD_PROPERTY( PropertyInfo( Variant::INT, "config/polyphony", PROPERTY_HINT_RANGE, "1,64,1"),_SCS("set_polyphony"),_SCS("get_polyphony")); - ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "config/samples", PROPERTY_HINT_RESOURCE_TYPE,"SampleLibrary"),_SCS("set_sample_library"),_SCS("get_sample_library")); - ADD_PROPERTY( PropertyInfo( Variant::REAL, "config/pitch_random", PROPERTY_HINT_RESOURCE_TYPE,"SampleLibrary"),_SCS("set_random_pitch_scale"),_SCS("get_random_pitch_scale")); + ADD_GROUP("Config",""); + ADD_PROPERTY( PropertyInfo( Variant::INT, "polyphony", PROPERTY_HINT_RANGE, "1,64,1"),_SCS("set_polyphony"),_SCS("get_polyphony")); + ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "samples", PROPERTY_HINT_RESOURCE_TYPE,"SampleLibrary"),_SCS("set_sample_library"),_SCS("get_sample_library")); + ADD_PROPERTY( PropertyInfo( Variant::REAL, "pitch_random", PROPERTY_HINT_RESOURCE_TYPE,"SampleLibrary"),_SCS("set_random_pitch_scale"),_SCS("get_random_pitch_scale")); } diff --git a/scene/2d/sound_player_2d.cpp b/scene/2d/sound_player_2d.cpp index 09b415814d..96382caa25 100644 --- a/scene/2d/sound_player_2d.cpp +++ b/scene/2d/sound_player_2d.cpp @@ -97,11 +97,13 @@ void SoundPlayer2D::_bind_methods() { BIND_CONSTANT( PARAM_ATTENUATION_DISTANCE_EXP ); BIND_CONSTANT( PARAM_MAX ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/volume_db",PROPERTY_HINT_RANGE, "-80,24,0.01"),_SCS("set_param"),_SCS("get_param"),PARAM_VOLUME_DB); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/pitch_scale",PROPERTY_HINT_RANGE, "0.001,32,0.001"),_SCS("set_param"),_SCS("get_param"),PARAM_PITCH_SCALE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/attenuation/min_distance",PROPERTY_HINT_EXP_RANGE, "16,16384,1"),_SCS("set_param"),_SCS("get_param"),PARAM_ATTENUATION_MIN_DISTANCE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/attenuation/max_distance",PROPERTY_HINT_EXP_RANGE, "16,16384,1"),_SCS("set_param"),_SCS("get_param"),PARAM_ATTENUATION_MAX_DISTANCE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/attenuation/distance_exp",PROPERTY_HINT_EXP_EASING, "attenuation"),_SCS("set_param"),_SCS("get_param"),PARAM_ATTENUATION_DISTANCE_EXP); + ADD_GROUP("Parameters",""); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "volume_db",PROPERTY_HINT_RANGE, "-80,24,0.01"),_SCS("set_param"),_SCS("get_param"),PARAM_VOLUME_DB); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "pitch_scale",PROPERTY_HINT_RANGE, "0.001,32,0.001"),_SCS("set_param"),_SCS("get_param"),PARAM_PITCH_SCALE); + ADD_GROUP("Attenuation","attenuation_"); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "attenuation_min_distance",PROPERTY_HINT_EXP_RANGE, "16,16384,1"),_SCS("set_param"),_SCS("get_param"),PARAM_ATTENUATION_MIN_DISTANCE); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "attenuation_max_distance",PROPERTY_HINT_EXP_RANGE, "16,16384,1"),_SCS("set_param"),_SCS("get_param"),PARAM_ATTENUATION_MAX_DISTANCE); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "attenuation_distance_exp",PROPERTY_HINT_EXP_EASING, "attenuation"),_SCS("set_param"),_SCS("get_param"),PARAM_ATTENUATION_DISTANCE_EXP); } diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 480991c71d..8bad8fcb38 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -97,7 +97,7 @@ void Sprite::_notification(int p_what) { if (vflip) dst_rect.size.y=-dst_rect.size.y; - texture->draw_rect_region(ci,dst_rect,src_rect,modulate); + texture->draw_rect_region(ci,dst_rect,src_rect); } break; } @@ -249,16 +249,6 @@ int Sprite::get_hframes() const { return hframes; } -void Sprite::set_modulate(const Color& p_color) { - - modulate=p_color; - update(); -} - -Color Sprite::get_modulate() const{ - - return modulate; -} Rect2 Sprite::get_item_rect() const { @@ -332,9 +322,6 @@ void Sprite::_bind_methods() { ClassDB::bind_method(_MD("set_hframes","hframes"),&Sprite::set_hframes); ClassDB::bind_method(_MD("get_hframes"),&Sprite::get_hframes); - ClassDB::bind_method(_MD("set_modulate","modulate"),&Sprite::set_modulate); - ClassDB::bind_method(_MD("get_modulate"),&Sprite::get_modulate); - ADD_SIGNAL(MethodInfo("frame_changed")); ADD_SIGNAL(MethodInfo("texture_changed")); @@ -346,7 +333,6 @@ void Sprite::_bind_methods() { ADD_PROPERTYNO( PropertyInfo( Variant::INT, "vframes",PROPERTY_HINT_RANGE,"1,16384,1"), _SCS("set_vframes"),_SCS("get_vframes")); ADD_PROPERTYNO( PropertyInfo( Variant::INT, "hframes",PROPERTY_HINT_RANGE,"1,16384,1"), _SCS("set_hframes"),_SCS("get_hframes")); ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), _SCS("set_frame"),_SCS("get_frame")); - ADD_PROPERTYNO( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate")); ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "region"), _SCS("set_region"),_SCS("is_region")); ADD_PROPERTYNZ( PropertyInfo( Variant::RECT2, "region_rect"), _SCS("set_region_rect"),_SCS("get_region_rect")); @@ -364,9 +350,6 @@ Sprite::Sprite() { vframes=1; hframes=1; - modulate=Color(1,1,1,1); - - } diff --git a/scene/2d/sprite.h b/scene/2d/sprite.h index 687d054297..05c0bd9eec 100644 --- a/scene/2d/sprite.h +++ b/scene/2d/sprite.h @@ -52,7 +52,6 @@ class Sprite : public Node2D { int vframes; int hframes; - Color modulate; protected: @@ -99,9 +98,6 @@ public: void set_hframes(int p_amount); int get_hframes() const; - void set_modulate(const Color& p_color); - Color get_modulate() const; - virtual Rect2 get_item_rect() const; Sprite(); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 8226a0c2a0..dbbc261b48 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -819,10 +819,10 @@ void TileMap::clear() { tile_map.clear(); } -void TileMap::_set_tile_data(const DVector<int>& p_data) { +void TileMap::_set_tile_data(const PoolVector<int>& p_data) { int c=p_data.size(); - DVector<int>::Read r = p_data.read(); + PoolVector<int>::Read r = p_data.read(); for(int i=0;i<c;i+=2) { @@ -857,11 +857,11 @@ void TileMap::_set_tile_data(const DVector<int>& p_data) { } -DVector<int> TileMap::_get_tile_data() const { +PoolVector<int> TileMap::_get_tile_data() const { - DVector<int> data; + PoolVector<int> data; data.resize(tile_map.size()*2); - DVector<int>::Write w = data.write(); + PoolVector<int>::Write w = data.write(); int idx=0; for(const Map<PosKey,Cell>::Element *E=tile_map.front();E;E=E->next()) { @@ -882,7 +882,7 @@ DVector<int> TileMap::_get_tile_data() const { } - w = DVector<int>::Write(); + w = PoolVector<int>::Write(); return data; @@ -1261,20 +1261,25 @@ void TileMap::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::INT,"mode",PROPERTY_HINT_ENUM,"Square,Isometric,Custom"),_SCS("set_mode"),_SCS("get_mode")); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"tile_set",PROPERTY_HINT_RESOURCE_TYPE,"TileSet"),_SCS("set_tileset"),_SCS("get_tileset")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"cell_size",PROPERTY_HINT_RANGE,"1,8192,1",0),_SCS("_set_old_cell_size"),_SCS("_get_old_cell_size")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"cell/size",PROPERTY_HINT_RANGE,"1,8192,1"),_SCS("set_cell_size"),_SCS("get_cell_size")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"cell/quadrant_size",PROPERTY_HINT_RANGE,"1,128,1"),_SCS("set_quadrant_size"),_SCS("get_quadrant_size")); - ADD_PROPERTY( PropertyInfo(Variant::MATRIX32,"cell/custom_transform"),_SCS("set_custom_transform"),_SCS("get_custom_transform")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"cell/half_offset",PROPERTY_HINT_ENUM,"Offset X,Offset Y,Disabled"),_SCS("set_half_offset"),_SCS("get_half_offset")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"cell/tile_origin",PROPERTY_HINT_ENUM,"Top Left,Center,Bottom Left"),_SCS("set_tile_origin"),_SCS("get_tile_origin")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"cell/y_sort"),_SCS("set_y_sort_mode"),_SCS("is_y_sort_mode_enabled")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"collision/use_kinematic",PROPERTY_HINT_NONE,""),_SCS("set_collision_use_kinematic"),_SCS("get_collision_use_kinematic")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"collision/friction",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_collision_friction"),_SCS("get_collision_friction")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"collision/bounce",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_collision_bounce"),_SCS("get_collision_bounce")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"collision/layers",PROPERTY_HINT_ALL_FLAGS),_SCS("set_collision_layer"),_SCS("get_collision_layer")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"collision/mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"occluder/light_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_occluder_light_mask"),_SCS("get_occluder_light_mask")); + ADD_GROUP("Cell","cell_"); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"cell_size",PROPERTY_HINT_RANGE,"1,8192,1"),_SCS("set_cell_size"),_SCS("get_cell_size")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"cell_quadrant_size",PROPERTY_HINT_RANGE,"1,128,1"),_SCS("set_quadrant_size"),_SCS("get_quadrant_size")); + ADD_PROPERTY( PropertyInfo(Variant::MATRIX32,"cell_custom_transform"),_SCS("set_custom_transform"),_SCS("get_custom_transform")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"cell_half_offset",PROPERTY_HINT_ENUM,"Offset X,Offset Y,Disabled"),_SCS("set_half_offset"),_SCS("get_half_offset")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"cell_tile_origin",PROPERTY_HINT_ENUM,"Top Left,Center,Bottom Left"),_SCS("set_tile_origin"),_SCS("get_tile_origin")); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"cell_y_sort"),_SCS("set_y_sort_mode"),_SCS("is_y_sort_mode_enabled")); + + ADD_GROUP("Collision","collision_"); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"collision_use_kinematic",PROPERTY_HINT_NONE,""),_SCS("set_collision_use_kinematic"),_SCS("get_collision_use_kinematic")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"collision_friction",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_collision_friction"),_SCS("get_collision_friction")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"collision_bounce",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_collision_bounce"),_SCS("get_collision_bounce")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"collision_layers",PROPERTY_HINT_LAYERS_2D_PHYSICS),_SCS("set_collision_layer"),_SCS("get_collision_layer")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"collision_mask",PROPERTY_HINT_LAYERS_2D_PHYSICS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); + + ADD_GROUP("Occluder","occluder_"); + ADD_PROPERTY( PropertyInfo(Variant::INT,"occluder_light_mask",PROPERTY_HINT_LAYERS_2D_RENDER),_SCS("set_occluder_light_mask"),_SCS("get_occluder_light_mask")); + ADD_GROUP("",""); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"tile_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_tile_data"),_SCS("_get_tile_data")); ADD_SIGNAL(MethodInfo("settings_changed")); diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 8cc144b74d..f863c0b2ea 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -168,8 +168,8 @@ private: _FORCE_INLINE_ int _get_quadrant_size() const; - void _set_tile_data(const DVector<int>& p_data); - DVector<int> _get_tile_data() const; + void _set_tile_data(const PoolVector<int>& p_data); + PoolVector<int> _get_tile_data() const; void _set_old_cell_size(int p_size) { set_cell_size(Size2(p_size,p_size)); } int _get_old_cell_size() const { return cell_size.x; } diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index 6c0dbcda29..4594273db2 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -358,12 +358,12 @@ void VisibilityEnabler2D::_bind_methods(){ ClassDB::bind_method(_MD("is_enabler_enabled","enabler"),&VisibilityEnabler2D::is_enabler_enabled); ClassDB::bind_method(_MD("_node_removed"),&VisibilityEnabler2D::_node_removed); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/pause_animations"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PAUSE_ANIMATIONS ); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/freeze_bodies"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_FREEZE_BODIES); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/pause_particles"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PAUSE_PARTICLES); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/pause_animated_sprites"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PAUSE_ANIMATED_SPRITES); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/process_parent"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PARENT_PROCESS); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/fixed_process_parent"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PARENT_FIXED_PROCESS); + ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"pause_animations"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PAUSE_ANIMATIONS ); + ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"freeze_bodies"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_FREEZE_BODIES); + ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"pause_particles"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PAUSE_PARTICLES); + ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"pause_animated_sprites"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PAUSE_ANIMATED_SPRITES); + ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"process_parent"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PARENT_PROCESS); + ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"fixed_process_parent"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PARENT_FIXED_PROCESS); BIND_CONSTANT( ENABLER_FREEZE_BODIES ); BIND_CONSTANT( ENABLER_PAUSE_ANIMATIONS ); diff --git a/scene/2d/y_sort.cpp b/scene/2d/y_sort.cpp index a02c451f5b..588f343048 100644 --- a/scene/2d/y_sort.cpp +++ b/scene/2d/y_sort.cpp @@ -46,7 +46,8 @@ void YSort::_bind_methods() { ClassDB::bind_method(_MD("set_sort_enabled","enabled"),&YSort::set_sort_enabled); ClassDB::bind_method(_MD("is_sort_enabled"),&YSort::is_sort_enabled); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"sort/enabled"),_SCS("set_sort_enabled"),_SCS("is_sort_enabled")); + ADD_GROUP("Sort","sort_"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"sort_enabled"),_SCS("set_sort_enabled"),_SCS("is_sort_enabled")); } |