diff options
author | clayjohn <claynjohn@gmail.com> | 2023-01-19 19:44:20 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2023-01-20 09:58:17 -0800 |
commit | 49bebf2bfb490d9e2e9ae8ce7fd81fb8c1d967ae (patch) | |
tree | 936fc5aecf8ef1e02a233871f2e7c3080bac8dc0 /scene | |
parent | 360b61084a4a5bc0f9577212a3079430601b3408 (diff) |
Sort decals and lights based on camera origin
Also implement sort_offset for decals
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/decal.cpp | 4 | ||||
-rw-r--r-- | scene/3d/visual_instance_3d.cpp | 12 | ||||
-rw-r--r-- | scene/3d/visual_instance_3d.h | 2 |
3 files changed, 18 insertions, 0 deletions
diff --git a/scene/3d/decal.cpp b/scene/3d/decal.cpp index e9cc4e9479..fbcb1c8f2c 100644 --- a/scene/3d/decal.cpp +++ b/scene/3d/decal.cpp @@ -156,6 +156,10 @@ void Decal::_validate_property(PropertyInfo &p_property) const { if (!distance_fade_enabled && (p_property.name == "distance_fade_begin" || p_property.name == "distance_fade_length")) { p_property.usage = PROPERTY_USAGE_NO_EDITOR; } + + if (p_property.name == "sorting_offset") { + p_property.usage = PROPERTY_USAGE_DEFAULT; + } } PackedStringArray Decal::get_configuration_warnings() const { diff --git a/scene/3d/visual_instance_3d.cpp b/scene/3d/visual_instance_3d.cpp index 64fb0a7657..8026b12c2b 100644 --- a/scene/3d/visual_instance_3d.cpp +++ b/scene/3d/visual_instance_3d.cpp @@ -120,6 +120,12 @@ bool VisualInstance3D::is_sorting_use_aabb_center() const { return sorting_use_aabb_center; } +void VisualInstance3D::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "sorting_offset" || p_property.name == "sorting_use_aabb_center") { + p_property.usage = PROPERTY_USAGE_NONE; + } +} + void VisualInstance3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_base", "base"), &VisualInstance3D::set_base); ClassDB::bind_method(D_METHOD("get_base"), &VisualInstance3D::get_base); @@ -437,6 +443,12 @@ PackedStringArray GeometryInstance3D::get_configuration_warnings() const { return warnings; } +void GeometryInstance3D::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "sorting_offset" || p_property.name == "sorting_use_aabb_center") { + p_property.usage = PROPERTY_USAGE_DEFAULT; + } +} + void GeometryInstance3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_material_override", "material"), &GeometryInstance3D::set_material_override); ClassDB::bind_method(D_METHOD("get_material_override"), &GeometryInstance3D::get_material_override); diff --git a/scene/3d/visual_instance_3d.h b/scene/3d/visual_instance_3d.h index 190ed17753..ef0f7966e2 100644 --- a/scene/3d/visual_instance_3d.h +++ b/scene/3d/visual_instance_3d.h @@ -47,6 +47,7 @@ protected: void _notification(int p_what); static void _bind_methods(); + void _validate_property(PropertyInfo &p_property) const; GDVIRTUAL0RC(AABB, _get_aabb) public: @@ -140,6 +141,7 @@ protected: bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; void _get_property_list(List<PropertyInfo> *p_list) const; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); |