diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/arvr_nodes.cpp | 4 | ||||
-rw-r--r-- | scene/3d/arvr_nodes.h | 4 | ||||
-rw-r--r-- | scene/3d/light.cpp | 9 | ||||
-rw-r--r-- | scene/3d/mesh_instance.cpp | 6 | ||||
-rw-r--r-- | scene/3d/mesh_instance.h | 1 | ||||
-rw-r--r-- | scene/3d/path.cpp | 39 | ||||
-rw-r--r-- | scene/3d/path.h | 4 | ||||
-rw-r--r-- | scene/3d/voxel_light_baker.cpp | 2 | ||||
-rw-r--r-- | scene/gui/gradient_edit.cpp | 4 | ||||
-rw-r--r-- | scene/gui/item_list.cpp | 1 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/tabs.cpp | 81 | ||||
-rw-r--r-- | scene/gui/tabs.h | 2 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 1 | ||||
-rw-r--r-- | scene/main/node.cpp | 2 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 3 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 1 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 2 |
18 files changed, 118 insertions, 50 deletions
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index 4bff26a200..2dc500f7ab 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -38,14 +38,14 @@ void ARVRCamera::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - // need to find our ARVROrigin parent and let it know we're it's camera! + // need to find our ARVROrigin parent and let it know we're its camera! ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent()); if (origin != NULL) { origin->set_tracked_camera(this); } }; break; case NOTIFICATION_EXIT_TREE: { - // need to find our ARVROrigin parent and let it know we're no longer it's camera! + // need to find our ARVROrigin parent and let it know we're no longer its camera! ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent()); if (origin != NULL) { origin->clear_tracked_camera_if(this); diff --git a/scene/3d/arvr_nodes.h b/scene/3d/arvr_nodes.h index 67fb658562..d6690676cc 100644 --- a/scene/3d/arvr_nodes.h +++ b/scene/3d/arvr_nodes.h @@ -62,7 +62,7 @@ public: }; /* - ARVRController is a helper node that automatically updates it's position based on tracker data. + ARVRController is a helper node that automatically updates its position based on tracker data. It must be a child node of our ARVROrigin node */ @@ -102,7 +102,7 @@ public: }; /* - ARVRAnchor is a helper node that automatically updates it's position based on anchor data, it represents a real world location. + ARVRAnchor is a helper node that automatically updates its position based on anchor data, it represents a real world location. It must be a child node of our ARVROrigin node */ diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 7e1d60ab8e..11d61315ba 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -163,11 +163,6 @@ void Light::_update_visibility() { if (!is_inside_tree()) return; - // FIXME: Since the call to VS::instance_light_set_enabled was disabled below, - // the whole logic became pointless so editor_ok triggers unused variable warnings. - // Commenting out for now but this should be fixed/reimplemented so that editor_only - // works as expected (GH-17989). - /* bool editor_ok = true; #ifdef TOOLS_ENABLED @@ -184,8 +179,8 @@ void Light::_update_visibility() { } #endif - //VS::get_singleton()->instance_light_set_enabled(get_instance(),is_visible_in_tree() && editor_ok); - */ + VS::get_singleton()->instance_set_visible(get_instance(), is_visible_in_tree() && editor_ok); + _change_notify("geometry/visible"); } diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index 4cbf6f2de3..cf0317cd58 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -253,6 +253,11 @@ void MeshInstance::_notification(int p_what) { } } +int MeshInstance::get_surface_material_count() const { + + return materials.size(); +} + void MeshInstance::set_surface_material(int p_surface, const Ref<Material> &p_material) { ERR_FAIL_INDEX(p_surface, materials.size()); @@ -359,6 +364,7 @@ void MeshInstance::_bind_methods() { ClassDB::bind_method(D_METHOD("set_skeleton_path", "skeleton_path"), &MeshInstance::set_skeleton_path); ClassDB::bind_method(D_METHOD("get_skeleton_path"), &MeshInstance::get_skeleton_path); + ClassDB::bind_method(D_METHOD("get_surface_material_count"), &MeshInstance::get_surface_material_count); ClassDB::bind_method(D_METHOD("set_surface_material", "surface", "material"), &MeshInstance::set_surface_material); ClassDB::bind_method(D_METHOD("get_surface_material", "surface"), &MeshInstance::get_surface_material); diff --git a/scene/3d/mesh_instance.h b/scene/3d/mesh_instance.h index 0dfec538f9..0b5b4b9e7b 100644 --- a/scene/3d/mesh_instance.h +++ b/scene/3d/mesh_instance.h @@ -76,6 +76,7 @@ public: void set_skeleton_path(const NodePath &p_skeleton); NodePath get_skeleton_path(); + int get_surface_material_count() const; void set_surface_material(int p_surface, const Ref<Material> &p_material); Ref<Material> get_surface_material(int p_surface) const; diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index e37efa0e8a..339a434a6e 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -43,6 +43,16 @@ void Path::_curve_changed() { if (is_inside_tree()) { emit_signal("curve_changed"); } + + // update the configuration warnings of all children of type OrientedPathFollows + if (is_inside_tree()) { + for (int i = 0; i < get_child_count(); i++) { + OrientedPathFollow *child = Object::cast_to<OrientedPathFollow>(get_child(i)); + if (child) { + child->update_configuration_warning(); + } + } + } } void Path::set_curve(const Ref<Curve3D> &p_curve) { @@ -207,6 +217,18 @@ void PathFollow::_validate_property(PropertyInfo &property) const { } } +String PathFollow::get_configuration_warning() const { + + if (!is_visible_in_tree() || !is_inside_tree()) + return String(); + + if (!Object::cast_to<Path>(get_parent())) { + return TTR("PathFollow only works when set as a child of a Path node."); + } + + return String(); +} + void PathFollow::_bind_methods() { ClassDB::bind_method(D_METHOD("set_offset", "offset"), &PathFollow::set_offset); @@ -444,6 +466,23 @@ void OrientedPathFollow::_validate_property(PropertyInfo &property) const { } } +String OrientedPathFollow::get_configuration_warning() const { + + if (!is_visible_in_tree() || !is_inside_tree()) + return String(); + + if (!Object::cast_to<Path>(get_parent())) { + return TTR("OrientedPathFollow only works when set as a child of a Path node."); + } else { + Path *path = Object::cast_to<Path>(get_parent()); + if (path->get_curve().is_valid() && !path->get_curve()->is_up_vector_enabled()) { + return TTR("OrientedPathFollow requires up vectors enabled in its parent Path."); + } + } + + return String(); +} + void OrientedPathFollow::_bind_methods() { ClassDB::bind_method(D_METHOD("set_offset", "offset"), &OrientedPathFollow::set_offset); diff --git a/scene/3d/path.h b/scene/3d/path.h index f73bf17dfe..beb37d9714 100644 --- a/scene/3d/path.h +++ b/scene/3d/path.h @@ -106,6 +106,8 @@ public: void set_cubic_interpolation(bool p_enable); bool get_cubic_interpolation() const; + String get_configuration_warning() const; + PathFollow(); }; @@ -151,6 +153,8 @@ public: void set_cubic_interpolation(bool p_enable); bool get_cubic_interpolation() const; + String get_configuration_warning() const; + OrientedPathFollow(); }; diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp index 541f6047d9..0eccbbc8f9 100644 --- a/scene/3d/voxel_light_baker.cpp +++ b/scene/3d/voxel_light_baker.cpp @@ -261,7 +261,7 @@ static _FORCE_INLINE_ void get_uv_and_normal(const Vector3 &p_pos, const Vector3 void VoxelLightBaker::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector3 *p_normal, const Vector2 *p_uv, const MaterialCache &p_material, const AABB &p_aabb) { if (p_level == cell_subdiv - 1) { - //plot the face by guessing it's albedo and emission value + //plot the face by guessing its albedo and emission value //find best axis to map to, for scanning values int closest_axis = 0; diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp index 934b84ec0c..c13964d196 100644 --- a/scene/gui/gradient_edit.cpp +++ b/scene/gui/gradient_edit.cpp @@ -236,8 +236,8 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { //Snap to nearest point if holding shift if (mm->get_shift()) { - float snap_treshhold = 0.03; - float smallest_ofs = snap_treshhold; + float snap_threshold = 0.03; + float smallest_ofs = snap_threshold; bool found = false; int nearest_point = 0; for (int i = 0; i < points.size(); ++i) { diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 0d5fbee9ee..494995fb85 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1524,6 +1524,7 @@ void ItemList::_bind_methods() { ADD_SIGNAL(MethodInfo("nothing_selected")); GLOBAL_DEF("gui/timers/incremental_search_max_interval_msec", 2000); + ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/incremental_search_max_interval_msec", PropertyInfo(Variant::INT, "gui/timers/incremental_search_max_interval_msec", PROPERTY_HINT_RANGE, "0,10000,1,or_greater")); // No negative numbers } ItemList::ItemList() { diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 6f344f1028..c4373876b1 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1608,6 +1608,8 @@ LineEdit::LineEdit() { text_changed_dirty = false; placeholder_alpha = 0.6; clear_button_enabled = false; + clear_button_status.press_attempt = false; + clear_button_status.pressing_inside = false; deselect(); set_focus_mode(FOCUS_ALL); diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index c56b7d0f26..b7f8c74046 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -106,41 +106,8 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) { } } - // test hovering to display right or close button - int hover_now = -1; - int hover_buttons = -1; - for (int i = 0; i < tabs.size(); i++) { - - if (i < offset) - continue; - - Rect2 rect = get_tab_rect(i); - if (rect.has_point(pos)) { - hover_now = i; - } - if (tabs[i].rb_rect.has_point(pos)) { - rb_hover = i; - cb_hover = -1; - hover_buttons = i; - break; - } else if (!tabs[i].disabled && tabs[i].cb_rect.has_point(pos)) { - cb_hover = i; - rb_hover = -1; - hover_buttons = i; - break; - } - } - if (hover != hover_now) { - hover = hover_now; - emit_signal("tab_hover", hover); - } - - if (hover_buttons == -1) { // no hover - rb_hover = hover_buttons; - cb_hover = hover_buttons; - } + _update_hover(); update(); - return; } @@ -522,6 +489,48 @@ Ref<Texture> Tabs::get_tab_right_button(int p_tab) const { return tabs[p_tab].right_button; } +void Tabs::_update_hover() { + + if (!is_inside_tree()) { + return; + } + + const Point2 &pos = get_local_mouse_position(); + // test hovering to display right or close button + int hover_now = -1; + int hover_buttons = -1; + for (int i = 0; i < tabs.size(); i++) { + + if (i < offset) + continue; + + Rect2 rect = get_tab_rect(i); + if (rect.has_point(pos)) { + hover_now = i; + } + if (tabs[i].rb_rect.has_point(pos)) { + rb_hover = i; + cb_hover = -1; + hover_buttons = i; + break; + } else if (!tabs[i].disabled && tabs[i].cb_rect.has_point(pos)) { + cb_hover = i; + rb_hover = -1; + hover_buttons = i; + break; + } + } + if (hover != hover_now) { + hover = hover_now; + emit_signal("tab_hover", hover); + } + + if (hover_buttons == -1) { // no hover + rb_hover = hover_buttons; + cb_hover = hover_buttons; + } +} + void Tabs::_update_cache() { Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled"); Ref<StyleBox> tab_bg = get_stylebox("tab_bg"); @@ -597,6 +606,7 @@ void Tabs::add_tab(const String &p_str, const Ref<Texture> &p_icon) { tabs.push_back(t); _update_cache(); + call_deferred("_update_hover"); update(); minimum_size_changed(); } @@ -604,6 +614,7 @@ void Tabs::add_tab(const String &p_str, const Ref<Texture> &p_icon) { void Tabs::clear_tabs() { tabs.clear(); current = 0; + call_deferred("_update_hover"); update(); } @@ -614,6 +625,7 @@ void Tabs::remove_tab(int p_idx) { if (current >= p_idx) current--; _update_cache(); + call_deferred("_update_hover"); update(); minimum_size_changed(); @@ -931,6 +943,7 @@ bool Tabs::get_select_with_rmb() const { void Tabs::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &Tabs::_gui_input); + ClassDB::bind_method(D_METHOD("_update_hover"), &Tabs::_update_hover); ClassDB::bind_method(D_METHOD("get_tab_count"), &Tabs::get_tab_count); ClassDB::bind_method(D_METHOD("set_current_tab", "tab_idx"), &Tabs::set_current_tab); ClassDB::bind_method(D_METHOD("get_current_tab"), &Tabs::get_current_tab); diff --git a/scene/gui/tabs.h b/scene/gui/tabs.h index e204f4364b..a98744b804 100644 --- a/scene/gui/tabs.h +++ b/scene/gui/tabs.h @@ -97,6 +97,8 @@ private: int get_tab_width(int p_idx) const; void _ensure_no_over_offset(); + + void _update_hover(); void _update_cache(); protected: diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index f8a5c4cea3..bb56eea98e 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -6232,6 +6232,7 @@ void TextEdit::_bind_methods() { BIND_ENUM_CONSTANT(MENU_MAX); GLOBAL_DEF("gui/timers/text_edit_idle_detect_sec", 3); + ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/text_edit_idle_detect_sec", PropertyInfo(Variant::REAL, "gui/timers/text_edit_idle_detect_sec", PROPERTY_HINT_RANGE, "0,10,0.01,or_greater")); // No negative numbers } TextEdit::TextEdit() { diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 8fd7dc1d7b..50e94e6db5 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2192,7 +2192,7 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const { if (p_copy->has_node(ptarget)) copytarget = p_copy->get_node(ptarget); - if (copy && copytarget) { + if (copy && copytarget && !copy->is_connected(E->get().signal, copytarget, E->get().method)) { copy->connect(E->get().signal, copytarget, E->get().method, E->get().binds, E->get().flags); } } diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index fdbe3b57f0..f7dec77ce4 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -1944,6 +1944,7 @@ SceneTree::SceneTree() { debug_navigation_color = GLOBAL_DEF("debug/shapes/navigation/geometry_color", Color(0.1, 1.0, 0.7, 0.4)); debug_navigation_disabled_color = GLOBAL_DEF("debug/shapes/navigation/disabled_geometry_color", Color(1.0, 0.7, 0.1, 0.4)); collision_debug_contacts = GLOBAL_DEF("debug/shapes/collision/max_contacts_displayed", 10000); + ProjectSettings::get_singleton()->set_custom_property_info("debug/shapes/collision/max_contacts_displayed", PropertyInfo(Variant::INT, "debug/shapes/collision/max_contacts_displayed", PROPERTY_HINT_RANGE, "0,20000,1")); // No negative tree_version = 1; physics_process_time = 1; @@ -1977,7 +1978,9 @@ SceneTree::SceneTree() { current_scene = NULL; int ref_atlas_size = GLOBAL_DEF("rendering/quality/reflections/atlas_size", 2048); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/reflections/atlas_size", PropertyInfo(Variant::INT, "rendering/quality/reflections/atlas_size", PROPERTY_HINT_RANGE, "0,8192,or_greater")); //next_power_of_2 will return a 0 as min value int ref_atlas_subdiv = GLOBAL_DEF("rendering/quality/reflections/atlas_subdiv", 8); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/reflections/atlas_subdiv", PropertyInfo(Variant::INT, "rendering/quality/reflections/atlas_subdiv", PROPERTY_HINT_RANGE, "0,32,or_greater")); //next_power_of_2 will return a 0 as min value int msaa_mode = GLOBAL_DEF("rendering/quality/filters/msaa", 0); ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x")); root->set_msaa(Viewport::MSAA(msaa_mode)); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 8dd1e507e8..6bf1d12086 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2943,6 +2943,7 @@ Viewport::Viewport() { //gui.tooltip_timer->force_parent_owned(); gui.tooltip_delay = GLOBAL_DEF("gui/timers/tooltip_delay_sec", 0.7); + ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/tooltip_delay_sec", PropertyInfo(Variant::REAL, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater")); // No negative numbers gui.tooltip = NULL; gui.tooltip_label = NULL; diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 086fb83af9..42ce9d10cd 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -264,7 +264,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const { } if (n.instance >= 0 || n.type != TYPE_INSTANCED || i == 0) { - //if node was not part of instance, must set it's name, parenthood and ownership + //if node was not part of instance, must set its name, parenthood and ownership if (i > 0) { if (parent) { parent->_add_child_nocheck(node, snames[n.name]); |