diff options
Diffstat (limited to 'modules')
22 files changed, 290 insertions, 273 deletions
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index bfa0b6bb9a..243c23342e 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -597,15 +597,14 @@ bool CSGShape3D::is_calculating_tangents() const { return calculate_tangents; } -void CSGShape3D::_validate_property(PropertyInfo &property) const { - bool is_collision_prefixed = property.name.begins_with("collision_"); - if ((is_collision_prefixed || property.name.begins_with("use_collision")) && is_inside_tree() && !is_root_shape()) { +void CSGShape3D::_validate_property(PropertyInfo &p_property) const { + bool is_collision_prefixed = p_property.name.begins_with("collision_"); + if ((is_collision_prefixed || p_property.name.begins_with("use_collision")) && is_inside_tree() && !is_root_shape()) { //hide collision if not root - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } else if (is_collision_prefixed && !bool(get("use_collision"))) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } - GeometryInstance3D::_validate_property(property); } Array CSGShape3D::get_meshes() const { @@ -2075,18 +2074,16 @@ void CSGPolygon3D::_notification(int p_what) { } } -void CSGPolygon3D::_validate_property(PropertyInfo &property) const { - if (property.name.begins_with("spin") && mode != MODE_SPIN) { - property.usage = PROPERTY_USAGE_NONE; +void CSGPolygon3D::_validate_property(PropertyInfo &p_property) const { + if (p_property.name.begins_with("spin") && mode != MODE_SPIN) { + p_property.usage = PROPERTY_USAGE_NONE; } - if (property.name.begins_with("path") && mode != MODE_PATH) { - property.usage = PROPERTY_USAGE_NONE; + if (p_property.name.begins_with("path") && mode != MODE_PATH) { + p_property.usage = PROPERTY_USAGE_NONE; } - if (property.name == "depth" && mode != MODE_DEPTH) { - property.usage = PROPERTY_USAGE_NONE; + if (p_property.name == "depth" && mode != MODE_DEPTH) { + p_property.usage = PROPERTY_USAGE_NONE; } - - CSGShape3D::_validate_property(property); } void CSGPolygon3D::_path_changed() { diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index 65658ce68b..7db5477b10 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -118,7 +118,7 @@ protected: friend class CSGCombiner3D; CSGBrush *_get_brush(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; public: Array get_meshes() const; @@ -387,7 +387,7 @@ private: protected: static void _bind_methods(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; void _notification(int p_what); public: diff --git a/modules/csg/editor/csg_gizmos.cpp b/modules/csg/editor/csg_gizmos.cpp index 6442ff71fc..ba9b96db74 100644 --- a/modules/csg/editor/csg_gizmos.cpp +++ b/modules/csg/editor/csg_gizmos.cpp @@ -32,7 +32,9 @@ #ifdef TOOLS_ENABLED +#include "editor/editor_node.h" #include "editor/editor_settings.h" +#include "editor/editor_undo_redo_manager.h" #include "editor/plugins/node_3d_editor_plugin.h" #include "scene/3d/camera_3d.h" @@ -215,7 +217,7 @@ void CSGShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int return; } - UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo(); + Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo(); ur->create_action(TTR("Change Sphere Shape Radius")); ur->add_do_method(s, "set_radius", s->get_radius()); ur->add_undo_method(s, "set_radius", p_restore); @@ -229,7 +231,7 @@ void CSGShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int return; } - UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo(); + Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo(); ur->create_action(TTR("Change Box Shape Size")); ur->add_do_method(s, "set_size", s->get_size()); ur->add_undo_method(s, "set_size", p_restore); @@ -247,7 +249,7 @@ void CSGShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int return; } - UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo(); + Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo(); if (p_id == 0) { ur->create_action(TTR("Change Cylinder Radius")); ur->add_do_method(s, "set_radius", s->get_radius()); @@ -272,7 +274,7 @@ void CSGShape3DGizmoPlugin::commit_handle(const EditorNode3DGizmo *p_gizmo, int return; } - UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo(); + Ref<EditorUndoRedoManager> &ur = EditorNode::get_undo_redo(); if (p_id == 0) { ur->create_action(TTR("Change Torus Inner Radius")); ur->add_do_method(s, "set_inner_radius", s->get_inner_radius()); diff --git a/modules/gltf/doc_classes/GLTFCamera.xml b/modules/gltf/doc_classes/GLTFCamera.xml index 9b9eff6141..b90abd105d 100644 --- a/modules/gltf/doc_classes/GLTFCamera.xml +++ b/modules/gltf/doc_classes/GLTFCamera.xml @@ -1,19 +1,30 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="GLTFCamera" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> <brief_description> + Represents a GLTF camera. </brief_description> <description> + Represents a camera as defined by the base GLTF spec. </description> <tutorials> + <link title="GLTF camera detailed specification">https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-camera</link> + <link title="GLTF camera spec and example file">https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_015_SimpleCameras.md</link> </tutorials> <members> <member name="depth_far" type="float" setter="set_depth_far" getter="get_depth_far" default="4000.0"> + The distance to the far culling boundary for this camera relative to its local Z axis, in meters. This maps to GLTF's [code]zfar[/code] property. </member> <member name="depth_near" type="float" setter="set_depth_near" getter="get_depth_near" default="0.05"> + The distance to the near culling boundary for this camera relative to its local Z axis, in meters. This maps to GLTF's [code]znear[/code] property. </member> - <member name="fov_size" type="float" setter="set_fov_size" getter="get_fov_size" default="75.0"> + <member name="fov" type="float" setter="set_fov" getter="get_fov" default="1.309"> + The FOV of the camera. This class and GLTF define the camera FOV in radians, while Godot uses degrees. This maps to GLTF's [code]yfov[/code] property. This value is only used for perspective cameras, when [member perspective] is true. </member> <member name="perspective" type="bool" setter="set_perspective" getter="get_perspective" default="true"> + Whether or not the camera is in perspective mode. If false, the camera is in orthographic/orthogonal mode. This maps to GLTF's camera [code]type[/code] property. See [member Camera3D.projection] and the GLTF spec for more information. + </member> + <member name="size_mag" type="float" setter="set_size_mag" getter="get_size_mag" default="0.5"> + The size of the camera. This class and GLTF define the camera size magnitude as a radius in meters, while Godot defines it as a diameter in meters. This maps to GLTF's [code]ymag[/code] property. This value is only used for orthographic/orthogonal cameras, when [member perspective] is false. </member> </members> </class> diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 6a6de40fbb..b913a771e1 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -50,7 +50,6 @@ #include "core/version.h" #include "drivers/png/png_driver_common.h" #include "scene/2d/node_2d.h" -#include "scene/3d/camera_3d.h" #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/multimesh_instance_3d.h" #include "scene/3d/node_3d.h" @@ -4582,22 +4581,21 @@ Error GLTFDocument::_serialize_cameras(Ref<GLTFState> state) { Ref<GLTFCamera> camera = state->cameras[i]; - if (camera->get_perspective() == false) { - Dictionary og; - og["ymag"] = Math::deg2rad(camera->get_fov_size()); - og["xmag"] = Math::deg2rad(camera->get_fov_size()); - og["zfar"] = camera->get_depth_far(); - og["znear"] = camera->get_depth_near(); - d["orthographic"] = og; - d["type"] = "orthographic"; - } else if (camera->get_perspective()) { - Dictionary ppt; - // GLTF spec is in radians, Godot's camera is in degrees. - ppt["yfov"] = Math::deg2rad(camera->get_fov_size()); - ppt["zfar"] = camera->get_depth_far(); - ppt["znear"] = camera->get_depth_near(); - d["perspective"] = ppt; + if (camera->get_perspective()) { + Dictionary persp; + persp["yfov"] = camera->get_fov(); + persp["zfar"] = camera->get_depth_far(); + persp["znear"] = camera->get_depth_near(); + d["perspective"] = persp; d["type"] = "perspective"; + } else { + Dictionary ortho; + ortho["ymag"] = camera->get_size_mag(); + ortho["xmag"] = camera->get_size_mag(); + ortho["zfar"] = camera->get_depth_far(); + ortho["znear"] = camera->get_depth_near(); + d["orthographic"] = ortho; + d["type"] = "orthographic"; } cameras[i] = d; } @@ -4680,27 +4678,23 @@ Error GLTFDocument::_parse_cameras(Ref<GLTFState> state) { camera.instantiate(); ERR_FAIL_COND_V(!d.has("type"), ERR_PARSE_ERROR); const String &type = d["type"]; - if (type == "orthographic") { - camera->set_perspective(false); - if (d.has("orthographic")) { - const Dictionary &og = d["orthographic"]; - // GLTF spec is in radians, Godot's camera is in degrees. - camera->set_fov_size(Math::rad2deg(real_t(og["ymag"]))); - camera->set_depth_far(og["zfar"]); - camera->set_depth_near(og["znear"]); - } else { - camera->set_fov_size(10); - } - } else if (type == "perspective") { + if (type == "perspective") { camera->set_perspective(true); if (d.has("perspective")) { - const Dictionary &ppt = d["perspective"]; - // GLTF spec is in radians, Godot's camera is in degrees. - camera->set_fov_size(Math::rad2deg(real_t(ppt["yfov"]))); - camera->set_depth_far(ppt["zfar"]); - camera->set_depth_near(ppt["znear"]); - } else { - camera->set_fov_size(10); + const Dictionary &persp = d["perspective"]; + camera->set_fov(persp["yfov"]); + if (persp.has("zfar")) { + camera->set_depth_far(persp["zfar"]); + } + camera->set_depth_near(persp["znear"]); + } + } else if (type == "orthographic") { + camera->set_perspective(false); + if (d.has("orthographic")) { + const Dictionary &ortho = d["orthographic"]; + camera->set_size_mag(ortho["ymag"]); + camera->set_depth_far(ortho["zfar"]); + camera->set_depth_near(ortho["znear"]); } } else { ERR_FAIL_V_MSG(ERR_PARSE_ERROR, "Camera3D should be in 'orthographic' or 'perspective'"); @@ -5204,12 +5198,13 @@ Camera3D *GLTFDocument::_generate_camera(Ref<GLTFState> state, const GLTFNodeInd print_verbose("glTF: Creating camera for: " + gltf_node->get_name()); Ref<GLTFCamera> c = state->cameras[gltf_node->camera]; - if (c->get_perspective()) { - camera->set_perspective(c->get_fov_size(), c->get_depth_near(), c->get_depth_far()); - } else { - camera->set_orthogonal(c->get_fov_size(), c->get_depth_near(), c->get_depth_far()); - } - + camera->set_projection(c->get_perspective() ? Camera3D::PROJECTION_PERSPECTIVE : Camera3D::PROJECTION_ORTHOGONAL); + // GLTF spec (yfov) is in radians, Godot's camera (fov) is in degrees. + camera->set_fov(Math::rad2deg(c->get_fov())); + // GLTF spec (xmag and ymag) is a radius in meters, Godot's camera (size) is a diameter in meters. + camera->set_size(c->get_size_mag() * 2.0f); + camera->set_near(c->get_depth_near()); + camera->set_far(c->get_depth_far()); return camera; } @@ -5218,11 +5213,11 @@ GLTFCameraIndex GLTFDocument::_convert_camera(Ref<GLTFState> state, Camera3D *p_ Ref<GLTFCamera> c; c.instantiate(); - - if (p_camera->get_projection() == Camera3D::ProjectionType::PROJECTION_PERSPECTIVE) { - c->set_perspective(true); - } - c->set_fov_size(p_camera->get_fov()); + c->set_perspective(p_camera->get_projection() == Camera3D::ProjectionType::PROJECTION_PERSPECTIVE); + // GLTF spec (yfov) is in radians, Godot's camera (fov) is in degrees. + c->set_fov(Math::deg2rad(p_camera->get_fov())); + // GLTF spec (xmag and ymag) is a radius in meters, Godot's camera (size) is a diameter in meters. + c->set_size_mag(p_camera->get_size() * 0.5f); c->set_depth_far(p_camera->get_far()); c->set_depth_near(p_camera->get_near()); GLTFCameraIndex camera_index = state->cameras.size(); diff --git a/modules/gltf/structures/gltf_camera.cpp b/modules/gltf/structures/gltf_camera.cpp index f3ea6a1c4c..c492913ea7 100644 --- a/modules/gltf/structures/gltf_camera.cpp +++ b/modules/gltf/structures/gltf_camera.cpp @@ -33,15 +33,18 @@ void GLTFCamera::_bind_methods() { ClassDB::bind_method(D_METHOD("get_perspective"), &GLTFCamera::get_perspective); ClassDB::bind_method(D_METHOD("set_perspective", "perspective"), &GLTFCamera::set_perspective); - ClassDB::bind_method(D_METHOD("get_fov_size"), &GLTFCamera::get_fov_size); - ClassDB::bind_method(D_METHOD("set_fov_size", "fov_size"), &GLTFCamera::set_fov_size); + ClassDB::bind_method(D_METHOD("get_fov"), &GLTFCamera::get_fov); + ClassDB::bind_method(D_METHOD("set_fov", "fov"), &GLTFCamera::set_fov); + ClassDB::bind_method(D_METHOD("get_size_mag"), &GLTFCamera::get_size_mag); + ClassDB::bind_method(D_METHOD("set_size_mag", "size_mag"), &GLTFCamera::set_size_mag); ClassDB::bind_method(D_METHOD("get_depth_far"), &GLTFCamera::get_depth_far); ClassDB::bind_method(D_METHOD("set_depth_far", "zdepth_far"), &GLTFCamera::set_depth_far); ClassDB::bind_method(D_METHOD("get_depth_near"), &GLTFCamera::get_depth_near); ClassDB::bind_method(D_METHOD("set_depth_near", "zdepth_near"), &GLTFCamera::set_depth_near); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "perspective"), "set_perspective", "get_perspective"); // bool - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fov_size"), "set_fov_size", "get_fov_size"); // float - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "depth_far"), "set_depth_far", "get_depth_far"); // float - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "depth_near"), "set_depth_near", "get_depth_near"); // float + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "perspective"), "set_perspective", "get_perspective"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fov"), "set_fov", "get_fov"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "size_mag"), "set_size_mag", "get_size_mag"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "depth_far"), "set_depth_far", "get_depth_far"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "depth_near"), "set_depth_near", "get_depth_near"); } diff --git a/modules/gltf/structures/gltf_camera.h b/modules/gltf/structures/gltf_camera.h index b7df741825..714ec21693 100644 --- a/modules/gltf/structures/gltf_camera.h +++ b/modules/gltf/structures/gltf_camera.h @@ -32,15 +32,22 @@ #define GLTF_CAMERA_H #include "core/io/resource.h" +#include "scene/3d/camera_3d.h" + +// Reference and test file: +// https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_015_SimpleCameras.md class GLTFCamera : public Resource { GDCLASS(GLTFCamera, Resource); private: + // GLTF has no default camera values, they should always be specified in + // the GLTF file. Here we default to Godot's default camera settings. bool perspective = true; - float fov_size = 75.0; - float depth_far = 4000.0; - float depth_near = 0.05; + real_t fov = Math::deg2rad(75.0); + real_t size_mag = 0.5; + real_t depth_far = 4000.0; + real_t depth_near = 0.05; protected: static void _bind_methods(); @@ -48,12 +55,14 @@ protected: public: bool get_perspective() const { return perspective; } void set_perspective(bool p_val) { perspective = p_val; } - float get_fov_size() const { return fov_size; } - void set_fov_size(float p_val) { fov_size = p_val; } - float get_depth_far() const { return depth_far; } - void set_depth_far(float p_val) { depth_far = p_val; } - float get_depth_near() const { return depth_near; } - void set_depth_near(float p_val) { depth_near = p_val; } + real_t get_fov() const { return fov; } + void set_fov(real_t p_val) { fov = p_val; } + real_t get_size_mag() const { return size_mag; } + void set_size_mag(real_t p_val) { size_mag = p_val; } + real_t get_depth_far() const { return depth_far; } + void set_depth_far(real_t p_val) { depth_far = p_val; } + real_t get_depth_near() const { return depth_near; } + void set_depth_near(real_t p_val) { depth_near = p_val; } }; #endif // GLTF_CAMERA_H diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index 7471bae093..17f9832096 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -37,6 +37,7 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "editor/editor_undo_redo_manager.h" #include "editor/plugins/node_3d_editor_plugin.h" #include "scene/3d/camera_3d.h" #include "scene/main/window.h" diff --git a/modules/gridmap/editor/grid_map_editor_plugin.h b/modules/gridmap/editor/grid_map_editor_plugin.h index 3b29397502..a64dc4a80b 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.h +++ b/modules/gridmap/editor/grid_map_editor_plugin.h @@ -39,6 +39,7 @@ #include "scene/gui/slider.h" #include "scene/gui/spin_box.h" +class EditorUndoRedoManager; class Node3DEditorPlugin; class GridMapEditor : public VBoxContainer { @@ -62,7 +63,7 @@ class GridMapEditor : public VBoxContainer { DISPLAY_LIST }; - UndoRedo *undo_redo = nullptr; + Ref<EditorUndoRedoManager> undo_redo; InputAction input_action = INPUT_NONE; Panel *panel = nullptr; MenuButton *options = nullptr; diff --git a/modules/multiplayer/editor/replication_editor_plugin.cpp b/modules/multiplayer/editor/replication_editor_plugin.cpp index 50f1434ad8..f045018f25 100644 --- a/modules/multiplayer/editor/replication_editor_plugin.cpp +++ b/modules/multiplayer/editor/replication_editor_plugin.cpp @@ -33,6 +33,7 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "editor/editor_undo_redo_manager.h" #include "editor/inspector_dock.h" #include "editor/scene_tree_editor.h" #include "modules/multiplayer/multiplayer_synchronizer.h" @@ -139,7 +140,7 @@ void ReplicationEditor::_add_sync_property(String p_path) { return; } - UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); + Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_singleton()->get_undo_redo(); undo_redo->create_action(TTR("Add property to synchronizer")); if (config.is_null()) { @@ -354,7 +355,7 @@ void ReplicationEditor::_tree_item_edited() { int column = tree->get_edited_column(); ERR_FAIL_COND(column < 1 || column > 2); const NodePath prop = ti->get_metadata(0); - UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); + Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo(); bool value = ti->is_checked(column); String method; if (column == 1) { @@ -394,7 +395,7 @@ void ReplicationEditor::_dialog_closed(bool p_confirmed) { int idx = config->property_get_index(prop); bool spawn = config->property_get_spawn(prop); bool sync = config->property_get_sync(prop); - UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); + Ref<EditorUndoRedoManager> undo_redo = EditorNode::get_undo_redo(); undo_redo->create_action(TTR("Remove Property")); undo_redo->add_do_method(config.ptr(), "remove_property", prop); undo_redo->add_undo_method(config.ptr(), "add_property", prop, idx); diff --git a/modules/noise/fastnoise_lite.cpp b/modules/noise/fastnoise_lite.cpp index b21e3247d7..06d97838f6 100644 --- a/modules/noise/fastnoise_lite.cpp +++ b/modules/noise/fastnoise_lite.cpp @@ -476,24 +476,24 @@ void FastNoiseLite::_bind_methods() { BIND_ENUM_CONSTANT(DOMAIN_WARP_FRACTAL_INDEPENDENT); } -void FastNoiseLite::_validate_property(PropertyInfo &property) const { - if (property.name.begins_with("cellular") && get_noise_type() != TYPE_CELLULAR) { - property.usage = PROPERTY_USAGE_NO_EDITOR; +void FastNoiseLite::_validate_property(PropertyInfo &p_property) const { + if (p_property.name.begins_with("cellular") && get_noise_type() != TYPE_CELLULAR) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; return; } - if (property.name != "fractal_type" && property.name.begins_with("fractal") && get_fractal_type() == FRACTAL_NONE) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name != "fractal_type" && p_property.name.begins_with("fractal") && get_fractal_type() == FRACTAL_NONE) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; return; } - if (property.name == "fractal_ping_pong_strength" && get_fractal_type() != FRACTAL_PING_PONG) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name == "fractal_ping_pong_strength" && get_fractal_type() != FRACTAL_PING_PONG) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; return; } - if (property.name != "domain_warp_enabled" && property.name.begins_with("domain_warp") && !domain_warp_enabled) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name != "domain_warp_enabled" && p_property.name.begins_with("domain_warp") && !domain_warp_enabled) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; return; } } diff --git a/modules/noise/fastnoise_lite.h b/modules/noise/fastnoise_lite.h index fe8cd7ce6e..50c633b923 100644 --- a/modules/noise/fastnoise_lite.h +++ b/modules/noise/fastnoise_lite.h @@ -92,7 +92,7 @@ public: protected: static void _bind_methods(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; private: _FastNoiseLite _noise; diff --git a/modules/noise/noise_texture.cpp b/modules/noise/noise_texture.cpp index 257a3ee8e6..923b420581 100644 --- a/modules/noise/noise_texture.cpp +++ b/modules/noise/noise_texture.cpp @@ -94,16 +94,16 @@ void NoiseTexture::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "Noise"), "set_noise", "get_noise"); } -void NoiseTexture::_validate_property(PropertyInfo &property) const { - if (property.name == "bump_strength") { +void NoiseTexture::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "bump_strength") { if (!as_normal_map) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } - if (property.name == "seamless_blend_skirt") { + if (p_property.name == "seamless_blend_skirt") { if (!seamless) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } } diff --git a/modules/noise/noise_texture.h b/modules/noise/noise_texture.h index 6c088562a1..83fbcc2d10 100644 --- a/modules/noise/noise_texture.h +++ b/modules/noise/noise_texture.h @@ -75,7 +75,7 @@ private: protected: static void _bind_methods(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; public: void set_noise(Ref<Noise> p_noise); diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp index 2c7d23a3c4..a5eb09f786 100644 --- a/modules/visual_script/editor/visual_script_editor.cpp +++ b/modules/visual_script/editor/visual_script_editor.cpp @@ -43,6 +43,7 @@ #include "editor/editor_resource_preview.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "editor/editor_undo_redo_manager.h" #include "scene/gui/check_button.h" #include "scene/gui/graph_edit.h" #include "scene/gui/separator.h" @@ -74,7 +75,7 @@ class VisualScriptEditorSignalEdit : public Object { StringName sig; public: - UndoRedo *undo_redo; + Ref<EditorUndoRedoManager> undo_redo; Ref<VisualScript> script; protected: @@ -197,8 +198,6 @@ public: sig = p_sig; notify_property_list_changed(); } - - VisualScriptEditorSignalEdit() { undo_redo = nullptr; } }; class VisualScriptEditorVariableEdit : public Object { @@ -207,7 +206,7 @@ class VisualScriptEditorVariableEdit : public Object { StringName var; public: - UndoRedo *undo_redo; + Ref<EditorUndoRedoManager> undo_redo; Ref<VisualScript> script; protected: @@ -355,8 +354,6 @@ public: var = p_var; notify_property_list_changed(); } - - VisualScriptEditorVariableEdit() { undo_redo = nullptr; } }; static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { diff --git a/modules/visual_script/editor/visual_script_editor.h b/modules/visual_script/editor/visual_script_editor.h index 6b337e52f6..306f71ecf8 100644 --- a/modules/visual_script/editor/visual_script_editor.h +++ b/modules/visual_script/editor/visual_script_editor.h @@ -38,6 +38,7 @@ class GraphEdit; +class EditorUndoRedoManager; class VisualScriptEditorSignalEdit; class VisualScriptEditorVariableEdit; @@ -135,8 +136,7 @@ class VisualScriptEditor : public ScriptEditorBase { EditorProperty *default_property_editor = nullptr; Ref<VisualScriptEditedProperty> edited_default_property_holder; - UndoRedo *undo_redo = nullptr; - + Ref<EditorUndoRedoManager> undo_redo; Tree *members = nullptr; AcceptDialog *function_name_edit = nullptr; LineEdit *function_name_box = nullptr; diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 0750713fe3..e79d3bae8a 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -512,32 +512,32 @@ Dictionary VisualScriptFunctionCall::_get_argument_cache() const { return method_cache; } -void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const { - if (property.name == "base_type") { +void VisualScriptFunctionCall::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "base_type") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } - if (property.name == "base_script") { + if (p_property.name == "base_script") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "basic_type") { + if (p_property.name == "basic_type") { if (call_mode != CALL_MODE_BASIC_TYPE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "singleton") { + if (p_property.name == "singleton") { if (call_mode != CALL_MODE_SINGLETON) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } else { List<Engine::Singleton> names; Engine::get_singleton()->get_singletons(&names); - property.hint = PROPERTY_HINT_ENUM; + p_property.hint = PROPERTY_HINT_ENUM; String sl; for (const Engine::Singleton &E : names) { if (!sl.is_empty()) { @@ -545,41 +545,41 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const } sl += E.name; } - property.hint_string = sl; + p_property.hint_string = sl; } } - if (property.name == "node_path") { + if (p_property.name == "node_path") { if (call_mode != CALL_MODE_NODE_PATH) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to long string + p_property.hint_string = bnode->get_path(); //convert to long string } } } - if (property.name == "function") { + if (p_property.name == "function") { if (call_mode == CALL_MODE_BASIC_TYPE) { - property.hint = PROPERTY_HINT_METHOD_OF_VARIANT_TYPE; - property.hint_string = Variant::get_type_name(basic_type); + p_property.hint = PROPERTY_HINT_METHOD_OF_VARIANT_TYPE; + p_property.hint_string = Variant::get_type_name(basic_type); } else if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid()) { - property.hint = PROPERTY_HINT_METHOD_OF_SCRIPT; - property.hint_string = itos(get_visual_script()->get_instance_id()); + p_property.hint = PROPERTY_HINT_METHOD_OF_SCRIPT; + p_property.hint_string = itos(get_visual_script()->get_instance_id()); } else if (call_mode == CALL_MODE_SINGLETON) { Object *obj = Engine::get_singleton()->get_singleton_object(singleton); if (obj) { - property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; - property.hint_string = itos(obj->get_instance_id()); + p_property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; + p_property.hint_string = itos(obj->get_instance_id()); } else { - property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; - property.hint_string = base_type; //should be cached + p_property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; + p_property.hint_string = base_type; //should be cached } } else if (call_mode == CALL_MODE_INSTANCE) { - property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; - property.hint_string = base_type; + p_property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; + p_property.hint_string = base_type; if (!base_script.is_empty()) { if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) { @@ -589,8 +589,8 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const if (ResourceCache::has(base_script)) { Ref<Script> script = ResourceCache::get_ref(base_script); if (script.is_valid()) { - property.hint = PROPERTY_HINT_METHOD_OF_SCRIPT; - property.hint_string = itos(script->get_instance_id()); + p_property.hint = PROPERTY_HINT_METHOD_OF_SCRIPT; + p_property.hint_string = itos(script->get_instance_id()); } } } @@ -598,17 +598,17 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const } else if (call_mode == CALL_MODE_NODE_PATH) { Node *node = _get_base_node(); if (node) { - property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; - property.hint_string = itos(node->get_instance_id()); + p_property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; + p_property.hint_string = itos(node->get_instance_id()); } else { - property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; - property.hint_string = get_base_type(); + p_property.hint = PROPERTY_HINT_METHOD_OF_BASE_TYPE; + p_property.hint_string = get_base_type(); } } } - if (property.name == "use_default_args") { - property.hint = PROPERTY_HINT_RANGE; + if (p_property.name == "use_default_args") { + p_property.hint = PROPERTY_HINT_RANGE; int mc = 0; @@ -622,15 +622,15 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const } if (mc == 0) { - property.usage = PROPERTY_USAGE_NONE; //do not show + p_property.usage = PROPERTY_USAGE_NONE; //do not show } else { - property.hint_string = "0," + itos(mc) + ",1"; + p_property.hint_string = "0," + itos(mc) + ",1"; } } - if (property.name == "rpc_call_mode") { + if (p_property.name == "rpc_call_mode") { if (call_mode == CALL_MODE_BASIC_TYPE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } } @@ -1290,47 +1290,47 @@ VisualScriptPropertySet::AssignOp VisualScriptPropertySet::get_assign_op() const return assign_op; } -void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { - if (property.name == "base_type") { +void VisualScriptPropertySet::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "base_type") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } - if (property.name == "base_script") { + if (p_property.name == "base_script") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "basic_type") { + if (p_property.name == "basic_type") { if (call_mode != CALL_MODE_BASIC_TYPE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "node_path") { + if (p_property.name == "node_path") { if (call_mode != CALL_MODE_NODE_PATH) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to long string + p_property.hint_string = bnode->get_path(); //convert to long string } } } - if (property.name == "property") { + if (p_property.name == "property") { if (call_mode == CALL_MODE_BASIC_TYPE) { - property.hint = PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE; - property.hint_string = Variant::get_type_name(basic_type); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE; + p_property.hint_string = Variant::get_type_name(basic_type); } else if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid()) { - property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(get_visual_script()->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; + p_property.hint_string = itos(get_visual_script()->get_instance_id()); } else if (call_mode == CALL_MODE_INSTANCE) { - property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; - property.hint_string = base_type; + p_property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; + p_property.hint_string = base_type; if (!base_script.is_empty()) { if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) { @@ -1340,8 +1340,8 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { if (ResourceCache::has(base_script)) { Ref<Script> script = ResourceCache::get_ref(base_script); if (script.is_valid()) { - property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(script->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; + p_property.hint_string = itos(script->get_instance_id()); } } } @@ -1349,16 +1349,16 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { } else if (call_mode == CALL_MODE_NODE_PATH) { Node *node = _get_base_node(); if (node) { - property.hint = PROPERTY_HINT_PROPERTY_OF_INSTANCE; - property.hint_string = itos(node->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_INSTANCE; + p_property.hint_string = itos(node->get_instance_id()); } else { - property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; - property.hint_string = get_base_type(); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; + p_property.hint_string = get_base_type(); } } } - if (property.name == "index") { + if (p_property.name == "index") { Callable::CallError ce; Variant v; Variant::construct(type_cache.type, v, nullptr, 0, ce); @@ -1369,11 +1369,11 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const { options += "," + E.name; } - property.hint = PROPERTY_HINT_ENUM; - property.hint_string = options; - property.type = Variant::STRING; + p_property.hint = PROPERTY_HINT_ENUM; + p_property.hint_string = options; + p_property.type = Variant::STRING; if (options.is_empty()) { - property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index + p_property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index } } } @@ -1996,47 +1996,47 @@ StringName VisualScriptPropertyGet::get_index() const { return index; } -void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const { - if (property.name == "base_type") { +void VisualScriptPropertyGet::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "base_type") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } - if (property.name == "base_script") { + if (p_property.name == "base_script") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "basic_type") { + if (p_property.name == "basic_type") { if (call_mode != CALL_MODE_BASIC_TYPE) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } - if (property.name == "node_path") { + if (p_property.name == "node_path") { if (call_mode != CALL_MODE_NODE_PATH) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to long string + p_property.hint_string = bnode->get_path(); //convert to long string } } } - if (property.name == "property") { + if (p_property.name == "property") { if (call_mode == CALL_MODE_BASIC_TYPE) { - property.hint = PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE; - property.hint_string = Variant::get_type_name(basic_type); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE; + p_property.hint_string = Variant::get_type_name(basic_type); } else if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid()) { - property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(get_visual_script()->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; + p_property.hint_string = itos(get_visual_script()->get_instance_id()); } else if (call_mode == CALL_MODE_INSTANCE) { - property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; - property.hint_string = base_type; + p_property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; + p_property.hint_string = base_type; if (!base_script.is_empty()) { if (!ResourceCache::has(base_script) && ScriptServer::edit_request_func) { @@ -2046,24 +2046,24 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const { if (ResourceCache::has(base_script)) { Ref<Script> script = ResourceCache::get_ref(base_script); if (script.is_valid()) { - property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; - property.hint_string = itos(script->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_SCRIPT; + p_property.hint_string = itos(script->get_instance_id()); } } } } else if (call_mode == CALL_MODE_NODE_PATH) { Node *node = _get_base_node(); if (node) { - property.hint = PROPERTY_HINT_PROPERTY_OF_INSTANCE; - property.hint_string = itos(node->get_instance_id()); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_INSTANCE; + p_property.hint_string = itos(node->get_instance_id()); } else { - property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; - property.hint_string = get_base_type(); + p_property.hint = PROPERTY_HINT_PROPERTY_OF_BASE_TYPE; + p_property.hint_string = get_base_type(); } } } - if (property.name == "index") { + if (p_property.name == "index") { Callable::CallError ce; Variant v; Variant::construct(type_cache, v, nullptr, 0, ce); @@ -2074,11 +2074,11 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const { options += "," + E.name; } - property.hint = PROPERTY_HINT_ENUM; - property.hint_string = options; - property.type = Variant::STRING; + p_property.hint = PROPERTY_HINT_ENUM; + p_property.hint_string = options; + p_property.type = Variant::STRING; if (options.is_empty()) { - property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index + p_property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index } } } @@ -2322,9 +2322,9 @@ StringName VisualScriptEmitSignal::get_signal() const { return name; } -void VisualScriptEmitSignal::_validate_property(PropertyInfo &property) const { - if (property.name == "signal") { - property.hint = PROPERTY_HINT_ENUM; +void VisualScriptEmitSignal::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "signal") { + p_property.hint = PROPERTY_HINT_ENUM; List<StringName> sigs; List<MethodInfo> base_sigs; @@ -2349,7 +2349,7 @@ void VisualScriptEmitSignal::_validate_property(PropertyInfo &property) const { ml += E.name; } - property.hint_string = ml; + p_property.hint_string = ml; } } diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h index 886ed7bc81..70f601307b 100644 --- a/modules/visual_script/visual_script_func_nodes.h +++ b/modules/visual_script/visual_script_func_nodes.h @@ -75,7 +75,7 @@ private: Dictionary _get_argument_cache() const; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -187,7 +187,7 @@ private: void _adjust_input_index(PropertyInfo &pinfo) const; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -275,7 +275,7 @@ private: void _adjust_input_index(PropertyInfo &pinfo) const; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -330,7 +330,7 @@ private: StringName name; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 5907e6a489..f02a79a617 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -1299,8 +1299,8 @@ StringName VisualScriptVariableGet::get_variable() const { return variable; } -void VisualScriptVariableGet::_validate_property(PropertyInfo &property) const { - if (property.name == "var_name" && get_visual_script().is_valid()) { +void VisualScriptVariableGet::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "var_name" && get_visual_script().is_valid()) { Ref<VisualScript> vs = get_visual_script(); List<StringName> vars; vs->get_variable_list(&vars); @@ -1314,8 +1314,8 @@ void VisualScriptVariableGet::_validate_property(PropertyInfo &property) const { vhint += E.operator String(); } - property.hint = PROPERTY_HINT_ENUM; - property.hint_string = vhint; + p_property.hint = PROPERTY_HINT_ENUM; + p_property.hint_string = vhint; } } @@ -1409,8 +1409,8 @@ StringName VisualScriptVariableSet::get_variable() const { return variable; } -void VisualScriptVariableSet::_validate_property(PropertyInfo &property) const { - if (property.name == "var_name" && get_visual_script().is_valid()) { +void VisualScriptVariableSet::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "var_name" && get_visual_script().is_valid()) { Ref<VisualScript> vs = get_visual_script(); List<StringName> vars; vs->get_variable_list(&vars); @@ -1424,8 +1424,8 @@ void VisualScriptVariableSet::_validate_property(PropertyInfo &property) const { vhint += E.operator String(); } - property.hint = PROPERTY_HINT_ENUM; - property.hint_string = vhint; + p_property.hint = PROPERTY_HINT_ENUM; + p_property.hint_string = vhint; } } @@ -1533,11 +1533,11 @@ Variant VisualScriptConstant::get_constant_value() const { return value; } -void VisualScriptConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "value") { - property.type = type; +void VisualScriptConstant::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "value") { + p_property.type = type; if (type == Variant::NIL) { - property.usage = PROPERTY_USAGE_NONE; //do not save if nil + p_property.usage = PROPERTY_USAGE_NONE; //do not save if nil } } } @@ -1982,17 +1982,17 @@ VisualScriptNodeInstance *VisualScriptClassConstant::instantiate(VisualScriptIns return instance; } -void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "constant") { +void VisualScriptClassConstant::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "constant") { List<String> constants; ClassDB::get_integer_constant_list(base_type, &constants, true); - property.hint_string = ""; + p_property.hint_string = ""; for (const String &E : constants) { - if (!property.hint_string.is_empty()) { - property.hint_string += ","; + if (!p_property.hint_string.is_empty()) { + p_property.hint_string += ","; } - property.hint_string += E; + p_property.hint_string += E; } } } @@ -2115,21 +2115,21 @@ VisualScriptNodeInstance *VisualScriptBasicTypeConstant::instantiate(VisualScrip return instance; } -void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) const { - if (property.name == "constant") { +void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "constant") { List<StringName> constants; Variant::get_constants_for_type(type, &constants); if (constants.size() == 0) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; return; } - property.hint_string = ""; + p_property.hint_string = ""; for (const StringName &E : constants) { - if (!property.hint_string.is_empty()) { - property.hint_string += ","; + if (!p_property.hint_string.is_empty()) { + p_property.hint_string += ","; } - property.hint_string += String(E); + p_property.hint_string += String(E); } } } @@ -2344,7 +2344,7 @@ VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output return tg; } -void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) const { +void VisualScriptEngineSingleton::_validate_property(PropertyInfo &p_property) const { String cc; List<Engine::Singleton> singletons; @@ -2362,8 +2362,8 @@ void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) con cc += E.name; } - property.hint = PROPERTY_HINT_ENUM; - property.hint_string = cc; + p_property.hint = PROPERTY_HINT_ENUM; + p_property.hint_string = cc; } void VisualScriptEngineSingleton::_bind_methods() { @@ -2525,9 +2525,9 @@ VisualScriptSceneNode::TypeGuess VisualScriptSceneNode::guess_output_type(TypeGu return tg; } -void VisualScriptSceneNode::_validate_property(PropertyInfo &property) const { +void VisualScriptSceneNode::_validate_property(PropertyInfo &p_property) const { #ifdef TOOLS_ENABLED - if (property.name == "node_path") { + if (p_property.name == "node_path") { Ref<Script> script = get_visual_script(); if (!script.is_valid()) { return; @@ -2552,7 +2552,7 @@ void VisualScriptSceneNode::_validate_property(PropertyInfo &property) const { return; } - property.hint_string = script_node->get_path(); + p_property.hint_string = script_node->get_path(); } #endif } @@ -2646,7 +2646,7 @@ VisualScriptSceneTree::TypeGuess VisualScriptSceneTree::guess_output_type(TypeGu return tg; } -void VisualScriptSceneTree::_validate_property(PropertyInfo &property) const { +void VisualScriptSceneTree::_validate_property(PropertyInfo &p_property) const { } void VisualScriptSceneTree::_bind_methods() { @@ -3757,9 +3757,9 @@ VisualScriptNodeInstance *VisualScriptInputAction::instantiate(VisualScriptInsta return instance; } -void VisualScriptInputAction::_validate_property(PropertyInfo &property) const { - if (property.name == "action") { - property.hint = PROPERTY_HINT_ENUM; +void VisualScriptInputAction::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "action") { + p_property.hint = PROPERTY_HINT_ENUM; String actions; List<PropertyInfo> pinfo; @@ -3785,7 +3785,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo &property) const { actions += al[i]; } - property.hint_string = actions; + p_property.hint_string = actions; } } @@ -3935,7 +3935,7 @@ VisualScriptNodeInstance *VisualScriptDeconstruct::instantiate(VisualScriptInsta return instance; } -void VisualScriptDeconstruct::_validate_property(PropertyInfo &property) const { +void VisualScriptDeconstruct::_validate_property(PropertyInfo &p_property) const { } void VisualScriptDeconstruct::_bind_methods() { diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h index 35e3c490cd..72a99b9fd2 100644 --- a/modules/visual_script/visual_script_nodes.h +++ b/modules/visual_script/visual_script_nodes.h @@ -269,7 +269,7 @@ class VisualScriptVariableGet : public VisualScriptNode { StringName variable; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); public: @@ -301,7 +301,7 @@ class VisualScriptVariableSet : public VisualScriptNode { StringName variable; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); public: @@ -334,7 +334,7 @@ class VisualScriptConstant : public VisualScriptNode { Variant value; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); public: @@ -478,7 +478,7 @@ class VisualScriptClassConstant : public VisualScriptNode { protected: static void _bind_methods(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; public: virtual int get_output_sequence_port_count() const override; @@ -514,7 +514,7 @@ class VisualScriptBasicTypeConstant : public VisualScriptNode { protected: static void _bind_methods(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; public: virtual int get_output_sequence_port_count() const override; @@ -598,7 +598,7 @@ class VisualScriptEngineSingleton : public VisualScriptNode { String singleton; protected: - void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -633,7 +633,7 @@ class VisualScriptSceneNode : public VisualScriptNode { NodePath path; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); public: @@ -665,7 +665,7 @@ class VisualScriptSceneTree : public VisualScriptNode { GDCLASS(VisualScriptSceneTree, VisualScriptNode); protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); public: @@ -1010,7 +1010,7 @@ public: Mode mode; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -1058,7 +1058,7 @@ class VisualScriptDeconstruct : public VisualScriptNode { void _set_elem_cache(const Array &p_elements); Array _get_elem_cache() const; - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; protected: static void _bind_methods(); diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp index 96e91a0baf..05dbe102f5 100644 --- a/modules/visual_script/visual_script_yield_nodes.cpp +++ b/modules/visual_script/visual_script_yield_nodes.cpp @@ -171,10 +171,10 @@ double VisualScriptYield::get_wait_time() { return wait_time; } -void VisualScriptYield::_validate_property(PropertyInfo &property) const { - if (property.name == "wait_time") { +void VisualScriptYield::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "wait_time") { if (yield_mode != YIELD_WAIT) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } } } @@ -417,26 +417,26 @@ VisualScriptYieldSignal::CallMode VisualScriptYieldSignal::get_call_mode() const return call_mode; } -void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const { - if (property.name == "base_type") { +void VisualScriptYieldSignal::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "base_type") { if (call_mode != CALL_MODE_INSTANCE) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } - if (property.name == "node_path") { + if (p_property.name == "node_path") { if (call_mode != CALL_MODE_NODE_PATH) { - property.usage = PROPERTY_USAGE_NONE; + p_property.usage = PROPERTY_USAGE_NONE; } else { Node *bnode = _get_base_node(); if (bnode) { - property.hint_string = bnode->get_path(); //convert to long string + p_property.hint_string = bnode->get_path(); //convert to long string } } } - if (property.name == "signal") { - property.hint = PROPERTY_HINT_ENUM; + if (p_property.name == "signal") { + p_property.hint = PROPERTY_HINT_ENUM; List<MethodInfo> methods; @@ -460,7 +460,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const { ml += E; } - property.hint_string = ml; + p_property.hint_string = ml; } } diff --git a/modules/visual_script/visual_script_yield_nodes.h b/modules/visual_script/visual_script_yield_nodes.h index a7bf4e8a78..248f2b6e94 100644 --- a/modules/visual_script/visual_script_yield_nodes.h +++ b/modules/visual_script/visual_script_yield_nodes.h @@ -50,7 +50,7 @@ private: double wait_time; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); @@ -103,7 +103,7 @@ private: StringName _get_base_type() const; protected: - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; static void _bind_methods(); |