diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/tile_map_layer.cpp | 27 | ||||
-rw-r--r-- | scene/2d/tile_map_layer.h | 2 | ||||
-rw-r--r-- | scene/3d/mesh_instance_3d.cpp | 17 | ||||
-rw-r--r-- | scene/3d/mesh_instance_3d.h | 3 | ||||
-rw-r--r-- | scene/animation/animation_blend_tree.cpp | 1 | ||||
-rw-r--r-- | scene/animation/animation_mixer.cpp | 7 | ||||
-rw-r--r-- | scene/animation/animation_mixer.h | 2 | ||||
-rw-r--r-- | scene/animation/animation_tree.cpp | 4 | ||||
-rw-r--r-- | scene/gui/graph_edit.cpp | 5 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 5 | ||||
-rw-r--r-- | scene/gui/tab_bar.cpp | 9 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 4 | ||||
-rw-r--r-- | scene/main/window.cpp | 5 | ||||
-rw-r--r-- | scene/main/window.h | 1 | ||||
-rw-r--r-- | scene/property_list_helper.cpp | 7 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 5 | ||||
-rw-r--r-- | scene/resources/visual_shader.h | 62 | ||||
-rw-r--r-- | scene/resources/visual_shader_nodes.h | 101 | ||||
-rw-r--r-- | scene/resources/visual_shader_particle_nodes.h | 20 |
19 files changed, 246 insertions, 41 deletions
diff --git a/scene/2d/tile_map_layer.cpp b/scene/2d/tile_map_layer.cpp index bc052f9034..8b2542b34e 100644 --- a/scene/2d/tile_map_layer.cpp +++ b/scene/2d/tile_map_layer.cpp @@ -1360,6 +1360,7 @@ void TileMapLayer::_build_runtime_update_tile_data() { if (!forced_cleanup) { if (tile_map_node->GDVIRTUAL_IS_OVERRIDDEN(_use_tile_data_runtime_update) && tile_map_node->GDVIRTUAL_IS_OVERRIDDEN(_tile_data_runtime_update)) { if (_runtime_update_tile_data_was_cleaned_up || dirty.flags[DIRTY_FLAGS_LAYER_GROUP_TILE_SET]) { + _runtime_update_needs_all_cells_cleaned_up = true; for (KeyValue<Vector2i, CellData> &E : tile_map) { _build_runtime_update_tile_data_for_cell(E.value); } @@ -1414,14 +1415,24 @@ void TileMapLayer::_build_runtime_update_tile_data_for_cell(CellData &r_cell_dat } void TileMapLayer::_clear_runtime_update_tile_data() { - for (SelfList<CellData> *cell_data_list_element = dirty.cell_list.first(); cell_data_list_element; cell_data_list_element = cell_data_list_element->next()) { - CellData &cell_data = *cell_data_list_element->self(); - - // Clear the runtime tile data. - if (cell_data.runtime_tile_data_cache) { - memdelete(cell_data.runtime_tile_data_cache); - cell_data.runtime_tile_data_cache = nullptr; + if (_runtime_update_needs_all_cells_cleaned_up) { + for (KeyValue<Vector2i, CellData> &E : tile_map) { + _clear_runtime_update_tile_data_for_cell(E.value); } + _runtime_update_needs_all_cells_cleaned_up = false; + } else { + for (SelfList<CellData> *cell_data_list_element = dirty.cell_list.first(); cell_data_list_element; cell_data_list_element = cell_data_list_element->next()) { + CellData &r_cell_data = *cell_data_list_element->self(); + _clear_runtime_update_tile_data_for_cell(r_cell_data); + } + } +} + +void TileMapLayer::_clear_runtime_update_tile_data_for_cell(CellData &r_cell_data) { + // Clear the runtime tile data. + if (r_cell_data.runtime_tile_data_cache) { + memdelete(r_cell_data.runtime_tile_data_cache); + r_cell_data.runtime_tile_data_cache = nullptr; } } @@ -1632,7 +1643,7 @@ void TileMapLayer::_deferred_internal_update() { void TileMapLayer::_internal_update() { // Find TileData that need a runtime modification. - // This may add cells to the dirty list is a runtime modification has been notified. + // This may add cells to the dirty list if a runtime modification has been notified. _build_runtime_update_tile_data(); // Update all subsystems. diff --git a/scene/2d/tile_map_layer.h b/scene/2d/tile_map_layer.h index 6cf432bc24..ac03f3155f 100644 --- a/scene/2d/tile_map_layer.h +++ b/scene/2d/tile_map_layer.h @@ -283,7 +283,9 @@ private: bool _runtime_update_tile_data_was_cleaned_up = false; void _build_runtime_update_tile_data(); void _build_runtime_update_tile_data_for_cell(CellData &r_cell_data, bool p_auto_add_to_dirty_list = false); + bool _runtime_update_needs_all_cells_cleaned_up = false; void _clear_runtime_update_tile_data(); + void _clear_runtime_update_tile_data_for_cell(CellData &r_cell_data); // Per-system methods. #ifdef DEBUG_ENABLED diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index d83d55d121..35baf81e89 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -493,6 +493,23 @@ void MeshInstance3D::create_debug_tangents() { } } +bool MeshInstance3D::_property_can_revert(const StringName &p_name) const { + HashMap<StringName, int>::ConstIterator E = blend_shape_properties.find(p_name); + if (E) { + return true; + } + return false; +} + +bool MeshInstance3D::_property_get_revert(const StringName &p_name, Variant &r_property) const { + HashMap<StringName, int>::ConstIterator E = blend_shape_properties.find(p_name); + if (E) { + r_property = 0.0f; + return true; + } + return false; +} + void MeshInstance3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &MeshInstance3D::set_mesh); ClassDB::bind_method(D_METHOD("get_mesh"), &MeshInstance3D::get_mesh); diff --git a/scene/3d/mesh_instance_3d.h b/scene/3d/mesh_instance_3d.h index 0a7ffa0bee..add6bfe15e 100644 --- a/scene/3d/mesh_instance_3d.h +++ b/scene/3d/mesh_instance_3d.h @@ -62,6 +62,9 @@ protected: void _notification(int p_what); static void _bind_methods(); + bool _property_can_revert(const StringName &p_name) const; + bool _property_get_revert(const StringName &p_name, Variant &r_property) const; + public: void set_mesh(const Ref<Mesh> &p_mesh); Ref<Mesh> get_mesh() const; diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index de7948dca7..1b9a9e812d 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -1403,6 +1403,7 @@ String AnimationNodeBlendTree::get_caption() const { double AnimationNodeBlendTree::_process(const AnimationMixer::PlaybackInfo p_playback_info, bool p_test_only) { Ref<AnimationNodeOutput> output = nodes[SceneStringNames::get_singleton()->output].node; node_state.connections = nodes[SceneStringNames::get_singleton()->output].connections; + ERR_FAIL_COND_V(output.is_null(), 0); AnimationMixer::PlaybackInfo pi = p_playback_info; pi.weight = 1.0; diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp index 87ac0bf5c8..0ee47ee0fe 100644 --- a/scene/animation/animation_mixer.cpp +++ b/scene/animation/animation_mixer.cpp @@ -693,6 +693,9 @@ bool AnimationMixer::_update_caches() { track_value->init_value = anim->track_get_key_value(i, 0); track_value->init_value.zero(); + // Can't interpolate them, need to convert. + track_value->is_variant_interpolatable = Animation::is_variant_interpolatable(track_value->init_value); + // If there is a Reset Animation, it takes precedence by overwriting. if (has_reset_anim) { int rt = reset_anim->find_track(path, track_src_type); @@ -1414,7 +1417,7 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) { bool is_value = ttype == Animation::TYPE_VALUE; bool is_discrete = is_value && a->value_track_get_update_mode(i) == Animation::UPDATE_DISCRETE; bool force_continuous = callback_mode_discrete == ANIMATION_CALLBACK_MODE_DISCRETE_FORCE_CONTINUOUS; - if (!is_discrete || force_continuous) { + if (t->is_variant_interpolatable && (!is_discrete || force_continuous)) { Variant value = is_value ? a->value_track_interpolate(i, time, is_discrete && force_continuous ? backward : false) : Variant(a->bezier_track_interpolate(i, time)); value = post_process_key_value(a, i, value, t->object_id); if (value == Variant()) { @@ -1727,7 +1730,7 @@ void AnimationMixer::_blend_apply() { case Animation::TYPE_VALUE: { TrackCacheValue *t = static_cast<TrackCacheValue *>(track); - if (callback_mode_discrete == ANIMATION_CALLBACK_MODE_DISCRETE_DOMINANT && t->use_discrete) { + if (!t->is_variant_interpolatable || (callback_mode_discrete == ANIMATION_CALLBACK_MODE_DISCRETE_DOMINANT && t->use_discrete)) { break; // Don't overwrite the value set by UPDATE_DISCRETE. } diff --git a/scene/animation/animation_mixer.h b/scene/animation/animation_mixer.h index 7808ec788c..5f7e6c5429 100644 --- a/scene/animation/animation_mixer.h +++ b/scene/animation/animation_mixer.h @@ -224,6 +224,7 @@ protected: Vector<StringName> subpath; bool use_discrete = false; bool is_using_angle = false; + bool is_variant_interpolatable = true; Variant element_size; TrackCacheValue(const TrackCacheValue &p_other) : @@ -233,6 +234,7 @@ protected: subpath(p_other.subpath), use_discrete(p_other.use_discrete), is_using_angle(p_other.is_using_angle), + is_variant_interpolatable(p_other.is_variant_interpolatable), element_size(p_other.element_size) {} TrackCacheValue() { type = Animation::TYPE_VALUE; } diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 2b7c47c869..2c2d8387f3 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -140,6 +140,7 @@ double AnimationNode::blend_input(int p_input, AnimationMixer::PlaybackInfo p_pl } Ref<AnimationNode> node = blend_tree->get_node(node_name); + ERR_FAIL_COND_V(node.is_null(), 0); real_t activity = 0.0; Vector<AnimationTree::Activity> *activity_ptr = process_state->tree->input_activity_map.getptr(node_state.base_path); @@ -153,12 +154,13 @@ double AnimationNode::blend_input(int p_input, AnimationMixer::PlaybackInfo p_pl } double AnimationNode::blend_node(Ref<AnimationNode> p_node, const StringName &p_subpath, AnimationMixer::PlaybackInfo p_playback_info, FilterAction p_filter, bool p_sync, bool p_test_only) { + ERR_FAIL_COND_V(p_node.is_null(), 0); + p_node->node_state.connections.clear(); return _blend_node(p_node, p_subpath, this, p_playback_info, p_filter, p_sync, p_test_only, nullptr); } double AnimationNode::_blend_node(Ref<AnimationNode> p_node, const StringName &p_subpath, AnimationNode *p_new_parent, AnimationMixer::PlaybackInfo p_playback_info, FilterAction p_filter, bool p_sync, bool p_test_only, real_t *r_activity) { - ERR_FAIL_COND_V(!p_node.is_valid(), 0); ERR_FAIL_NULL_V(process_state, 0); int blend_count = node_state.track_weights.size(); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index c23d21775f..b7118d595f 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -52,6 +52,7 @@ constexpr int MINIMAP_PADDING = 5; constexpr int MIN_DRAG_DISTANCE_FOR_VALID_CONNECTION = 20; constexpr int MAX_CONNECTION_LINE_CURVE_TESSELATION_STAGES = 5; constexpr int GRID_MINOR_STEPS_PER_MAJOR_LINE = 10; +constexpr int GRID_MINOR_STEPS_PER_MAJOR_DOT = 5; constexpr int GRID_MIN_SNAPPING_DISTANCE = 2; constexpr int GRID_MAX_SNAPPING_DISTANCE = 100; @@ -1349,13 +1350,13 @@ void GraphEdit::_draw_grid() { } break; case GRID_PATTERN_DOTS: { Color transparent_grid_minor = theme_cache.grid_minor; - transparent_grid_minor.a *= CLAMP(2 * (zoom - 0.4), 0, 1); + transparent_grid_minor.a *= CLAMP(1.0 * (zoom - 0.4), 0, 1); for (int i = from_pos.x; i < from_pos.x + len.x; i++) { for (int j = from_pos.y; j < from_pos.y + len.y; j++) { Color color = transparent_grid_minor; - if (ABS(i) % GRID_MINOR_STEPS_PER_MAJOR_LINE == 0 && ABS(j) % GRID_MINOR_STEPS_PER_MAJOR_LINE == 0) { + if (ABS(i) % GRID_MINOR_STEPS_PER_MAJOR_DOT == 0 && ABS(j) % GRID_MINOR_STEPS_PER_MAJOR_DOT == 0) { color = theme_cache.grid_major; } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 0da5093ab8..fda909af79 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1808,6 +1808,11 @@ void PopupMenu::set_item_submenu(int p_idx, const String &p_submenu) { return; } + String submenu_name_safe = p_submenu.replace("@", "_"); // Allow special characters for auto-generated names. + if (submenu_name_safe.validate_node_name() != submenu_name_safe) { + ERR_FAIL_MSG(vformat("Invalid node name '%s' for a submenu, the following characters are not allowed:\n%s", p_submenu, String::get_invalid_node_name_characters(true))); + } + if (!global_menu_name.is_empty()) { if (items[p_idx].submenu_bound) { PopupMenu *pm = Object::cast_to<PopupMenu>(get_node_or_null(items[p_idx].submenu)); diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp index f87bccdfe7..d20fef8164 100644 --- a/scene/gui/tab_bar.cpp +++ b/scene/gui/tab_bar.cpp @@ -627,6 +627,10 @@ void TabBar::set_tab_count(int p_count) { offset = MIN(offset, p_count - 1); max_drawn_tab = MIN(max_drawn_tab, p_count - 1); current = MIN(current, p_count - 1); + // Fix range if unable to deselect. + if (current == -1 && !_can_deselect()) { + current = 0; + } _update_cache(); _ensure_no_over_offset(); @@ -1557,10 +1561,7 @@ bool TabBar::_can_deselect() const { } void TabBar::ensure_tab_visible(int p_idx) { - if (!is_inside_tree() || !buttons_visible) { - return; - } - if (p_idx == -1 && _can_deselect()) { + if (p_idx == -1 || !is_inside_tree() || !buttons_visible) { return; } ERR_FAIL_INDEX(p_idx, tabs.size()); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 6b3b2d6260..a29311af43 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -60,7 +60,9 @@ #include "servers/display_server.h" #include "servers/navigation_server_3d.h" #include "servers/physics_server_2d.h" +#ifndef _3D_DISABLED #include "servers/physics_server_3d.h" +#endif // _3D_DISABLED #include "window.h" #include <stdio.h> #include <stdlib.h> @@ -884,7 +886,9 @@ void SceneTree::set_pause(bool p_enabled) { return; } paused = p_enabled; +#ifndef _3D_DISABLED PhysicsServer3D::get_singleton()->set_active(!p_enabled); +#endif // _3D_DISABLED PhysicsServer2D::get_singleton()->set_active(!p_enabled); if (get_root()) { get_root()->_propagate_pause_notification(p_enabled); diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 483c6e4c60..9c2509404c 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1194,10 +1194,7 @@ void Window::_update_viewport_size() { } } - if (old_size != size) { - old_size = size; - notification(NOTIFICATION_WM_SIZE_CHANGED); - } + notification(NOTIFICATION_WM_SIZE_CHANGED); if (embedder) { embedder->_sub_window_update(this); diff --git a/scene/main/window.h b/scene/main/window.h index 70ee744344..e37a98bd2d 100644 --- a/scene/main/window.h +++ b/scene/main/window.h @@ -116,7 +116,6 @@ private: mutable Size2i size = Size2i(DEFAULT_WINDOW_SIZE, DEFAULT_WINDOW_SIZE); mutable Size2i min_size; mutable Size2i max_size; - mutable Size2i old_size = size; mutable Vector<Vector2> mpath; mutable Mode mode = MODE_WINDOWED; mutable bool flags[FLAG_MAX] = {}; diff --git a/scene/property_list_helper.cpp b/scene/property_list_helper.cpp index 2d3179d9fd..d9a80011b0 100644 --- a/scene/property_list_helper.cpp +++ b/scene/property_list_helper.cpp @@ -111,12 +111,7 @@ bool PropertyListHelper::property_set_value(const String &p_property, const Vari bool PropertyListHelper::property_can_revert(const String &p_property) const { int index; - const Property *property = _get_property(p_property, &index); - - if (property) { - return _call_getter(property->getter, index) != property->default_value; - } - return false; + return _get_property(p_property, &index) != nullptr; } bool PropertyListHelper::property_get_revert(const String &p_property, Variant &r_value) const { diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 218ca6322a..c7c2ddbb18 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -403,6 +403,11 @@ String VisualShaderNode::get_warning(Shader::Mode p_mode, VisualShader::Type p_t return String(); } +VisualShaderNode::Category VisualShaderNode::get_category() const { + WARN_PRINT(get_caption() + " is missing a category."); + return CATEGORY_NONE; +} + bool VisualShaderNode::is_input_port_default(int p_port, Shader::Mode p_mode) const { return false; } diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index d4d77e7609..09ea9a8890 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -255,6 +255,37 @@ VARIANT_ENUM_CAST(VisualShader::VaryingType) class VisualShaderNode : public Resource { GDCLASS(VisualShaderNode, Resource); +public: + enum PortType { + PORT_TYPE_SCALAR, + PORT_TYPE_SCALAR_INT, + PORT_TYPE_SCALAR_UINT, + PORT_TYPE_VECTOR_2D, + PORT_TYPE_VECTOR_3D, + PORT_TYPE_VECTOR_4D, + PORT_TYPE_BOOLEAN, + PORT_TYPE_TRANSFORM, + PORT_TYPE_SAMPLER, + PORT_TYPE_MAX, + }; + + enum Category { + CATEGORY_NONE, + CATEGORY_OUTPUT, + CATEGORY_COLOR, + CATEGORY_CONDITIONAL, + CATEGORY_INPUT, + CATEGORY_SCALAR, + CATEGORY_TEXTURES, + CATEGORY_TRANSFORM, + CATEGORY_UTILITY, + CATEGORY_VECTOR, + CATEGORY_SPECIAL, + CATEGORY_PARTICLE, + CATEGORY_MAX + }; + +private: int port_preview = -1; HashMap<int, bool> connected_input_ports; @@ -270,19 +301,6 @@ protected: static void _bind_methods(); public: - enum PortType { - PORT_TYPE_SCALAR, - PORT_TYPE_SCALAR_INT, - PORT_TYPE_SCALAR_UINT, - PORT_TYPE_VECTOR_2D, - PORT_TYPE_VECTOR_3D, - PORT_TYPE_VECTOR_4D, - PORT_TYPE_BOOLEAN, - PORT_TYPE_TRANSFORM, - PORT_TYPE_SAMPLER, - PORT_TYPE_MAX, - }; - bool is_simple_decl() const; virtual String get_caption() const = 0; @@ -348,6 +366,8 @@ public: virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const; + virtual Category get_category() const; + VisualShaderNode(); }; @@ -507,6 +527,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_INPUT; } + VisualShaderNodeInput(); }; @@ -546,6 +568,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_OUTPUT; } + VisualShaderNodeOutput(); }; @@ -589,6 +613,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const override; + virtual Category get_category() const override { return CATEGORY_INPUT; } + VisualShaderNodeParameter(); }; @@ -661,6 +687,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_INPUT; } + VisualShaderNodeParameterRef(); }; @@ -713,6 +741,8 @@ public: void set_description(const String &p_description); String get_description() const; + virtual Category get_category() const override { return CATEGORY_SPECIAL; } + VisualShaderNodeComment(); }; @@ -781,6 +811,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_SPECIAL; } + VisualShaderNodeGroupBase(); }; @@ -887,6 +919,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_OUTPUT; } + VisualShaderNodeVaryingSetter(); }; @@ -907,6 +941,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_INPUT; } + VisualShaderNodeVaryingGetter(); }; diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h index 67e2c4633d..05c8fbd16c 100644 --- a/scene/resources/visual_shader_nodes.h +++ b/scene/resources/visual_shader_nodes.h @@ -76,6 +76,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_VECTOR; } + VisualShaderNodeVectorBase(); }; @@ -101,6 +103,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override = 0; + virtual Category get_category() const override { return CATEGORY_INPUT; } + VisualShaderNodeConstant(); }; @@ -437,6 +441,8 @@ public: virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeTexture(); }; @@ -473,6 +479,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; virtual bool is_use_prop_slots() const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeCurveTexture(); }; @@ -543,6 +551,8 @@ public: virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeSample3D(); }; @@ -671,8 +681,11 @@ public: virtual bool has_output_port_preview(int p_port) const override; virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override; + virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeLinearSceneDepth(); }; @@ -695,6 +708,8 @@ public: virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeWorldPositionFromDepth(); }; @@ -717,6 +732,8 @@ public: virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeScreenNormalWorldSpace(); }; @@ -765,6 +782,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_SCALAR; } + VisualShaderNodeFloatOp(); }; @@ -957,6 +976,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_COLOR; } + VisualShaderNodeColorOp(); }; @@ -1006,6 +1027,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_TRANSFORM; } + VisualShaderNodeTransformOp(); }; @@ -1050,6 +1073,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_TRANSFORM; } + VisualShaderNodeTransformVecMult(); }; @@ -1122,6 +1147,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_SCALAR; } + VisualShaderNodeFloatFunc(); }; @@ -1166,6 +1193,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_SCALAR; } + VisualShaderNodeIntFunc(); }; @@ -1208,6 +1237,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_SCALAR; } + VisualShaderNodeUIntFunc(); }; @@ -1327,6 +1358,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_COLOR; } + VisualShaderNodeColorFunc(); }; @@ -1369,6 +1402,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_TRANSFORM; } + VisualShaderNodeTransformFunc(); }; @@ -1414,6 +1449,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeUVFunc(); }; @@ -1440,6 +1477,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TEXTURES; } + VisualShaderNodeUVPolarCoord(); }; @@ -1620,6 +1659,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_UTILITY; } + VisualShaderNodeDerivativeFunc(); }; @@ -1669,6 +1710,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TRANSFORM; } + VisualShaderNodeOuterProduct(); }; @@ -1714,6 +1757,14 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { + if (op_type == OP_TYPE_SCALAR) { + return CATEGORY_SCALAR; + } else { + return CATEGORY_VECTOR; + } + } + VisualShaderNodeStep(); }; @@ -1761,6 +1812,14 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { + if (op_type == OP_TYPE_SCALAR) { + return CATEGORY_SCALAR; + } else { + return CATEGORY_VECTOR; + } + } + VisualShaderNodeSmoothStep(); }; @@ -1852,6 +1911,14 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { + if (op_type == OP_TYPE_SCALAR) { + return CATEGORY_SCALAR; + } else { + return CATEGORY_VECTOR; + } + } + VisualShaderNodeMix(); }; @@ -1898,6 +1965,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TRANSFORM; } + VisualShaderNodeTransformCompose(); }; @@ -1921,6 +1990,8 @@ public: virtual void set_op_type(OpType p_op_type) override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_VECTOR; } + VisualShaderNodeVectorDecompose(); }; @@ -1942,6 +2013,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_TRANSFORM; } + VisualShaderNodeTransformDecompose(); }; @@ -2584,6 +2657,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_CONDITIONAL; } + VisualShaderNodeIf(); }; @@ -2630,6 +2705,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_CONDITIONAL; } + VisualShaderNodeSwitch(); }; @@ -2698,6 +2775,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_CONDITIONAL; } + VisualShaderNodeIs(); }; @@ -2772,6 +2851,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const override; + virtual Category get_category() const override { return CATEGORY_CONDITIONAL; } + VisualShaderNodeCompare(); }; @@ -2815,6 +2896,14 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { + if (op_type == OP_TYPE_SCALAR) { + return CATEGORY_SCALAR; + } else { + return CATEGORY_VECTOR; + } + } + VisualShaderNodeMultiplyAdd(); }; @@ -2862,6 +2951,8 @@ public: virtual Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_UTILITY; } + VisualShaderNodeBillboard(); }; @@ -2888,6 +2979,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_UTILITY; } + VisualShaderNodeDistanceFade(); }; @@ -2909,6 +3002,8 @@ public: virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_UTILITY; } + VisualShaderNodeProximityFade(); }; @@ -2929,6 +3024,8 @@ public: virtual String generate_global_per_node(Shader::Mode p_mode, int p_id) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_UTILITY; } + VisualShaderNodeRandomRange(); }; @@ -2948,6 +3045,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_UTILITY; } + VisualShaderNodeRemap(); }; @@ -2968,6 +3067,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_UTILITY; } + VisualShaderNodeRotationByAxis(); }; diff --git a/scene/resources/visual_shader_particle_nodes.h b/scene/resources/visual_shader_particle_nodes.h index 652b5dff03..23d06d4b7c 100644 --- a/scene/resources/visual_shader_particle_nodes.h +++ b/scene/resources/visual_shader_particle_nodes.h @@ -57,6 +57,8 @@ public: virtual HashMap<StringName, String> get_editable_properties_names() const override; bool is_show_prop_names() const override; + virtual Category get_category() const override { return CATEGORY_PARTICLE; } + VisualShaderNodeParticleEmitter(); }; @@ -73,6 +75,8 @@ public: virtual String generate_global_per_node(Shader::Mode p_mode, int p_id) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_PARTICLE; } + VisualShaderNodeParticleSphereEmitter(); }; @@ -90,6 +94,8 @@ public: virtual String generate_global_per_node(Shader::Mode p_mode, int p_id) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_PARTICLE; } + VisualShaderNodeParticleBoxEmitter(); }; @@ -106,6 +112,8 @@ public: virtual String generate_global_per_node(Shader::Mode p_mode, int p_id) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_PARTICLE; } + VisualShaderNodeParticleRingEmitter(); }; @@ -158,6 +166,8 @@ public: HashMap<StringName, String> get_editable_properties_names() const override; Vector<VisualShader::DefaultTextureParam> get_default_texture_parameters(VisualShader::Type p_type, int p_id) const override; + virtual Category get_category() const override { return CATEGORY_PARTICLE; } + VisualShaderNodeParticleMeshEmitter(); }; @@ -187,6 +197,8 @@ public: bool is_degrees_mode() const; Vector<StringName> get_editable_properties() const override; + virtual Category get_category() const override { return CATEGORY_PARTICLE; } + VisualShaderNodeParticleMultiplyByAxisAngle(); }; @@ -207,6 +219,8 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_PARTICLE; } + VisualShaderNodeParticleConeVelocity(); }; @@ -248,6 +262,8 @@ public: void set_op_type(OpType p_type); OpType get_op_type() const; + virtual Category get_category() const override { return CATEGORY_PARTICLE; } + VisualShaderNodeParticleRandomness(); }; @@ -290,6 +306,8 @@ public: void set_mode(Mode p_mode); Mode get_mode() const; + virtual Category get_category() const override { return CATEGORY_PARTICLE; } + VisualShaderNodeParticleAccelerator(); }; @@ -352,6 +370,8 @@ public: virtual bool is_input_port_default(int p_port, Shader::Mode p_mode) const override; virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + virtual Category get_category() const override { return CATEGORY_PARTICLE; } + VisualShaderNodeParticleEmit(); }; |