diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-10 22:20:57 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-10 22:20:57 -0300 |
commit | 4338c9016347159d9562a5435e4c81afc21a362a (patch) | |
tree | 639c27da13718bcdfff64e5f95be4efffa45b576 | |
parent | 80b733a33a56067eb7a067f0f1ce30b6c38275f8 (diff) |
It is now possible to name layers of different kinds!
-rw-r--r-- | core/global_constants.cpp | 7 | ||||
-rw-r--r-- | core/object.h | 5 | ||||
-rw-r--r-- | modules/gdscript/gd_parser.cpp | 2 | ||||
-rw-r--r-- | scene/2d/area_2d.cpp | 4 | ||||
-rw-r--r-- | scene/2d/canvas_item.cpp | 2 | ||||
-rw-r--r-- | scene/2d/light_2d.cpp | 4 | ||||
-rw-r--r-- | scene/2d/light_occluder_2d.cpp | 2 | ||||
-rw-r--r-- | scene/2d/physics_body_2d.cpp | 6 | ||||
-rw-r--r-- | scene/2d/ray_cast_2d.cpp | 2 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 6 | ||||
-rw-r--r-- | scene/3d/area.cpp | 4 | ||||
-rw-r--r-- | scene/3d/camera.cpp | 2 | ||||
-rw-r--r-- | scene/3d/light.cpp | 2 | ||||
-rw-r--r-- | scene/3d/physics_body.cpp | 5 | ||||
-rw-r--r-- | scene/3d/ray_cast.cpp | 2 | ||||
-rw-r--r-- | scene/3d/reflection_probe.cpp | 2 | ||||
-rw-r--r-- | scene/3d/visual_instance.cpp | 2 | ||||
-rw-r--r-- | scene/register_scene_types.cpp | 6 | ||||
-rw-r--r-- | tools/editor/property_editor.cpp | 67 | ||||
-rw-r--r-- | tools/editor/property_editor.h | 2 |
20 files changed, 90 insertions, 44 deletions
diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 320f649400..88d986f60e 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -463,7 +463,12 @@ static _GlobalConstant _global_constants[]={ BIND_GLOBAL_CONSTANT( PROPERTY_HINT_LENGTH ), BIND_GLOBAL_CONSTANT( PROPERTY_HINT_KEY_ACCEL ), BIND_GLOBAL_CONSTANT( PROPERTY_HINT_FLAGS ), - BIND_GLOBAL_CONSTANT( PROPERTY_HINT_ALL_FLAGS ), + + BIND_GLOBAL_CONSTANT( PROPERTY_HINT_LAYERS_2D_RENDER ), + BIND_GLOBAL_CONSTANT( PROPERTY_HINT_LAYERS_2D_PHYSICS ), + BIND_GLOBAL_CONSTANT( PROPERTY_HINT_LAYERS_3D_RENDER ), + BIND_GLOBAL_CONSTANT( PROPERTY_HINT_LAYERS_3D_PHYSICS), + BIND_GLOBAL_CONSTANT( PROPERTY_HINT_FILE ), BIND_GLOBAL_CONSTANT( PROPERTY_HINT_DIR ), BIND_GLOBAL_CONSTANT( PROPERTY_HINT_GLOBAL_FILE ), diff --git a/core/object.h b/core/object.h index b675486082..a54693eab6 100644 --- a/core/object.h +++ b/core/object.h @@ -58,7 +58,10 @@ enum PropertyHint { PROPERTY_HINT_SPRITE_FRAME, PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer) PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags) - PROPERTY_HINT_ALL_FLAGS, + PROPERTY_HINT_LAYERS_2D_RENDER, + PROPERTY_HINT_LAYERS_2D_PHYSICS, + PROPERTY_HINT_LAYERS_3D_RENDER, + PROPERTY_HINT_LAYERS_3D_PHYSICS, PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc," PROPERTY_HINT_DIR, ///< a directort path must be passed PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc," diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index ede6e63806..adf13e0a3b 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2668,7 +2668,7 @@ void GDParser::_parse_class(ClassNode *p_class) { if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="FLAGS") { - current_export.hint=PROPERTY_HINT_ALL_FLAGS; + //current_export.hint=PROPERTY_HINT_ALL_FLAGS; tokenizer->advance(); if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) { diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index f184822c94..883118dc41 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -667,8 +667,8 @@ void Area2D::_bind_methods() { 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_GROUP("Collision","collision_"); - 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_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/canvas_item.cpp b/scene/2d/canvas_item.cpp index 611e7540c1..d42743afc2 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -1009,7 +1009,7 @@ void CanvasItem::_bind_methods() { 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/light_2d.cpp b/scene/2d/light_2d.cpp index 928602478d..b9dc8fe130 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -442,7 +442,7 @@ void Light2D::_bind_methods() { 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::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")); @@ -450,7 +450,7 @@ void Light2D::_bind_methods() { 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_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 ac2a8d4dc5..b7b280d902 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -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/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 46f98afe51..6be5689f1d 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -101,10 +101,10 @@ 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,"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_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,"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")); 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/tile_map.cpp b/scene/2d/tile_map.cpp index 04b0379a1c..dbbc261b48 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1274,11 +1274,11 @@ void TileMap::_bind_methods() { 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,"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_ALL_FLAGS),_SCS("set_occluder_light_mask"),_SCS("get_occluder_light_mask")); + 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")); diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index 8a0fc18ab6..10b0faadb0 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -656,8 +656,8 @@ void Area::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::BOOL,"monitoring"),_SCS("set_enable_monitoring"),_SCS("is_monitoring_enabled")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"monitorable"),_SCS("set_monitorable"),_SCS("is_monitorable")); ADD_GROUP("Collision","collision_"); - 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,"collision_layers",PROPERTY_HINT_LAYERS_3D_PHYSICS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"collision_mask",PROPERTY_HINT_LAYERS_3D_PHYSICS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); } diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 69a1f42a65..6298e629a4 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -176,7 +176,7 @@ void Camera::_get_property_list( List<PropertyInfo> *p_list) const { p_list->push_back( PropertyInfo( Variant::REAL, "far" , PROPERTY_HINT_EXP_RANGE, "0.01,4096.0,0.01") ); p_list->push_back( PropertyInfo( Variant::INT, "keep_aspect",PROPERTY_HINT_ENUM,"Keep Width,Keep Height") ); p_list->push_back( PropertyInfo( Variant::BOOL, "current" ) ); - p_list->push_back( PropertyInfo( Variant::INT, "cull_mask",PROPERTY_HINT_ALL_FLAGS ) ); + p_list->push_back( PropertyInfo( Variant::INT, "cull_mask",PROPERTY_HINT_LAYERS_3D_RENDER ) ); p_list->push_back( PropertyInfo( Variant::OBJECT, "environment",PROPERTY_HINT_RESOURCE_TYPE,"Environment" ) ); p_list->push_back( PropertyInfo( Variant::REAL, "h_offset" ) ); p_list->push_back( PropertyInfo( Variant::REAL, "v_offset" ) ); diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index ba3c63c403..2322df6a9e 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -248,7 +248,7 @@ void Light::_bind_methods() { ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light_energy",PROPERTY_HINT_RANGE,"0,16,0.01"), _SCS("set_param"), _SCS("get_param"), PARAM_ENERGY); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "light_negative"), _SCS("set_negative"), _SCS("is_negative")); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light_specular",PROPERTY_HINT_RANGE,"0,1,0.01"), _SCS("set_param"), _SCS("get_param"), PARAM_SPECULAR); - ADD_PROPERTY( PropertyInfo( Variant::INT, "light_cull_mask",PROPERTY_HINT_ALL_FLAGS), _SCS("set_cull_mask"), _SCS("get_cull_mask")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "light_cull_mask",PROPERTY_HINT_LAYERS_3D_RENDER), _SCS("set_cull_mask"), _SCS("get_cull_mask")); ADD_GROUP("Shadow","shadow_"); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "shadow_enabled"), _SCS("set_shadow"), _SCS("has_shadow")); ADD_PROPERTY( PropertyInfo( Variant::COLOR, "shadow_color",PROPERTY_HINT_COLOR_NO_ALPHA), _SCS("set_shadow_color"), _SCS("get_shadow_color")); diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 0a1ef5cf15..f6499aefe3 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -162,9 +162,8 @@ void PhysicsBody::_bind_methods() { ClassDB::bind_method(_MD("_set_layers","mask"),&PhysicsBody::_set_layers); ClassDB::bind_method(_MD("_get_layers"),&PhysicsBody::_get_layers); - 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,"collision_layers",PROPERTY_HINT_LAYERS_3D_PHYSICS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"collision_mask",PROPERTY_HINT_LAYERS_3D_PHYSICS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); } diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index edf337a5b2..8216d7295f 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -240,7 +240,7 @@ void RayCast::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL,"enabled"),_SCS("set_enabled"),_SCS("is_enabled")); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3,"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_3D_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/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index 0235a063ea..fe56560483 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -229,7 +229,7 @@ void ReflectionProbe::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"origin_offset"),_SCS("set_origin_offset"),_SCS("get_origin_offset")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"box_projection"),_SCS("set_enable_box_projection"),_SCS("is_box_projection_enabled")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"enable_shadows"),_SCS("set_enable_shadows"),_SCS("are_shadows_enabled")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"cull_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_cull_mask"),_SCS("get_cull_mask")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"cull_mask",PROPERTY_HINT_LAYERS_3D_RENDER),_SCS("set_cull_mask"),_SCS("get_cull_mask")); ADD_GROUP("Interior","interior_"); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"interior_enable"),_SCS("set_as_interior"),_SCS("is_set_as_interior")); diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 659731c185..812fb93dd1 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -144,7 +144,7 @@ void VisualInstance::_bind_methods() { ClassDB::bind_method(_MD("get_transformed_aabb"), &VisualInstance::get_transformed_aabb); - ADD_PROPERTY( PropertyInfo( Variant::INT, "layers",PROPERTY_HINT_ALL_FLAGS), _SCS("set_layer_mask"), _SCS("get_layer_mask")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "layers",PROPERTY_HINT_LAYERS_3D_RENDER), _SCS("set_layer_mask"), _SCS("get_layer_mask")); } diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 42262559ce..2b7c95306f 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -644,6 +644,12 @@ void register_scene_types() { resource_loader_text = memnew( ResourceFormatLoaderText ); ResourceLoader::add_resource_format_loader(resource_loader_text,true); + for(int i=0;i<20;i++) { + GLOBAL_DEF("layer_names/2d_render/layer_"+itos(i+1),""); + GLOBAL_DEF("layer_names/2d_physics/layer_"+itos(i+1),""); + GLOBAL_DEF("layer_names/3d_render/layer_"+itos(i+1),""); + GLOBAL_DEF("layer_names/3d_physics/layer_"+itos(i+1),""); + } } void unregister_scene_types() { diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 4c69412b3b..c4a93c4af0 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -47,6 +47,7 @@ #include "editor_file_system.h" #include "create_dialog.h" #include "property_selector.h" +#include "globals.h" void CustomPropertyEditor::_notification(int p_what) { @@ -306,6 +307,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty action_buttons[i]->hide(); } + checks20gc->hide(); for(int i=0;i<20;i++) checks20[i]->hide(); @@ -316,12 +318,16 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty case Variant::BOOL: { + checks20gc->show(); + CheckBox *c=checks20[0]; c->set_text("True"); - c->set_pos(Vector2(4,4)); + checks20gc->set_pos(Vector2(4,4)); c->set_pressed(v); c->show(); - set_size(checks20[0]->get_pos()+checks20[0]->get_size()+Vector2(4,4)*EDSCALE); + + checks20gc->set_size(checks20gc->get_minimum_size()); + set_size(checks20gc->get_pos()+checks20gc->get_size()+Vector2(4,4)*EDSCALE); } break; case Variant::INT: @@ -378,10 +384,19 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty return false; - } else if (hint==PROPERTY_HINT_ALL_FLAGS) { + } else if (hint==PROPERTY_HINT_LAYERS_2D_PHYSICS || hint==PROPERTY_HINT_LAYERS_2D_RENDER || hint==PROPERTY_HINT_LAYERS_3D_PHYSICS || hint==PROPERTY_HINT_LAYERS_3D_RENDER) { - checks20[0]->set_text(""); + String title; + String basename; + switch (hint) { + case PROPERTY_HINT_LAYERS_2D_RENDER: basename="layer_names/2d_render"; title="2D Render Layers"; break; + case PROPERTY_HINT_LAYERS_2D_PHYSICS: basename="layer_names/2d_physics"; title="2D Physics Layers"; break; + case PROPERTY_HINT_LAYERS_3D_RENDER: basename="layer_names/3d_render"; title="3D Render Layers"; break; + case PROPERTY_HINT_LAYERS_3D_PHYSICS: basename="layer_names/3d_physics";title="3D Physics Layers"; break; + } + + checks20gc->show(); uint32_t flgs = v; for(int i=0;i<2;i++) { @@ -389,12 +404,9 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty ofs.y+=22*i; for(int j=0;j<10;j++) { - CheckBox *c=checks20[i*10+j]; - Point2 o=ofs; - o.x+=j*22; - if (j>=5) - o.x+=4; - c->set_pos(o); + int idx = i*10+j; + CheckBox *c=checks20[idx]; + c->set_text(GlobalConfig::get_singleton()->get(basename+"/layer_"+itos(idx+1))); c->set_pressed( flgs & (1<<(i*10+j)) ); c->show(); } @@ -402,7 +414,16 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty } - set_size(checks20[19]->get_pos()+Size2(20,25)*EDSCALE); + show(); + + value_label[0]->set_text(title); + value_label[0]->show(); + value_label[0]->set_pos(Vector2(4,4)*EDSCALE); + + checks20gc->set_pos(Vector2(4,4)*EDSCALE+Vector2(0,value_label[0]->get_size().height+4*EDSCALE)); + checks20gc->set_size(checks20gc->get_minimum_size()); + + set_size(Vector2(4,4)*EDSCALE+checks20gc->get_pos()+checks20gc->get_size()); } else if (hint==PROPERTY_HINT_EXP_EASING) { @@ -1206,7 +1227,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { } break; case Variant::INT: { - if (hint==PROPERTY_HINT_ALL_FLAGS) { + if (hint==PROPERTY_HINT_LAYERS_2D_PHYSICS || hint==PROPERTY_HINT_LAYERS_2D_RENDER || hint==PROPERTY_HINT_LAYERS_3D_PHYSICS || hint==PROPERTY_HINT_LAYERS_3D_RENDER) { uint32_t f = v; if (checks20[p_which]->is_pressed()) @@ -1995,11 +2016,21 @@ CustomPropertyEditor::CustomPropertyEditor() { } + checks20gc = memnew( GridContainer ); + add_child(checks20gc); + checks20gc->set_columns(11); + for(int i=0;i<20;i++) { + if (i==5 || i==15) { + Control *space = memnew( Control ); + space->set_custom_minimum_size(Size2(20,0)*EDSCALE); + checks20gc->add_child(space); + } + checks20[i]=memnew( CheckBox ); checks20[i]->set_toggle_mode(true); - checks20[i]->set_focus_mode(FOCUS_NONE); - add_child(checks20[i]); + checks20[i]->set_focus_mode(FOCUS_NONE); + checks20gc->add_child(checks20[i]); checks20[i]->hide(); checks20[i]->connect("pressed",this,"_action_pressed",make_binds(i)); checks20[i]->set_tooltip(vformat(TTR("Bit %d, val %d."), i, 1<<i)); @@ -2302,7 +2333,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p case Variant::REAL: case Variant::INT: { - if (p_hint==PROPERTY_HINT_ALL_FLAGS) { + if (p_hint==PROPERTY_HINT_LAYERS_2D_PHYSICS || p_hint==PROPERTY_HINT_LAYERS_2D_RENDER || p_hint==PROPERTY_HINT_LAYERS_3D_PHYSICS || p_hint==PROPERTY_HINT_LAYERS_3D_RENDER) { tree->update(); break; } @@ -3265,7 +3296,7 @@ void PropertyEditor::update_tree() { } - if (p.hint==PROPERTY_HINT_ALL_FLAGS) { + if (p.hint==PROPERTY_HINT_LAYERS_2D_PHYSICS || p.hint==PROPERTY_HINT_LAYERS_2D_RENDER || p.hint==PROPERTY_HINT_LAYERS_3D_PHYSICS || p.hint==PROPERTY_HINT_LAYERS_3D_RENDER) { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_editable(1,!read_only); @@ -3914,7 +3945,7 @@ void PropertyEditor::_item_edited() { case Variant::INT: case Variant::REAL: { - if (hint==PROPERTY_HINT_ALL_FLAGS) + if (hint==PROPERTY_HINT_LAYERS_2D_PHYSICS || hint==PROPERTY_HINT_LAYERS_2D_RENDER || hint==PROPERTY_HINT_LAYERS_3D_PHYSICS || hint==PROPERTY_HINT_LAYERS_3D_RENDER) break; if (hint==PROPERTY_HINT_EXP_EASING) break; @@ -4533,7 +4564,7 @@ class SectionedPropertyEditorFilter : public Object { PropertyInfo pi=E->get(); int sp = pi.name.find("/"); - if (pi.name=="resource_path" || pi.name=="resource_name") //skip resource stuff + if (pi.name=="resource_path" || pi.name=="resource_name" || pi.name.begins_with("script/")) //skip resource stuff continue; if (sp==-1) { diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index af7d01f935..8f429ab979 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -41,6 +41,7 @@ #include "scene/gui/text_edit.h" #include "scene/gui/check_button.h" #include "scene/gui/split_container.h" +#include "scene/gui/grid_container.h" #include "scene_tree_editor.h" /** @@ -100,6 +101,7 @@ class CustomPropertyEditor : public Popup { TextEdit *text_edit; bool read_only; bool picking_viewport; + GridContainer *checks20gc; CheckBox *checks20[20]; SpinBox *spinbox; HSlider *slider; |