diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/visibility_notifier_2d.h | 2 | ||||
-rw-r--r-- | scene/3d/physics_body.h | 2 | ||||
-rw-r--r-- | scene/3d/visibility_notifier.h | 2 | ||||
-rw-r--r-- | scene/3d/voxel_light_baker.cpp | 3 | ||||
-rw-r--r-- | scene/3d/voxel_light_baker.h | 10 | ||||
-rw-r--r-- | scene/gui/base_button.cpp | 8 | ||||
-rw-r--r-- | scene/gui/color_picker.cpp | 28 | ||||
-rw-r--r-- | scene/gui/spin_box.cpp | 13 | ||||
-rw-r--r-- | scene/gui/spin_box.h | 3 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 10 | ||||
-rw-r--r-- | scene/resources/mesh.cpp | 27 | ||||
-rw-r--r-- | scene/resources/mesh_data_tool.cpp | 8 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 9 | ||||
-rw-r--r-- | scene/resources/texture.h | 2 | ||||
-rw-r--r-- | scene/resources/world.h | 2 | ||||
-rw-r--r-- | scene/resources/world_2d.cpp | 6 | ||||
-rw-r--r-- | scene/resources/world_2d.h | 2 |
17 files changed, 95 insertions, 42 deletions
diff --git a/scene/2d/visibility_notifier_2d.h b/scene/2d/visibility_notifier_2d.h index c4e12dfa22..04084b609a 100644 --- a/scene/2d/visibility_notifier_2d.h +++ b/scene/2d/visibility_notifier_2d.h @@ -43,7 +43,7 @@ class VisibilityNotifier2D : public Node2D { Rect2 rect; protected: - friend class SpatialIndexer2D; + friend struct SpatialIndexer2D; void _enter_viewport(Viewport *p_viewport); void _exit_viewport(Viewport *p_viewport); diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h index ca48b51ffb..ed9f41197b 100644 --- a/scene/3d/physics_body.h +++ b/scene/3d/physics_body.h @@ -389,6 +389,8 @@ public: virtual bool _set(const StringName &p_name, const Variant &p_value, RID j = RID()); virtual bool _get(const StringName &p_name, Variant &r_ret) const; virtual void _get_property_list(List<PropertyInfo> *p_list) const; + + virtual ~JointData() {} }; struct PinJointData : public JointData { diff --git a/scene/3d/visibility_notifier.h b/scene/3d/visibility_notifier.h index b1985f4a0c..2cf685a92c 100644 --- a/scene/3d/visibility_notifier.h +++ b/scene/3d/visibility_notifier.h @@ -48,7 +48,7 @@ protected: void _notification(int p_what); static void _bind_methods(); - friend class SpatialIndexer; + friend struct SpatialIndexer; void _enter_camera(Camera *p_camera); void _exit_camera(Camera *p_camera); diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp index 651a057392..68359eac52 100644 --- a/scene/3d/voxel_light_baker.cpp +++ b/scene/3d/voxel_light_baker.cpp @@ -734,7 +734,8 @@ void VoxelLightBaker::_check_init_light() { leaf_voxel_count = 0; _fixup_plot(0, 0); //pre fixup, so normal, albedo, emission, etc. work for lighting. bake_light.resize(bake_cells.size()); - zeromem(bake_light.ptrw(), bake_light.size() * sizeof(Light)); + print_line("bake light size: " + itos(bake_light.size())); + //zeromem(bake_light.ptrw(), bake_light.size() * sizeof(Light)); first_leaf = -1; _init_light_plot(0, 0, 0, 0, 0, CHILD_EMPTY); } diff --git a/scene/3d/voxel_light_baker.h b/scene/3d/voxel_light_baker.h index 6a1f1253a3..3d55c053f3 100644 --- a/scene/3d/voxel_light_baker.h +++ b/scene/3d/voxel_light_baker.h @@ -92,6 +92,16 @@ private: float accum[6][3]; //rgb anisotropic float direct_accum[6][3]; //for direct bake int next_leaf; + Light() { + x = y = z = 0; + for (int i = 0; i < 6; i++) { + for (int j = 0; j < 3; j++) { + accum[i][j] = 0; + direct_accum[i][j] = 0; + } + } + next_leaf = 0; + } }; int first_leaf; diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 895e76d516..71fb97c2c6 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -315,6 +315,14 @@ void BaseButton::set_disabled(bool p_disabled) { return; status.disabled = p_disabled; + if (p_disabled) { + if (!toggle_mode) { + status.pressed = false; + } + status.press_attempt = false; + status.pressing_inside = false; + status.pressing_button = 0; + } update(); _change_notify("disabled"); } diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 537a16fbc3..03eee9c6d8 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -33,6 +33,11 @@ #include "core/os/input.h" #include "core/os/keyboard.h" #include "core/os/os.h" + +#ifdef TOOLS_ENABLED +#include "editor_settings.h" +#endif + #include "scene/gui/separator.h" #include "scene/main/viewport.h" @@ -52,6 +57,16 @@ void ColorPicker::_notification(int p_what) { bt_add_preset->set_icon(get_icon("add_preset")); _update_color(); + +#ifdef TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) { + PoolColorArray saved_presets = EditorSettings::get_singleton()->get_project_metadata("color_picker", "presets", PoolColorArray()); + + for (int i = 0; i < saved_presets.size(); i++) { + add_preset(saved_presets[i]); + } + } +#endif } break; case NOTIFICATION_PARENTED: { @@ -186,9 +201,22 @@ void ColorPicker::_update_presets() { preset->draw_texture_rect(get_icon("preset_bg", "ColorPicker"), Rect2(Point2(), preset_size), true); +#ifdef TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) { + PoolColorArray arr_to_save = PoolColorArray(); + + for (int i = 0; i < presets.size(); i++) { + preset->draw_rect(Rect2(Point2(size.width * i, 0), size), presets[i]); + arr_to_save.insert(i, presets[i]); + } + + EditorSettings::get_singleton()->set_project_metadata("color_picker", "presets", arr_to_save); + } +#else for (int i = 0; i < presets.size(); i++) { preset->draw_rect(Rect2(Point2(size.width * i, 0), size), presets[i]); } +#endif } void ColorPicker::_text_type_toggled() { diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 2221923093..f766c0722d 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -217,6 +217,16 @@ void SpinBox::_notification(int p_what) { } } +void SpinBox::set_align(LineEdit::Align p_align) { + + line_edit->set_align(p_align); +} + +LineEdit::Align SpinBox::get_align() const { + + return line_edit->get_align(); +} + void SpinBox::set_suffix(const String &p_suffix) { suffix = p_suffix; @@ -253,6 +263,8 @@ void SpinBox::_bind_methods() { //ClassDB::bind_method(D_METHOD("_value_changed"),&SpinBox::_value_changed); ClassDB::bind_method(D_METHOD("_gui_input"), &SpinBox::_gui_input); ClassDB::bind_method(D_METHOD("_text_entered"), &SpinBox::_text_entered); + ClassDB::bind_method(D_METHOD("set_align", "align"), &SpinBox::set_align); + ClassDB::bind_method(D_METHOD("get_align"), &SpinBox::get_align); ClassDB::bind_method(D_METHOD("set_suffix", "suffix"), &SpinBox::set_suffix); ClassDB::bind_method(D_METHOD("get_suffix"), &SpinBox::get_suffix); ClassDB::bind_method(D_METHOD("set_prefix", "prefix"), &SpinBox::set_prefix); @@ -264,6 +276,7 @@ void SpinBox::_bind_methods() { ClassDB::bind_method(D_METHOD("_line_edit_input"), &SpinBox::_line_edit_input); ClassDB::bind_method(D_METHOD("_range_click_timeout"), &SpinBox::_range_click_timeout); + ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editable"), "set_editable", "is_editable"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "prefix"), "set_prefix", "get_prefix"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "suffix"), "set_suffix", "get_suffix"); diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h index 8863f44bef..f1ee26d9f3 100644 --- a/scene/gui/spin_box.h +++ b/scene/gui/spin_box.h @@ -76,6 +76,9 @@ public: virtual Size2 get_minimum_size() const; + void set_align(LineEdit::Align p_align); + LineEdit::Align get_align() const; + void set_editable(bool p_editable); bool is_editable() const; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 9fe306c236..c390c60a8c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4545,9 +4545,13 @@ void TextEdit::cut() { void TextEdit::copy() { if (!selection.active) { - String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length()); - OS::get_singleton()->set_clipboard(clipboard); - cut_copy_line = clipboard; + + if (text[cursor.line].length() != 0) { + + String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length()); + OS::get_singleton()->set_clipboard(clipboard); + cut_copy_line = clipboard; + } } else { String clipboard = _base_get_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column); OS::get_singleton()->set_clipboard(clipboard); diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index fa87623e38..6cd701eb9a 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -546,33 +546,6 @@ void Mesh::clear_cache() const { Mesh::Mesh() { } -static const ArrayMesh::ArrayType _array_types[] = { - - ArrayMesh::ARRAY_VERTEX, - ArrayMesh::ARRAY_NORMAL, - ArrayMesh::ARRAY_TANGENT, - ArrayMesh::ARRAY_COLOR, - ArrayMesh::ARRAY_TEX_UV, - ArrayMesh::ARRAY_TEX_UV2, - ArrayMesh::ARRAY_BONES, - ArrayMesh::ARRAY_WEIGHTS, - ArrayMesh::ARRAY_INDEX -}; - -/* compatibility */ -static const int _format_translate[] = { - - ArrayMesh::ARRAY_FORMAT_VERTEX, - ArrayMesh::ARRAY_FORMAT_NORMAL, - ArrayMesh::ARRAY_FORMAT_TANGENT, - ArrayMesh::ARRAY_FORMAT_COLOR, - ArrayMesh::ARRAY_FORMAT_TEX_UV, - ArrayMesh::ARRAY_FORMAT_TEX_UV2, - ArrayMesh::ARRAY_FORMAT_BONES, - ArrayMesh::ARRAY_FORMAT_WEIGHTS, - ArrayMesh::ARRAY_FORMAT_INDEX, -}; - bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) { String sname = p_name; diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index 6732303925..a5449e1fe8 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -79,9 +79,9 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf if (arrays[Mesh::ARRAY_COLOR].get_type() != Variant::NIL) col = arrays[Mesh::ARRAY_COLOR].operator PoolVector<Color>().read(); - PoolVector<real_t>::Read bo; + PoolVector<int>::Read bo; if (arrays[Mesh::ARRAY_BONES].get_type() != Variant::NIL) - bo = arrays[Mesh::ARRAY_BONES].operator PoolVector<real_t>().read(); + bo = arrays[Mesh::ARRAY_BONES].operator PoolVector<int>().read(); PoolVector<real_t>::Read we; if (arrays[Mesh::ARRAY_WEIGHTS].get_type() != Variant::NIL) @@ -194,7 +194,7 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) { PoolVector<Vector2> u; PoolVector<Vector2> u2; PoolVector<Color> c; - PoolVector<real_t> b; + PoolVector<int> b; PoolVector<real_t> w; PoolVector<int> in; @@ -233,7 +233,7 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) { col = c.write(); } - PoolVector<real_t>::Write bo; + PoolVector<int>::Write bo; if (format & Mesh::ARRAY_FORMAT_BONES) { b.resize(vcount * 4); bo = b.write(); diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index f0e3979f13..682bfebdd2 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -426,6 +426,15 @@ ImageTexture::~ImageTexture() { ////////////////////////////////////////// +void StreamTexture::set_path(const String &p_path, bool p_take_over) { + + if (texture.is_valid()) { + VisualServer::get_singleton()->texture_set_path(texture, p_path); + } + + Resource::set_path(p_path, p_take_over); +} + void StreamTexture::_requested_3d(void *p_ud) { StreamTexture *st = (StreamTexture *)p_ud; diff --git a/scene/resources/texture.h b/scene/resources/texture.h index cb759c63da..e9b69e9cb1 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -219,6 +219,8 @@ public: int get_height() const; virtual RID get_rid() const; + virtual void set_path(const String &p_path, bool p_take_over); + virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture> &p_normal_map = Ref<Texture>()) const; virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture> &p_normal_map = Ref<Texture>()) const; virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture> &p_normal_map = Ref<Texture>(), bool p_clip_uv = true) const; diff --git a/scene/resources/world.h b/scene/resources/world.h index 4c517323f3..4ba6b13476 100644 --- a/scene/resources/world.h +++ b/scene/resources/world.h @@ -36,9 +36,9 @@ #include "servers/physics_server.h" #include "servers/visual_server.h" -class SpatialIndexer; class Camera; class VisibilityNotifier; +struct SpatialIndexer; class World : public Resource { GDCLASS(World, Resource); diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index b390e74073..dd78d04104 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -29,13 +29,13 @@ /*************************************************************************/ #include "world_2d.h" -#include "servers/physics_2d_server.h" -#include "servers/visual_server.h" -//#include "servers/spatial_sound_2d_server.h" + #include "core/project_settings.h" #include "scene/2d/camera_2d.h" #include "scene/2d/visibility_notifier_2d.h" #include "scene/main/viewport.h" +#include "servers/physics_2d_server.h" +#include "servers/visual_server.h" struct SpatialIndexer2D { diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h index 856e9dbf01..88ad392f85 100644 --- a/scene/resources/world_2d.h +++ b/scene/resources/world_2d.h @@ -35,9 +35,9 @@ #include "core/resource.h" #include "servers/physics_2d_server.h" -class SpatialIndexer2D; class VisibilityNotifier2D; class Viewport; +struct SpatialIndexer2D; class World2D : public Resource { |