From fc3b845c072538f33836db38eb9d4f4d3fcfb16a Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Thu, 19 May 2022 14:08:47 +0800 Subject: Add dedicated macros for property name extraction * Replace case-by-case extraction with PNAME & GNAME * Fix group handling when group hint begins with property name * Exclude properties that are PROPERTY_USAGE_NO_EDITOR * Extract missing ADD_ARRAY*, ADD_SUBGROUP* macros --- servers/physics_server_2d.cpp | 2 +- servers/physics_server_3d.cpp | 2 +- servers/rendering/shader_types.cpp | 62 +++++++++++++++++++------------------- 3 files changed, 33 insertions(+), 33 deletions(-) (limited to 'servers') diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp index 3259bd6ef9..a9b7964858 100644 --- a/servers/physics_server_2d.cpp +++ b/servers/physics_server_2d.cpp @@ -861,7 +861,7 @@ PhysicsServer2D::~PhysicsServer2D() { Vector PhysicsServer2DManager::physics_2d_servers; int PhysicsServer2DManager::default_server_id = -1; int PhysicsServer2DManager::default_server_priority = -1; -const String PhysicsServer2DManager::setting_property_name("physics/2d/physics_engine"); +const String PhysicsServer2DManager::setting_property_name(PNAME("physics/2d/physics_engine")); void PhysicsServer2DManager::on_servers_changed() { String physics_servers("DEFAULT"); diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp index 63085cf275..f2072f7666 100644 --- a/servers/physics_server_3d.cpp +++ b/servers/physics_server_3d.cpp @@ -1033,7 +1033,7 @@ PhysicsServer3D::~PhysicsServer3D() { Vector PhysicsServer3DManager::physics_servers; int PhysicsServer3DManager::default_server_id = -1; int PhysicsServer3DManager::default_server_priority = -1; -const String PhysicsServer3DManager::setting_property_name("physics/3d/physics_engine"); +const String PhysicsServer3DManager::setting_property_name(PNAME("physics/3d/physics_engine")); void PhysicsServer3DManager::on_servers_changed() { String physics_servers2("DEFAULT"); diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp index 98c7f0d7aa..05700e7ff9 100644 --- a/servers/rendering/shader_types.cpp +++ b/servers/rendering/shader_types.cpp @@ -192,26 +192,26 @@ ShaderTypes::ShaderTypes() { // spatial render modes { - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "blend", "mix", "add", "sub", "mul" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "depth_draw", "opaque", "always", "never" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "depth_prepass_alpha" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "depth_test_disabled" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "sss_mode_skin" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "cull", "back", "front", "disabled" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "unshaded" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "wireframe" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "diffuse", "lambert", "lambert_wrap", "burley", "toon" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "specular", "schlick_ggx", "toon", "disabled" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "skip_vertex_transform" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "world_vertex_coords" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "ensure_correct_normals" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "shadows_disabled" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "ambient_light_disabled" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "shadow_to_opacity" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "vertex_lighting" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "particle_trails" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "alpha_to_coverage" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ "alpha_to_coverage_and_one" }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("blend"), "mix", "add", "sub", "mul" }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("depth_draw"), "opaque", "always", "never" }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("depth_prepass_alpha") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("depth_test_disabled") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("sss_mode_skin") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("cull"), "back", "front", "disabled" }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("unshaded") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("wireframe") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("diffuse"), "lambert", "lambert_wrap", "burley", "toon" }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("specular"), "schlick_ggx", "toon", "disabled" }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("skip_vertex_transform") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("world_vertex_coords") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("ensure_correct_normals") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("shadows_disabled") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("ambient_light_disabled") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("shadow_to_opacity") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("vertex_lighting") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("particle_trails") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("alpha_to_coverage") }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("alpha_to_coverage_and_one") }); } /************ CANVAS ITEM **************************/ @@ -299,10 +299,10 @@ ShaderTypes::ShaderTypes() { // canvasitem render modes { - shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back({ "skip_vertex_transform" }); - shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back({ "blend", "mix", "add", "sub", "mul", "premul_alpha", "disabled" }); - shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back({ "unshaded" }); - shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back({ "light_only" }); + shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back({ PNAME("skip_vertex_transform") }); + shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back({ PNAME("blend"), "mix", "add", "sub", "mul", "premul_alpha", "disabled" }); + shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back({ PNAME("unshaded") }); + shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back({ PNAME("light_only") }); } /************ PARTICLES **************************/ @@ -380,10 +380,10 @@ ShaderTypes::ShaderTypes() { // particles render modes { - shader_modes[RS::SHADER_PARTICLES].modes.push_back({ "collision_use_scale" }); - shader_modes[RS::SHADER_PARTICLES].modes.push_back({ "disable_force" }); - shader_modes[RS::SHADER_PARTICLES].modes.push_back({ "disable_velocity" }); - shader_modes[RS::SHADER_PARTICLES].modes.push_back({ "keep_data" }); + shader_modes[RS::SHADER_PARTICLES].modes.push_back({ PNAME("collision_use_scale") }); + shader_modes[RS::SHADER_PARTICLES].modes.push_back({ PNAME("disable_force") }); + shader_modes[RS::SHADER_PARTICLES].modes.push_back({ PNAME("disable_velocity") }); + shader_modes[RS::SHADER_PARTICLES].modes.push_back({ PNAME("keep_data") }); } /************ SKY **************************/ @@ -430,9 +430,9 @@ ShaderTypes::ShaderTypes() { // sky render modes { - shader_modes[RS::SHADER_SKY].modes.push_back({ "use_half_res_pass" }); - shader_modes[RS::SHADER_SKY].modes.push_back({ "use_quarter_res_pass" }); - shader_modes[RS::SHADER_SKY].modes.push_back({ "disable_fog" }); + shader_modes[RS::SHADER_SKY].modes.push_back({ PNAME("use_half_res_pass") }); + shader_modes[RS::SHADER_SKY].modes.push_back({ PNAME("use_quarter_res_pass") }); + shader_modes[RS::SHADER_SKY].modes.push_back({ PNAME("disable_fog") }); } /************ FOG **************************/ -- cgit v1.2.3