diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/audio_stream_player_2d.cpp | 4 | ||||
-rw-r--r-- | scene/3d/audio_stream_player_3d.cpp | 4 | ||||
-rw-r--r-- | scene/3d/collision_shape.cpp | 2 | ||||
-rw-r--r-- | scene/3d/collision_shape.h | 2 | ||||
-rw-r--r-- | scene/3d/immediate_geometry.h | 2 | ||||
-rw-r--r-- | scene/3d/remote_transform.cpp | 3 | ||||
-rw-r--r-- | scene/animation/animation_tree_player.h | 2 | ||||
-rw-r--r-- | scene/audio/audio_player.cpp | 4 | ||||
-rw-r--r-- | scene/gui/check_box.h | 2 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 2 | ||||
-rw-r--r-- | scene/main/scene_tree.h | 2 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.h | 2 | ||||
-rw-r--r-- | scene/resources/material.cpp | 35 | ||||
-rw-r--r-- | scene/resources/material.h | 12 |
14 files changed, 58 insertions, 20 deletions
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index eb186a8e1f..39d3f2d6bf 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -246,12 +246,14 @@ void AudioStreamPlayer2D::set_stream(Ref<AudioStream> p_stream) { stream = p_stream; stream_playback = p_stream->instance_playback(); + AudioServer::get_singleton()->unlock(); + if (stream_playback.is_null()) { stream.unref(); ERR_FAIL_COND(stream_playback.is_null()); } - AudioServer::get_singleton()->unlock(); + } Ref<AudioStream> AudioStreamPlayer2D::get_stream() const { diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 6efdf25f0d..1ad36102ba 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -555,12 +555,12 @@ void AudioStreamPlayer3D::set_stream(Ref<AudioStream> p_stream) { stream = p_stream; stream_playback = p_stream->instance_playback(); + AudioServer::get_singleton()->unlock(); + if (stream_playback.is_null()) { stream.unref(); ERR_FAIL_COND(stream_playback.is_null()); } - - AudioServer::get_singleton()->unlock(); } Ref<AudioStream> AudioStreamPlayer3D::get_stream() const { diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp index 4d4ed30d03..5f1151f8e9 100644 --- a/scene/3d/collision_shape.cpp +++ b/scene/3d/collision_shape.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* body_shape.cpp */ +/* collision_shape.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/scene/3d/collision_shape.h b/scene/3d/collision_shape.h index 6d849f42af..94621177cb 100644 --- a/scene/3d/collision_shape.h +++ b/scene/3d/collision_shape.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* body_shape.h */ +/* collision_shape.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h index b2bcb5af1a..6db825bf54 100644 --- a/scene/3d/immediate_geometry.h +++ b/scene/3d/immediate_geometry.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* immediate_geometry.h */ +/* immediate_geometry.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp index 3d402fa5af..8faf985b11 100644 --- a/scene/3d/remote_transform.cpp +++ b/scene/3d/remote_transform.cpp @@ -1,6 +1,5 @@ - /*************************************************************************/ -/* remote_transform.cpp */ +/* remote_transform.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h index 71d7277118..609430340b 100644 --- a/scene/animation/animation_tree_player.h +++ b/scene/animation/animation_tree_player.h @@ -347,7 +347,7 @@ public: void animation_node_set_master_animation(const StringName &p_node, const String &p_master_animation); String animation_node_get_master_animation(const StringName &p_node) const; - void animation_node_set_filter_path(const StringName &p_node, const NodePath &p_filter, bool p_enable); + void animation_node_set_filter_path(const StringName &p_node, const NodePath &p_track_path, bool p_filter); void animation_node_set_get_filtered_paths(const StringName &p_node, List<NodePath> *r_paths) const; bool animation_node_is_path_filtered(const StringName &p_node, const NodePath &p_path) const; diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp index 5d71f702df..8bd924e7ce 100644 --- a/scene/audio/audio_player.cpp +++ b/scene/audio/audio_player.cpp @@ -139,12 +139,12 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) { stream = p_stream; stream_playback = p_stream->instance_playback(); + AudioServer::get_singleton()->unlock(); + if (stream_playback.is_null()) { stream.unref(); ERR_FAIL_COND(stream_playback.is_null()); } - - AudioServer::get_singleton()->unlock(); } Ref<AudioStream> AudioStreamPlayer::get_stream() const { diff --git a/scene/gui/check_box.h b/scene/gui/check_box.h index 4a1adb5f2f..4da06be8d1 100644 --- a/scene/gui/check_box.h +++ b/scene/gui/check_box.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* check_box.h */ +/* check_box.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 766b7923d3..a71b491bae 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* scene_main_loop.cpp */ +/* scene_tree.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index 594b806cef..c116bec4fc 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* scene_main_loop.h */ +/* scene_tree.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/scene/resources/default_theme/default_theme.h b/scene/resources/default_theme/default_theme.h index 9032b71775..f2a4b2616d 100644 --- a/scene/resources/default_theme/default_theme.h +++ b/scene/resources/default_theme/default_theme.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* default_theme.cpp */ +/* default_theme.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 315351d039..63b7fe4a86 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -48,6 +48,19 @@ Ref<Material> Material::get_next_pass() const { return next_pass; } +void Material::set_render_priority(int p_priority) { + + ERR_FAIL_COND(p_priority < RENDER_PRIORITY_MIN); + ERR_FAIL_COND(p_priority > RENDER_PRIORITY_MAX); + render_priority = p_priority; + VS::get_singleton()->material_set_render_priority(material, p_priority); +} + +int Material::get_render_priority() const { + + return render_priority; +} + RID Material::get_rid() const { return material; @@ -58,12 +71,20 @@ void Material::_bind_methods() { ClassDB::bind_method(D_METHOD("set_next_pass", "next_pass"), &Material::set_next_pass); ClassDB::bind_method(D_METHOD("get_next_pass"), &Material::get_next_pass); + ClassDB::bind_method(D_METHOD("set_render_priority", "priority"), &Material::set_render_priority); + ClassDB::bind_method(D_METHOD("get_render_priority"), &Material::get_render_priority); + + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "render_priority", PROPERTY_HINT_RANGE, itos(RENDER_PRIORITY_MIN) + "," + itos(RENDER_PRIORITY_MAX) + ",1"), "set_render_priority", "get_render_priority"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "next_pass", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_next_pass", "get_next_pass"); + + BIND_CONSTANT(RENDER_PRIORITY_MAX); + BIND_CONSTANT(RENDER_PRIORITY_MIN); } Material::Material() { material = VisualServer::get_singleton()->material_create(); + render_priority = 0; } Material::~Material() { @@ -347,8 +368,8 @@ void SpatialMaterial::_update_shader() { if (flags[FLAG_UNSHADED]) { code += ",unshaded"; } - if (flags[FLAG_ONTOP]) { - code += ",ontop"; + if (flags[FLAG_DISABLE_DEPTH_TEST]) { + code += ",depth_test_disable"; } if (flags[FLAG_USE_VERTEX_LIGHTING]) { code += ",vertex_lighting"; @@ -1459,6 +1480,12 @@ RID SpatialMaterial::get_material_rid_for_2d(bool p_shaded, bool p_transparent, return materials_for_2d[version]->get_rid(); } +void SpatialMaterial::set_on_top_of_alpha() { + set_feature(FEATURE_TRANSPARENT, true); + set_render_priority(RENDER_PRIORITY_MAX); + set_flag(FLAG_DISABLE_DEPTH_TEST, true); +} + void SpatialMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_albedo", "albedo"), &SpatialMaterial::set_albedo); @@ -1606,7 +1633,7 @@ void SpatialMaterial::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_transparent"), "set_feature", "get_feature", FEATURE_TRANSPARENT); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_unshaded"), "set_flag", "get_flag", FLAG_UNSHADED); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_vertex_lighting"), "set_flag", "get_flag", FLAG_USE_VERTEX_LIGHTING); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_on_top"), "set_flag", "get_flag", FLAG_ONTOP); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_no_depth_test"), "set_flag", "get_flag", FLAG_DISABLE_DEPTH_TEST); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_use_point_size"), "set_flag", "get_flag", FLAG_USE_POINT_SIZE); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_fixed_size"), "set_flag", "get_flag", FLAG_FIXED_SIZE); ADD_GROUP("Vertex Color", "vertex_color"); @@ -1768,7 +1795,7 @@ void SpatialMaterial::_bind_methods() { BIND_ENUM_CONSTANT(FLAG_UNSHADED); BIND_ENUM_CONSTANT(FLAG_USE_VERTEX_LIGHTING); - BIND_ENUM_CONSTANT(FLAG_ONTOP); + BIND_ENUM_CONSTANT(FLAG_DISABLE_DEPTH_TEST); BIND_ENUM_CONSTANT(FLAG_ALBEDO_FROM_VERTEX_COLOR); BIND_ENUM_CONSTANT(FLAG_SRGB_VERTEX_COLOR); BIND_ENUM_CONSTANT(FLAG_USE_POINT_SIZE); diff --git a/scene/resources/material.h b/scene/resources/material.h index 6a0eead708..4977e5dd70 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -48,15 +48,23 @@ class Material : public Resource { RID material; Ref<Material> next_pass; + int render_priority; protected: _FORCE_INLINE_ RID _get_material() const { return material; } static void _bind_methods(); public: + enum { + RENDER_PRIORITY_MAX = VS::MATERIAL_RENDER_PRIORITY_MAX, + RENDER_PRIORITY_MIN = VS::MATERIAL_RENDER_PRIORITY_MIN, + }; void set_next_pass(const Ref<Material> &p_pass); Ref<Material> get_next_pass() const; + void set_render_priority(int p_priority); + int get_render_priority() const; + virtual RID get_rid() const; Material(); virtual ~Material(); @@ -156,7 +164,7 @@ public: enum Flags { FLAG_UNSHADED, FLAG_USE_VERTEX_LIGHTING, - FLAG_ONTOP, + FLAG_DISABLE_DEPTH_TEST, FLAG_ALBEDO_FROM_VERTEX_COLOR, FLAG_SRGB_VERTEX_COLOR, FLAG_USE_POINT_SIZE, @@ -511,6 +519,8 @@ public: void set_alpha_scissor_threshold(float p_treshold); float get_alpha_scissor_threshold() const; + void set_on_top_of_alpha(); + void set_metallic_texture_channel(TextureChannel p_channel); TextureChannel get_metallic_texture_channel() const; void set_roughness_texture_channel(TextureChannel p_channel); |