summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/class_db.h2
-rw-r--r--core/image.cpp6
-rw-r--r--core/io/file_access_buffered.cpp12
-rw-r--r--core/io/file_access_buffered.h2
-rw-r--r--core/io/file_access_compressed.cpp20
-rw-r--r--core/io/file_access_memory.h2
-rw-r--r--core/io/file_access_zip.cpp12
-rw-r--r--core/io/ip_address.h2
-rw-r--r--core/io/json.cpp60
-rw-r--r--core/io/marshalls.cpp251
-rw-r--r--core/io/marshalls.h21
-rw-r--r--core/io/packet_peer.cpp36
-rw-r--r--core/io/packet_peer.h7
-rw-r--r--core/io/packet_peer_udp.h2
-rw-r--r--core/io/resource_import.cpp46
-rw-r--r--core/io/resource_import.h1
-rw-r--r--core/io/stream_peer.cpp5
-rw-r--r--core/io/tcp_server.h2
-rw-r--r--core/math/geometry.cpp4
-rw-r--r--core/math/math_2d.cpp16
-rw-r--r--core/math/math_2d.h40
-rw-r--r--core/math/octree.h12
-rw-r--r--core/math/plane.cpp4
-rw-r--r--core/math/plane.h4
-rw-r--r--core/math/rect3.h46
-rw-r--r--core/math/vector3.h22
-rw-r--r--core/method_bind.h1
-rw-r--r--core/method_ptrcall.h57
-rw-r--r--core/object.cpp12
-rw-r--r--core/object.h6
-rw-r--r--core/os/file_access.cpp4
-rw-r--r--core/os/file_access.h2
-rw-r--r--core/os/input_event.cpp5
-rw-r--r--core/os/input_event.h1
-rw-r--r--core/os/keyboard.h2
-rw-r--r--core/pair.h2
-rw-r--r--core/project_settings.h2
-rw-r--r--core/reference.h7
-rw-r--r--core/register_core_types.cpp3
-rw-r--r--core/resource.h2
-rw-r--r--core/script_debugger_remote.cpp96
-rw-r--r--core/script_debugger_remote.h2
-rw-r--r--core/typedefs.h21
-rw-r--r--core/ustring.cpp6
-rw-r--r--core/ustring.h8
-rw-r--r--core/variant_call.cpp4
-rw-r--r--core/variant_construct_string.cpp62
-rw-r--r--core/vector.h12
-rw-r--r--doc/base/classes.xml13
-rw-r--r--drivers/alsa/audio_driver_alsa.cpp2
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp84
-rw-r--r--drivers/gles2/rasterizer_gles2.h2
-rw-r--r--drivers/gles2/shader_gles2.cpp4
-rw-r--r--drivers/gles2/shader_gles2.h8
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp7
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.h2
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp76
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h12
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp76
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h10
-rw-r--r--drivers/gles3/shader_gles3.cpp14
-rw-r--r--drivers/gles3/shader_gles3.h8
-rw-r--r--drivers/gles3/shaders/canvas.glsl4
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp2
-rw-r--r--drivers/rtaudio/audio_driver_rtaudio.cpp2
-rw-r--r--drivers/unix/dir_access_unix.cpp45
-rw-r--r--drivers/unix/dir_access_unix.h4
-rw-r--r--drivers/unix/ip_unix.cpp1
-rw-r--r--drivers/unix/os_unix.h2
-rw-r--r--drivers/unix/packet_peer_udp_posix.cpp8
-rw-r--r--drivers/unix/packet_peer_udp_posix.h2
-rw-r--r--drivers/unix/tcp_server_posix.cpp2
-rw-r--r--drivers/unix/tcp_server_posix.h2
-rw-r--r--drivers/windows/dir_access_windows.h4
-rw-r--r--drivers/windows/file_access_windows.cpp4
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.cpp2
-rw-r--r--editor/animation_editor.cpp4
-rw-r--r--editor/animation_editor.h2
-rw-r--r--editor/asset_library_editor_plugin.cpp103
-rw-r--r--editor/asset_library_editor_plugin.h6
-rw-r--r--editor/call_dialog.cpp20
-rw-r--r--editor/code_editor.cpp20
-rw-r--r--editor/collada/collada.h2
-rw-r--r--editor/connections_dialog.h3
-rw-r--r--editor/dependency_editor.h2
-rw-r--r--editor/editor_audio_buses.cpp2
-rw-r--r--editor/editor_autoload_settings.cpp2
-rw-r--r--editor/editor_autoload_settings.h8
-rw-r--r--editor/editor_data.cpp8
-rw-r--r--editor/editor_dir_dialog.cpp10
-rw-r--r--editor/editor_export.cpp61
-rw-r--r--editor/editor_export.h6
-rw-r--r--editor/editor_file_system.cpp91
-rw-r--r--editor/editor_file_system.h9
-rw-r--r--editor/editor_help.cpp2
-rw-r--r--editor/editor_help.h4
-rw-r--r--editor/editor_name_dialog.cpp2
-rw-r--r--editor/editor_node.cpp94
-rw-r--r--editor/editor_node.h6
-rw-r--r--editor/editor_plugin.cpp6
-rw-r--r--editor/editor_plugin.h2
-rw-r--r--editor/editor_resource_preview.h4
-rw-r--r--editor/editor_run.cpp2
-rw-r--r--editor/editor_settings.cpp13
-rw-r--r--editor/editor_settings.h2
-rw-r--r--editor/editor_themes.cpp139
-rw-r--r--editor/filesystem_dock.h2
-rw-r--r--editor/icons/2x/icon_editor_control_anchor.pngbin0 -> 855 bytes
-rw-r--r--editor/icons/icon_GUI_scroll_grabber_pressed.pngbin0 -> 233 bytes
-rw-r--r--editor/icons/icon_editor_control_anchor.pngbin0 -> 472 bytes
-rw-r--r--editor/icons/source/icon_GUI_scroll_grabber_pressed.svg83
-rw-r--r--editor/icons/source/icon_editor_control_anchor.svg98
-rw-r--r--editor/import/editor_import_collada.cpp36
-rw-r--r--editor/import/resource_importer_scene.cpp22
-rw-r--r--editor/io_plugins/editor_font_import_plugin.cpp4
-rw-r--r--editor/io_plugins/editor_scene_import_plugin.cpp2
-rw-r--r--editor/io_plugins/editor_texture_import_plugin.cpp4
-rw-r--r--editor/node_dock.cpp5
-rw-r--r--editor/node_dock.h2
-rw-r--r--editor/output_strings.cpp6
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.h6
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp20
-rw-r--r--editor/plugins/animation_tree_editor_plugin.h6
-rw-r--r--editor/plugins/baked_light_baker.cpp4
-rw-r--r--editor/plugins/camera_editor_plugin.cpp2
-rw-r--r--editor/plugins/camera_editor_plugin.h4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp402
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h19
-rw-r--r--editor/plugins/collision_polygon_2d_editor_plugin.h4
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.h4
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp8
-rw-r--r--editor/plugins/cube_grid_theme_editor_plugin.cpp344
-rw-r--r--editor/plugins/cube_grid_theme_editor_plugin.h18
-rw-r--r--editor/plugins/gi_probe_editor_plugin.h4
-rw-r--r--editor/plugins/gradient_editor_plugin.h4
-rw-r--r--editor/plugins/item_list_editor_plugin.h4
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.h4
-rw-r--r--editor/plugins/line_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/line_2d_editor_plugin.h4
-rw-r--r--editor/plugins/mesh_editor_plugin.h4
-rw-r--r--editor/plugins/mesh_instance_editor_plugin.h4
-rw-r--r--editor/plugins/multimesh_editor_plugin.cpp2
-rw-r--r--editor/plugins/multimesh_editor_plugin.h4
-rw-r--r--editor/plugins/navigation_polygon_editor_plugin.h4
-rw-r--r--editor/plugins/particles_2d_editor_plugin.h4
-rw-r--r--editor/plugins/particles_editor_plugin.h4
-rw-r--r--editor/plugins/path_2d_editor_plugin.h4
-rw-r--r--editor/plugins/path_editor_plugin.cpp18
-rw-r--r--editor/plugins/path_editor_plugin.h4
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.h4
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp2
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.h4
-rw-r--r--editor/plugins/rich_text_editor_plugin.h4
-rw-r--r--editor/plugins/sample_editor_plugin.cpp12
-rw-r--r--editor/plugins/sample_library_editor_plugin.cpp6
-rw-r--r--editor/plugins/sample_player_editor_plugin.cpp14
-rw-r--r--editor/plugins/script_editor_plugin.cpp17
-rw-r--r--editor/plugins/script_editor_plugin.h11
-rw-r--r--editor/plugins/script_text_editor.cpp18
-rw-r--r--editor/plugins/script_text_editor.h1
-rw-r--r--editor/plugins/shader_editor_plugin.h6
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp32
-rw-r--r--editor/plugins/spatial_editor_plugin.h2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp4
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.h4
-rw-r--r--editor/plugins/texture_editor_plugin.h4
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp8
-rw-r--r--editor/plugins/texture_region_editor_plugin.h4
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp21
-rw-r--r--editor/plugins/tile_map_editor_plugin.h5
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp5
-rw-r--r--editor/progress_dialog.cpp7
-rw-r--r--editor/project_manager.cpp5
-rw-r--r--editor/property_editor.cpp76
-rw-r--r--editor/property_editor.h6
-rw-r--r--editor/resources_dock.h2
-rw-r--r--editor/scene_tree_dock.cpp2
-rw-r--r--editor/scene_tree_dock.h2
-rw-r--r--editor/scene_tree_editor.cpp6
-rw-r--r--editor/scene_tree_editor.h2
-rw-r--r--editor/script_create_dialog.h2
-rw-r--r--editor/script_editor_debugger.cpp14
-rw-r--r--editor/spatial_editor_gizmos.cpp2
-rw-r--r--editor/spatial_editor_gizmos.h4
-rw-r--r--main/input_default.cpp12
-rw-r--r--main/input_default.h2
-rw-r--r--main/main.cpp17
-rw-r--r--main/tests/test_gdscript.cpp12
-rw-r--r--main/tests/test_gui.cpp4
-rw-r--r--modules/enet/networked_multiplayer_enet.h2
-rw-r--r--modules/etc/image_etc.cpp2
-rw-r--r--modules/gdnative/gdnative.h2
-rw-r--r--modules/gdnative/godot/dictionary.cpp2
-rw-r--r--modules/gdnative/godot/string.cpp12
-rw-r--r--modules/gdnative/godot/string.h6
-rw-r--r--modules/gdscript/gd_function.cpp6
-rw-r--r--modules/gdscript/gd_functions.cpp2
-rw-r--r--modules/gdscript/gd_script.cpp2
-rw-r--r--modules/gridmap/grid_map.cpp16
-rw-r--r--modules/gridmap/grid_map.h2
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp2
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h4
-rw-r--r--modules/nativescript/nativescript.h2
-rw-r--r--modules/visual_script/visual_script.cpp11
-rw-r--r--modules/visual_script/visual_script.h4
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp2
-rw-r--r--modules/visual_script/visual_script_editor.cpp30
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp6
-rw-r--r--modules/visual_script/visual_script_func_nodes.h2
-rw-r--r--modules/visual_script/visual_script_nodes.cpp1
-rw-r--r--modules/visual_script/visual_script_nodes.h6
-rw-r--r--platform/android/audio_driver_jandroid.cpp2
-rw-r--r--platform/android/audio_driver_jandroid.h2
-rw-r--r--platform/android/dir_access_jandroid.h2
-rw-r--r--platform/android/file_access_jandroid.h2
-rw-r--r--platform/android/godot_android.cpp24
-rw-r--r--platform/android/java_glue.h4
-rw-r--r--platform/haiku/audio_driver_media_kit.cpp2
-rw-r--r--platform/osx/audio_driver_osx.cpp102
-rw-r--r--platform/osx/audio_driver_osx.h4
-rw-r--r--platform/uwp/export/export.cpp4
-rw-r--r--platform/windows/detect.py61
-rw-r--r--platform/windows/joypad.cpp8
-rw-r--r--platform/windows/os_windows.cpp142
-rw-r--r--platform/windows/os_windows.h10
-rw-r--r--platform/windows/packet_peer_udp_winsock.cpp2
-rw-r--r--platform/windows/packet_peer_udp_winsock.h2
-rw-r--r--platform/windows/tcp_server_winsock.cpp2
-rw-r--r--platform/windows/tcp_server_winsock.h2
-rw-r--r--platform/x11/context_gl_x11.cpp14
-rw-r--r--platform/x11/joypad_linux.h10
-rw-r--r--platform/x11/os_x11.cpp11
-rw-r--r--scene/2d/camera_2d.cpp6
-rw-r--r--scene/2d/canvas_item.cpp12
-rw-r--r--scene/2d/canvas_item.h6
-rw-r--r--scene/2d/joints_2d.h2
-rw-r--r--scene/2d/light_2d.cpp2
-rw-r--r--scene/2d/navigation2d.cpp3
-rw-r--r--scene/2d/node_2d.h2
-rw-r--r--scene/2d/parallax_background.h2
-rw-r--r--scene/2d/parallax_layer.h4
-rw-r--r--scene/2d/particles_2d.cpp2
-rw-r--r--scene/2d/particles_2d.h2
-rw-r--r--scene/2d/path_2d.h2
-rw-r--r--scene/2d/physics_body_2d.cpp3
-rw-r--r--scene/2d/polygon_2d.cpp20
-rw-r--r--scene/2d/polygon_2d.h8
-rw-r--r--scene/2d/screen_button.h2
-rw-r--r--scene/2d/tile_map.cpp8
-rw-r--r--scene/3d/camera.h6
-rw-r--r--scene/3d/collision_shape.cpp7
-rw-r--r--scene/3d/immediate_geometry.h4
-rw-r--r--scene/3d/light.cpp16
-rw-r--r--scene/3d/light.h4
-rw-r--r--scene/3d/navigation_mesh.cpp2
-rw-r--r--scene/3d/particles.cpp21
-rw-r--r--scene/3d/particles.h2
-rw-r--r--scene/3d/proximity_group.cpp4
-rw-r--r--scene/3d/skeleton.cpp4
-rw-r--r--scene/3d/skeleton.h6
-rw-r--r--scene/3d/spatial_velocity_tracker.h2
-rw-r--r--scene/3d/sprite_3d.h2
-rw-r--r--scene/3d/vehicle_body.cpp4
-rw-r--r--scene/3d/vehicle_body.h2
-rw-r--r--scene/3d/visual_instance.cpp19
-rw-r--r--scene/3d/visual_instance.h1
-rw-r--r--scene/animation/animation_player.h2
-rw-r--r--scene/animation/animation_tree_player.h8
-rw-r--r--scene/animation/tween.h22
-rw-r--r--scene/gui/button.cpp4
-rw-r--r--scene/gui/color_picker.cpp24
-rw-r--r--scene/gui/color_picker.h8
-rw-r--r--scene/gui/control.cpp256
-rw-r--r--scene/gui/control.h45
-rw-r--r--scene/gui/dialogs.cpp14
-rw-r--r--scene/gui/file_dialog.cpp2
-rw-r--r--scene/gui/graph_edit.cpp4
-rw-r--r--scene/gui/input_action.h2
-rw-r--r--scene/gui/item_list.cpp8
-rw-r--r--scene/gui/item_list.h4
-rw-r--r--scene/gui/label.cpp9
-rw-r--r--scene/gui/line_edit.cpp2
-rw-r--r--scene/gui/line_edit.h2
-rw-r--r--scene/gui/option_button.cpp12
-rw-r--r--scene/gui/patch_9_rect.h2
-rw-r--r--scene/gui/popup.cpp33
-rw-r--r--scene/gui/popup_menu.cpp14
-rw-r--r--scene/gui/popup_menu.h2
-rw-r--r--scene/gui/rich_text_label.cpp2
-rw-r--r--scene/gui/rich_text_label.h2
-rw-r--r--scene/gui/scroll_bar.cpp63
-rw-r--r--scene/gui/scroll_bar.h7
-rw-r--r--scene/gui/scroll_container.cpp4
-rw-r--r--scene/gui/tab_container.cpp20
-rw-r--r--scene/gui/tab_container.h2
-rw-r--r--scene/gui/text_edit.cpp111
-rw-r--r--scene/gui/text_edit.h19
-rw-r--r--scene/gui/texture_button.cpp4
-rw-r--r--scene/gui/texture_button.h4
-rw-r--r--scene/gui/tree.cpp32
-rw-r--r--scene/gui/tree.h13
-rw-r--r--scene/gui/video_player.h2
-rw-r--r--scene/main/canvas_layer.h2
-rwxr-xr-xscene/main/node.cpp3
-rw-r--r--scene/main/node.h8
-rw-r--r--scene/main/scene_tree.cpp129
-rw-r--r--scene/main/scene_tree.h1
-rw-r--r--scene/main/viewport.cpp7
-rw-r--r--scene/resources/animation.cpp20
-rw-r--r--scene/resources/animation.h2
-rw-r--r--scene/resources/color_ramp.h6
-rw-r--r--scene/resources/curve.h6
-rw-r--r--scene/resources/default_theme/default_theme.cpp820
-rw-r--r--scene/resources/default_theme/scroll_grabber_pressed.pngbin0 -> 233 bytes
-rw-r--r--scene/resources/default_theme/theme_data.h4
-rw-r--r--scene/resources/dynamic_font.cpp12
-rw-r--r--scene/resources/dynamic_font.h2
-rw-r--r--scene/resources/dynamic_font_stb.cpp2
-rw-r--r--scene/resources/environment.cpp4
-rw-r--r--scene/resources/environment.h4
-rw-r--r--scene/resources/font.cpp8
-rw-r--r--scene/resources/material.cpp3
-rw-r--r--scene/resources/material.h2
-rw-r--r--scene/resources/mesh.h2
-rw-r--r--scene/resources/packed_scene.cpp58
-rw-r--r--scene/resources/primitive_meshes.cpp20
-rw-r--r--scene/resources/room.h2
-rw-r--r--scene/resources/scene_format_text.cpp4
-rw-r--r--scene/resources/shape_2d.h4
-rw-r--r--scene/resources/sky_box.cpp63
-rw-r--r--scene/resources/sky_box.h11
-rw-r--r--scene/resources/style_box.cpp547
-rw-r--r--scene/resources/style_box.h94
-rw-r--r--scene/resources/surface_tool.cpp20
-rw-r--r--scene/resources/surface_tool.h4
-rw-r--r--scene/resources/theme.cpp6
-rw-r--r--scene/resources/theme.h6
-rw-r--r--scene/resources/tile_set.h4
-rw-r--r--servers/arvr_server.h14
-rw-r--r--servers/audio/audio_driver_dummy.cpp2
-rw-r--r--servers/audio/audio_filter_sw.h16
-rw-r--r--servers/audio/audio_stream.h4
-rw-r--r--servers/audio/effects/audio_effect_distortion.h8
-rw-r--r--servers/audio/effects/audio_effect_panner.h2
-rw-r--r--servers/audio_server.cpp74
-rw-r--r--servers/audio_server.h2
-rw-r--r--servers/physics/broad_phase_basic.cpp4
-rw-r--r--servers/physics/broad_phase_octree.cpp2
-rw-r--r--servers/physics/broad_phase_octree.h2
-rw-r--r--servers/physics/collision_object_sw.h2
-rw-r--r--servers/physics/joints/cone_twist_joint_sw.cpp10
-rw-r--r--servers/physics/joints/cone_twist_joint_sw.h4
-rw-r--r--servers/physics/joints/generic_6dof_joint_sw.cpp6
-rw-r--r--servers/physics/joints/generic_6dof_joint_sw.h4
-rw-r--r--servers/physics/physics_server_sw.h2
-rw-r--r--servers/physics/shape_sw.h2
-rw-r--r--servers/physics_2d/broad_phase_2d_basic.cpp4
-rw-r--r--servers/physics_2d/broad_phase_2d_hash_grid.h2
-rw-r--r--servers/physics_2d/collision_object_2d_sw.h2
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp8
-rw-r--r--servers/physics_2d/physics_2d_server_sw.h8
-rw-r--r--servers/physics_2d/space_2d_sw.cpp30
-rw-r--r--servers/physics_2d_server.cpp16
-rw-r--r--servers/physics_server.cpp16
-rw-r--r--servers/visual/rasterizer.h2
-rw-r--r--servers/visual/shader_language.cpp6
-rw-r--r--servers/visual/visual_server_canvas.cpp13
-rw-r--r--servers/visual/visual_server_canvas.h4
-rw-r--r--servers/visual/visual_server_raster.cpp4
-rw-r--r--servers/visual/visual_server_raster.h3
-rw-r--r--servers/visual/visual_server_scene.cpp36
-rw-r--r--servers/visual/visual_server_scene.h2
-rw-r--r--servers/visual/visual_server_wrap_mt.h3
-rw-r--r--servers/visual_server.cpp14
-rw-r--r--servers/visual_server.h4
-rw-r--r--thirdparty/README.md3
-rw-r--r--thirdparty/minizip/LICENSE-InfoZip.txt60
-rw-r--r--thirdparty/minizip/LICENSE-MiniZip.txt32
-rw-r--r--thirdparty/minizip/MiniZip_info.txt74
-rw-r--r--thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch295
-rw-r--r--thirdparty/minizip/ioapi.c10
-rw-r--r--thirdparty/minizip/ioapi.h49
-rw-r--r--thirdparty/minizip/unzip.c241
-rw-r--r--thirdparty/minizip/unzip.h85
-rw-r--r--thirdparty/minizip/zip.c33
-rw-r--r--thirdparty/minizip/zip.h71
388 files changed, 5287 insertions, 2926 deletions
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 70ae31055d..71038cd5a6 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -458,7 +458,7 @@ protected:
public:
Error open(const String &p_path);
- Error list_dir_begin(bool p_skip_internal = false, bool p_skip_hidden = false); ///< This starts dir listing
+ Error list_dir_begin(bool p_skip_navigational = false, bool p_skip_hidden = false); ///< This starts dir listing
String get_next();
bool current_is_dir() const;
diff --git a/core/class_db.h b/core/class_db.h
index f73e082c52..4287c5990f 100644
--- a/core/class_db.h
+++ b/core/class_db.h
@@ -45,7 +45,7 @@ struct ParamHint {
String hint_text;
Variant default_val;
- ParamHint(const String &p_name = "", PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_text = "", Variant p_default_val = Variant())
+ ParamHint(const String &p_name = "", PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_text = "", const Variant &p_default_val = Variant())
: name(p_name),
hint(p_hint),
hint_text(p_hint_text),
diff --git a/core/image.cpp b/core/image.cpp
index 2db9cb1571..a4864458b5 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -676,8 +676,8 @@ void Image::resize_to_po2(bool p_square) {
ERR_FAIL();
}
- int w = nearest_power_of_2(width);
- int h = nearest_power_of_2(height);
+ int w = next_power_of_2(width);
+ int h = next_power_of_2(height);
if (w == width && h == height) {
@@ -1060,7 +1060,7 @@ Error Image::generate_mipmaps() {
PoolVector<uint8_t>::Write wp = data.write();
- if (nearest_power_of_2(width) == uint32_t(width) && nearest_power_of_2(height) == uint32_t(height)) {
+ if (next_power_of_2(width) == uint32_t(width) && next_power_of_2(height) == uint32_t(height)) {
//use fast code for powers of 2
int prev_ofs = 0;
int prev_h = height;
diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp
index 81adbbbaf7..126ec7575e 100644
--- a/core/io/file_access_buffered.cpp
+++ b/core/io/file_access_buffered.cpp
@@ -106,11 +106,11 @@ uint8_t FileAccessBuffered::get_8() const {
return byte;
};
-int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const {
+int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_length) const {
ERR_FAIL_COND_V(!file.open, -1);
- if (p_elements > cache_size) {
+ if (p_length > cache_size) {
int total_read = 0;
@@ -122,12 +122,12 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const {
//memcpy(p_dest, read.ptr() + (file.offset - cache.offset), size);
memcpy(p_dest, cache.buffer.ptr() + (file.offset - cache.offset), size);
p_dest += size;
- p_elements -= size;
+ p_length -= size;
file.offset += size;
total_read += size;
};
- int err = read_data_block(file.offset, p_elements, p_dest);
+ int err = read_data_block(file.offset, p_length, p_dest);
if (err >= 0) {
total_read += err;
file.offset += err;
@@ -136,7 +136,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const {
return total_read;
};
- int to_read = p_elements;
+ int to_read = p_length;
int total_read = 0;
while (to_read > 0) {
@@ -161,7 +161,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const {
to_read -= r;
};
- return p_elements;
+ return p_length;
};
bool FileAccessBuffered::is_open() const {
diff --git a/core/io/file_access_buffered.h b/core/io/file_access_buffered.h
index c5bf120890..0ad2d0e929 100644
--- a/core/io/file_access_buffered.h
+++ b/core/io/file_access_buffered.h
@@ -81,7 +81,7 @@ public:
virtual bool eof_reached() const;
virtual uint8_t get_8() const;
- virtual int get_buffer(uint8_t *p_dst, int p_length) const; ///< get an array of bytes
+ virtual int get_buffer(uint8_t *p_dest, int p_length) const; ///< get an array of bytes
virtual bool is_open() const;
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index 4e802579c6..34bce3f04f 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -43,16 +43,16 @@ void FileAccessCompressed::configure(const String &p_magic, Compression::Mode p_
block_size = p_block_size;
}
-#define WRITE_FIT(m_bytes) \
- { \
- if (write_pos + (m_bytes) > write_max) { \
- write_max = write_pos + (m_bytes); \
- } \
- if (write_max > write_buffer_size) { \
- write_buffer_size = nearest_power_of_2(write_max); \
- buffer.resize(write_buffer_size); \
- write_ptr = buffer.ptr(); \
- } \
+#define WRITE_FIT(m_bytes) \
+ { \
+ if (write_pos + (m_bytes) > write_max) { \
+ write_max = write_pos + (m_bytes); \
+ } \
+ if (write_max > write_buffer_size) { \
+ write_buffer_size = next_power_of_2(write_max); \
+ buffer.resize(write_buffer_size); \
+ write_ptr = buffer.ptr(); \
+ } \
}
Error FileAccessCompressed::open_after_magic(FileAccess *p_base) {
diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h
index 8b6abe7e81..ea858c547e 100644
--- a/core/io/file_access_memory.h
+++ b/core/io/file_access_memory.h
@@ -62,7 +62,7 @@ public:
virtual Error get_error() const; ///< get last error
- virtual void store_8(uint8_t p_dest); ///< store a byte
+ virtual void store_8(uint8_t p_byte); ///< store a byte
virtual void store_buffer(const uint8_t *p_src, int p_length); ///< store an array of bytes
virtual bool file_exists(const String &p_name); ///< return true if a file exists
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index a92014000d..d748d5c773 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -159,15 +159,15 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
return pkg;
};
-bool ZipArchive::try_open_pack(const String &p_name) {
+bool ZipArchive::try_open_pack(const String &p_path) {
//printf("opening zip pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz"));
- if (p_name.get_extension().nocasecmp_to("zip") != 0 && p_name.get_extension().nocasecmp_to("pcz") != 0)
+ if (p_path.get_extension().nocasecmp_to("zip") != 0 && p_path.get_extension().nocasecmp_to("pcz") != 0)
return false;
zlib_filefunc_def io;
- FileAccess *f = FileAccess::open(p_name, FileAccess::READ);
+ FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
if (!f)
return false;
io.opaque = f;
@@ -180,7 +180,7 @@ bool ZipArchive::try_open_pack(const String &p_name) {
io.zclose_file = godot_close;
io.zerror_file = godot_testerror;
- unzFile zfile = unzOpen2(p_name.utf8().get_data(), &io);
+ unzFile zfile = unzOpen2(p_path.utf8().get_data(), &io);
ERR_FAIL_COND_V(!zfile, false);
unz_global_info64 gi;
@@ -188,7 +188,7 @@ bool ZipArchive::try_open_pack(const String &p_name) {
ERR_FAIL_COND_V(err != UNZ_OK, false);
Package pkg;
- pkg.filename = p_name;
+ pkg.filename = p_path;
pkg.zfile = zfile;
packages.push_back(pkg);
int pkg_num = packages.size() - 1;
@@ -209,7 +209,7 @@ bool ZipArchive::try_open_pack(const String &p_name) {
files[fname] = f;
uint8_t md5[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- PackedData::get_singleton()->add_path(p_name, fname, 1, 0, md5, this);
+ PackedData::get_singleton()->add_path(p_path, fname, 1, 0, md5, this);
//printf("packed data add path %ls, %ls\n", p_name.c_str(), fname.c_str());
if ((i + 1) < gi.number_entry) {
diff --git a/core/io/ip_address.h b/core/io/ip_address.h
index ac58283605..da16622a9b 100644
--- a/core/io/ip_address.h
+++ b/core/io/ip_address.h
@@ -75,7 +75,7 @@ public:
void set_ipv4(const uint8_t *p_ip);
const uint8_t *get_ipv6() const;
- void set_ipv6(const uint8_t *buf);
+ void set_ipv6(const uint8_t *p_buf);
operator String() const;
IP_Address(const String &p_string);
diff --git a/core/io/json.cpp b/core/io/json.cpp
index 10fd60abf7..d537061c5b 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -94,15 +94,15 @@ String JSON::print(const Variant &p_var) {
return _print_var(p_var);
}
-Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_token, int &line, String &r_err_str) {
+Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str) {
while (p_len > 0) {
- switch (p_str[idx]) {
+ switch (p_str[index]) {
case '\n': {
line++;
- idx++;
+ index++;
break;
};
case 0: {
@@ -112,54 +112,54 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke
case '{': {
r_token.type = TK_CURLY_BRACKET_OPEN;
- idx++;
+ index++;
return OK;
};
case '}': {
r_token.type = TK_CURLY_BRACKET_CLOSE;
- idx++;
+ index++;
return OK;
};
case '[': {
r_token.type = TK_BRACKET_OPEN;
- idx++;
+ index++;
return OK;
};
case ']': {
r_token.type = TK_BRACKET_CLOSE;
- idx++;
+ index++;
return OK;
};
case ':': {
r_token.type = TK_COLON;
- idx++;
+ index++;
return OK;
};
case ',': {
r_token.type = TK_COMMA;
- idx++;
+ index++;
return OK;
};
case '"': {
- idx++;
+ index++;
String str;
while (true) {
- if (p_str[idx] == 0) {
+ if (p_str[index] == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
- } else if (p_str[idx] == '"') {
- idx++;
+ } else if (p_str[index] == '"') {
+ index++;
break;
- } else if (p_str[idx] == '\\') {
+ } else if (p_str[index] == '\\') {
//escaped characters...
- idx++;
- CharType next = p_str[idx];
+ index++;
+ CharType next = p_str[index];
if (next == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
@@ -177,7 +177,7 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke
//hexnumbarh - oct is deprecated
for (int j = 0; j < 4; j++) {
- CharType c = p_str[idx + j + 1];
+ CharType c = p_str[index + j + 1];
if (c == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
@@ -204,7 +204,7 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke
res <<= 4;
res |= v;
}
- idx += 4; //will add at the end anyway
+ index += 4; //will add at the end anyway
} break;
//case '\"': res='\"'; break;
@@ -220,11 +220,11 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke
str += res;
} else {
- if (p_str[idx] == '\n')
+ if (p_str[index] == '\n')
line++;
- str += p_str[idx];
+ str += p_str[index];
}
- idx++;
+ index++;
}
r_token.type = TK_STRING;
@@ -234,28 +234,28 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke
} break;
default: {
- if (p_str[idx] <= 32) {
- idx++;
+ if (p_str[index] <= 32) {
+ index++;
break;
}
- if (p_str[idx] == '-' || (p_str[idx] >= '0' && p_str[idx] <= '9')) {
+ if (p_str[index] == '-' || (p_str[index] >= '0' && p_str[index] <= '9')) {
//a number
const CharType *rptr;
- double number = String::to_double(&p_str[idx], &rptr);
- idx += (rptr - &p_str[idx]);
+ double number = String::to_double(&p_str[index], &rptr);
+ index += (rptr - &p_str[index]);
r_token.type = TK_NUMBER;
r_token.value = number;
return OK;
- } else if ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) {
+ } else if ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) {
String id;
- while ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) {
+ while ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) {
- id += p_str[idx];
- idx++;
+ id += p_str[index];
+ index++;
}
r_token.type = TK_IDENTIFIER;
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 75dfd563dd..c5d59f786d 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -30,12 +30,60 @@
#include "marshalls.h"
#include "os/keyboard.h"
#include "print_string.h"
+#include "reference.h"
#include <stdio.h>
+void EncodedObjectAsID::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_object_id", "id"), &EncodedObjectAsID::set_object_id);
+ ClassDB::bind_method(D_METHOD("get_object_id"), &EncodedObjectAsID::get_object_id);
+}
+
+void EncodedObjectAsID::set_object_id(ObjectID p_id) {
+ id = p_id;
+}
+
+ObjectID EncodedObjectAsID::get_object_id() const {
+
+ return id;
+}
+
+EncodedObjectAsID::EncodedObjectAsID() {
+
+ id = 0;
+}
+
#define ENCODE_MASK 0xFF
#define ENCODE_FLAG_64 1 << 16
+#define ENCODE_FLAG_OBJECT_AS_ID 1 << 16
+
+static Error _decode_string(const uint8_t *&buf, int &len, int *r_len, String &r_string) {
+ ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
+
+ uint32_t strlen = decode_uint32(buf);
+ buf += 4;
+ len -= 4;
+ ERR_FAIL_COND_V((int)strlen > len, ERR_FILE_EOF);
-Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len) {
+ String str;
+ str.parse_utf8((const char *)buf, strlen);
+ r_string = str;
+
+ //handle padding
+ if (strlen % 4) {
+ strlen += 4 - strlen % 4;
+ }
+
+ buf += strlen;
+ len -= strlen;
+
+ if (r_len) {
+ (*r_len) += 4 + strlen;
+ }
+
+ return OK;
+}
+
+Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len, bool p_allow_objects) {
const uint8_t *buf = p_buffer;
int len = p_len;
@@ -104,22 +152,12 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::STRING: {
- ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
- uint32_t strlen = decode_uint32(buf);
- buf += 4;
- len -= 4;
- ERR_FAIL_COND_V((int)strlen > len, ERR_INVALID_DATA);
-
String str;
- str.parse_utf8((const char *)buf, strlen);
+ Error err = _decode_string(buf, len, r_len, str);
+ if (err)
+ return err;
r_variant = str;
- if (r_len) {
- if (strlen % 4)
- (*r_len) += 4 - strlen % 4;
- (*r_len) += 4 + strlen;
- }
-
} break;
// math types
@@ -363,7 +401,77 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::OBJECT: {
- r_variant = (Object *)NULL;
+ if (type & ENCODE_FLAG_OBJECT_AS_ID) {
+ //this _is_ allowed
+ ObjectID val = decode_uint64(buf);
+ if (r_len)
+ (*r_len) += 8;
+
+ if (val == 0) {
+ r_variant = (Object *)NULL;
+ } else {
+ Ref<EncodedObjectAsID> obj_as_id;
+ obj_as_id.instance();
+ obj_as_id->set_object_id(val);
+
+ r_variant = obj_as_id;
+ }
+
+ } else {
+ ERR_FAIL_COND_V(!p_allow_objects, ERR_UNAUTHORIZED);
+
+ String str;
+ Error err = _decode_string(buf, len, r_len, str);
+ if (err)
+ return err;
+
+ if (str == String()) {
+ r_variant = (Object *)NULL;
+ } else {
+
+ Object *obj = ClassDB::instance(str);
+
+ ERR_FAIL_COND_V(!obj, ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
+
+ int32_t count = decode_uint32(buf);
+ buf += 4;
+ len -= 4;
+ if (r_len) {
+ (*r_len) += 4;
+ }
+
+ for (int i = 0; i < count; i++) {
+
+ str = String();
+ err = _decode_string(buf, len, r_len, str);
+ if (err)
+ return err;
+
+ Variant value;
+ int used;
+ err = decode_variant(value, buf, len, &used, p_allow_objects);
+ if (err)
+ return err;
+
+ buf += used;
+ len -= used;
+ if (r_len) {
+ (*r_len) += used;
+ }
+
+ obj->set(str, value);
+ }
+
+ if (obj->cast_to<Reference>()) {
+ REF ref = REF(obj->cast_to<Reference>());
+ r_variant = ref;
+ } else {
+ r_variant = obj;
+ }
+ }
+ }
+
} break;
case Variant::DICTIONARY: {
@@ -386,7 +494,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
Variant key, value;
int used;
- Error err = decode_variant(key, buf, len, &used);
+ Error err = decode_variant(key, buf, len, &used, p_allow_objects);
ERR_FAIL_COND_V(err, err);
buf += used;
@@ -395,7 +503,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
(*r_len) += used;
}
- err = decode_variant(value, buf, len, &used);
+ err = decode_variant(value, buf, len, &used, p_allow_objects);
ERR_FAIL_COND_V(err, err);
buf += used;
@@ -430,7 +538,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
int used = 0;
Variant v;
- Error err = decode_variant(v, buf, len, &used);
+ Error err = decode_variant(v, buf, len, &used, p_allow_objects);
ERR_FAIL_COND_V(err, err);
buf += used;
len -= used;
@@ -691,7 +799,22 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
return OK;
}
-Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
+static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) {
+
+ CharString utf8 = p_string.utf8();
+
+ if (buf) {
+ encode_uint32(utf8.length(), buf);
+ buf += 4;
+ copymem(buf, utf8.get_data(), utf8.length());
+ }
+
+ r_len += 4 + utf8.length();
+ while (r_len % 4)
+ r_len++; //pad
+}
+
+Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_object_as_id) {
uint8_t *buf = r_buffer;
@@ -715,6 +838,11 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
flags |= ENCODE_FLAG_64; //always encode real as double
}
} break;
+ case Variant::OBJECT: {
+ if (p_object_as_id) {
+ flags |= ENCODE_FLAG_OBJECT_AS_ID;
+ }
+ } break;
}
if (buf) {
@@ -831,17 +959,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
} break;
case Variant::STRING: {
- CharString utf8 = p_variant.operator String().utf8();
-
- if (buf) {
- encode_uint32(utf8.length(), buf);
- buf += 4;
- copymem(buf, utf8.get_data(), utf8.length());
- }
-
- r_len += 4 + utf8.length();
- while (r_len % 4)
- r_len++; //pad
+ _encode_string(p_variant, buf, r_len);
} break;
// math types
@@ -991,9 +1109,74 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
ERR_EXPLAIN("Can't marshallize resources");
ERR_FAIL_V(ERR_INVALID_DATA); //no, i'm sorry, no go
} break;*/
- case Variant::_RID:
+ case Variant::_RID: {
+
+ } break;
case Variant::OBJECT: {
+ if (p_object_as_id) {
+
+ if (buf) {
+
+ Object *obj = p_variant;
+ ObjectID id = 0;
+ if (obj && ObjectDB::instance_validate(obj)) {
+ id = obj->get_instance_id();
+ }
+
+ encode_uint64(id, buf);
+ }
+
+ r_len += 8;
+
+ } else {
+ Object *obj = p_variant;
+ if (!obj) {
+ if (buf) {
+ encode_uint32(0, buf);
+ buf += 4;
+ r_len += 4;
+ }
+ } else {
+ _encode_string(obj->get_class(), buf, r_len);
+
+ List<PropertyInfo> props;
+ obj->get_property_list(&props);
+
+ int pc = 0;
+ for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
+
+ if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
+ continue;
+ pc++;
+ }
+
+ if (buf) {
+ encode_uint32(pc, buf);
+ buf += 4;
+ }
+
+ r_len += 4;
+
+ for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
+
+ if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
+ continue;
+
+ _encode_string(E->get().name, buf, r_len);
+
+ int len;
+ Error err = encode_variant(obj->get(E->get().name), buf, len, p_object_as_id);
+ if (err)
+ return err;
+ ERR_FAIL_COND_V(len % 4, ERR_BUG);
+ r_len += len;
+ if (buf)
+ buf += len;
+ }
+ }
+ }
+
} break;
case Variant::DICTIONARY: {
@@ -1024,12 +1207,12 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
r_len++; //pad
*/
int len;
- encode_variant(E->get(), buf, len);
+ encode_variant(E->get(), buf, len, p_object_as_id);
ERR_FAIL_COND_V(len % 4, ERR_BUG);
r_len += len;
if (buf)
buf += len;
- encode_variant(d[E->get()], buf, len);
+ encode_variant(d[E->get()], buf, len, p_object_as_id);
ERR_FAIL_COND_V(len % 4, ERR_BUG);
r_len += len;
if (buf)
@@ -1051,7 +1234,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) {
for (int i = 0; i < v.size(); i++) {
int len;
- encode_variant(v.get(i), buf, len);
+ encode_variant(v.get(i), buf, len, p_object_as_id);
ERR_FAIL_COND_V(len % 4, ERR_BUG);
r_len += len;
if (buf)
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index eb2785aa4e..234ae3b183 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -32,8 +32,8 @@
#include "typedefs.h"
+#include "reference.h"
#include "variant.h"
-
/**
* Miscellaneous helpers for marshalling data types, and encoding
* in an endian independent way
@@ -183,7 +183,22 @@ static inline double decode_double(const uint8_t *p_arr) {
return md.d;
}
-Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = NULL);
-Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len);
+class EncodedObjectAsID : public Reference {
+ GDCLASS(EncodedObjectAsID, Reference);
+
+ ObjectID id;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_object_id(ObjectID p_id);
+ ObjectID get_object_id() const;
+
+ EncodedObjectAsID();
+};
+
+Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = NULL, bool p_allow_objects = true);
+Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_object_as_id = false);
#endif
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index c028d7d197..ca00b8b480 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -35,9 +35,20 @@
PacketPeer::PacketPeer() {
+ allow_object_decoding = false;
last_get_error = OK;
}
+void PacketPeer::set_allow_object_decoding(bool p_enable) {
+
+ allow_object_decoding = p_enable;
+}
+
+bool PacketPeer::is_object_decoding_allowed() const {
+
+ return allow_object_decoding;
+}
+
Error PacketPeer::get_packet_buffer(PoolVector<uint8_t> &r_buffer) const {
const uint8_t *buffer;
@@ -75,13 +86,13 @@ Error PacketPeer::get_var(Variant &r_variant) const {
if (err)
return err;
- return decode_variant(r_variant, buffer, buffer_size);
+ return decode_variant(r_variant, buffer, buffer_size, NULL, allow_object_decoding);
}
Error PacketPeer::put_var(const Variant &p_packet) {
int len;
- Error err = encode_variant(p_packet, NULL, len); // compute len first
+ Error err = encode_variant(p_packet, NULL, len, !allow_object_decoding); // compute len first
if (err)
return err;
@@ -90,7 +101,7 @@ Error PacketPeer::put_var(const Variant &p_packet) {
uint8_t *buf = (uint8_t *)alloca(len);
ERR_FAIL_COND_V(!buf, ERR_OUT_OF_MEMORY);
- err = encode_variant(p_packet, buf, len);
+ err = encode_variant(p_packet, buf, len, !allow_object_decoding);
ERR_FAIL_COND_V(err, err);
return put_packet(buf, len);
@@ -126,6 +137,9 @@ void PacketPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("put_packet", "buffer"), &PacketPeer::_put_packet);
ClassDB::bind_method(D_METHOD("get_packet_error"), &PacketPeer::_get_packet_error);
ClassDB::bind_method(D_METHOD("get_available_packet_count"), &PacketPeer::get_available_packet_count);
+
+ ClassDB::bind_method(D_METHOD("set_allow_object_decoding", "enable"), &PacketPeer::set_allow_object_decoding);
+ ClassDB::bind_method(D_METHOD("is_object_decoding_allowed"), &PacketPeer::is_object_decoding_allowed);
};
/***************/
@@ -141,6 +155,8 @@ void PacketPeerStream::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_stream_peer", "peer"), &PacketPeerStream::_set_stream_peer);
ClassDB::bind_method(D_METHOD("set_input_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_input_buffer_max_size);
ClassDB::bind_method(D_METHOD("set_output_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_output_buffer_max_size);
+ ClassDB::bind_method(D_METHOD("get_input_buffer_max_size"), &PacketPeerStream::get_input_buffer_max_size);
+ ClassDB::bind_method(D_METHOD("get_output_buffer_max_size"), &PacketPeerStream::get_output_buffer_max_size);
}
Error PacketPeerStream::_poll_buffer() const {
@@ -251,12 +267,22 @@ void PacketPeerStream::set_input_buffer_max_size(int p_max_size) {
ERR_EXPLAIN("Buffer in use, resizing would cause loss of data");
ERR_FAIL_COND(ring_buffer.data_left());
ring_buffer.resize(nearest_shift(p_max_size + 4));
- input_buffer.resize(nearest_power_of_2(p_max_size + 4));
+ input_buffer.resize(next_power_of_2(p_max_size + 4));
+}
+
+int PacketPeerStream::get_input_buffer_max_size() const {
+
+ return input_buffer.size() - 4;
}
void PacketPeerStream::set_output_buffer_max_size(int p_max_size) {
- output_buffer.resize(nearest_power_of_2(p_max_size + 4));
+ output_buffer.resize(next_power_of_2(p_max_size + 4));
+}
+
+int PacketPeerStream::get_output_buffer_max_size() const {
+
+ return output_buffer.size() - 4;
}
PacketPeerStream::PacketPeerStream() {
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index ed6b252d80..597119f7f4 100644
--- a/core/io/packet_peer.h
+++ b/core/io/packet_peer.h
@@ -48,6 +48,8 @@ class PacketPeer : public Reference {
mutable Error last_get_error;
+ bool allow_object_decoding;
+
public:
virtual int get_available_packet_count() const = 0;
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const = 0; ///< buffer is GONE after next get_packet
@@ -63,6 +65,9 @@ public:
virtual Error get_var(Variant &r_variant) const;
virtual Error put_var(const Variant &p_packet);
+ void set_allow_object_decoding(bool p_enable);
+ bool is_object_decoding_allowed() const;
+
PacketPeer();
~PacketPeer() {}
};
@@ -93,7 +98,9 @@ public:
void set_stream_peer(const Ref<StreamPeer> &p_peer);
void set_input_buffer_max_size(int p_max_size);
+ int get_input_buffer_max_size() const;
void set_output_buffer_max_size(int p_max_size);
+ int get_output_buffer_max_size() const;
PacketPeerStream();
};
diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h
index a39eb6bcfd..007b810b67 100644
--- a/core/io/packet_peer_udp.h
+++ b/core/io/packet_peer_udp.h
@@ -49,7 +49,7 @@ protected:
public:
void set_blocking_mode(bool p_enable);
- virtual Error listen(int p_port, IP_Address p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536) = 0;
+ virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536) = 0;
virtual void close() = 0;
virtual Error wait() = 0;
virtual bool is_listening() const = 0;
diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp
index 61da4f3350..7033dbe5fb 100644
--- a/core/io/resource_import.cpp
+++ b/core/io/resource_import.cpp
@@ -199,6 +199,52 @@ String ResourceFormatImporter::get_internal_resource_path(const String &p_path)
return pat.path;
}
+void ResourceFormatImporter::get_internal_resource_path_list(const String &p_path, List<String> *r_paths) {
+
+ Error err;
+ FileAccess *f = FileAccess::open(p_path + ".import", FileAccess::READ, &err);
+
+ if (!f)
+ return;
+
+ VariantParser::StreamFile stream;
+ stream.f = f;
+
+ String assign;
+ Variant value;
+ VariantParser::Tag next_tag;
+
+ int lines = 0;
+ String error_text;
+ while (true) {
+
+ assign = Variant();
+ next_tag.fields.clear();
+ next_tag.name = String();
+
+ err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+ if (err == ERR_FILE_EOF) {
+ memdelete(f);
+ return;
+ } else if (err != OK) {
+ ERR_PRINTS("ResourceFormatImporter::get_internal_resource_path_list - " + p_path + ".import:" + itos(lines) + " error: " + error_text);
+ memdelete(f);
+ return;
+ }
+
+ if (assign != String()) {
+ if (assign.begins_with("path.")) {
+ r_paths->push_back(value);
+ } else if (assign == "path") {
+ r_paths->push_back(value);
+ }
+ } else if (next_tag.name != "remap") {
+ break;
+ }
+ }
+ memdelete(f);
+}
+
String ResourceFormatImporter::get_resource_type(const String &p_path) const {
PathAndType pat;
diff --git a/core/io/resource_import.h b/core/io/resource_import.h
index d3f98cbc07..67fd870178 100644
--- a/core/io/resource_import.h
+++ b/core/io/resource_import.h
@@ -59,6 +59,7 @@ public:
virtual bool can_be_imported(const String &p_path) const;
String get_internal_resource_path(const String &p_path) const;
+ void get_internal_resource_path_list(const String &p_path, List<String> *r_paths);
void add_importer(const Ref<ResourceImporter> &p_importer) { importers.insert(p_importer); }
void remove_importer(const Ref<ResourceImporter> &p_importer) { importers.erase(p_importer); }
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index fdad7c7bdf..7042700d92 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -210,7 +210,7 @@ void StreamPeer::put_double(double p_val) {
void StreamPeer::put_utf8_string(const String &p_string) {
CharString cs = p_string.utf8();
- put_u32(p_string.length());
+ put_u32(cs.length());
put_data((const uint8_t *)cs.get_data(), cs.length());
}
void StreamPeer::put_var(const Variant &p_variant) {
@@ -459,8 +459,9 @@ Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_
}
PoolVector<uint8_t>::Read r = data.read();
- copymem(p_buffer, r.ptr(), r_received);
+ copymem(p_buffer, r.ptr() + pointer, r_received);
+ pointer += r_received;
// FIXME: return what? OK or ERR_*
}
diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h
index 4e7fa7cf3e..b4ff3246ad 100644
--- a/core/io/tcp_server.h
+++ b/core/io/tcp_server.h
@@ -45,7 +45,7 @@ protected:
static void _bind_methods();
public:
- virtual Error listen(uint16_t p_port, const IP_Address p_bind_address = IP_Address("*")) = 0;
+ virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*")) = 0;
virtual bool is_connection_available() const = 0;
virtual Ref<StreamPeerTCP> take_connection() = 0;
diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp
index 2bea514d37..9a5811244a 100644
--- a/core/math/geometry.cpp
+++ b/core/math/geometry.cpp
@@ -1076,8 +1076,8 @@ void Geometry::make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_resu
for (int i = 0; i < results.size(); i++) {
- real_t h = nearest_power_of_2(results[i].max_h);
- real_t w = nearest_power_of_2(results[i].max_w);
+ real_t h = next_power_of_2(results[i].max_h);
+ real_t w = next_power_of_2(results[i].max_w);
real_t aspect = h > w ? h / w : w / h;
if (aspect < best_aspect) {
best = i;
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp
index 52e240ed47..956cfe5258 100644
--- a/core/math/math_2d.cpp
+++ b/core/math/math_2d.cpp
@@ -281,22 +281,22 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c
}
// slide returns the component of the vector along the given plane, specified by its normal vector.
-Vector2 Vector2::slide(const Vector2 &p_n) const {
+Vector2 Vector2::slide(const Vector2 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector2());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector2());
#endif
- return *this - p_n * this->dot(p_n);
+ return *this - p_normal * this->dot(p_normal);
}
-Vector2 Vector2::bounce(const Vector2 &p_n) const {
- return -reflect(p_n);
+Vector2 Vector2::bounce(const Vector2 &p_normal) const {
+ return -reflect(p_normal);
}
-Vector2 Vector2::reflect(const Vector2 &p_n) const {
+Vector2 Vector2::reflect(const Vector2 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector2());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector2());
#endif
- return 2.0 * p_n * this->dot(p_n) - *this;
+ return 2.0 * p_normal * this->dot(p_normal) - *this;
}
bool Rect2::intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos, Point2 *r_normal) const {
diff --git a/core/math/math_2d.h b/core/math/math_2d.h
index b679371e03..6fea6c8adb 100644
--- a/core/math/math_2d.h
+++ b/core/math/math_2d.h
@@ -43,6 +43,14 @@ enum Margin {
MARGIN_BOTTOM
};
+enum Corner {
+
+ CORNER_TOP_LEFT,
+ CORNER_TOP_RIGHT,
+ CORNER_BOTTOM_RIGHT,
+ CORNER_BOTTOM_LEFT
+};
+
enum Orientation {
HORIZONTAL,
@@ -107,9 +115,9 @@ struct Vector2 {
Vector2 cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
Vector2 cubic_interpolate_soft(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
- Vector2 slide(const Vector2 &p_vec) const;
- Vector2 bounce(const Vector2 &p_vec) const;
- Vector2 reflect(const Vector2 &p_vec) const;
+ Vector2 slide(const Vector2 &p_normal) const;
+ Vector2 bounce(const Vector2 &p_normal) const;
+ Vector2 reflect(const Vector2 &p_normal) const;
Vector2 operator+(const Vector2 &p_v) const;
void operator+=(const Vector2 &p_v);
@@ -621,9 +629,9 @@ struct Transform2D {
void affine_invert();
Transform2D affine_inverse() const;
- void set_rotation(real_t p_phi);
+ void set_rotation(real_t p_rot);
real_t get_rotation() const;
- _FORCE_INLINE_ void set_rotation_and_scale(real_t p_phi, const Size2 &p_scale);
+ _FORCE_INLINE_ void set_rotation_and_scale(real_t p_rot, const Size2 &p_scale);
void rotate(real_t p_phi);
void scale(const Size2 &p_scale);
@@ -660,8 +668,8 @@ struct Transform2D {
_FORCE_INLINE_ Vector2 basis_xform_inv(const Vector2 &p_vec) const;
_FORCE_INLINE_ Vector2 xform(const Vector2 &p_vec) const;
_FORCE_INLINE_ Vector2 xform_inv(const Vector2 &p_vec) const;
- _FORCE_INLINE_ Rect2 xform(const Rect2 &p_vec) const;
- _FORCE_INLINE_ Rect2 xform_inv(const Rect2 &p_vec) const;
+ _FORCE_INLINE_ Rect2 xform(const Rect2 &p_rect) const;
+ _FORCE_INLINE_ Rect2 xform_inv(const Rect2 &p_rect) const;
operator String() const;
@@ -833,25 +841,25 @@ next4:
return true;
}
-Vector2 Transform2D::basis_xform(const Vector2 &v) const {
+Vector2 Transform2D::basis_xform(const Vector2 &p_vec) const {
return Vector2(
- tdotx(v),
- tdoty(v));
+ tdotx(p_vec),
+ tdoty(p_vec));
}
-Vector2 Transform2D::basis_xform_inv(const Vector2 &v) const {
+Vector2 Transform2D::basis_xform_inv(const Vector2 &p_vec) const {
return Vector2(
- elements[0].dot(v),
- elements[1].dot(v));
+ elements[0].dot(p_vec),
+ elements[1].dot(p_vec));
}
-Vector2 Transform2D::xform(const Vector2 &v) const {
+Vector2 Transform2D::xform(const Vector2 &p_vec) const {
return Vector2(
- tdotx(v),
- tdoty(v)) +
+ tdotx(p_vec),
+ tdoty(p_vec)) +
elements[2];
}
Vector2 Transform2D::xform_inv(const Vector2 &p_vec) const {
diff --git a/core/math/octree.h b/core/math/octree.h
index 010c1b18f7..2e37056030 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -351,7 +351,7 @@ private:
};
void _cull_convex(Octant *p_octant, _CullConvexData *p_cull);
- void _cull_AABB(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
+ void _cull_aabb(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
void _cull_segment(Octant *p_octant, const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
void _cull_point(Octant *p_octant, const Vector3 &p_point, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask);
@@ -380,7 +380,7 @@ public:
int get_subindex(OctreeElementID p_id) const;
int cull_convex(const Vector<Plane> &p_convex, T **p_result_array, int p_result_max, uint32_t p_mask = 0xFFFFFFFF);
- int cull_AABB(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
+ int cull_aabb(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
int cull_segment(const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
int cull_point(const Vector3 &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
@@ -1095,7 +1095,7 @@ void Octree<T, use_pairs, AL>::_cull_convex(Octant *p_octant, _CullConvexData *p
}
template <class T, bool use_pairs, class AL>
-void Octree<T, use_pairs, AL>::_cull_AABB(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
+void Octree<T, use_pairs, AL>::_cull_aabb(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
if (*p_result_idx == p_result_max)
return; //pointless
@@ -1160,7 +1160,7 @@ void Octree<T, use_pairs, AL>::_cull_AABB(Octant *p_octant, const Rect3 &p_aabb,
for (int i = 0; i < 8; i++) {
if (p_octant->children[i] && p_octant->children[i]->aabb.intersects_inclusive(p_aabb)) {
- _cull_AABB(p_octant->children[i], p_aabb, p_result_array, p_result_idx, p_result_max, p_subindex_array, p_mask);
+ _cull_aabb(p_octant->children[i], p_aabb, p_result_array, p_result_idx, p_result_max, p_subindex_array, p_mask);
}
}
}
@@ -1336,14 +1336,14 @@ int Octree<T, use_pairs, AL>::cull_convex(const Vector<Plane> &p_convex, T **p_r
}
template <class T, bool use_pairs, class AL>
-int Octree<T, use_pairs, AL>::cull_AABB(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
+int Octree<T, use_pairs, AL>::cull_aabb(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array, uint32_t p_mask) {
if (!root)
return 0;
int result_count = 0;
pass++;
- _cull_AABB(root, p_aabb, p_result_array, &result_count, p_result_max, p_subindex_array, p_mask);
+ _cull_aabb(root, p_aabb, p_result_array, &result_count, p_result_max, p_subindex_array, p_mask);
return result_count;
}
diff --git a/core/math/plane.cpp b/core/math/plane.cpp
index f5e92866c4..17928d07c3 100644
--- a/core/math/plane.cpp
+++ b/core/math/plane.cpp
@@ -103,7 +103,7 @@ bool Plane::intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r
return true;
}
-bool Plane::intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersection) const {
+bool Plane::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection) const {
Vector3 segment = p_dir;
real_t den = normal.dot(segment);
@@ -128,7 +128,7 @@ bool Plane::intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersectio
return true;
}
-bool Plane::intersects_segment(Vector3 p_begin, Vector3 p_end, Vector3 *p_intersection) const {
+bool Plane::intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 *p_intersection) const {
Vector3 segment = p_begin - p_end;
real_t den = normal.dot(segment);
diff --git a/core/math/plane.h b/core/math/plane.h
index 92ebcd8024..73d584e553 100644
--- a/core/math/plane.h
+++ b/core/math/plane.h
@@ -56,8 +56,8 @@ public:
/* intersections */
bool intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r_result = 0) const;
- bool intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersection) const;
- bool intersects_segment(Vector3 p_begin, Vector3 p_end, Vector3 *p_intersection) const;
+ bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection) const;
+ bool intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 *p_intersection) const;
_FORCE_INLINE_ Vector3 project(const Vector3 &p_point) const {
diff --git a/core/math/rect3.h b/core/math/rect3.h
index e5d7462009..4890a19d99 100644
--- a/core/math/rect3.h
+++ b/core/math/rect3.h
@@ -47,12 +47,12 @@ public:
real_t get_area() const; /// get area
_FORCE_INLINE_ bool has_no_area() const {
- return (size.x <= CMP_EPSILON || size.y <= CMP_EPSILON || size.z <= CMP_EPSILON);
+ return (size.x <= 0 || size.y <= 0 || size.z <= 0);
}
_FORCE_INLINE_ bool has_no_surface() const {
- return (size.x <= CMP_EPSILON && size.y <= CMP_EPSILON && size.z <= CMP_EPSILON);
+ return (size.x <= 0 && size.y <= 0 && size.z <= 0);
}
const Vector3 &get_position() const { return position; }
@@ -72,9 +72,9 @@ public:
Rect3 intersection(const Rect3 &p_aabb) const; ///get box where two intersect, empty if no intersection occurs
bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
- _FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &from, const Vector3 &p_dir, real_t t0, real_t t1) const;
+ _FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const;
- _FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_plane, int p_plane_count) const;
+ _FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_planes, int p_plane_count) const;
bool intersects_plane(const Plane &p_plane) const;
_FORCE_INLINE_ bool has_point(const Vector3 &p_point) const;
@@ -326,27 +326,27 @@ inline real_t Rect3::get_shortest_axis_size() const {
return max_size;
}
-bool Rect3::smits_intersect_ray(const Vector3 &from, const Vector3 &dir, real_t t0, real_t t1) const {
+bool Rect3::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const {
- real_t divx = 1.0 / dir.x;
- real_t divy = 1.0 / dir.y;
- real_t divz = 1.0 / dir.z;
+ real_t divx = 1.0 / p_dir.x;
+ real_t divy = 1.0 / p_dir.y;
+ real_t divz = 1.0 / p_dir.z;
Vector3 upbound = position + size;
real_t tmin, tmax, tymin, tymax, tzmin, tzmax;
- if (dir.x >= 0) {
- tmin = (position.x - from.x) * divx;
- tmax = (upbound.x - from.x) * divx;
+ if (p_dir.x >= 0) {
+ tmin = (position.x - p_from.x) * divx;
+ tmax = (upbound.x - p_from.x) * divx;
} else {
- tmin = (upbound.x - from.x) * divx;
- tmax = (position.x - from.x) * divx;
+ tmin = (upbound.x - p_from.x) * divx;
+ tmax = (position.x - p_from.x) * divx;
}
- if (dir.y >= 0) {
- tymin = (position.y - from.y) * divy;
- tymax = (upbound.y - from.y) * divy;
+ if (p_dir.y >= 0) {
+ tymin = (position.y - p_from.y) * divy;
+ tymax = (upbound.y - p_from.y) * divy;
} else {
- tymin = (upbound.y - from.y) * divy;
- tymax = (position.y - from.y) * divy;
+ tymin = (upbound.y - p_from.y) * divy;
+ tymax = (position.y - p_from.y) * divy;
}
if ((tmin > tymax) || (tymin > tmax))
return false;
@@ -354,12 +354,12 @@ bool Rect3::smits_intersect_ray(const Vector3 &from, const Vector3 &dir, real_t
tmin = tymin;
if (tymax < tmax)
tmax = tymax;
- if (dir.z >= 0) {
- tzmin = (position.z - from.z) * divz;
- tzmax = (upbound.z - from.z) * divz;
+ if (p_dir.z >= 0) {
+ tzmin = (position.z - p_from.z) * divz;
+ tzmax = (upbound.z - p_from.z) * divz;
} else {
- tzmin = (upbound.z - from.z) * divz;
- tzmax = (position.z - from.z) * divz;
+ tzmin = (upbound.z - p_from.z) * divz;
+ tzmax = (position.z - p_from.z) * divz;
}
if ((tmin > tzmax) || (tzmin > tmax))
return false;
diff --git a/core/math/vector3.h b/core/math/vector3.h
index 6a7974681e..c58a86fbdb 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -108,9 +108,9 @@ struct Vector3 {
_FORCE_INLINE_ real_t angle_to(const Vector3 &p_b) const;
- _FORCE_INLINE_ Vector3 slide(const Vector3 &p_vec) const;
- _FORCE_INLINE_ Vector3 bounce(const Vector3 &p_vec) const;
- _FORCE_INLINE_ Vector3 reflect(const Vector3 &p_vec) const;
+ _FORCE_INLINE_ Vector3 slide(const Vector3 &p_normal) const;
+ _FORCE_INLINE_ Vector3 bounce(const Vector3 &p_normal) const;
+ _FORCE_INLINE_ Vector3 reflect(const Vector3 &p_normal) const;
/* Operators */
@@ -410,22 +410,22 @@ void Vector3::zero() {
}
// slide returns the component of the vector along the given plane, specified by its normal vector.
-Vector3 Vector3::slide(const Vector3 &p_n) const {
+Vector3 Vector3::slide(const Vector3 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector3());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector3());
#endif
- return *this - p_n * this->dot(p_n);
+ return *this - p_normal * this->dot(p_normal);
}
-Vector3 Vector3::bounce(const Vector3 &p_n) const {
- return -reflect(p_n);
+Vector3 Vector3::bounce(const Vector3 &p_normal) const {
+ return -reflect(p_normal);
}
-Vector3 Vector3::reflect(const Vector3 &p_n) const {
+Vector3 Vector3::reflect(const Vector3 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector3());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector3());
#endif
- return 2.0 * p_n * this->dot(p_n) - *this;
+ return 2.0 * p_normal * this->dot(p_normal) - *this;
}
#endif
diff --git a/core/method_bind.h b/core/method_bind.h
index 3b4ff96a19..9bf0323733 100644
--- a/core/method_bind.h
+++ b/core/method_bind.h
@@ -150,6 +150,7 @@ VARIANT_ENUM_CAST(Vector3::Axis);
VARIANT_ENUM_CAST(Error);
VARIANT_ENUM_CAST(wchar_t);
VARIANT_ENUM_CAST(Margin);
+VARIANT_ENUM_CAST(Corner);
VARIANT_ENUM_CAST(Orientation);
VARIANT_ENUM_CAST(HAlign);
VARIANT_ENUM_CAST(Variant::Type);
diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h
index ead58c23c8..d8755fd98b 100644
--- a/core/method_ptrcall.h
+++ b/core/method_ptrcall.h
@@ -80,6 +80,26 @@ struct PtrToArg {
} \
}
+#define MAKE_PTRARG_BY_REFERENCE(m_type) \
+ template <> \
+ struct PtrToArg<m_type> { \
+ _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \
+ return *reinterpret_cast<const m_type *>(p_ptr); \
+ } \
+ _FORCE_INLINE_ static void encode(const m_type &p_val, void *p_ptr) { \
+ *((m_type *)p_ptr) = p_val; \
+ } \
+ }; \
+ template <> \
+ struct PtrToArg<const m_type &> { \
+ _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \
+ return *reinterpret_cast<const m_type *>(p_ptr); \
+ } \
+ _FORCE_INLINE_ static void encode(const m_type &p_val, void *p_ptr) { \
+ *((m_type *)p_ptr) = p_val; \
+ } \
+ }
+
MAKE_PTRARG(bool);
MAKE_PTRARGCONV(uint8_t, int64_t);
MAKE_PTRARGCONV(int8_t, int64_t);
@@ -95,14 +115,14 @@ MAKE_PTRARG(double);
MAKE_PTRARG(String);
MAKE_PTRARG(Vector2);
MAKE_PTRARG(Rect2);
-MAKE_PTRARG(Vector3);
+MAKE_PTRARG_BY_REFERENCE(Vector3);
MAKE_PTRARG(Transform2D);
-MAKE_PTRARG(Plane);
+MAKE_PTRARG_BY_REFERENCE(Plane);
MAKE_PTRARG(Quat);
-MAKE_PTRARG(Rect3);
-MAKE_PTRARG(Basis);
-MAKE_PTRARG(Transform);
-MAKE_PTRARG(Color);
+MAKE_PTRARG_BY_REFERENCE(Rect3);
+MAKE_PTRARG_BY_REFERENCE(Basis);
+MAKE_PTRARG_BY_REFERENCE(Transform);
+MAKE_PTRARG_BY_REFERENCE(Color);
MAKE_PTRARG(NodePath);
MAKE_PTRARG(RID);
MAKE_PTRARG(Dictionary);
@@ -114,7 +134,7 @@ MAKE_PTRARG(PoolStringArray);
MAKE_PTRARG(PoolVector2Array);
MAKE_PTRARG(PoolVector3Array);
MAKE_PTRARG(PoolColorArray);
-MAKE_PTRARG(Variant);
+MAKE_PTRARG_BY_REFERENCE(Variant);
//this is for Object
@@ -311,8 +331,29 @@ MAKE_DVECARR(Plane);
} \
}
+#define MAKE_STRINGCONV_BY_REFERENCE(m_type) \
+ template <> \
+ struct PtrToArg<m_type> { \
+ _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \
+ m_type s = *reinterpret_cast<const String *>(p_ptr); \
+ return s; \
+ } \
+ _FORCE_INLINE_ static void encode(const m_type &p_vec, void *p_ptr) { \
+ String *arr = reinterpret_cast<String *>(p_ptr); \
+ *arr = p_vec; \
+ } \
+ }; \
+ \
+ template <> \
+ struct PtrToArg<const m_type &> { \
+ _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \
+ m_type s = *reinterpret_cast<const String *>(p_ptr); \
+ return s; \
+ } \
+ }
+
MAKE_STRINGCONV(StringName);
-MAKE_STRINGCONV(IP_Address);
+MAKE_STRINGCONV_BY_REFERENCE(IP_Address);
template <>
struct PtrToArg<PoolVector<Face3> > {
diff --git a/core/object.cpp b/core/object.cpp
index 62b2b5d545..06c2603b74 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1560,7 +1560,7 @@ void Object::initialize_class() {
initialized = true;
}
-StringName Object::XL_MESSAGE(const StringName &p_message) const {
+StringName Object::tr(const StringName &p_message) const {
if (!_can_translate || !TranslationServer::get_singleton())
return p_message;
@@ -1568,11 +1568,6 @@ StringName Object::XL_MESSAGE(const StringName &p_message) const {
return TranslationServer::get_singleton()->translate(p_message);
}
-StringName Object::tr(const StringName &p_message) const {
-
- return XL_MESSAGE(p_message);
-}
-
void Object::_clear_internal_resource_paths(const Variant &p_var) {
switch (p_var.get_type()) {
@@ -1712,11 +1707,10 @@ void Object::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_block_signals", "enable"), &Object::set_block_signals);
ClassDB::bind_method(D_METHOD("is_blocking_signals"), &Object::is_blocking_signals);
- ClassDB::bind_method(D_METHOD("set_message_translation", "enable"), &Object::set_message_translation);
- ClassDB::bind_method(D_METHOD("can_translate_messages"), &Object::can_translate_messages);
ClassDB::bind_method(D_METHOD("property_list_changed_notify"), &Object::property_list_changed_notify);
- ClassDB::bind_method(D_METHOD("XL_MESSAGE", "message"), &Object::XL_MESSAGE);
+ ClassDB::bind_method(D_METHOD("set_message_translation", "enable"), &Object::set_message_translation);
+ ClassDB::bind_method(D_METHOD("can_translate_messages"), &Object::can_translate_messages);
ClassDB::bind_method(D_METHOD("tr", "message"), &Object::tr);
ClassDB::bind_method(D_METHOD("is_queued_for_deletion"), &Object::is_queued_for_deletion);
diff --git a/core/object.h b/core/object.h
index 551c3c31b9..8a858b5b00 100644
--- a/core/object.h
+++ b/core/object.h
@@ -83,6 +83,7 @@ enum PropertyHint {
PROPERTY_HINT_PROPERTY_OF_BASE_TYPE, ///< a property of a base type
PROPERTY_HINT_PROPERTY_OF_INSTANCE, ///< a property of an instance
PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base
+ PROPERTY_HINT_OBJECT_TOO_BIG, ///< object is too big to send
PROPERTY_HINT_MAX,
};
@@ -443,7 +444,7 @@ private:
mutable StringName _class_name;
mutable const StringName *_class_ptr;
- void _add_user_signal(const String &p_name, const Array &p_pargs = Array());
+ void _add_user_signal(const String &p_name, const Array &p_args = Array());
bool _has_user_signal(const StringName &p_name) const;
Variant _emit_signal(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
Array _get_signal_list() const;
@@ -678,8 +679,7 @@ public:
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
- StringName XL_MESSAGE(const StringName &p_message) const; //translate message (internationalization)
- StringName tr(const StringName &p_message) const; //translate message (alternative)
+ StringName tr(const StringName &p_message) const; // translate message (internationalization)
bool _is_queued_for_deletion; // set to true by SceneTree::queue_delete()
bool is_queued_for_deletion() const;
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 3bd5ac3f41..9d1fefc925 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -475,9 +475,9 @@ void FileAccess::store_buffer(const uint8_t *p_src, int p_length) {
store_8(p_src[i]);
}
-Vector<uint8_t> FileAccess::get_file_as_array(const String &p_file) {
+Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path) {
- FileAccess *f = FileAccess::open(p_file, READ);
+ FileAccess *f = FileAccess::open(p_path, READ);
ERR_FAIL_COND_V(!f, Vector<uint8_t>());
Vector<uint8_t> data;
data.resize(f->get_len());
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 6d3e491167..beed7551fb 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -129,7 +129,7 @@ public:
virtual void store_real(real_t p_real);
virtual void store_string(const String &p_string);
- virtual void store_line(const String &p_string);
+ virtual void store_line(const String &p_line);
virtual void store_pascal_string(const String &p_string);
virtual String get_pascal_string();
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index fe0e2c2524..cb38eb67b6 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -595,6 +595,11 @@ float InputEventJoypadMotion::get_axis_value() const {
return axis_value;
}
+bool InputEventJoypadMotion::is_pressed() const {
+
+ return Math::abs(axis_value) > 0.5f;
+}
+
bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event) const {
Ref<InputEventJoypadMotion> jm = p_event;
diff --git a/core/os/input_event.h b/core/os/input_event.h
index b120d4b840..d1fd7cc90f 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -348,6 +348,7 @@ public:
void set_axis_value(float p_value);
float get_axis_value() const;
+ virtual bool is_pressed() const;
virtual bool action_match(const Ref<InputEvent> &p_event) const;
virtual bool is_action_type() const { return true; }
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index 1ed93e3540..1ef26de183 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -324,7 +324,7 @@ enum KeyModifierMask {
};
String keycode_get_string(uint32_t p_code);
-bool keycode_has_unicode(uint32_t p_unicode);
+bool keycode_has_unicode(uint32_t p_keycode);
int find_keycode(const String &p_code);
int keycode_get_count();
int keycode_get_value_by_index(int p_index);
diff --git a/core/pair.h b/core/pair.h
index d4b1897537..d517339ddf 100644
--- a/core/pair.h
+++ b/core/pair.h
@@ -37,7 +37,7 @@ struct Pair {
S second;
Pair() {}
- Pair(F p_first, S p_second)
+ Pair(F p_first, const S &p_second)
: first(p_first),
second(p_second) {
}
diff --git a/core/project_settings.h b/core/project_settings.h
index c64bb393d1..cee3b3b5f3 100644
--- a/core/project_settings.h
+++ b/core/project_settings.h
@@ -158,7 +158,7 @@ public:
bool is_using_datapack() const;
- void set_registering_order(bool p_registering);
+ void set_registering_order(bool p_enable);
ProjectSettings();
~ProjectSettings();
diff --git a/core/reference.h b/core/reference.h
index 7f48f8323e..69250a4701 100644
--- a/core/reference.h
+++ b/core/reference.h
@@ -374,6 +374,10 @@ struct PtrToArg<const RefPtr &> {
}
};
+#endif // PTRCALL_ENABLED
+
+#ifdef DEBUG_METHODS_ENABLED
+
template <class T>
struct GetTypeInfo<Ref<T> > {
enum { VARIANT_TYPE = Variant::OBJECT };
@@ -392,5 +396,6 @@ struct GetTypeInfo<const Ref<T> &> {
}
};
-#endif
+#endif // DEBUG_METHODS_ENABLED
+
#endif // REFERENCE_H
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 43f781af55..fca9afbf5e 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -39,6 +39,7 @@
#include "input_map.h"
#include "io/config_file.h"
#include "io/http_client.h"
+#include "io/marshalls.h"
#include "io/packet_peer.h"
#include "io/packet_peer_udp.h"
#include "io/pck_packer.h"
@@ -56,7 +57,6 @@
#include "project_settings.h"
#include "translation.h"
#include "undo_redo.h"
-
static ResourceFormatSaverBinary *resource_saver_binary = NULL;
static ResourceFormatLoaderBinary *resource_loader_binary = NULL;
static ResourceFormatImporter *resource_format_importer = NULL;
@@ -157,6 +157,7 @@ void register_core_types() {
ClassDB::register_class<PackedDataContainer>();
ClassDB::register_virtual_class<PackedDataContainerRef>();
ClassDB::register_class<AStar>();
+ ClassDB::register_class<EncodedObjectAsID>();
ip = IP::create();
diff --git a/core/resource.h b/core/resource.h
index 5a4e45da36..bbf233d53e 100644
--- a/core/resource.h
+++ b/core/resource.h
@@ -107,7 +107,7 @@ public:
int get_subindex() const;
virtual Ref<Resource> duplicate(bool p_subresources = false) const;
- Ref<Resource> duplicate_for_local_scene(Node *p_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache);
+ Ref<Resource> duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache);
void set_local_to_scene(bool p_enable);
bool is_local_to_scene() const;
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 3628f2ecaf..25f0044cc6 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -30,10 +30,10 @@
#include "script_debugger_remote.h"
#include "io/ip.h"
+#include "io/marshalls.h"
#include "os/input.h"
#include "os/os.h"
#include "project_settings.h"
-
void ScriptDebuggerRemote::_send_video_memory() {
List<ResourceUsage> usage;
@@ -120,6 +120,18 @@ static ObjectID safe_get_instance_id(const Variant &p_v) {
}
}
+void ScriptDebuggerRemote::_put_variable(const String &p_name, const Variant &p_variable) {
+
+ packet_peer_stream->put_var(p_name);
+ int len = 0;
+ Error err = encode_variant(p_variable, NULL, len);
+ if (len > packet_peer_stream->get_output_buffer_max_size()) { //limit to max size
+ packet_peer_stream->put_var(Variant());
+ } else {
+ packet_peer_stream->put_var(p_variable);
+ }
+}
+
void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue) {
//this function is called when there is a debugger break (bug on script)
@@ -210,14 +222,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue)
while (E) {
- if (F->get().get_type() == Variant::OBJECT) {
- packet_peer_stream->put_var("*" + E->get());
- String pretty_print = F->get().operator String();
- packet_peer_stream->put_var(pretty_print.ascii().get_data());
- } else {
- packet_peer_stream->put_var(E->get());
- packet_peer_stream->put_var(F->get());
- }
+ _put_variable(E->get(), F->get());
E = E->next();
F = F->next();
@@ -231,15 +236,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue)
List<Variant>::Element *F = local_vals.front();
while (E) {
-
- if (F->get().get_type() == Variant::OBJECT) {
- packet_peer_stream->put_var("*" + E->get());
- String pretty_print = F->get().operator String();
- packet_peer_stream->put_var(pretty_print.ascii().get_data());
- } else {
- packet_peer_stream->put_var(E->get());
- packet_peer_stream->put_var(F->get());
- }
+ _put_variable(E->get(), F->get());
E = E->next();
F = F->next();
@@ -429,9 +426,9 @@ void ScriptDebuggerRemote::_err_handler(void *ud, const char *p_func, const char
sdr->mutex->unlock();
}
-bool ScriptDebuggerRemote::_parse_live_edit(const Array &cmd) {
+bool ScriptDebuggerRemote::_parse_live_edit(const Array &p_command) {
- String cmdstr = cmd[0];
+ String cmdstr = p_command[0];
if (!live_edit_funcs || !cmdstr.begins_with("live_"))
return false;
@@ -441,7 +438,7 @@ bool ScriptDebuggerRemote::_parse_live_edit(const Array &cmd) {
if (!live_edit_funcs->root_func)
return true;
//print_line("root: "+Variant(cmd).get_construct_string());
- live_edit_funcs->root_func(live_edit_funcs->udata, cmd[1], cmd[2]);
+ live_edit_funcs->root_func(live_edit_funcs->udata, p_command[1], p_command[2]);
} else if (cmdstr == "live_node_path") {
@@ -449,75 +446,75 @@ bool ScriptDebuggerRemote::_parse_live_edit(const Array &cmd) {
return true;
//print_line("path: "+Variant(cmd).get_construct_string());
- live_edit_funcs->node_path_func(live_edit_funcs->udata, cmd[1], cmd[2]);
+ live_edit_funcs->node_path_func(live_edit_funcs->udata, p_command[1], p_command[2]);
} else if (cmdstr == "live_res_path") {
if (!live_edit_funcs->res_path_func)
return true;
- live_edit_funcs->res_path_func(live_edit_funcs->udata, cmd[1], cmd[2]);
+ live_edit_funcs->res_path_func(live_edit_funcs->udata, p_command[1], p_command[2]);
} else if (cmdstr == "live_node_prop_res") {
if (!live_edit_funcs->node_set_res_func)
return true;
- live_edit_funcs->node_set_res_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->node_set_res_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_node_prop") {
if (!live_edit_funcs->node_set_func)
return true;
- live_edit_funcs->node_set_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->node_set_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_res_prop_res") {
if (!live_edit_funcs->res_set_res_func)
return true;
- live_edit_funcs->res_set_res_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->res_set_res_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_res_prop") {
if (!live_edit_funcs->res_set_func)
return true;
- live_edit_funcs->res_set_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->res_set_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_node_call") {
if (!live_edit_funcs->node_call_func)
return true;
- live_edit_funcs->node_call_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]);
+ live_edit_funcs->node_call_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3], p_command[4], p_command[5], p_command[6], p_command[7]);
} else if (cmdstr == "live_res_call") {
if (!live_edit_funcs->res_call_func)
return true;
- live_edit_funcs->res_call_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]);
+ live_edit_funcs->res_call_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3], p_command[4], p_command[5], p_command[6], p_command[7]);
} else if (cmdstr == "live_create_node") {
- live_edit_funcs->tree_create_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->tree_create_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_instance_node") {
- live_edit_funcs->tree_instance_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->tree_instance_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_remove_node") {
- live_edit_funcs->tree_remove_node_func(live_edit_funcs->udata, cmd[1]);
+ live_edit_funcs->tree_remove_node_func(live_edit_funcs->udata, p_command[1]);
} else if (cmdstr == "live_remove_and_keep_node") {
- live_edit_funcs->tree_remove_and_keep_node_func(live_edit_funcs->udata, cmd[1], cmd[2]);
+ live_edit_funcs->tree_remove_and_keep_node_func(live_edit_funcs->udata, p_command[1], p_command[2]);
} else if (cmdstr == "live_restore_node") {
- live_edit_funcs->tree_restore_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]);
+ live_edit_funcs->tree_restore_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]);
} else if (cmdstr == "live_duplicate_node") {
- live_edit_funcs->tree_duplicate_node_func(live_edit_funcs->udata, cmd[1], cmd[2]);
+ live_edit_funcs->tree_duplicate_node_func(live_edit_funcs->udata, p_command[1], p_command[2]);
} else if (cmdstr == "live_reparent_node") {
- live_edit_funcs->tree_reparent_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3], cmd[4]);
+ live_edit_funcs->tree_reparent_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3], p_command[4]);
} else {
@@ -566,30 +563,19 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
}
Variant var = obj->get(E->get().name);
+ packet_peer_stream->put_var(E->get().type);
+ //only send information that can be sent..
- if (E->get().type == Variant::OBJECT || var.get_type() == Variant::OBJECT) {
-
- ObjectID id2;
- Object *obj = var;
- if (obj) {
- id2 = obj->get_instance_id();
- } else {
- id2 = 0;
- }
+ int len = 0; //test how big is this to encode
+ encode_variant(var, NULL, len);
- packet_peer_stream->put_var(Variant::INT); //hint string
- packet_peer_stream->put_var(PROPERTY_HINT_OBJECT_ID); //hint
- packet_peer_stream->put_var(E->get().hint_string); //hint string
- packet_peer_stream->put_var(id2); //value
+ if (len > packet_peer_stream->get_output_buffer_max_size()) { //limit to max size
+ packet_peer_stream->put_var(PROPERTY_HINT_OBJECT_TOO_BIG);
+ packet_peer_stream->put_var("");
+ packet_peer_stream->put_var(Variant());
} else {
- packet_peer_stream->put_var(E->get().type);
packet_peer_stream->put_var(E->get().hint);
packet_peer_stream->put_var(E->get().hint_string);
- //only send information that can be sent..
-
- if (var.get_type() >= Variant::DICTIONARY) {
- var = Array(); //send none for now, may be to big
- }
packet_peer_stream->put_var(var);
}
}
diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h
index 924e3774a2..cf75c0eb4a 100644
--- a/core/script_debugger_remote.h
+++ b/core/script_debugger_remote.h
@@ -126,6 +126,8 @@ class ScriptDebuggerRemote : public ScriptDebugger {
Vector<FrameData> profile_frame_data;
+ void _put_variable(const String &p_name, const Variant &p_variable);
+
public:
struct ResourceUsage {
diff --git a/core/typedefs.h b/core/typedefs.h
index 40d9ea37b5..34a1a93a3b 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -162,9 +162,9 @@ inline void __swap_tmpl(T &x, T &y) {
#define _add_overflow __builtin_add_overflow
#endif
-/** Function to find the nearest (bigger) power of 2 to an integer */
+/** Function to find the next power of 2 to an integer */
-static _FORCE_INLINE_ unsigned int nearest_power_of_2(unsigned int x) {
+static _FORCE_INLINE_ unsigned int next_power_of_2(unsigned int x) {
--x;
x |= x >> 1;
@@ -176,6 +176,23 @@ static _FORCE_INLINE_ unsigned int nearest_power_of_2(unsigned int x) {
return ++x;
}
+static _FORCE_INLINE_ unsigned int previous_power_of_2(unsigned int x) {
+
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+ return x - (x >> 1);
+}
+
+static _FORCE_INLINE_ unsigned int closest_power_of_2(unsigned int x) {
+
+ unsigned int nx = next_power_of_2(x);
+ unsigned int px = previous_power_of_2(x);
+ return (nx - x) > (x - px) ? px : nx;
+}
+
// We need this definition inside the function below.
static inline int get_shift_from_power_of_2(unsigned int p_pixel);
diff --git a/core/ustring.cpp b/core/ustring.cpp
index ab4528e495..0521966943 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -279,16 +279,16 @@ void String::operator=(const CharType *p_str) {
copy_from(p_str);
}
-bool String::operator==(const StrRange &p_range) const {
+bool String::operator==(const StrRange &p_str_range) const {
- int len = p_range.len;
+ int len = p_str_range.len;
if (length() != len)
return false;
if (empty())
return true;
- const CharType *c_str = p_range.c_str;
+ const CharType *c_str = p_str_range.c_str;
const CharType *dst = &operator[](0);
/* Compare char by char */
diff --git a/core/ustring.h b/core/ustring.h
index d00bfa59b5..1c61e12e85 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -78,7 +78,7 @@ public:
//String operator+(CharType p_char) const;
String &operator+=(const String &);
- String &operator+=(CharType p_str);
+ String &operator+=(CharType p_char);
String &operator+=(const char *p_str);
String &operator+=(const CharType *p_str);
@@ -156,7 +156,7 @@ public:
int get_slice_count(String p_splitter) const;
String get_slice(String p_splitter, int p_slice) const;
- String get_slicec(CharType splitter, int p_slice) const;
+ String get_slicec(CharType p_splitter, int p_slice) const;
Vector<String> split(const String &p_splitter, bool p_allow_empty = true) const;
Vector<String> split_spaces() const;
@@ -186,8 +186,8 @@ public:
bool parse_utf8(const char *p_utf8, int p_len = -1); //return true on error
static String utf8(const char *p_utf8, int p_len = -1);
- static uint32_t hash(const CharType *p_str, int p_len); /* hash the string */
- static uint32_t hash(const CharType *p_str); /* hash the string */
+ static uint32_t hash(const CharType *p_cstr, int p_len); /* hash the string */
+ static uint32_t hash(const CharType *p_cstr); /* hash the string */
static uint32_t hash(const char *p_cstr, int p_len); /* hash the string */
static uint32_t hash(const char *p_cstr); /* hash the string */
uint32_t hash() const; /* hash the string */
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index aabc2546bc..59d31d2586 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -747,6 +747,7 @@ struct _VariantCall {
VCALL_PTR1R(Transform, translated);
VCALL_PTR0R(Transform, orthonormalized);
VCALL_PTR2R(Transform, looking_at);
+ VCALL_PTR2R(Transform, interpolate_with);
static void _call_Transform_xform(Variant &r_ret, Variant &p_self, const Variant **p_args) {
@@ -1691,7 +1692,7 @@ void register_variant_methods() {
ADDFUNC1(TRANSFORM2D, TRANSFORM2D, Transform2D, xform_inv, NIL, "v", varray());
ADDFUNC1(TRANSFORM2D, TRANSFORM2D, Transform2D, basis_xform, NIL, "v", varray());
ADDFUNC1(TRANSFORM2D, TRANSFORM2D, Transform2D, basis_xform_inv, NIL, "v", varray());
- ADDFUNC2(TRANSFORM2D, TRANSFORM2D, Transform2D, interpolate_with, TRANSFORM2D, "m", REAL, "c", varray());
+ ADDFUNC2(TRANSFORM2D, TRANSFORM2D, Transform2D, interpolate_with, TRANSFORM2D, "transform", REAL, "weight", varray());
ADDFUNC0(BASIS, BASIS, Basis, inverse, varray());
ADDFUNC0(BASIS, BASIS, Basis, transposed, varray());
@@ -1718,6 +1719,7 @@ void register_variant_methods() {
ADDFUNC1(TRANSFORM, TRANSFORM, Transform, scaled, VECTOR3, "scale", varray());
ADDFUNC1(TRANSFORM, TRANSFORM, Transform, translated, VECTOR3, "ofs", varray());
ADDFUNC2(TRANSFORM, TRANSFORM, Transform, looking_at, VECTOR3, "target", VECTOR3, "up", varray());
+ ADDFUNC2(TRANSFORM, TRANSFORM, Transform, interpolate_with, TRANSFORM, "transform", REAL, "weight", varray());
ADDFUNC1(TRANSFORM, NIL, Transform, xform, NIL, "v", varray());
ADDFUNC1(TRANSFORM, NIL, Transform, xform_inv, NIL, "v", varray());
diff --git a/core/variant_construct_string.cpp b/core/variant_construct_string.cpp
index 45fe367ce6..fa8a393d08 100644
--- a/core/variant_construct_string.cpp
+++ b/core/variant_construct_string.cpp
@@ -66,7 +66,7 @@ class VariantConstruct {
static Error _get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str);
static Error _parse_value(Variant &value, Token &token, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud);
static Error _parse_array(Array &array, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud);
- static Error _parse_dict(Dictionary &object, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud);
+ static Error _parse_dict(Dictionary &dict, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud);
public:
static Error parse(const String &p_string, Variant &r_ret, String &r_err_str, int &r_err_line, Variant::ObjectConstruct *p_construct, void *p_ud);
@@ -85,15 +85,15 @@ const char *VariantConstruct::tk_name[TK_MAX] = {
"EOF",
};
-Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_token, int &line, String &r_err_str) {
+Error VariantConstruct::_get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str) {
while (true) {
- switch (p_str[idx]) {
+ switch (p_str[index]) {
case '\n': {
line++;
- idx++;
+ index++;
break;
};
case 0: {
@@ -103,54 +103,54 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
case '{': {
r_token.type = TK_CURLY_BRACKET_OPEN;
- idx++;
+ index++;
return OK;
};
case '}': {
r_token.type = TK_CURLY_BRACKET_CLOSE;
- idx++;
+ index++;
return OK;
};
case '[': {
r_token.type = TK_BRACKET_OPEN;
- idx++;
+ index++;
return OK;
};
case ']': {
r_token.type = TK_BRACKET_CLOSE;
- idx++;
+ index++;
return OK;
};
case ':': {
r_token.type = TK_COLON;
- idx++;
+ index++;
return OK;
};
case ',': {
r_token.type = TK_COMMA;
- idx++;
+ index++;
return OK;
};
case '"': {
- idx++;
+ index++;
String str;
while (true) {
- if (p_str[idx] == 0) {
+ if (p_str[index] == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
- } else if (p_str[idx] == '"') {
- idx++;
+ } else if (p_str[index] == '"') {
+ index++;
break;
- } else if (p_str[idx] == '\\') {
+ } else if (p_str[index] == '\\') {
//escaped characters...
- idx++;
- CharType next = p_str[idx];
+ index++;
+ CharType next = p_str[index];
if (next == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
@@ -171,7 +171,7 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
//hexnumbarh - oct is deprecated
for (int j = 0; j < 4; j++) {
- CharType c = p_str[idx + j + 1];
+ CharType c = p_str[index + j + 1];
if (c == 0) {
r_err_str = "Unterminated String";
return ERR_PARSE_ERROR;
@@ -198,7 +198,7 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
res <<= 4;
res |= v;
}
- idx += 4; //will add at the end anyway
+ index += 4; //will add at the end anyway
} break;
default: {
@@ -211,11 +211,11 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
str += res;
} else {
- if (p_str[idx] == '\n')
+ if (p_str[index] == '\n')
line++;
- str += p_str[idx];
+ str += p_str[index];
}
- idx++;
+ index++;
}
r_token.type = TK_STRING;
@@ -225,28 +225,28 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T
} break;
default: {
- if (p_str[idx] <= 32) {
- idx++;
+ if (p_str[index] <= 32) {
+ index++;
break;
}
- if (p_str[idx] == '-' || (p_str[idx] >= '0' && p_str[idx] <= '9')) {
+ if (p_str[index] == '-' || (p_str[index] >= '0' && p_str[index] <= '9')) {
//a number
const CharType *rptr;
- double number = String::to_double(&p_str[idx], &rptr);
- idx += (rptr - &p_str[idx]);
+ double number = String::to_double(&p_str[index], &rptr);
+ index += (rptr - &p_str[index]);
r_token.type = TK_NUMBER;
r_token.value = number;
return OK;
- } else if ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) {
+ } else if ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) {
String id;
- while ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) {
+ while ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) {
- id += p_str[idx];
- idx++;
+ id += p_str[index];
+ index++;
}
r_token.type = TK_IDENTIFIER;
diff --git a/core/vector.h b/core/vector.h
index 5eed8dce96..966832ac50 100644
--- a/core/vector.h
+++ b/core/vector.h
@@ -71,7 +71,7 @@ class Vector {
_FORCE_INLINE_ size_t _get_alloc_size(size_t p_elements) const {
//return nearest_power_of_2_templated(p_elements*sizeof(T)+sizeof(SafeRefCount)+sizeof(int));
- return nearest_power_of_2(p_elements * sizeof(T));
+ return next_power_of_2(p_elements * sizeof(T));
}
_FORCE_INLINE_ bool _get_alloc_size_checked(size_t p_elements, size_t *out) const {
@@ -79,7 +79,7 @@ class Vector {
size_t o;
size_t p;
if (_mul_overflow(p_elements, sizeof(T), &o)) return false;
- *out = nearest_power_of_2(o);
+ *out = next_power_of_2(o);
if (_add_overflow(o, static_cast<size_t>(32), &p)) return false; //no longer allocated here
return true;
#else
@@ -117,7 +117,7 @@ public:
}
_FORCE_INLINE_ bool empty() const { return _ptr == 0; }
Error resize(int p_size);
- bool push_back(T p_elem);
+ bool push_back(const T &p_elem);
void remove(int p_index);
void erase(const T &p_val) {
@@ -129,7 +129,7 @@ public:
template <class T_val>
int find(const T_val &p_val, int p_from = 0) const;
- void set(int p_index, T p_elem);
+ void set(int p_index, const T &p_elem);
T get(int p_index) const;
inline T &operator[](int p_index) {
@@ -336,7 +336,7 @@ void Vector<T>::invert() {
}
template <class T>
-void Vector<T>::set(int p_index, T p_elem) {
+void Vector<T>::set(int p_index, const T &p_elem) {
operator[](p_index) = p_elem;
}
@@ -348,7 +348,7 @@ T Vector<T>::get(int p_index) const {
}
template <class T>
-bool Vector<T>::push_back(T p_elem) {
+bool Vector<T>::push_back(const T &p_elem) {
Error err = resize(size() + 1);
ERR_FAIL_COND_V(err, true)
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index e9902badea..f21fa2c7c0 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -28002,15 +28002,6 @@
Objects also receive notifications ([method _notification]). Notifications are a simple way to notify the object about simple events, so they can all be handled together.
</description>
<methods>
- <method name="XL_MESSAGE" qualifiers="const">
- <return type="String">
- </return>
- <argument index="0" name="message" type="String">
- </argument>
- <description>
- Deprecated, will go away.
- </description>
- </method>
<method name="_get" qualifiers="virtual">
<argument index="0" name="property" type="String">
</argument>
@@ -28301,7 +28292,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Set true if this object can translate strings (in calls to tr() ). Default is true.
+ Define whether this object can translate strings (with calls to [method tr]). Default is true.
</description>
</method>
<method name="set_meta">
@@ -28326,7 +28317,7 @@
<argument index="0" name="message" type="String">
</argument>
<description>
- Translate a message. Only works in message translation is enabled (which is by default). See [method set_message_translation].
+ Translate a message. Only works if message translation is enabled (which it is by default). See [method set_message_translation].
</description>
</method>
</methods>
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp
index 4e6739e8c0..a6b9748129 100644
--- a/drivers/alsa/audio_driver_alsa.cpp
+++ b/drivers/alsa/audio_driver_alsa.cpp
@@ -87,7 +87,7 @@ Error AudioDriverALSA::init() {
CHECK_FAIL(status < 0);
int latency = GLOBAL_DEF("audio/output_latency", 25);
- buffer_size = nearest_power_of_2(latency * mix_rate / 1000);
+ buffer_size = closest_power_of_2(latency * mix_rate / 1000);
// set buffer size from project settings
status = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size);
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index 2abdbe9d0a..6a6611ff81 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -857,8 +857,8 @@ void RasterizerGLES2::texture_allocate(RID p_texture, int p_width, int p_height,
GLenum internal_format;
bool compressed;
- int po2_width = nearest_power_of_2(p_width);
- int po2_height = nearest_power_of_2(p_height);
+ int po2_width = next_power_of_2(p_width);
+ int po2_height = next_power_of_2(p_height);
if (p_flags & VS::TEXTURE_FLAG_VIDEO_SURFACE) {
p_flags &= ~VS::TEXTURE_FLAG_MIPMAPS; // no mipies for video
@@ -977,7 +977,7 @@ void RasterizerGLES2::texture_set_data(RID p_texture, const Image &p_image, VS::
glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // raw Filtering
}
- bool force_clamp_to_edge = !(texture->flags & VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) && (nearest_power_of_2(texture->alloc_height) != texture->alloc_height || nearest_power_of_2(texture->alloc_width) != texture->alloc_width);
+ bool force_clamp_to_edge = !(texture->flags & VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) && (next_power_of_2(texture->alloc_height) != texture->alloc_height || next_power_of_2(texture->alloc_width) != texture->alloc_width);
if (!force_clamp_to_edge && (texture->flags & VS::TEXTURE_FLAG_REPEAT || texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) && texture->target != GL_TEXTURE_CUBE_MAP) {
@@ -1234,7 +1234,7 @@ void RasterizerGLES2::texture_set_flags(RID p_texture, uint32_t p_flags) {
uint32_t cube = texture->flags & VS::TEXTURE_FLAG_CUBEMAP;
texture->flags = p_flags | cube; // can't remove a cube from being a cube
- bool force_clamp_to_edge = !(p_flags & VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) && (nearest_power_of_2(texture->alloc_height) != texture->alloc_height || nearest_power_of_2(texture->alloc_width) != texture->alloc_width);
+ bool force_clamp_to_edge = !(p_flags & VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) && (next_power_of_2(texture->alloc_height) != texture->alloc_height || next_power_of_2(texture->alloc_width) != texture->alloc_width);
if (!force_clamp_to_edge && (texture->flags & VS::TEXTURE_FLAG_REPEAT || texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) && texture->target != GL_TEXTURE_CUBE_MAP) {
@@ -1600,9 +1600,9 @@ RID RasterizerGLES2::material_create() {
return material;
}
-void RasterizerGLES2::material_set_shader(RID p_material, RID p_shader) {
+void RasterizerGLES2::material_set_shader(RID p_shader_material, RID p_shader) {
- Material *material = material_owner.get(p_material);
+ Material *material = material_owner.get(p_shader_material);
ERR_FAIL_COND(!material);
if (material->shader == p_shader)
return;
@@ -1610,9 +1610,9 @@ void RasterizerGLES2::material_set_shader(RID p_material, RID p_shader) {
material->shader_version = 0;
}
-RID RasterizerGLES2::material_get_shader(RID p_material) const {
+RID RasterizerGLES2::material_get_shader(RID p_shader_material) const {
- Material *material = material_owner.get(p_material);
+ Material *material = material_owner.get(p_shader_material);
ERR_FAIL_COND_V(!material, RID());
return material->shader;
}
@@ -2701,7 +2701,7 @@ void RasterizerGLES2::multimesh_set_instance_count(RID p_multimesh, int p_count)
if (use_texture_instancing) {
- if (nearest_power_of_2(p_count) != nearest_power_of_2(multimesh->elements.size())) {
+ if (next_power_of_2(p_count) != next_power_of_2(multimesh->elements.size())) {
if (multimesh->tex_id) {
glDeleteTextures(1, &multimesh->tex_id);
multimesh->tex_id = 0;
@@ -2709,7 +2709,7 @@ void RasterizerGLES2::multimesh_set_instance_count(RID p_multimesh, int p_count)
if (p_count) {
- uint32_t po2 = nearest_power_of_2(p_count);
+ uint32_t po2 = next_power_of_2(p_count);
if (po2 & 0xAAAAAAAA) {
//half width
@@ -3333,7 +3333,7 @@ void RasterizerGLES2::skeleton_resize(RID p_skeleton, int p_bones) {
};
if (use_hw_skeleton_xform) {
- if (nearest_power_of_2(p_bones) != nearest_power_of_2(skeleton->bones.size())) {
+ if (next_power_of_2(p_bones) != next_power_of_2(skeleton->bones.size())) {
if (skeleton->tex_id) {
glDeleteTextures(1, &skeleton->tex_id);
skeleton->tex_id = 0;
@@ -3344,7 +3344,7 @@ void RasterizerGLES2::skeleton_resize(RID p_skeleton, int p_bones) {
glGenTextures(1, &skeleton->tex_id);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, skeleton->tex_id);
- int ps = nearest_power_of_2(p_bones * 3);
+ int ps = next_power_of_2(p_bones * 3);
#ifdef GLEW_ENABLED
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, ps, 1, 0, GL_RGBA, GL_FLOAT, skel_default.ptr());
#else
@@ -3998,7 +3998,7 @@ void RasterizerGLES2::begin_frame() {
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, s->tex_id);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, nearest_power_of_2(s->bones.size() * 3), 1, GL_RGBA, GL_FLOAT, sk_float);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, next_power_of_2(s->bones.size() * 3), 1, GL_RGBA, GL_FLOAT, sk_float);
_skeleton_dirty_list.remove(_skeleton_dirty_list.first());
}
@@ -7891,7 +7891,7 @@ void RasterizerGLES2::canvas_draw_rect(const Rect2 &p_rect, int p_flags, const R
_rinfo.ci_draw_commands++;
}
-void RasterizerGLES2::canvas_draw_style_box(const Rect2 &p_rect, const Rect2 &p_src_region, RID p_texture, const float *p_margin, bool p_draw_center, const Color &p_modulate) {
+void RasterizerGLES2::canvas_draw_style_box(const Rect2 &p_rect, const Rect2 &p_src_region, RID p_texture, const float *p_margins, bool p_draw_center, const Color &p_modulate) {
Color m = p_modulate;
m.a *= canvas_opacity;
@@ -7907,47 +7907,47 @@ void RasterizerGLES2::canvas_draw_style_box(const Rect2 &p_rect, const Rect2 &p_
region.size.height = texture->height;
/* CORNERS */
_draw_textured_quad( // top left
- Rect2(p_rect.pos, Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_TOP])),
- Rect2(region.pos, Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_TOP])),
+ Rect2(p_rect.pos, Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_TOP])),
+ Rect2(region.pos, Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_TOP])),
Size2(texture->width, texture->height));
_draw_textured_quad( // top right
- Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margin[MARGIN_RIGHT], p_rect.pos.y), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_TOP])),
- Rect2(Point2(region.pos.x + region.size.width - p_margin[MARGIN_RIGHT], region.pos.y), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_TOP])),
+ Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margins[MARGIN_RIGHT], p_rect.pos.y), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_TOP])),
+ Rect2(Point2(region.pos.x + region.size.width - p_margins[MARGIN_RIGHT], region.pos.y), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_TOP])),
Size2(texture->width, texture->height));
_draw_textured_quad( // bottom left
- Rect2(Point2(p_rect.pos.x, p_rect.pos.y + p_rect.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_BOTTOM])),
- Rect2(Point2(region.pos.x, region.pos.y + region.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_BOTTOM])),
+ Rect2(Point2(p_rect.pos.x, p_rect.pos.y + p_rect.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_BOTTOM])),
+ Rect2(Point2(region.pos.x, region.pos.y + region.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_BOTTOM])),
Size2(texture->width, texture->height));
_draw_textured_quad( // bottom right
- Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margin[MARGIN_RIGHT], p_rect.pos.y + p_rect.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_BOTTOM])),
- Rect2(Point2(region.pos.x + region.size.width - p_margin[MARGIN_RIGHT], region.pos.y + region.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_BOTTOM])),
+ Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margins[MARGIN_RIGHT], p_rect.pos.y + p_rect.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_BOTTOM])),
+ Rect2(Point2(region.pos.x + region.size.width - p_margins[MARGIN_RIGHT], region.pos.y + region.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_BOTTOM])),
Size2(texture->width, texture->height));
- Rect2 rect_center(p_rect.pos + Point2(p_margin[MARGIN_LEFT], p_margin[MARGIN_TOP]), Size2(p_rect.size.width - p_margin[MARGIN_LEFT] - p_margin[MARGIN_RIGHT], p_rect.size.height - p_margin[MARGIN_TOP] - p_margin[MARGIN_BOTTOM]));
+ Rect2 rect_center(p_rect.pos + Point2(p_margins[MARGIN_LEFT], p_margins[MARGIN_TOP]), Size2(p_rect.size.width - p_margins[MARGIN_LEFT] - p_margins[MARGIN_RIGHT], p_rect.size.height - p_margins[MARGIN_TOP] - p_margins[MARGIN_BOTTOM]));
- Rect2 src_center(Point2(region.pos.x + p_margin[MARGIN_LEFT], region.pos.y + p_margin[MARGIN_TOP]), Size2(region.size.width - p_margin[MARGIN_LEFT] - p_margin[MARGIN_RIGHT], region.size.height - p_margin[MARGIN_TOP] - p_margin[MARGIN_BOTTOM]));
+ Rect2 src_center(Point2(region.pos.x + p_margins[MARGIN_LEFT], region.pos.y + p_margins[MARGIN_TOP]), Size2(region.size.width - p_margins[MARGIN_LEFT] - p_margins[MARGIN_RIGHT], region.size.height - p_margins[MARGIN_TOP] - p_margins[MARGIN_BOTTOM]));
_draw_textured_quad( // top
- Rect2(Point2(rect_center.pos.x, p_rect.pos.y), Size2(rect_center.size.width, p_margin[MARGIN_TOP])),
- Rect2(Point2(src_center.pos.x, region.pos.y), Size2(src_center.size.width, p_margin[MARGIN_TOP])),
+ Rect2(Point2(rect_center.pos.x, p_rect.pos.y), Size2(rect_center.size.width, p_margins[MARGIN_TOP])),
+ Rect2(Point2(src_center.pos.x, region.pos.y), Size2(src_center.size.width, p_margins[MARGIN_TOP])),
Size2(texture->width, texture->height));
_draw_textured_quad( // bottom
- Rect2(Point2(rect_center.pos.x, rect_center.pos.y + rect_center.size.height), Size2(rect_center.size.width, p_margin[MARGIN_BOTTOM])),
- Rect2(Point2(src_center.pos.x, src_center.pos.y + src_center.size.height), Size2(src_center.size.width, p_margin[MARGIN_BOTTOM])),
+ Rect2(Point2(rect_center.pos.x, rect_center.pos.y + rect_center.size.height), Size2(rect_center.size.width, p_margins[MARGIN_BOTTOM])),
+ Rect2(Point2(src_center.pos.x, src_center.pos.y + src_center.size.height), Size2(src_center.size.width, p_margins[MARGIN_BOTTOM])),
Size2(texture->width, texture->height));
_draw_textured_quad( // left
- Rect2(Point2(p_rect.pos.x, rect_center.pos.y), Size2(p_margin[MARGIN_LEFT], rect_center.size.height)),
- Rect2(Point2(region.pos.x, region.pos.y + p_margin[MARGIN_TOP]), Size2(p_margin[MARGIN_LEFT], src_center.size.height)),
+ Rect2(Point2(p_rect.pos.x, rect_center.pos.y), Size2(p_margins[MARGIN_LEFT], rect_center.size.height)),
+ Rect2(Point2(region.pos.x, region.pos.y + p_margins[MARGIN_TOP]), Size2(p_margins[MARGIN_LEFT], src_center.size.height)),
Size2(texture->width, texture->height));
_draw_textured_quad( // right
- Rect2(Point2(rect_center.pos.x + rect_center.size.width, rect_center.pos.y), Size2(p_margin[MARGIN_RIGHT], rect_center.size.height)),
- Rect2(Point2(src_center.pos.x + src_center.size.width, region.pos.y + p_margin[MARGIN_TOP]), Size2(p_margin[MARGIN_RIGHT], src_center.size.height)),
+ Rect2(Point2(rect_center.pos.x + rect_center.size.width, rect_center.pos.y), Size2(p_margins[MARGIN_RIGHT], rect_center.size.height)),
+ Rect2(Point2(src_center.pos.x + src_center.size.width, region.pos.y + p_margins[MARGIN_TOP]), Size2(p_margins[MARGIN_RIGHT], src_center.size.height)),
Size2(texture->width, texture->height));
if (p_draw_center) {
@@ -8700,17 +8700,17 @@ void RasterizerGLES2::_canvas_item_render_commands(CanvasItem *p_item, CanvasIte
}
}
-void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material, Shader *shader) {
+void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material, Shader *p_shader) {
if (canvas_shader.bind())
rebind_texpixel_size = true;
- if (material->shader_version != shader->version) {
+ if (material->shader_version != p_shader->version) {
//todo optimize uniforms
- material->shader_version = shader->version;
+ material->shader_version = p_shader->version;
}
- if (shader->has_texscreen && framebuffer.active) {
+ if (p_shader->has_texscreen && framebuffer.active) {
int x = viewport.x;
int y = window_size.height - (viewport.height + viewport.y);
@@ -8742,19 +8742,19 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material,
glActiveTexture(GL_TEXTURE0);
}
- if (shader->has_screen_uv) {
+ if (p_shader->has_screen_uv) {
canvas_shader.set_uniform(CanvasShaderGLES2::SCREEN_UV_MULT, Vector2(1.0 / viewport.width, 1.0 / viewport.height));
}
- uses_texpixel_size = shader->uses_texpixel_size;
+ uses_texpixel_size = p_shader->uses_texpixel_size;
}
-void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *material, Shader *shader) {
+void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *material, Shader *p_shader) {
//this can be optimized..
int tex_id = 1;
int idx = 0;
- for (Map<StringName, ShaderLanguage::Uniform>::Element *E = shader->uniforms.front(); E; E = E->next()) {
+ for (Map<StringName, ShaderLanguage::Uniform>::Element *E = p_shader->uniforms.front(); E; E = E->next()) {
Map<StringName, Variant>::Element *F = material->shader_param.find(E->key());
@@ -8767,7 +8767,7 @@ void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *materia
if (!rid.is_valid()) {
- Map<StringName, RID>::Element *DT = shader->default_textures.find(E->key());
+ Map<StringName, RID>::Element *DT = p_shader->default_textures.find(E->key());
if (DT) {
rid = DT->get();
}
@@ -8799,7 +8799,7 @@ void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *materia
glActiveTexture(GL_TEXTURE0);
}
- if (shader->uses_time) {
+ if (p_shader->uses_time) {
canvas_shader.set_uniform(CanvasShaderGLES2::TIME, Math::fmod(last_time, shader_time_rollback));
draw_next_frame = true;
}
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index e86d3ba298..ca6a0fce26 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -1524,7 +1524,7 @@ public:
virtual void light_directional_set_shadow_param(RID p_light, VS::LightDirectionalShadowParam p_param, float p_value);
virtual float light_directional_get_shadow_param(RID p_light, VS::LightDirectionalShadowParam p_param) const;
- virtual AABB light_get_aabb(RID p_poly) const;
+ virtual AABB light_get_aabb(RID p_light) const;
virtual RID light_instance_create(RID p_light);
virtual void light_instance_set_transform(RID p_light_instance, const Transform &p_transform);
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
index 961bf27a72..8764ae3895 100644
--- a/drivers/gles2/shader_gles2.cpp
+++ b/drivers/gles2/shader_gles2.cpp
@@ -103,11 +103,11 @@ void ShaderGLES2::bind_uniforms() {
uniforms_dirty = false;
};
-GLint ShaderGLES2::get_uniform_location(int p_idx) const {
+GLint ShaderGLES2::get_uniform_location(int p_index) const {
ERR_FAIL_COND_V(!version, -1);
- return version->uniform_location[p_idx];
+ return version->uniform_location[p_index];
};
bool ShaderGLES2::bind() {
diff --git a/drivers/gles2/shader_gles2.h b/drivers/gles2/shader_gles2.h
index 69a66b8ab7..32b979807d 100644
--- a/drivers/gles2/shader_gles2.h
+++ b/drivers/gles2/shader_gles2.h
@@ -281,7 +281,7 @@ public:
};
GLint get_uniform_location(const String &p_name) const;
- GLint get_uniform_location(int p_uniform) const;
+ GLint get_uniform_location(int p_index) const;
static _FORCE_INLINE_ ShaderGLES2 *get_active() { return active; };
bool bind();
@@ -293,9 +293,9 @@ public:
void clear_caches();
uint32_t create_custom_shader();
- void set_custom_shader_code(uint32_t p_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_p_light, const String &p_fragment_globals, const Vector<StringName> &p_uniforms, const Vector<const char *> &p_custom_defines);
- void set_custom_shader(uint32_t p_id);
- void free_custom_shader(uint32_t p_id);
+ void set_custom_shader_code(uint32_t p_code_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_light, const String &p_fragment_globals, const Vector<StringName> &p_uniforms, const Vector<const char *> &p_custom_defines);
+ void set_custom_shader(uint32_t p_code_id);
+ void free_custom_shader(uint32_t p_code_id);
void set_uniform_default(int p_idx, const Variant &p_value) {
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index e6ffa39197..376a208559 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -691,6 +691,13 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
state.canvas_shader.set_uniform(CanvasShaderGLES3::COLOR_TEXPIXEL_SIZE, texpixel_size);
}
_draw_polygon(polygon->indices.ptr(), polygon->count, polygon->points.size(), polygon->points.ptr(), polygon->uvs.ptr(), polygon->colors.ptr(), polygon->colors.size() == 1);
+#ifdef GLES_OVER_GL
+ if (polygon->antialiased) {
+ glEnable(GL_LINE_SMOOTH);
+ _draw_generic(GL_LINE_LOOP, polygon->points.size(), polygon->points.ptr(), polygon->uvs.ptr(), polygon->colors.ptr(), polygon->colors.size() == 1);
+ glDisable(GL_LINE_SMOOTH);
+ }
+#endif
} break;
case Item::Command::TYPE_PARTICLES: {
diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h
index 26003f543f..29f889cc88 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.h
+++ b/drivers/gles3/rasterizer_canvas_gles3.h
@@ -42,6 +42,7 @@ public:
float projection_matrix[16];
float time;
+ uint8_t padding[12];
};
RasterizerSceneGLES3 *scene_render;
@@ -102,6 +103,7 @@ public:
float light_height;
float light_outside_alpha;
float shadow_distance_mult;
+ uint8_t padding[4];
} ubo_data;
GLuint ubo;
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 30a77c4b39..6e8303563f 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -120,7 +120,7 @@ void RasterizerSceneGLES3::shadow_atlas_set_size(RID p_atlas, int p_size) {
ERR_FAIL_COND(!shadow_atlas);
ERR_FAIL_COND(p_size < 0);
- p_size = nearest_power_of_2(p_size);
+ p_size = next_power_of_2(p_size);
if (p_size == shadow_atlas->size)
return;
@@ -185,7 +185,7 @@ void RasterizerSceneGLES3::shadow_atlas_set_quadrant_subdivision(RID p_atlas, in
ERR_FAIL_INDEX(p_quadrant, 4);
ERR_FAIL_INDEX(p_subdivision, 16384);
- uint32_t subdiv = nearest_power_of_2(p_subdivision);
+ uint32_t subdiv = next_power_of_2(p_subdivision);
if (subdiv & 0xaaaaaaaa) { //sqrt(subdiv) must be integer
subdiv <<= 1;
}
@@ -310,7 +310,7 @@ bool RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_light_in
}
uint32_t quad_size = shadow_atlas->size >> 1;
- int desired_fit = MIN(quad_size / shadow_atlas->smallest_subdiv, nearest_power_of_2(quad_size * p_coverage));
+ int desired_fit = MIN(quad_size / shadow_atlas->smallest_subdiv, next_power_of_2(quad_size * p_coverage));
int valid_quadrants[4];
int valid_quadrant_count = 0;
@@ -479,7 +479,7 @@ void RasterizerSceneGLES3::reflection_atlas_set_size(RID p_ref_atlas, int p_size
ReflectionAtlas *reflection_atlas = reflection_atlas_owner.getornull(p_ref_atlas);
ERR_FAIL_COND(!reflection_atlas);
- int size = nearest_power_of_2(p_size);
+ int size = next_power_of_2(p_size);
if (size == reflection_atlas->size)
return;
@@ -554,7 +554,7 @@ void RasterizerSceneGLES3::reflection_atlas_set_subdivision(RID p_ref_atlas, int
ReflectionAtlas *reflection_atlas = reflection_atlas_owner.getornull(p_ref_atlas);
ERR_FAIL_COND(!reflection_atlas);
- uint32_t subdiv = nearest_power_of_2(p_subdiv);
+ uint32_t subdiv = next_power_of_2(p_subdiv);
if (subdiv & 0xaaaaaaaa) { //sqrt(subdiv) must be integer
subdiv <<= 1;
}
@@ -1088,11 +1088,12 @@ void RasterizerSceneGLES3::gi_probe_instance_set_bounds(RID p_probe, const Vecto
bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_material, bool p_alpha_pass) {
+ /* this is handled outside
if (p_material->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_DISABLED) {
glDisable(GL_CULL_FACE);
} else {
glEnable(GL_CULL_FACE);
- }
+ } */
if (state.current_line_width != p_material->line_width) {
//glLineWidth(MAX(p_material->line_width,1.0));
@@ -1857,12 +1858,21 @@ void RasterizerSceneGLES3::_setup_light(RenderList::Element *e, const Transform
}
}
-void RasterizerSceneGLES3::_set_cull(bool p_front, bool p_reverse_cull) {
+void RasterizerSceneGLES3::_set_cull(bool p_front, bool p_disabled, bool p_reverse_cull) {
bool front = p_front;
if (p_reverse_cull)
front = !front;
+ if (p_disabled != state.cull_disabled) {
+ if (p_disabled)
+ glDisable(GL_CULL_FACE);
+ else
+ glEnable(GL_CULL_FACE);
+
+ state.cull_disabled = p_disabled;
+ }
+
if (front != state.cull_front) {
glCullFace(front ? GL_FRONT : GL_BACK);
@@ -1900,7 +1910,9 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
}
state.cull_front = false;
+ state.cull_disabled = false;
glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
state.current_depth_test = true;
glEnable(GL_DEPTH_TEST);
@@ -2101,7 +2113,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
storage->info.render.surface_switch_count++;
}
- _set_cull(e->sort_key & RenderList::SORT_KEY_MIRROR_FLAG, p_reverse_cull);
+ _set_cull(e->sort_key & RenderList::SORT_KEY_MIRROR_FLAG, e->sort_key & RenderList::SORT_KEY_CULL_DISABLED_FLAG, p_reverse_cull);
state.scene_shader.set_uniform(SceneShaderGLES3::NORMAL_MULT, e->instance->mirror ? -1.0 : 1.0);
state.scene_shader.set_uniform(SceneShaderGLES3::WORLD_TRANSFORM, e->instance->transform);
@@ -2180,38 +2192,45 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo
}
}
-void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *m, bool p_shadow) {
+void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_shadow) {
- bool has_base_alpha = (m->shader->spatial.uses_alpha && !m->shader->spatial.uses_alpha_scissor) || m->shader->spatial.uses_screen_texture || m->shader->spatial.unshaded;
- bool has_blend_alpha = m->shader->spatial.blend_mode != RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX || m->shader->spatial.ontop;
+ bool has_base_alpha = (p_material->shader->spatial.uses_alpha && !p_material->shader->spatial.uses_alpha_scissor) || p_material->shader->spatial.uses_screen_texture || p_material->shader->spatial.unshaded;
+ bool has_blend_alpha = p_material->shader->spatial.blend_mode != RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX || p_material->shader->spatial.ontop;
bool has_alpha = has_base_alpha || has_blend_alpha;
bool shadow = false;
bool mirror = p_instance->mirror;
+ bool no_cull = false;
- if (m->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_FRONT) {
+ if (p_material->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_DISABLED) {
+ no_cull = true;
+ mirror = false;
+ } else if (p_material->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_FRONT) {
mirror = !mirror;
}
- if (m->shader->spatial.uses_sss) {
+ if (p_material->shader->spatial.uses_sss) {
state.used_sss = true;
}
- if (m->shader->spatial.uses_screen_texture) {
+ if (p_material->shader->spatial.uses_screen_texture) {
state.used_screen_texture = true;
}
if (p_shadow) {
- if (has_blend_alpha || (has_base_alpha && m->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS))
+ if (has_blend_alpha || (has_base_alpha && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS))
return; //bye
- if (!m->shader->spatial.uses_alpha_scissor && !m->shader->spatial.writes_modelview_or_projection && !m->shader->spatial.uses_vertex && !m->shader->spatial.uses_discard && m->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
+ if (!p_material->shader->spatial.uses_alpha_scissor && !p_material->shader->spatial.writes_modelview_or_projection && !p_material->shader->spatial.uses_vertex && !p_material->shader->spatial.uses_discard && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
//shader does not use discard and does not write a vertex position, use generic material
- if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED)
- m = storage->material_owner.getptr(default_material_twosided);
- else
- m = storage->material_owner.getptr(default_material);
+ if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) {
+ p_material = storage->material_owner.getptr(default_material_twosided);
+ no_cull = true;
+ mirror = false;
+ } else {
+ p_material = storage->material_owner.getptr(default_material);
+ }
}
has_alpha = false;
@@ -2223,7 +2242,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
return;
e->geometry = p_geometry;
- e->material = m;
+ e->material = p_material;
e->instance = p_instance;
e->owner = p_owner;
e->sort_key = 0;
@@ -2250,7 +2269,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
e->sort_key |= uint64_t(e->material->index) << RenderList::SORT_KEY_MATERIAL_INDEX_SHIFT;
e->sort_key |= uint64_t(e->instance->depth_layer) << RenderList::SORT_KEY_DEPTH_LAYER_SHIFT;
- if (!has_blend_alpha && has_alpha && m->shader->spatial.depth_draw_mode == RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
+ if (!has_blend_alpha && has_alpha && p_material->shader->spatial.depth_draw_mode == RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
//if nothing exists, add this element as opaque too
RenderList::Element *oe = render_list.add_element();
@@ -2275,14 +2294,18 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
e->sort_key |= RenderList::SORT_KEY_MIRROR_FLAG;
}
+ if (no_cull) {
+ e->sort_key |= RenderList::SORT_KEY_CULL_DISABLED_FLAG;
+ }
+
//e->light_type=0xFF; // no lights!
- if (shadow || m->shader->spatial.unshaded || state.debug_draw == VS::VIEWPORT_DEBUG_DRAW_UNSHADED) {
+ if (shadow || p_material->shader->spatial.unshaded || state.debug_draw == VS::VIEWPORT_DEBUG_DRAW_UNSHADED) {
e->sort_key |= SORT_KEY_UNSHADED_FLAG;
}
- if (!shadow && (m->shader->spatial.uses_vertex_lighting || storage->config.force_vertex_shading)) {
+ if (!shadow && (p_material->shader->spatial.uses_vertex_lighting || storage->config.force_vertex_shading)) {
e->sort_key |= SORT_KEY_VERTEX_LIT_FLAG;
}
@@ -4535,6 +4558,9 @@ void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_
state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH, true);
+ if (light->reverse_cull) {
+ flip_facing = !flip_facing;
+ }
_render_list(render_list.elements, render_list.element_count, light_transform, light_projection, 0, flip_facing, false, true, false, false);
state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH, false);
@@ -4757,7 +4783,7 @@ void RasterizerSceneGLES3::initialize() {
{
//directional light shadow
directional_shadow.light_count = 0;
- directional_shadow.size = nearest_power_of_2(GLOBAL_GET("rendering/quality/directional_shadow/size"));
+ directional_shadow.size = next_power_of_2(GLOBAL_GET("rendering/quality/directional_shadow/size"));
glGenFramebuffers(1, &directional_shadow.fbo);
glBindFramebuffer(GL_FRAMEBUFFER, directional_shadow.fbo);
glGenTextures(1, &directional_shadow.depth);
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index f6509e0041..740d277a3a 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -141,6 +141,7 @@ public:
float fog_height_min;
float fog_height_max;
float fog_height_curve;
+ uint8_t padding[8];
} ubo_data;
@@ -150,6 +151,7 @@ public:
float transform[16];
float ambient_contribution;
+ uint8_t padding[12];
} env_radiance_data;
@@ -185,6 +187,7 @@ public:
int reflection_probe_count;
bool cull_front;
+ bool cull_disabled;
bool used_sss;
bool used_screen_texture;
bool using_contact_shadows;
@@ -521,8 +524,8 @@ public:
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer);
virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0);
- virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality);
- virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality);
+ virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality);
+ virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality);
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, bool p_bicubic_upscale);
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture);
@@ -652,6 +655,7 @@ public:
SORT_KEY_MATERIAL_INDEX_SHIFT = 40,
SORT_KEY_GEOMETRY_INDEX_SHIFT = 20,
SORT_KEY_GEOMETRY_TYPE_SHIFT = 15,
+ SORT_KEY_CULL_DISABLED_FLAG = 4,
SORT_KEY_SKELETON_FLAG = 2,
SORT_KEY_MIRROR_FLAG = 1
@@ -777,7 +781,7 @@ public:
RenderList render_list;
- _FORCE_INLINE_ void _set_cull(bool p_front, bool p_reverse_cull);
+ _FORCE_INLINE_ void _set_cull(bool p_front, bool p_disabled, bool p_reverse_cull);
_FORCE_INLINE_ bool _setup_material(RasterizerStorageGLES3::Material *p_material, bool p_alpha_pass);
_FORCE_INLINE_ void _setup_geometry(RenderList::Element *e, const Transform &p_view_transform);
@@ -793,7 +797,7 @@ public:
void _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale, float p_energy);
void _setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform);
- void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transformm, bool p_use_shadows);
+ void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transform, bool p_use_shadows);
void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_shadow_atlas);
void _setup_reflections(RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_reflection_atlas, Environment *p_env);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index a8e4bc0d4b..dc9006a4e1 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -2143,7 +2143,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
gui[0] = v.normal.x;
gui[1] = v.normal.y;
- gui[2] = v.normal.x;
+ gui[2] = v.normal.z;
gui[3] = v.d;
}
} break;
@@ -2497,7 +2497,13 @@ void RasterizerStorageGLES3::_update_material(Material *material) {
//value=E->get().default_value;
} else {
//zero because it was not provided
- _fill_std140_ubo_empty(E->get().type, data);
+ if (E->get().type == ShaderLanguage::TYPE_VEC4 && E->get().hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ //colors must be set as black, with alpha as 1.0
+ _fill_std140_variant_ubo_value(E->get().type, Color(0, 0, 0, 1), data, material->shader->mode == VS::SHADER_SPATIAL);
+ } else {
+ //else just zero it out
+ _fill_std140_ubo_empty(E->get().type, data);
+ }
}
}
@@ -4451,7 +4457,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type) {
light->omni_shadow_mode = VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID;
light->omni_shadow_detail = VS::LIGHT_OMNI_SHADOW_DETAIL_VERTICAL;
light->directional_blend_splits = false;
-
+ light->reverse_cull = false;
light->version = 0;
return light_owner.make_rid(light);
@@ -4530,6 +4536,14 @@ void RasterizerStorageGLES3::light_set_cull_mask(RID p_light, uint32_t p_mask) {
light->instance_change_notify();
}
+void RasterizerStorageGLES3::light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {
+
+ Light *light = light_owner.getornull(p_light);
+ ERR_FAIL_COND(!light);
+
+ light->reverse_cull = p_enabled;
+}
+
void RasterizerStorageGLES3::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {
Light *light = light_owner.getornull(p_light);
@@ -5177,6 +5191,10 @@ void RasterizerStorageGLES3::particles_set_emitting(RID p_particles, bool p_emit
Particles *particles = particles_owner.getornull(p_particles);
ERR_FAIL_COND(!particles);
+ if (p_emitting != particles->emitting) {
+ // Restart is overriden by set_emitting
+ particles->restart_request = false;
+ }
particles->emitting = p_emitting;
}
void RasterizerStorageGLES3::particles_set_amount(RID p_particles, int p_amount) {
@@ -5468,58 +5486,58 @@ RID RasterizerStorageGLES3::particles_get_draw_pass_mesh(RID p_particles, int p_
return particles->draw_passes[p_pass];
}
-void RasterizerStorageGLES3::_particles_process(Particles *particles, float p_delta) {
+void RasterizerStorageGLES3::_particles_process(Particles *p_particles, float p_delta) {
- float new_phase = Math::fmod((float)particles->phase + (p_delta / particles->lifetime) * particles->speed_scale, (float)1.0);
+ float new_phase = Math::fmod((float)p_particles->phase + (p_delta / p_particles->lifetime) * p_particles->speed_scale, (float)1.0);
- if (particles->clear) {
- particles->cycle_number = 0;
- particles->random_seed = Math::rand();
- } else if (new_phase < particles->phase) {
- if (particles->one_shot) {
- particles->emitting = false;
+ if (p_particles->clear) {
+ p_particles->cycle_number = 0;
+ p_particles->random_seed = Math::rand();
+ } else if (new_phase < p_particles->phase) {
+ if (p_particles->one_shot) {
+ p_particles->emitting = false;
shaders.particles.set_uniform(ParticlesShaderGLES3::EMITTING, false);
}
- particles->cycle_number++;
+ p_particles->cycle_number++;
}
shaders.particles.set_uniform(ParticlesShaderGLES3::SYSTEM_PHASE, new_phase);
- shaders.particles.set_uniform(ParticlesShaderGLES3::PREV_SYSTEM_PHASE, particles->phase);
- particles->phase = new_phase;
+ shaders.particles.set_uniform(ParticlesShaderGLES3::PREV_SYSTEM_PHASE, p_particles->phase);
+ p_particles->phase = new_phase;
- shaders.particles.set_uniform(ParticlesShaderGLES3::DELTA, p_delta * particles->speed_scale);
- shaders.particles.set_uniform(ParticlesShaderGLES3::CLEAR, particles->clear);
- glUniform1ui(shaders.particles.get_uniform_location(ParticlesShaderGLES3::RANDOM_SEED), particles->random_seed);
+ shaders.particles.set_uniform(ParticlesShaderGLES3::DELTA, p_delta * p_particles->speed_scale);
+ shaders.particles.set_uniform(ParticlesShaderGLES3::CLEAR, p_particles->clear);
+ glUniform1ui(shaders.particles.get_uniform_location(ParticlesShaderGLES3::RANDOM_SEED), p_particles->random_seed);
- if (particles->use_local_coords)
+ if (p_particles->use_local_coords)
shaders.particles.set_uniform(ParticlesShaderGLES3::EMISSION_TRANSFORM, Transform());
else
- shaders.particles.set_uniform(ParticlesShaderGLES3::EMISSION_TRANSFORM, particles->emission_transform);
+ shaders.particles.set_uniform(ParticlesShaderGLES3::EMISSION_TRANSFORM, p_particles->emission_transform);
- glUniform1ui(shaders.particles.get_uniform(ParticlesShaderGLES3::CYCLE), particles->cycle_number);
+ glUniform1ui(shaders.particles.get_uniform(ParticlesShaderGLES3::CYCLE), p_particles->cycle_number);
- particles->clear = false;
+ p_particles->clear = false;
- glBindVertexArray(particles->particle_vaos[0]);
+ glBindVertexArray(p_particles->particle_vaos[0]);
- glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, particles->particle_buffers[1]);
+ glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, p_particles->particle_buffers[1]);
// GLint size = 0;
// glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
glBeginTransformFeedback(GL_POINTS);
- glDrawArrays(GL_POINTS, 0, particles->amount);
+ glDrawArrays(GL_POINTS, 0, p_particles->amount);
glEndTransformFeedback();
- SWAP(particles->particle_buffers[0], particles->particle_buffers[1]);
- SWAP(particles->particle_vaos[0], particles->particle_vaos[1]);
+ SWAP(p_particles->particle_buffers[0], p_particles->particle_buffers[1]);
+ SWAP(p_particles->particle_vaos[0], p_particles->particle_vaos[1]);
glBindVertexArray(0);
/* //debug particles :D
- glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[0]);
+ glBindBuffer(GL_ARRAY_BUFFER, p_particles->particle_buffers[0]);
- float *data = (float *)glMapBufferRange(GL_ARRAY_BUFFER, 0, particles->amount * 16 * 6, GL_MAP_READ_BIT);
- for (int i = 0; i < particles->amount; i++) {
+ float *data = (float *)glMapBufferRange(GL_ARRAY_BUFFER, 0, p_particles->amount * 16 * 6, GL_MAP_READ_BIT);
+ for (int i = 0; i < p_particles->amount; i++) {
int ofs = i * 24;
print_line(itos(i) + ":");
print_line("\tColor: " + Color(data[ofs + 0], data[ofs + 1], data[ofs + 2], data[ofs + 3]));
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 5a272f43fb..f612d9e879 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -314,7 +314,7 @@ public:
mutable RID_Owner<Texture> texture_owner;
- Ref<Image> _get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_type, bool &r_compressed, bool &srgb);
+ Ref<Image> _get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type, bool &r_compressed, bool &srgb);
virtual RID texture_create();
virtual void texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags = VS::TEXTURE_FLAGS_DEFAULT);
@@ -528,8 +528,8 @@ public:
mutable SelfList<Material>::List _material_dirty_list;
void _material_make_dirty(Material *p_material) const;
- void _material_add_geometry(RID p_material, Geometry *p_instantiable);
- void _material_remove_geometry(RID p_material, Geometry *p_instantiable);
+ void _material_add_geometry(RID p_material, Geometry *p_geometry);
+ void _material_remove_geometry(RID p_material, Geometry *p_geometry);
mutable RID_Owner<Material> material_owner;
@@ -868,6 +868,7 @@ public:
RID projector;
bool shadow;
bool negative;
+ bool reverse_cull;
uint32_t cull_mask;
VS::LightOmniShadowMode omni_shadow_mode;
VS::LightOmniShadowDetail omni_shadow_detail;
@@ -887,6 +888,7 @@ public:
virtual void light_set_projector(RID p_light, RID p_texture);
virtual void light_set_negative(RID p_light, bool p_enable);
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask);
+ virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled);
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail);
@@ -1168,7 +1170,7 @@ public:
virtual void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order);
- virtual void particles_set_draw_passes(RID p_particles, int p_count);
+ virtual void particles_set_draw_passes(RID p_particles, int p_passes);
virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh);
virtual void particles_request_process(RID p_particles);
diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp
index f1077e2d20..20956ad644 100644
--- a/drivers/gles3/shader_gles3.cpp
+++ b/drivers/gles3/shader_gles3.cpp
@@ -102,11 +102,11 @@ void ShaderGLES3::bind_uniforms() {
uniforms_dirty = false;
}
-GLint ShaderGLES3::get_uniform_location(int p_idx) const {
+GLint ShaderGLES3::get_uniform_location(int p_index) const {
ERR_FAIL_COND_V(!version, -1);
- return version->uniform_location[p_idx];
+ return version->uniform_location[p_index];
}
bool ShaderGLES3::bind() {
@@ -273,6 +273,11 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() {
//vertex precision is high
strings.push_back("precision highp float;\n");
strings.push_back("precision highp int;\n");
+#ifndef GLES_OVER_GL
+ strings.push_back("precision highp sampler2D;\n");
+ strings.push_back("precision highp samplerCube;\n");
+ strings.push_back("precision highp sampler2DArray;\n");
+#endif
#if 0
if (cc) {
@@ -371,6 +376,11 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() {
//fragment precision is medium
strings.push_back("precision highp float;\n");
strings.push_back("precision highp int;\n");
+#ifndef GLES_OVER_GL
+ strings.push_back("precision highp sampler2D;\n");
+ strings.push_back("precision highp samplerCube;\n");
+ strings.push_back("precision highp sampler2DArray;\n");
+#endif
#if 0
if (cc) {
diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h
index 5a34010a98..6a399a74cc 100644
--- a/drivers/gles3/shader_gles3.h
+++ b/drivers/gles3/shader_gles3.h
@@ -306,7 +306,7 @@ public:
};
GLint get_uniform_location(const String &p_name) const;
- GLint get_uniform_location(int p_uniform) const;
+ GLint get_uniform_location(int p_index) const;
static _FORCE_INLINE_ ShaderGLES3 *get_active() { return active; };
bool bind();
@@ -318,9 +318,9 @@ public:
void clear_caches();
uint32_t create_custom_shader();
- void set_custom_shader_code(uint32_t p_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_p_light, const String &p_fragment_globals, const String &p_uniforms, const Vector<StringName> &p_texture_uniforms, const Vector<CharString> &p_custom_defines);
- void set_custom_shader(uint32_t p_id);
- void free_custom_shader(uint32_t p_id);
+ void set_custom_shader_code(uint32_t p_code_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_light, const String &p_fragment_globals, const String &p_uniforms, const Vector<StringName> &p_texture_uniforms, const Vector<CharString> &p_custom_defines);
+ void set_custom_shader(uint32_t p_code_id);
+ void free_custom_shader(uint32_t p_code_id);
void set_uniform_default(int p_idx, const Variant &p_value) {
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl
index 1c950c82d9..f0dc14c35a 100644
--- a/drivers/gles3/shaders/canvas.glsl
+++ b/drivers/gles3/shaders/canvas.glsl
@@ -532,11 +532,11 @@ FRAGMENT_SHADER_CODE
#ifdef USE_RGBA_SHADOWS
-#define SHADOW_DEPTH(m_tex,m_uv) dot(texture2D((m_tex),(m_uv)),vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) )
+#define SHADOW_DEPTH(m_tex,m_uv) dot(texture((m_tex),(m_uv)),vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) )
#else
-#define SHADOW_DEPTH(m_tex,m_uv) (texture2D((m_tex),(m_uv)).r)
+#define SHADOW_DEPTH(m_tex,m_uv) (texture((m_tex),(m_uv)).r)
#endif
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index fb04ef0088..5acf9bf46e 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -54,7 +54,7 @@ Error AudioDriverPulseAudio::init() {
spec.rate = mix_rate;
int latency = GLOBAL_DEF("audio/output_latency", 25);
- buffer_size = nearest_power_of_2(latency * mix_rate / 1000);
+ buffer_size = closest_power_of_2(latency * mix_rate / 1000);
pa_buffer_attr attr;
// set to appropriate buffer size from global settings
diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp
index 3de25c32ad..8466f55afc 100644
--- a/drivers/rtaudio/audio_driver_rtaudio.cpp
+++ b/drivers/rtaudio/audio_driver_rtaudio.cpp
@@ -118,7 +118,7 @@ Error AudioDriverRtAudio::init() {
int latency = GLOBAL_DEF("audio/output_latency", 25);
// calculate desired buffer_size, taking the desired numberOfBuffers into account (latency depends on numberOfBuffers*buffer_size)
- unsigned int buffer_size = nearest_power_of_2(latency * mix_rate / 1000 / target_number_of_buffers);
+ unsigned int buffer_size = closest_power_of_2(latency * mix_rate / 1000 / target_number_of_buffers);
if (OS::get_singleton()->is_stdout_verbose()) {
print_line("audio buffer size: " + itos(buffer_size));
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index cf54f3fea0..a183a37446 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -223,36 +223,37 @@ Error DirAccessUnix::make_dir(String p_dir) {
Error DirAccessUnix::change_dir(String p_dir) {
GLOBAL_LOCK_FUNCTION
- p_dir = fix_path(p_dir);
- char real_current_dir_name[2048];
- getcwd(real_current_dir_name, 2048);
- String prev_dir;
- if (prev_dir.parse_utf8(real_current_dir_name))
- prev_dir = real_current_dir_name; //no utf8, maybe latin?
+ // make sure current_dir is valid absolute path
+ if (current_dir == "." || current_dir == "") {
+ char real_current_dir_name[2048];
+ getcwd(real_current_dir_name, 2048);
+ current_dir.parse_utf8(real_current_dir_name);
+ }
- chdir(current_dir.utf8().get_data()); //ascii since this may be unicode or wathever the host os wants
- bool worked = (chdir(p_dir.utf8().get_data()) == 0); // we can only give this utf8
+ if (p_dir == ".") {
+ return OK;
+ }
- String base = _get_root_path();
- if (base != "") {
+ p_dir = fix_path(p_dir);
- getcwd(real_current_dir_name, 2048);
- String new_dir;
- new_dir.parse_utf8(real_current_dir_name);
- if (!new_dir.begins_with(base))
- worked = false;
- }
+ String prev_dir = current_dir;
- if (worked) {
+ if (p_dir.is_rel_path()) {
+ String next_dir = current_dir + "/" + p_dir;
+ next_dir = next_dir.simplify_path();
+ current_dir = next_dir;
+ } else {
+ current_dir = p_dir;
+ }
- getcwd(real_current_dir_name, 2048);
- if (current_dir.parse_utf8(real_current_dir_name))
- current_dir = real_current_dir_name; //no utf8, maybe latin?
+ bool worked = (chdir(current_dir.utf8().get_data()) == 0); // we can only give this utf8
+ if (!worked) {
+ current_dir = prev_dir;
+ return ERR_INVALID_PARAMETER;
}
- chdir(prev_dir.utf8().get_data());
- return worked ? OK : ERR_INVALID_PARAMETER;
+ return OK;
}
String DirAccessUnix::get_current_dir() {
diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h
index 5a35cdf2e9..e4b294a802 100644
--- a/drivers/unix/dir_access_unix.h
+++ b/drivers/unix/dir_access_unix.h
@@ -75,8 +75,8 @@ public:
virtual uint64_t get_modified_time(String p_file);
- virtual Error rename(String p_from, String p_to);
- virtual Error remove(String p_name);
+ virtual Error rename(String p_path, String p_new_path);
+ virtual Error remove(String p_path);
virtual size_t get_space_left();
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp
index 30d2377a04..f55b75c1d9 100644
--- a/drivers/unix/ip_unix.cpp
+++ b/drivers/unix/ip_unix.cpp
@@ -100,6 +100,7 @@ IP_Address IP_Unix::_resolve_hostname(const String &p_hostname, Type p_type) {
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_ADDRCONFIG;
};
+ hints.ai_flags &= !AI_NUMERICHOST;
int s = getaddrinfo(p_hostname.utf8().get_data(), NULL, &hints, &result);
if (s != 0) {
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 6cd0016bb0..115bdc2d65 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -69,7 +69,7 @@ public:
virtual void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type = ERR_ERROR);
virtual void print(const char *p_format, ...);
- virtual void vprint(const char *p_format, va_list p_list, bool p_stderr = false);
+ virtual void vprint(const char *p_format, va_list p_list, bool p_stder = false);
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
virtual String get_stdin_string(bool p_block);
diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp
index 74ceb3946a..b21990a866 100644
--- a/drivers/unix/packet_peer_udp_posix.cpp
+++ b/drivers/unix/packet_peer_udp_posix.cpp
@@ -127,7 +127,7 @@ int PacketPeerUDPPosix::get_max_packet_size() const {
return 512; // uhm maybe not
}
-Error PacketPeerUDPPosix::listen(int p_port, IP_Address p_bind_address, int p_recv_buffer_size) {
+Error PacketPeerUDPPosix::listen(int p_port, const IP_Address &p_bind_address, int p_recv_buffer_size) {
ERR_FAIL_COND_V(sockfd != -1, ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
@@ -172,13 +172,13 @@ Error PacketPeerUDPPosix::wait() {
return _poll(true);
}
-Error PacketPeerUDPPosix::_poll(bool p_wait) {
+Error PacketPeerUDPPosix::_poll(bool p_block) {
if (sockfd == -1) {
return FAILED;
}
- _set_sock_blocking(p_wait);
+ _set_sock_blocking(p_block);
struct sockaddr_storage from = { 0 };
socklen_t len = sizeof(struct sockaddr_storage);
@@ -216,7 +216,7 @@ Error PacketPeerUDPPosix::_poll(bool p_wait) {
len = sizeof(struct sockaddr_storage);
++queue_count;
- if (p_wait)
+ if (p_block)
break;
};
diff --git a/drivers/unix/packet_peer_udp_posix.h b/drivers/unix/packet_peer_udp_posix.h
index a52b8b8e95..d8b08818b0 100644
--- a/drivers/unix/packet_peer_udp_posix.h
+++ b/drivers/unix/packet_peer_udp_posix.h
@@ -67,7 +67,7 @@ public:
virtual int get_max_packet_size() const;
- virtual Error listen(int p_port, IP_Address p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536);
+ virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536);
virtual void close();
virtual Error wait();
virtual bool is_listening() const;
diff --git a/drivers/unix/tcp_server_posix.cpp b/drivers/unix/tcp_server_posix.cpp
index 865e9aa1d6..a8554d07a3 100644
--- a/drivers/unix/tcp_server_posix.cpp
+++ b/drivers/unix/tcp_server_posix.cpp
@@ -69,7 +69,7 @@ void TCPServerPosix::make_default() {
TCP_Server::_create = TCPServerPosix::_create;
};
-Error TCPServerPosix::listen(uint16_t p_port, const IP_Address p_bind_address) {
+Error TCPServerPosix::listen(uint16_t p_port, const IP_Address &p_bind_address) {
ERR_FAIL_COND_V(listen_sockfd != -1, ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
diff --git a/drivers/unix/tcp_server_posix.h b/drivers/unix/tcp_server_posix.h
index 659b389fe2..947050ab8a 100644
--- a/drivers/unix/tcp_server_posix.h
+++ b/drivers/unix/tcp_server_posix.h
@@ -41,7 +41,7 @@ class TCPServerPosix : public TCP_Server {
static TCP_Server *_create();
public:
- virtual Error listen(uint16_t p_port, IP_Address p_bind_address = IP_Address("*"));
+ virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*"));
virtual bool is_connection_available() const;
virtual Ref<StreamPeerTCP> take_connection();
diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h
index f7553f50c2..a352415fd6 100644
--- a/drivers/windows/dir_access_windows.h
+++ b/drivers/windows/dir_access_windows.h
@@ -75,8 +75,8 @@ public:
virtual Error make_dir(String p_dir);
- virtual Error rename(String p_from, String p_to);
- virtual Error remove(String p_name);
+ virtual Error rename(String p_path, String p_new_path);
+ virtual Error remove(String p_path);
//virtual FileType get_file_type() const;
size_t get_space_left();
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index c66da2da29..bb133b9899 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -53,9 +53,9 @@ void FileAccessWindows::check_errors() const {
}
}
-Error FileAccessWindows::_open(const String &p_filename, int p_mode_flags) {
+Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
- String filename = fix_path(p_filename);
+ String filename = fix_path(p_path);
if (f)
close();
diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp
index a1ca2c678e..42c4c40300 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.cpp
+++ b/drivers/xaudio2/audio_driver_xaudio2.cpp
@@ -50,7 +50,7 @@ Error AudioDriverXAudio2::init() {
channels = 2;
int latency = GLOBAL_DEF("audio/output_latency", 25);
- buffer_size = nearest_power_of_2(latency * mix_rate / 1000);
+ buffer_size = closest_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_size * channels);
for (int i = 0; i < AUDIO_BUFFERS; i++) {
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index 3675948b1d..1571131aee 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -1299,7 +1299,7 @@ void AnimationKeyEditor::_track_editor_draw() {
Object *obj = NULL;
RES res;
- Node *node = root->get_node_and_resource(animation->track_get_path(idx), res);
+ Node *node = root ? root->get_node_and_resource(animation->track_get_path(idx), res) : (Node *)NULL;
if (res.is_valid()) {
obj = res.ptr();
@@ -1324,7 +1324,7 @@ void AnimationKeyEditor::_track_editor_draw() {
te->draw_texture(type_icon[animation->track_get_type(idx)], ofs + Point2(0, y + (h - type_icon[0]->get_height()) / 2).floor());
NodePath np = animation->track_get_path(idx);
- Node *n = root->get_node(np);
+ Node *n = root ? root->get_node(np) : (Node *)NULL;
Color ncol = color;
if (n && editor_selection->is_selected(n))
ncol = track_select_color;
diff --git a/editor/animation_editor.h b/editor/animation_editor.h
index 88cc446853..9eacafb021 100644
--- a/editor/animation_editor.h
+++ b/editor/animation_editor.h
@@ -278,7 +278,7 @@ class AnimationKeyEditor : public VBoxContainer {
void _track_name_changed(const String &p_name);
void _track_menu_selected(int p_idx);
void _confirm_insert_list();
- int _confirm_insert(InsertData p_id, int p_at_track = -1);
+ int _confirm_insert(InsertData p_id, int p_last_track = -1);
void _query_insert(const InsertData &p_id);
void _update_menu();
bool insert_queue;
diff --git a/editor/asset_library_editor_plugin.cpp b/editor/asset_library_editor_plugin.cpp
index 2a22cde2fb..0a2799c51f 100644
--- a/editor/asset_library_editor_plugin.cpp
+++ b/editor/asset_library_editor_plugin.cpp
@@ -189,7 +189,14 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const
} break;
}
}
-
+void EditorAssetLibraryItemDescription::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ previews_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
+ desc_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
+ } break;
+ }
+}
void EditorAssetLibraryItemDescription::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_image"), &EditorAssetLibraryItemDescription::set_image);
ClassDB::bind_method(D_METHOD("_link_click"), &EditorAssetLibraryItemDescription::_link_click);
@@ -274,23 +281,21 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
desc_vbox->add_child(item);
desc_vbox->set_custom_minimum_size(Size2(300, 0));
- PanelContainer *desc_bg = memnew(PanelContainer);
+ desc_bg = memnew(PanelContainer);
desc_vbox->add_child(desc_bg);
desc_bg->set_v_size_flags(SIZE_EXPAND_FILL);
description = memnew(RichTextLabel);
description->connect("meta_clicked", this, "_link_click");
desc_bg->add_child(description);
- desc_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
preview = memnew(TextureRect);
preview->set_custom_minimum_size(Size2(640, 345));
hbox->add_child(preview);
- PanelContainer *previews_bg = memnew(PanelContainer);
+ previews_bg = memnew(PanelContainer);
vbox->add_child(previews_bg);
previews_bg->set_custom_minimum_size(Size2(0, 85));
- previews_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
previews = memnew(ScrollContainer);
previews_bg->add_child(previews);
@@ -525,53 +530,62 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
////////////////////////////////////////////////////////////////////////////////
void EditorAssetLibrary::_notification(int p_what) {
- if (p_what == NOTIFICATION_READY) {
- TextureRect *tf = memnew(TextureRect);
- tf->set_texture(get_icon("Error", "EditorIcons"));
- reverse->set_icon(get_icon("Updown", "EditorIcons"));
+ switch (p_what) {
+ case NOTIFICATION_READY: {
- error_hb->add_child(tf);
- error_label->raise();
- }
+ TextureRect *tf = memnew(TextureRect);
+ tf->set_texture(get_icon("Error", "EditorIcons"));
+ reverse->set_icon(get_icon("Updown", "EditorIcons"));
- if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
- if (is_visible()) {
- _repository_changed(0); // Update when shown for the first time
- }
- }
+ error_hb->add_child(tf);
+ error_label->raise();
+ } break;
- if (p_what == NOTIFICATION_PROCESS) {
+ case NOTIFICATION_VISIBILITY_CHANGED: {
- HTTPClient::Status s = request->get_http_client_status();
- bool visible = s != HTTPClient::STATUS_DISCONNECTED;
+ if (is_visible()) {
+ _repository_changed(0); // Update when shown for the first time
+ }
+ } break;
- if (visible != load_status->is_visible()) {
- load_status->set_visible(visible);
- }
+ case NOTIFICATION_PROCESS: {
- if (visible) {
- switch (s) {
+ HTTPClient::Status s = request->get_http_client_status();
+ bool visible = s != HTTPClient::STATUS_DISCONNECTED;
- case HTTPClient::STATUS_RESOLVING: {
- load_status->set_value(0.1);
- } break;
- case HTTPClient::STATUS_CONNECTING: {
- load_status->set_value(0.2);
- } break;
- case HTTPClient::STATUS_REQUESTING: {
- load_status->set_value(0.3);
- } break;
- case HTTPClient::STATUS_BODY: {
- load_status->set_value(0.4);
- } break;
- default: {}
+ if (visible != load_status->is_visible()) {
+ load_status->set_visible(visible);
}
- }
- bool no_downloads = downloads_hb->get_child_count() == 0;
- if (no_downloads == downloads_scroll->is_visible()) {
- downloads_scroll->set_visible(!no_downloads);
- }
+ if (visible) {
+ switch (s) {
+
+ case HTTPClient::STATUS_RESOLVING: {
+ load_status->set_value(0.1);
+ } break;
+ case HTTPClient::STATUS_CONNECTING: {
+ load_status->set_value(0.2);
+ } break;
+ case HTTPClient::STATUS_REQUESTING: {
+ load_status->set_value(0.3);
+ } break;
+ case HTTPClient::STATUS_BODY: {
+ load_status->set_value(0.4);
+ } break;
+ default: {}
+ }
+ }
+
+ bool no_downloads = downloads_hb->get_child_count() == 0;
+ if (no_downloads == downloads_scroll->is_visible()) {
+ downloads_scroll->set_visible(!no_downloads);
+ }
+
+ } break;
+ case NOTIFICATION_THEME_CHANGED: {
+
+ library_scroll_bg->add_style_override("panel", get_stylebox("bg", "Tree"));
+ } break;
}
}
@@ -1360,9 +1374,8 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
/////////
- PanelContainer *library_scroll_bg = memnew(PanelContainer);
+ library_scroll_bg = memnew(PanelContainer);
library_main->add_child(library_scroll_bg);
- library_scroll_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
library_scroll_bg->set_v_size_flags(SIZE_EXPAND_FILL);
library_scroll = memnew(ScrollContainer);
diff --git a/editor/asset_library_editor_plugin.h b/editor/asset_library_editor_plugin.h
index 9e4a240101..fa768ec96a 100644
--- a/editor/asset_library_editor_plugin.h
+++ b/editor/asset_library_editor_plugin.h
@@ -89,6 +89,8 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog {
RichTextLabel *description;
ScrollContainer *previews;
HBoxContainer *preview_hb;
+ PanelContainer *previews_bg;
+ PanelContainer *desc_bg;
struct Preview {
int id;
@@ -110,9 +112,10 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog {
Ref<Texture> icon;
void _link_click(const String &p_url);
- void _preview_click(int p_index);
+ void _preview_click(int p_id);
protected:
+ void _notification(int p_what);
static void _bind_methods();
public:
@@ -179,6 +182,7 @@ class EditorAssetLibrary : public PanelContainer {
void _asset_open();
void _asset_file_selected(const String &p_file);
+ PanelContainer *library_scroll_bg;
ScrollContainer *library_scroll;
VBoxContainer *library_vb;
LineEdit *filter;
diff --git a/editor/call_dialog.cpp b/editor/call_dialog.cpp
index 8cf9ed6ef4..32b9fc1254 100644
--- a/editor/call_dialog.cpp
+++ b/editor/call_dialog.cpp
@@ -253,8 +253,8 @@ CallDialog::CallDialog() {
call->set_anchor( MARGIN_TOP, ANCHOR_END );
call->set_anchor( MARGIN_RIGHT, ANCHOR_END );
call->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
- call->set_begin( Point2( 70, 29 ) );
- call->set_end( Point2( 15, 15 ) );
+ call->set_begin( Point2( -70, -29 ) );
+ call->set_end( Point2( -15, -15 ) );
call->set_text(TTR("Call"));
add_child(call);
@@ -262,8 +262,8 @@ CallDialog::CallDialog() {
cancel = memnew( Button );
cancel->set_anchor( MARGIN_TOP, ANCHOR_END );
cancel->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
- cancel->set_begin( Point2( 15, 29 ) );
- cancel->set_end( Point2( 70, 15 ) );
+ cancel->set_begin( Point2( -15, 29 ) );
+ cancel->set_end( Point2( 70, -15 ) );
cancel->set_text(TTR("Close"));
add_child(cancel);
@@ -272,7 +272,7 @@ CallDialog::CallDialog() {
tree->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
tree->set_begin( Point2( 20,50 ) );
- tree->set_margin(MARGIN_BOTTOM, 44 );
+ tree->set_margin(MARGIN_BOTTOM, -44 );
tree->set_margin(MARGIN_RIGHT, 0.5 );
tree->set_select_mode( Tree::SELECT_ROW );
add_child(tree);
@@ -282,10 +282,10 @@ CallDialog::CallDialog() {
property_editor = memnew( PropertyEditor );
- property_editor->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, 15 );
+ property_editor->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, -15 );
property_editor->set_anchor_and_margin( MARGIN_TOP, ANCHOR_BEGIN, 50 );
//property_editor->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.55 );
- property_editor->set_anchor_and_margin( MARGIN_BOTTOM, ANCHOR_END, 90 );
+ property_editor->set_anchor_and_margin( MARGIN_BOTTOM, ANCHOR_END, -90 );
property_editor->get_scene_tree()->set_hide_root( true );
property_editor->hide_top_label();
@@ -305,15 +305,15 @@ CallDialog::CallDialog() {
return_label = memnew( Label );
//return_label->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.53 );
- return_label->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, 85 );
+ return_label->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, -85 );
return_label->set_text(TTR("Return:"));
add_child(return_label);
return_value = memnew( LineEdit );
//return_value->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.55 );
- return_value->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, 15 );
- return_value->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, 65 );
+ return_value->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, -15 );
+ return_value->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, -65 );
add_child(return_value);
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 2e406fb23d..c33340ce69 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -70,7 +70,7 @@ GotoLineDialog::GotoLineDialog() {
line = memnew(LineEdit);
line->set_anchor(MARGIN_RIGHT, ANCHOR_END);
line->set_begin(Point2(15, 22));
- line->set_end(Point2(15, 35));
+ line->set_end(Point2(-15, 35));
add_child(line);
register_text_enter(line);
text_editor = NULL;
@@ -887,7 +887,7 @@ FindReplaceDialog::FindReplaceDialog() {
replace_text = memnew(LineEdit);
replace_text->set_anchor(MARGIN_RIGHT, ANCHOR_END);
replace_text->set_begin(Point2(15, 132));
- replace_text->set_end(Point2(15, 135));
+ replace_text->set_end(Point2(-15, 135));
//replace_text->set_self_opacity(0.7);
replace_mc->add_child(replace_text);
@@ -937,8 +937,8 @@ FindReplaceDialog::FindReplaceDialog() {
skip->set_anchor(MARGIN_TOP, ANCHOR_END);
skip->set_anchor(MARGIN_RIGHT, ANCHOR_END);
skip->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
- skip->set_begin(Point2(70, button_margin));
- skip->set_end(Point2(10, margin));
+ skip->set_begin(Point2(-70, -button_margin));
+ skip->set_end(Point2(-10, -margin));
skip->set_text(TTR("Skip"));
add_child(skip);
skip->connect("pressed", this, "_skip_pressed");
@@ -1087,6 +1087,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed"));
text_editor->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_breakpoint_gutter"));
text_editor->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret"));
+ text_editor->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/open_scripts/smooth_scrolling"));
}
void CodeTextEditor::set_error(const String &p_error) {
@@ -1222,10 +1223,11 @@ CodeTextEditor::CodeTextEditor() {
error = memnew(Label);
status_bar->add_child(error);
error->hide();
+ error->set_clip_text(true); //do not change, or else very long errors can push the whole container to the right
error->set_valign(Label::VALIGN_CENTER);
error->add_color_override("font_color", Color(1, 0.7, 0.6, 0.9));
-
- status_bar->add_spacer();
+ error->set_h_size_flags(SIZE_EXPAND_FILL); //required for it to display, given now it's clipping contents, do not touch
+ //status_bar->add_spacer();
Label *line_txt = memnew(Label);
status_bar->add_child(line_txt);
@@ -1238,7 +1240,8 @@ CodeTextEditor::CodeTextEditor() {
status_bar->add_child(line_nb);
line_nb->set_valign(Label::VALIGN_CENTER);
line_nb->set_v_size_flags(SIZE_FILL);
- line_nb->set_autowrap(true); // workaround to prevent resizing the label on each change
+ line_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch
+ line_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch
line_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE);
Label *col_txt = memnew(Label);
@@ -1252,7 +1255,8 @@ CodeTextEditor::CodeTextEditor() {
status_bar->add_child(col_nb);
col_nb->set_valign(Label::VALIGN_CENTER);
col_nb->set_v_size_flags(SIZE_FILL);
- col_nb->set_autowrap(true); // workaround to prevent resizing the label on each change
+ col_nb->set_autowrap(true); // workaround to prevent resizing the label on each change, do not touch
+ col_nb->set_clip_text(true); // workaround to prevent resizing the label on each change, do not touch
col_nb->set_custom_minimum_size(Size2(40, 1) * EDSCALE);
text_editor->connect("gui_input", this, "_text_editor_gui_input");
diff --git a/editor/collada/collada.h b/editor/collada/collada.h
index 8945e14cce..f94f9ed197 100644
--- a/editor/collada/collada.h
+++ b/editor/collada/collada.h
@@ -613,7 +613,7 @@ private: // private stuff
void _parse_curve_geometry(XMLParser &parser, String p_id, String p_name);
void _parse_skin_controller(XMLParser &parser, String p_id);
- void _parse_morph_controller(XMLParser &parser, String id);
+ void _parse_morph_controller(XMLParser &parser, String p_id);
void _parse_controller(XMLParser &parser);
Node *_parse_visual_instance_geometry(XMLParser &parser);
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h
index bff85941cb..849bb880d4 100644
--- a/editor/connections_dialog.h
+++ b/editor/connections_dialog.h
@@ -103,8 +103,6 @@ class ConnectionsDock : public VBoxContainer {
ConfirmationDialog *remove_confirm;
ConnectDialog *connect_dialog;
- void update_tree();
-
void _close();
void _connect();
void _something_selected();
@@ -121,6 +119,7 @@ public:
void set_node(Node *p_node);
String get_selected_type();
+ void update_tree();
ConnectionsDock(EditorNode *p_editor = NULL);
~ConnectionsDock();
diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h
index e7344bbf13..5fdd2b72a8 100644
--- a/editor/dependency_editor.h
+++ b/editor/dependency_editor.h
@@ -106,7 +106,7 @@ class DependencyErrorDialog : public ConfirmationDialog {
void custom_action(const String &);
public:
- void show(const String &p_for, const Vector<String> &report);
+ void show(const String &p_for_file, const Vector<String> &report);
DependencyErrorDialog();
};
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 993429a5a4..282055be4a 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -705,8 +705,8 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) {
effects->set_drag_forwarding(this);
effects->connect("item_rmb_selected", this, "_effect_rmb");
effects->set_allow_rmb_select(true);
- effects->set_single_select_cell_editing_only_when_already_selected(true);
effects->set_focus_mode(FOCUS_CLICK);
+ effects->set_allow_reselect(true);
send = memnew(OptionButton);
send->set_clip_text(true);
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index dde94cb334..0d7874818c 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -580,7 +580,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
tree = memnew(Tree);
tree->set_hide_root(true);
tree->set_select_mode(Tree::SELECT_MULTI);
- tree->set_single_select_cell_editing_only_when_already_selected(true);
+ tree->set_allow_reselect(true);
tree->set_drag_forwarding(this);
diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h
index 4a2e5b48e2..9f8e3526b4 100644
--- a/editor/editor_autoload_settings.h
+++ b/editor/editor_autoload_settings.h
@@ -66,7 +66,7 @@ class EditorAutoloadSettings : public VBoxContainer {
EditorLineEditFileChooser *autoload_add_path;
LineEdit *autoload_add_name;
- bool _autoload_name_is_valid(const String &p_string, String *r_error = NULL);
+ bool _autoload_name_is_valid(const String &p_name, String *r_error = NULL);
void _autoload_add();
void _autoload_selected();
@@ -74,9 +74,9 @@ class EditorAutoloadSettings : public VBoxContainer {
void _autoload_button_pressed(Object *p_item, int p_column, int p_button);
void _autoload_file_callback(const String &p_path);
- Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
- bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
- void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
+ Variant get_drag_data_fw(const Point2 &p_point, Control *p_control);
+ bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control) const;
+ void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control);
protected:
void _notification(int p_what);
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index e788fe2c13..51fb1554c1 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -633,13 +633,13 @@ Vector<EditorData::EditedScene> EditorData::get_edited_scenes() const {
return out_edited_scenes_list;
}
-void EditorData::set_edited_scene_version(uint64_t version, int scene_idx) {
+void EditorData::set_edited_scene_version(uint64_t version, int p_scene_idx) {
ERR_FAIL_INDEX(current_edited_scene, edited_scene.size());
- if (scene_idx < 0) {
+ if (p_scene_idx < 0) {
edited_scene[current_edited_scene].version = version;
} else {
- ERR_FAIL_INDEX(scene_idx, edited_scene.size());
- edited_scene[scene_idx].version = version;
+ ERR_FAIL_INDEX(p_scene_idx, edited_scene.size());
+ edited_scene[p_scene_idx].version = version;
}
}
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index 9f8331febd..b64f5f1c69 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -112,19 +112,19 @@ void EditorDirDialog::_notification(int p_what) {
}
}
-void EditorDirDialog::_item_collapsed(Object *_p_item) {
+void EditorDirDialog::_item_collapsed(Object *p_item) {
- TreeItem *p_item = _p_item->cast_to<TreeItem>();
+ TreeItem *item = p_item->cast_to<TreeItem>();
- if (updating || p_item->is_collapsed())
+ if (updating || item->is_collapsed())
return;
- TreeItem *ci = p_item->get_children();
+ TreeItem *ci = item->get_children();
while (ci) {
String p = ci->get_metadata(0);
if (p == "") {
- String pp = p_item->get_metadata(0);
+ String pp = item->get_metadata(0);
ci->set_metadata(0, pp.plus_file(ci->get_text(0)));
_update_dir(ci);
}
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 36fd86d88f..fe1dfa281c 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -37,7 +37,6 @@
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "io/zip_io.h"
-#include "os/dir_access.h"
#include "os/file_access.h"
#include "project_settings.h"
#include "script_language.h"
@@ -420,6 +419,63 @@ void EditorExportPlatform::_export_find_dependencies(const String &p_path, Set<S
}
}
+void EditorExportPlatform::_edit_files_with_filter(DirAccess *da, const Vector<String> &p_filters, Set<String> &r_list, bool exclude) {
+
+ da->list_dir_begin();
+ String cur_dir = da->get_current_dir().replace("\\", "/");
+ if (!cur_dir.ends_with("/"))
+ cur_dir += "/";
+
+ Vector<String> dirs;
+ String f;
+ while ((f = da->get_next()) != "") {
+ if (da->current_is_dir())
+ dirs.push_back(f);
+ else {
+ String fullpath = cur_dir + f;
+ for (int i = 0; i < p_filters.size(); ++i) {
+ if (fullpath.matchn(p_filters[i])) {
+ if (!exclude) {
+ r_list.insert(fullpath);
+ } else {
+ r_list.erase(fullpath);
+ }
+ }
+ }
+ }
+ }
+
+ da->list_dir_end();
+
+ for (int i = 0; i < dirs.size(); ++i) {
+ String dir = dirs[i];
+ if (dir.begins_with("."))
+ continue;
+ da->change_dir(dir);
+ _edit_files_with_filter(da, p_filters, r_list, exclude);
+ da->change_dir("..");
+ }
+}
+
+void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String &p_filter, bool exclude) {
+
+ if (p_filter == "")
+ return;
+ Vector<String> split = p_filter.split(",");
+ Vector<String> filters;
+ for (int i = 0; i < split.size(); i++) {
+ String f = split[i].strip_edges();
+ if (f.empty())
+ continue;
+ filters.push_back(f);
+ }
+
+ DirAccess *da = DirAccess::open("res://");
+ ERR_FAIL_NULL(da);
+ _edit_files_with_filter(da, filters, r_list, exclude);
+ memdelete(da);
+}
+
Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &p_preset, EditorExportSaveFunction p_func, void *p_udata) {
Ref<EditorExportPlatform> platform = p_preset->get_platform();
@@ -449,6 +505,9 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
}
}
+ _edit_filter_list(paths, p_preset->get_include_filter(), false);
+ _edit_filter_list(paths, p_preset->get_exclude_filter(), true);
+
//store everything in the export medium
int idx = 0;
int total = paths.size();
diff --git a/editor/editor_export.h b/editor/editor_export.h
index dc4b198575..df42b0d95d 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -30,6 +30,7 @@
#ifndef EDITOR_EXPORT_H
#define EDITOR_EXPORT_H
+#include "os/dir_access.h"
#include "resource.h"
#include "scene/main/node.h"
#include "scene/main/timer.h"
@@ -157,6 +158,9 @@ private:
static Error _save_pack_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total);
static Error _save_zip_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total);
+ void _edit_files_with_filter(DirAccess *da, const Vector<String> &p_filters, Set<String> &r_list, bool exclude);
+ void _edit_filter_list(Set<String> &r_list, const String &p_filter, bool exclude);
+
protected:
bool exists_export_template(String template_file_name, String *err) const;
String find_export_template(String template_file_name, String *err = NULL) const;
@@ -290,7 +294,7 @@ public:
void set_name(const String &p_name);
void set_os_name(const String &p_name);
- void set_logo(const Ref<Texture> &p_loco);
+ void set_logo(const Ref<Texture> &p_logo);
void set_release_64(const String &p_file);
void set_release_32(const String &p_file);
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index eeb2f5ae8a..9d194e0501 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -230,6 +230,28 @@ void EditorFileSystem::_scan_filesystem() {
memdelete(f);
}
+ String update_cache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_update2");
+
+ print_line("try to see fs update2");
+ if (FileAccess::exists(update_cache)) {
+
+ print_line("it exists");
+
+ {
+ FileAccessRef f = FileAccess::open(update_cache, FileAccess::READ);
+ String l = f->get_line().strip_edges();
+ while (l != String()) {
+
+ print_line("erased cache for: " + l + " " + itos(file_cache.has(l)));
+ file_cache.erase(l); //erase cache for this, so it gets updated
+ l = f->get_line().strip_edges();
+ }
+ }
+
+ DirAccessRef d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ d->remove(update_cache); //bye bye update cache
+ }
+
EditorProgressBG scan_progress("efs", "ScanFS", 1000);
ScanProgress sp;
@@ -339,6 +361,7 @@ bool EditorFileSystem::_update_scan_actions() {
int idx = ia.dir->find_file_index(ia.file);
ERR_CONTINUE(idx == -1);
+ _delete_internal_files(ia.dir->files[idx]->file);
memdelete(ia.dir->files[idx]);
ia.dir->files.remove(idx);
@@ -596,8 +619,14 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
if (fc && fc->modification_time == mt && fc->import_modification_time == import_mt && _check_missing_imported_files(path)) {
fi->type = fc->type;
+ fi->deps = fc->deps;
fi->modified_time = fc->modification_time;
fi->import_modified_time = fc->import_modification_time;
+ if (fc->type == String()) {
+ fi->type = ResourceLoader::get_resource_type(path);
+ //there is also the chance that file type changed due to reimport, must probably check this somehow here (or kind of note it for next time in another file?)
+ //note: I think this should not happen any longer..
+ }
} else {
@@ -615,6 +644,8 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
}
fi->type = ResourceFormatImporter::get_singleton()->get_resource_type(path);
+ //fi->deps = ResourceLoader::get_dependencies(path); pointless because it will be reimported, but..
+ print_line("import extension tried resource type for " + path + " and its " + fi->type);
fi->modified_time = 0;
fi->import_modified_time = 0;
@@ -625,14 +656,18 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
scan_actions.push_back(ia);
}
} else {
- //not imported, so just update type if changed
- if (fc && fc->modification_time == mt) {
+ if (fc && fc->modification_time == mt) {
+ //not imported, so just update type if changed
fi->type = fc->type;
fi->modified_time = fc->modification_time;
+ fi->deps = fc->deps;
fi->import_modified_time = 0;
} else {
+ //new or modified time
fi->type = ResourceLoader::get_resource_type(path);
+ fi->deps = _get_dependencies(path);
+ print_line("regular import tried resource type for " + path + " and its " + fi->type);
fi->modified_time = mt;
fi->import_modified_time = 0;
}
@@ -832,6 +867,19 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const
}
}
+void EditorFileSystem::_delete_internal_files(String p_file) {
+ if (FileAccess::exists(p_file + ".import")) {
+ List<String> paths;
+ ResourceFormatImporter::get_singleton()->get_internal_resource_path_list(p_file, &paths);
+ DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ for (List<String>::Element *E = paths.front(); E; E = E->next()) {
+ da->remove(E->get());
+ }
+ da->remove(p_file + ".import");
+ memdelete(da);
+ }
+}
+
void EditorFileSystem::_thread_func_sources(void *_userdata) {
EditorFileSystem *efs = (EditorFileSystem *)_userdata;
@@ -1167,12 +1215,34 @@ EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String &p
return fs;
}
+void EditorFileSystem::_save_late_updated_files() {
+ //files that already existed, and were modified, need re-scanning for dependencies upon project restart. This is done via saving this special file
+ String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_update2");
+ FileAccessRef f = FileAccess::open(fscache, FileAccess::WRITE);
+ for (Set<String>::Element *E = late_update_files.front(); E; E = E->next()) {
+ f->store_line(E->get());
+ }
+}
+
void EditorFileSystem::_resource_saved(const String &p_path) {
//print_line("resource saved: "+p_path);
EditorFileSystem::get_singleton()->update_file(p_path);
}
+Vector<String> EditorFileSystem::_get_dependencies(const String &p_path) {
+
+ List<String> deps;
+ ResourceLoader::get_dependencies(p_path, &deps);
+
+ Vector<String> ret;
+ for (List<String>::Element *E = deps.front(); E; E = E->next()) {
+ ret.push_back(E->get());
+ }
+
+ return ret;
+}
+
void EditorFileSystem::update_file(const String &p_file) {
EditorFileSystemDirectory *fs = NULL;
@@ -1186,6 +1256,7 @@ void EditorFileSystem::update_file(const String &p_file) {
if (!FileAccess::exists(p_file)) {
//was removed
+ _delete_internal_files(p_file);
memdelete(fs->files[cpos]);
fs->files.remove(cpos);
call_deferred("emit_signal", "filesystem_changed"); //update later
@@ -1196,6 +1267,9 @@ void EditorFileSystem::update_file(const String &p_file) {
if (cpos == -1) {
+ //the file did not exist, it was added
+
+ late_added_files.insert(p_file); //remember that it was added. This mean it will be scanned and imported on editor restart
int idx = 0;
for (int i = 0; i < fs->files.size(); i++) {
@@ -1215,11 +1289,18 @@ void EditorFileSystem::update_file(const String &p_file) {
fs->files.insert(idx, fi);
}
cpos = idx;
+ } else {
+
+ //the file exists and it was updated, and was not added in this step.
+ //this means we must force upon next restart to scan it again, to get proper type and dependencies
+ late_update_files.insert(p_file);
+ _save_late_updated_files(); //files need to be updated in the re-scan
}
//print_line("UPDATING: "+p_file);
fs->files[cpos]->type = type;
fs->files[cpos]->modified_time = FileAccess::get_modified_time(p_file);
+ fs->files[cpos]->deps = _get_dependencies(p_file);
//if (FileAccess::exists(p_file+".import")) {
// fs->files[cpos]->import_modified_time=FileAccess::get_modified_time(p_file+".import");
//}
@@ -1255,6 +1336,9 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
}
importer_name = cf->get_value("remap", "importer");
}
+
+ } else {
+ late_added_files.insert(p_file); //imported files do not call update_file(), but just in case..
}
Ref<ResourceImporter> importer;
@@ -1336,6 +1420,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
}
f->store_line("");
+
if (gen_files.size()) {
f->store_line("[gen]");
Array genf;
@@ -1368,6 +1453,8 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
//update modified times, to avoid reimport
fs->files[cpos]->modified_time = FileAccess::get_modified_time(p_file);
fs->files[cpos]->import_modified_time = FileAccess::get_modified_time(p_file + ".import");
+ fs->files[cpos]->deps = _get_dependencies(p_file);
+ fs->files[cpos]->type = importer->get_resource_type();
//if file is currently up, maybe the source it was loaded from changed, so import math must be updated for it
//to reload properly
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h
index 3522a1ab1d..fd62b06d07 100644
--- a/editor/editor_file_system.h
+++ b/editor/editor_file_system.h
@@ -137,6 +137,11 @@ class EditorFileSystem : public Node {
void _scan_filesystem();
+ Set<String> late_added_files; //keep track of files that were added, these will be re-scanned
+ Set<String> late_update_files;
+
+ void _save_late_updated_files();
+
EditorFileSystemDirectory *filesystem;
static EditorFileSystem *singleton;
@@ -168,6 +173,8 @@ class EditorFileSystem : public Node {
void _scan_fs_changes(EditorFileSystemDirectory *p_dir, const ScanProgress &p_progress);
+ void _delete_internal_files(String p_file);
+
Set<String> valid_extensions;
Set<String> import_extensions;
@@ -194,6 +201,8 @@ class EditorFileSystem : public Node {
bool reimport_on_missing_imported_files;
+ Vector<String> _get_dependencies(const String &p_path);
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index f80c4ee0e2..8b1f558c0a 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1788,7 +1788,7 @@ void EditorHelpBit::_bind_methods() {
void EditorHelpBit::_notification(int p_what) {
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles"));
+ add_style_override("panel", get_stylebox("ScriptPanel", "EditorStyles"));
}
}
diff --git a/editor/editor_help.h b/editor/editor_help.h
index de30b543fc..e0d68605ab 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -137,7 +137,7 @@ class EditorHelp : public VBoxContainer {
void _help_callback(const String &p_topic);
- void _add_text(const String &p_text);
+ void _add_text(const String &p_bbcode);
bool scroll_locked;
//void _button_pressed(int p_idx);
@@ -189,7 +189,7 @@ class EditorHelpBit : public Panel {
RichTextLabel *rich_text;
void _go_to_help(String p_what);
- void _meta_clicked(String p_what);
+ void _meta_clicked(String p_select);
protected:
static void _bind_methods();
diff --git a/editor/editor_name_dialog.cpp b/editor/editor_name_dialog.cpp
index 6ebfcbf313..74bb526ccc 100644
--- a/editor/editor_name_dialog.cpp
+++ b/editor/editor_name_dialog.cpp
@@ -87,6 +87,6 @@ EditorNameDialog::EditorNameDialog() {
makevb->add_child(name);
name->set_margin(MARGIN_TOP, 5);
name->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
- name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 5);
+ name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
name->connect("gui_input", this, "_line_gui_input");
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ea6a4180ad..9150e6a9bb 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -365,10 +365,29 @@ void EditorNode::_fs_changed() {
E->get()->invalidate();
}
- if (export_defer.platform != "") {
+ if (export_defer.preset != "") {
+ Ref<EditorExportPreset> preset;
+ for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) {
+ preset = EditorExport::get_singleton()->get_export_preset(i);
+ if (preset->get_name() == export_defer.preset) {
+ break;
+ }
+ preset.unref();
+ }
+ if (preset.is_null()) {
+ String err = "Unknown export preset: " + export_defer.preset;
+ ERR_PRINT(err.utf8().get_data());
+ } else {
+ Ref<EditorExportPlatform> platform = preset->get_platform();
+ if (platform.is_null()) {
+ String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
+ ERR_PRINT(err.utf8().get_data());
+ } else {
+ platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0);
+ }
+ }
- //project_export_settings->export_platform(export_defer.platform,export_defer.path,export_defer.debug,export_defer.password,true);
- export_defer.platform = "";
+ get_tree()->quit();
}
{
@@ -702,34 +721,34 @@ void EditorNode::_set_scene_metadata(const String &p_file, int p_idx) {
ERR_FAIL_COND(err != OK);
}
-bool EditorNode::_find_and_save_resource(RES res, Map<RES, bool> &processed, int32_t flags) {
+bool EditorNode::_find_and_save_resource(RES p_res, Map<RES, bool> &processed, int32_t flags) {
- if (res.is_null())
+ if (p_res.is_null())
return false;
- if (processed.has(res)) {
+ if (processed.has(p_res)) {
- return processed[res];
+ return processed[p_res];
}
- bool changed = res->is_edited();
- res->set_edited(false);
+ bool changed = p_res->is_edited();
+ p_res->set_edited(false);
- bool subchanged = _find_and_save_edited_subresources(res.ptr(), processed, flags);
+ bool subchanged = _find_and_save_edited_subresources(p_res.ptr(), processed, flags);
- //print_line("checking if edited: "+res->get_type()+" :: "+res->get_name()+" :: "+res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged));
+ //print_line("checking if edited: "+p_res->get_type()+" :: "+p_res->get_name()+" :: "+p_res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged));
- if (res->get_path().is_resource_file()) {
+ if (p_res->get_path().is_resource_file()) {
if (changed || subchanged) {
//save
- print_line("Also saving modified external resource: " + res->get_path());
- ResourceSaver::save(res->get_path(), res, flags);
+ print_line("Also saving modified external resource: " + p_res->get_path());
+ ResourceSaver::save(p_res->get_path(), p_res, flags);
}
- processed[res] = false; //because it's a file
+ processed[p_res] = false; //because it's a file
return false;
} else {
- processed[res] = changed;
+ processed[p_res] = changed;
return changed;
}
}
@@ -1215,7 +1234,7 @@ void EditorNode::_dialog_action(String p_file) {
ml = Ref<MeshLibrary>(memnew(MeshLibrary));
}
- //MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(),ml,true);
+ MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(), ml, true);
Error err = ResourceSaver::save(p_file, ml);
if (err) {
@@ -1286,7 +1305,7 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err == ERR_CANT_OPEN) {
config.instance(); // new config
@@ -1297,7 +1316,7 @@ void EditorNode::_dialog_action(String p_file) {
_save_docks_to_config(config, p_file);
- config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
layout_dialog->hide();
_update_layouts_menu();
@@ -1314,7 +1333,7 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK || !config->has_section(p_file)) {
show_warning(TTR("Layout name not found!"));
@@ -1328,7 +1347,7 @@ void EditorNode::_dialog_action(String p_file) {
config->set_value(p_file, E->get(), Variant());
}
- config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
layout_dialog->hide();
_update_layouts_menu();
@@ -3775,9 +3794,9 @@ void EditorNode::progress_add_task(const String &p_task, const String &p_label,
singleton->progress_dialog->add_task(p_task, p_label, p_steps);
}
-void EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_redraw) {
+void EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) {
- singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_redraw);
+ singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_refresh);
}
void EditorNode::progress_end_task(const String &p_task) {
@@ -3845,9 +3864,9 @@ void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) {
Vector<EditorNodeInitCallback> EditorNode::_init_callbacks;
-Error EditorNode::export_platform(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) {
+Error EditorNode::export_preset(const String &preset, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) {
- export_defer.platform = p_platform;
+ export_defer.preset = preset;
export_defer.path = p_path;
export_defer.debug = p_debug;
export_defer.password = p_password;
@@ -3922,6 +3941,7 @@ void EditorNode::_dock_select_input(const Ref<InputEvent> &p_input) {
splits[i]->hide();
}
+ _edit_current();
_save_docks();
}
}
@@ -3949,6 +3969,7 @@ void EditorNode::_dock_move_left() {
dock_slot[dock_popup_selected]->move_child(current, prev->get_index());
dock_slot[dock_popup_selected]->set_current_tab(dock_slot[dock_popup_selected]->get_current_tab() - 1);
dock_select->update();
+ _edit_current();
_save_docks();
}
@@ -3961,6 +3982,7 @@ void EditorNode::_dock_move_right() {
dock_slot[dock_popup_selected]->move_child(next, current->get_index());
dock_slot[dock_popup_selected]->set_current_tab(dock_slot[dock_popup_selected]->get_current_tab() + 1);
dock_select->update();
+ _edit_current();
_save_docks();
}
@@ -4314,7 +4336,7 @@ void EditorNode::_update_layouts_menu() {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK) {
return; //no config
}
@@ -4362,7 +4384,7 @@ void EditorNode::_layout_menu_option(int p_id) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK) {
return; //no config
}
@@ -4908,13 +4930,19 @@ void EditorNode::dim_editor(bool p_dimming) {
static int dim_count = 0;
bool dim_ui = EditorSettings::get_singleton()->get("interface/dim_editor_on_dialog_popup");
if (p_dimming) {
- if (dim_ui && dim_count == 0)
- _start_dimming(true);
- dim_count++;
+ if (dim_ui) {
+ if (dim_count == 0) {
+ _start_dimming(true);
+ }
+ dim_count++;
+ }
} else {
- dim_count--;
- if (dim_count < 1)
+ if (dim_count == 1) {
_start_dimming(false);
+ dim_count = 0;
+ } else if (dim_ui && dim_count > 0) {
+ dim_count--;
+ }
}
}
@@ -6059,7 +6087,7 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(MultiMeshEditorPlugin(this)));
add_editor_plugin(memnew(MeshInstanceEditorPlugin(this)));
add_editor_plugin(memnew(AnimationTreeEditorPlugin(this)));
- //add_editor_plugin( memnew( MeshLibraryEditorPlugin(this) ) );
+ add_editor_plugin(memnew(MeshLibraryEditorPlugin(this)));
add_editor_plugin(memnew(StyleBoxEditorPlugin(this)));
add_editor_plugin(memnew(ParticlesEditorPlugin(this)));
add_editor_plugin(memnew(ResourcePreloaderEditorPlugin(this)));
diff --git a/editor/editor_node.h b/editor/editor_node.h
index a440aaa1e6..cf6ef33325 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -539,7 +539,7 @@ private:
}
struct ExportDefer {
- String platform;
+ String preset;
String path;
bool debug;
String password;
@@ -581,7 +581,7 @@ private:
void _update_top_menu_visibility();
void _update_layouts_menu();
- void _layout_menu_option(int p_idx);
+ void _layout_menu_option(int p_id);
void _toggle_search_bar(bool p_pressed);
void _clear_search_box();
@@ -742,7 +742,7 @@ public:
void show_warning(const String &p_text, const String &p_title = "Warning!");
- Error export_platform(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false);
+ Error export_preset(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false);
static void register_editor_types();
static void unregister_editor_types();
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 19c77ef737..d8c8d419b9 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -249,8 +249,8 @@ bool EditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEv
}
String EditorPlugin::get_name() const {
- if (get_script_instance() && get_script_instance()->has_method("get_name")) {
- return get_script_instance()->call("get_name");
+ if (get_script_instance() && get_script_instance()->has_method("get_plugin_name")) {
+ return get_script_instance()->call("get_plugin_name");
}
return String();
@@ -450,7 +450,7 @@ void EditorPlugin::_bind_methods() {
gizmo.return_val.hint = PROPERTY_HINT_RESOURCE_TYPE;
gizmo.return_val.hint_string = "EditorSpatialGizmo";
ClassDB::add_virtual_method(get_class_static(), gizmo);
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_name"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_plugin_name"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "has_main_screen"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("make_visible", PropertyInfo(Variant::BOOL, "visible")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("edit", PropertyInfo(Variant::OBJECT, "object")));
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 0baa373b42..77c5501b25 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -134,7 +134,7 @@ public:
virtual void make_visible(bool p_visible);
virtual void selected_notify() {} //notify that it was raised by the user, not the editor
virtual void edit(Object *p_object);
- virtual bool handles(Object *p_node) const;
+ virtual bool handles(Object *p_object) const;
virtual Dictionary get_state() const; //save editor state so it can't be reloaded when reloading scene
virtual void set_state(const Dictionary &p_state); //restore editor state (likely was saved with the scene)
virtual void clear(); // clear any temporary data in te editor, reset it (likely new scene or load another scene)
diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h
index 1bfa094a38..cedd571194 100644
--- a/editor/editor_resource_preview.h
+++ b/editor/editor_resource_preview.h
@@ -115,8 +115,8 @@ public:
static EditorResourcePreview *get_singleton();
//callback function is callback(String p_path,Ref<Texture> preview,Variant udata) preview null if could not load
- void queue_resource_preview(const String &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);
- void queue_edited_resource_preview(const Ref<Resource> &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);
+ void queue_resource_preview(const String &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);
+ void queue_edited_resource_preview(const Ref<Resource> &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);
void add_preview_generator(const Ref<EditorResourcePreviewGenerator> &p_generator);
void remove_preview_generator(const Ref<EditorResourcePreviewGenerator> &p_generator);
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 4954b1f741..e1ef20255b 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -93,7 +93,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
int window_placement = EditorSettings::get_singleton()->get("run/window_placement/rect");
switch (window_placement) {
- case 0: { // default
+ case 0: { // top left
args.push_back("-p");
args.push_back(itos(screen_rect.position.x) + "x" + itos(screen_rect.position.y));
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 07af60d634..843e5d0748 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -615,6 +615,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("text_editor/line_numbers/line_length_guideline_column", 80);
hints["text_editor/line_numbers/line_length_guideline_column"] = PropertyInfo(Variant::INT, "text_editor/line_numbers/line_length_guideline_column", PROPERTY_HINT_RANGE, "20, 160, 10");
+ set("text_editor/open_scripts/smooth_scrolling", true);
set("text_editor/open_scripts/show_members_overview", true);
set("text_editor/files/trim_trailing_whitespace_on_save", false);
@@ -663,6 +664,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("editors/3d/emulate_3_button_mouse", false);
set("editors/3d/warped_mouse_panning", true);
+ set("editors/3d/orbit_sensitivity", 0.7);
+
set("editors/3d/freelook_base_speed", 1);
set("editors/3d/freelook_activation_modifier", 0);
@@ -683,7 +686,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("editors/poly_editor/point_grab_radius", 8);
set("run/window_placement/rect", 1);
- hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Default,Centered,Custom Position,Force Maximized,Force Full Screen");
+ hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Top Left,Centered,Custom Position,Force Maximized,Force Fullscreen");
String screen_hints = TTR("Default (Same as Editor)");
for (int i = 0; i < OS::get_singleton()->get_screen_count(); i++) {
screen_hints += ",Monitor " + itos(i + 1);
@@ -843,9 +846,9 @@ void EditorSettings::add_property_hint(const PropertyInfo &p_hint) {
hints[p_hint.name] = p_hint;
}
-void EditorSettings::set_favorite_dirs(const Vector<String> &p_favorites) {
+void EditorSettings::set_favorite_dirs(const Vector<String> &p_favorites_dirs) {
- favorite_dirs = p_favorites;
+ favorite_dirs = p_favorites_dirs;
FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("favorite_dirs"), FileAccess::WRITE);
if (f) {
for (int i = 0; i < favorite_dirs.size(); i++)
@@ -859,9 +862,9 @@ Vector<String> EditorSettings::get_favorite_dirs() const {
return favorite_dirs;
}
-void EditorSettings::set_recent_dirs(const Vector<String> &p_recent) {
+void EditorSettings::set_recent_dirs(const Vector<String> &p_recent_dirs) {
- recent_dirs = p_recent;
+ recent_dirs = p_recent_dirs;
FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("recent_dirs"), FileAccess::WRITE);
if (f) {
for (int i = 0; i < recent_dirs.size(); i++)
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index d5adb84b63..a99d7e0ad5 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -145,7 +145,7 @@ public:
void add_property_hint(const PropertyInfo &p_hint);
- void set_favorite_dirs(const Vector<String> &p_favorite_dirs);
+ void set_favorite_dirs(const Vector<String> &p_favorites_dirs);
Vector<String> get_favorite_dirs() const;
void set_recent_dirs(const Vector<String> &p_recent_dirs);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 7b1a6a8e27..11150371d2 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -80,17 +80,20 @@ static Ref<StyleBoxLine> make_line_stylebox(Color color, int thickness = 1, floa
static Ref<StyleBoxFlat> change_border_color(Ref<StyleBoxFlat> p_style, Color p_color) {
Ref<StyleBoxFlat> style = p_style->duplicate();
- style->set_light_color(p_color);
- style->set_dark_color(p_color);
+ style->set_border_color_all(p_color);
return style;
}
static Ref<StyleBoxFlat> add_additional_border(Ref<StyleBoxFlat> p_style, int p_left, int p_top, int p_right, int p_bottom) {
Ref<StyleBoxFlat> style = p_style->duplicate();
- style->_set_additional_border_size(MARGIN_LEFT, p_left * EDSCALE);
- style->_set_additional_border_size(MARGIN_RIGHT, p_right * EDSCALE);
- style->_set_additional_border_size(MARGIN_TOP, p_top * EDSCALE);
- style->_set_additional_border_size(MARGIN_BOTTOM, p_bottom * EDSCALE);
+ style->set_border_width(MARGIN_LEFT, p_left * EDSCALE + style->get_border_width(MARGIN_LEFT));
+ style->set_border_width(MARGIN_RIGHT, p_right * EDSCALE + style->get_border_width(MARGIN_RIGHT));
+ style->set_border_width(MARGIN_TOP, p_top * EDSCALE + style->get_border_width(MARGIN_TOP));
+ style->set_border_width(MARGIN_BOTTOM, p_bottom * EDSCALE + style->get_border_width(MARGIN_BOTTOM));
+ style->set_expand_margin_size(MARGIN_LEFT, p_left * EDSCALE);
+ style->set_expand_margin_size(MARGIN_RIGHT, p_right * EDSCALE);
+ style->set_expand_margin_size(MARGIN_TOP, p_top * EDSCALE);
+ style->set_expand_margin_size(MARGIN_BOTTOM, p_bottom * EDSCALE);
return style;
}
@@ -186,8 +189,8 @@ Ref<Theme> create_editor_theme() {
// Focus
Ref<StyleBoxFlat> focus_sbt = make_flat_stylebox(light_color_1, 4, 4, 4, 4);
- focus_sbt->set_draw_center(false);
- focus_sbt->set_border_size(border_width);
+ focus_sbt->set_filled(false);
+ focus_sbt->set_border_width_all(1 * EDSCALE);
focus_sbt = change_border_color(focus_sbt, light_color_2);
theme->set_stylebox("Focus", "EditorStyles", focus_sbt);
@@ -202,8 +205,10 @@ Ref<Theme> create_editor_theme() {
Ref<StyleBoxFlat> style_menu_hover_border = make_flat_stylebox(highlight_color, 4, 4, 4, 4);
Ref<StyleBoxFlat> style_menu_hover_bg = make_flat_stylebox(dark_color_2, 4, 4, 4, 4);
- style_menu_hover_border->set_draw_center(false);
- style_menu_hover_border->_set_additional_border_size(MARGIN_BOTTOM, border_width);
+ style_menu_hover_border->set_filled(false);
+ style_menu_hover_border->set_border_width(MARGIN_BOTTOM, border_width);
+ style_menu_hover_border->set_expand_margin_size(MARGIN_BOTTOM, border_width);
+
theme->set_stylebox("normal", "MenuButton", style_menu);
theme->set_stylebox("hover", "MenuButton", style_menu);
theme->set_stylebox("pressed", "MenuButton", style_menu);
@@ -230,24 +235,18 @@ Ref<Theme> create_editor_theme() {
// Content of each tab
Ref<StyleBoxFlat> style_content_panel = make_flat_stylebox(base_color, 4, 5, 4, 4);
- style_content_panel->set_dark_color(title_color_hl);
- style_content_panel->set_light_color(title_color_hl);
- style_content_panel->set_border_size(border_width);
- style_content_panel->set_border_blend(false);
+ style_content_panel->set_border_color_all(title_color_hl);
+ style_content_panel->set_border_width_all(border_width);
Ref<StyleBoxFlat> style_content_panel_vp = make_flat_stylebox(base_color, border_width, 5, border_width, border_width);
- style_content_panel_vp->set_dark_color(title_color_hl);
- style_content_panel_vp->set_light_color(title_color_hl);
- style_content_panel_vp->set_border_size(border_width);
- style_content_panel_vp->set_border_blend(false);
+ style_content_panel_vp->set_border_color_all(title_color_hl);
+ style_content_panel_vp->set_border_width_all(border_width);
theme->set_stylebox("panel", "TabContainer", style_content_panel);
theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp);
Ref<StyleBoxFlat> style_button_type = make_flat_stylebox(dark_color_1, 6, 4, 6, 4);
- style_button_type->set_draw_center(true);
- style_button_type->set_border_size(border_width);
- style_button_type->set_light_color(light_color_1);
- style_button_type->set_dark_color(light_color_1);
- style_button_type->set_border_blend(false);
+ style_button_type->set_filled(true);
+ style_button_type->set_border_width_all(border_width);
+ style_button_type->set_border_color_all(light_color_1);
Ref<StyleBoxFlat> style_button_type_disabled = change_border_color(style_button_type, dark_color_2);
@@ -260,6 +259,7 @@ Ref<Theme> create_editor_theme() {
theme->set_stylebox("focus", "Button", change_border_color(style_button_type, highlight_color));
theme->set_stylebox("disabled", "Button", style_button_type_disabled);
theme->set_color("font_color", "Button", button_font_color);
+
theme->set_color("font_color_hover", "Button", HIGHLIGHT_COLOR_LIGHT);
theme->set_color("font_color_pressed", "Button", highlight_color);
theme->set_color("icon_color_hover", "Button", HIGHLIGHT_COLOR_LIGHT);
@@ -267,11 +267,9 @@ Ref<Theme> create_editor_theme() {
theme->set_color("icon_color_pressed", "Button", Color(highlight_color.r * 1.15, highlight_color.g * 1.15, highlight_color.b * 1.15, highlight_color.a));
// OptionButton
- Ref<StyleBoxFlat> style_option_button = make_flat_stylebox(dark_color_1, 4, 4, 8, 4);
- style_option_button->set_border_size(border_width);
- style_option_button->set_light_color(light_color_1);
- style_option_button->set_dark_color(light_color_1);
- style_option_button->set_border_blend(false);
+ Ref<StyleBoxFlat> style_option_button = make_flat_stylebox(dark_color_1, 4, 4, 4, 4);
+ style_option_button->set_border_width_all(border_width);
+ style_option_button->set_border_color_all(light_color_1);
theme->set_stylebox("hover", "OptionButton", change_border_color(style_button_type, HIGHLIGHT_COLOR_LIGHT));
theme->set_stylebox("pressed", "OptionButton", change_border_color(style_button_type, highlight_color));
theme->set_stylebox("focus", "OptionButton", change_border_color(style_button_type, highlight_color));
@@ -291,24 +289,20 @@ Ref<Theme> create_editor_theme() {
// PopupMenu
Ref<StyleBoxFlat> style_popup_menu = make_flat_stylebox(dark_color_1, 8, 8, 8, 8);
- style_popup_menu->set_border_size(MAX(EDSCALE, border_width));
- style_popup_menu->set_light_color(light_color_1);
- style_popup_menu->set_dark_color(light_color_1);
- style_popup_menu->set_border_blend(false);
+ style_popup_menu->set_border_width_all(MAX(EDSCALE, border_width));
+ style_popup_menu->set_border_color_all(light_color_1);
theme->set_stylebox("panel", "PopupMenu", style_popup_menu);
theme->set_stylebox("separator", "PopupMenu", make_line_stylebox(separator_color, MAX(EDSCALE, border_width), 8 - MAX(EDSCALE, border_width)));
// Tree & ItemList background
Ref<StyleBoxFlat> style_tree_bg = make_flat_stylebox(dark_color_1, 2, 4, 2, 4);
- style_tree_bg->set_border_size(border_width);
- style_tree_bg->set_light_color(dark_color_3);
- style_tree_bg->set_dark_color(dark_color_3);
+ style_tree_bg->set_border_width_all(border_width);
+ style_tree_bg->set_border_color_all(dark_color_3);
theme->set_stylebox("bg", "Tree", style_tree_bg);
// Script background
Ref<StyleBoxFlat> style_script_bg = make_flat_stylebox(dark_color_1, 0, 0, 0, 0);
- style_script_bg->set_border_size(border_width);
- style_script_bg->set_light_color(dark_color_3);
- style_script_bg->set_dark_color(dark_color_3);
+ style_script_bg->set_border_width_all(border_width);
+ style_script_bg->set_border_color_all(dark_color_3);
theme->set_stylebox("ScriptPanel", "EditorStyles", style_script_bg);
// Tree
@@ -333,10 +327,10 @@ Ref<Theme> create_editor_theme() {
theme->set_stylebox("selected", "Tree", style_tree_selected);
Ref<StyleBoxFlat> style_tree_cursor = make_flat_stylebox(HIGHLIGHT_COLOR_DARK, 4, 4, 4, 4);
- style_tree_cursor->set_draw_center(false);
- style_tree_cursor->set_border_size(border_width);
- style_tree_cursor->set_light_color(light_color_1);
- style_tree_cursor->set_dark_color(light_color_1);
+ style_tree_cursor->set_filled(false);
+ style_tree_cursor->set_border_width_all(border_width);
+ style_tree_cursor->set_border_color_all(light_color_1);
+
Ref<StyleBoxFlat> style_tree_title = make_flat_stylebox(dark_color_3, 4, 4, 4, 4);
theme->set_stylebox("cursor", "Tree", style_tree_cursor);
theme->set_stylebox("cursor_unfocused", "Tree", style_tree_cursor);
@@ -353,14 +347,13 @@ Ref<Theme> create_editor_theme() {
// ItemList
Ref<StyleBoxFlat> style_itemlist_bg = make_flat_stylebox(dark_color_1, 4, 4, 4, 4);
- style_itemlist_bg->set_border_size(border_width);
- style_itemlist_bg->set_light_color(dark_color_3);
- style_itemlist_bg->set_dark_color(dark_color_3);
+ style_itemlist_bg->set_border_width_all(border_width);
+ style_itemlist_bg->set_border_color_all(dark_color_3);
+
Ref<StyleBoxFlat> style_itemlist_cursor = make_flat_stylebox(highlight_color, 0, 0, 0, 0);
- style_itemlist_cursor->set_draw_center(false);
- style_itemlist_cursor->set_border_size(border_width);
- style_itemlist_cursor->set_light_color(HIGHLIGHT_COLOR_DARK);
- style_itemlist_cursor->set_dark_color(HIGHLIGHT_COLOR_DARK);
+ style_itemlist_cursor->set_filled(false);
+ style_itemlist_cursor->set_border_width_all(border_width);
+ style_itemlist_cursor->set_border_color_all(HIGHLIGHT_COLOR_DARK);
theme->set_stylebox("cursor", "ItemList", style_itemlist_cursor);
theme->set_stylebox("cursor_unfocused", "ItemList", style_itemlist_cursor);
theme->set_stylebox("selected_focus", "ItemList", style_tree_focus);
@@ -371,7 +364,7 @@ Ref<Theme> create_editor_theme() {
Ref<StyleBoxFlat> style_tab_fg = make_flat_stylebox(title_color_hl, 15, 5, 15, 5);
Ref<StyleBoxFlat> style_tab_bg = make_flat_stylebox(base_color, 15, 5, 15, 5);
- style_tab_bg->set_draw_center(false);
+ style_tab_bg->set_filled(false);
// Tabs & TabContainer
theme->set_stylebox("tab_fg", "TabContainer", style_tab_fg);
@@ -396,7 +389,7 @@ Ref<Theme> create_editor_theme() {
Ref<StyleBoxFlat> style_tab_fg_debugger = make_flat_stylebox(dark_color_2, 10, 5, 10, 5);
Ref<StyleBoxFlat> style_tab_bg_debugger = make_flat_stylebox(dark_color_2, 10, 5, 10, 5);
- style_tab_bg_debugger->set_draw_center(false);
+ style_tab_bg_debugger->set_filled(false);
theme->set_stylebox("DebuggerTabFG", "EditorStyles", style_tab_fg_debugger);
theme->set_stylebox("DebuggerTabBG", "EditorStyles", style_tab_bg_debugger);
@@ -435,11 +428,10 @@ Ref<Theme> create_editor_theme() {
// WindowDialog
Ref<StyleBoxFlat> style_window = make_flat_stylebox(dark_color_2, 4, 4, 4, 4);
- style_window->set_border_size(MAX(EDSCALE, border_width));
- style_window->set_border_blend(false);
- style_window->set_light_color(title_color_hl);
- style_window->set_dark_color(title_color_hl);
- style_window->_set_additional_border_size(MARGIN_TOP, 24 * EDSCALE);
+ style_window->set_border_width_all(MAX(EDSCALE, border_width));
+ style_window->set_border_color_all(title_color_hl);
+ style_window->set_border_width(MARGIN_TOP, 24 * EDSCALE);
+ style_window->set_expand_margin_size(MARGIN_TOP, 24 * EDSCALE);
theme->set_stylebox("panel", "WindowDialog", style_window);
theme->set_color("title_color", "WindowDialog", title_color_hl_text_color);
theme->set_icon("close", "WindowDialog", title_hl_close_icon);
@@ -455,6 +447,7 @@ Ref<Theme> create_editor_theme() {
theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0));
theme->set_stylebox("grabber", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabber", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2));
theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberHl", "EditorIcons"), 5, 5, 5, 5, 2, 2, 2, 2));
+ theme->set_stylebox("grabber_pressed", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberPressed", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2));
theme->set_icon("increment", "HScrollBar", empty_icon);
theme->set_icon("increment_highlight", "HScrollBar", empty_icon);
@@ -466,6 +459,7 @@ Ref<Theme> create_editor_theme() {
theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0));
theme->set_stylebox("grabber", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabber", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2));
theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberHl", "EditorIcons"), 5, 5, 5, 5, 2, 2, 2, 2));
+ theme->set_stylebox("grabber_pressed", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberPressed", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2));
theme->set_icon("increment", "VScrollBar", empty_icon);
theme->set_icon("increment_highlight", "VScrollBar", empty_icon);
@@ -490,16 +484,13 @@ Ref<Theme> create_editor_theme() {
// TooltipPanel
Ref<StyleBoxFlat> style_tooltip = make_flat_stylebox(Color(1, 1, 1, 0.8), 8, 8, 8, 8);
- style_tooltip->set_border_size(border_width);
- style_tooltip->set_border_blend(false);
- style_tooltip->set_light_color(Color(1, 1, 1, 0.9));
- style_tooltip->set_dark_color(Color(1, 1, 1, 0.9));
+ style_tooltip->set_border_width_all(border_width);
+ style_tooltip->set_border_color_all(Color(1, 1, 1, 0.9));
theme->set_stylebox("panel", "TooltipPanel", style_tooltip);
// PopupPanel
Ref<StyleBoxFlat> style_dock_select = make_flat_stylebox(base_color);
- style_dock_select->set_light_color(light_color_1);
- style_dock_select->set_dark_color(light_color_1);
+ style_dock_select->set_border_color_all(light_color_1);
style_dock_select = add_additional_border(style_dock_select, 2, 2, 2, 2);
theme->set_stylebox("panel", "PopupPanel", style_dock_select);
@@ -520,28 +511,20 @@ Ref<Theme> create_editor_theme() {
// GraphNode
Ref<StyleBoxFlat> graphsb = make_flat_stylebox(Color(0, 0, 0, 0.3), 16, 24, 16, 5);
- graphsb->set_border_blend(false);
- graphsb->set_border_size(border_width);
- graphsb->set_light_color(Color(1, 1, 1, 0.6));
- graphsb->set_dark_color(Color(1, 1, 1, 0.6));
+ graphsb->set_border_width_all(border_width);
+ graphsb->set_border_color_all(Color(1, 1, 1, 0.6));
graphsb = add_additional_border(graphsb, 0, -22, 0, 0);
Ref<StyleBoxFlat> graphsbselected = make_flat_stylebox(Color(0, 0, 0, 0.4), 16, 24, 16, 5);
- graphsbselected->set_border_blend(false);
- graphsbselected->set_border_size(border_width);
- graphsbselected->set_light_color(Color(1, 1, 1, 0.9));
- graphsbselected->set_dark_color(Color(1, 1, 1, 0.9));
+ graphsbselected->set_border_width_all(border_width);
+ graphsbselected->set_border_color_all(Color(1, 1, 1, 0.9));
graphsbselected = add_additional_border(graphsbselected, 0, -22, 0, 0);
Ref<StyleBoxFlat> graphsbcomment = make_flat_stylebox(Color(0, 0, 0, 0.3), 16, 24, 16, 5);
- graphsbcomment->set_border_blend(false);
- graphsbcomment->set_border_size(border_width);
- graphsbcomment->set_light_color(Color(1, 1, 1, 0.6));
- graphsbcomment->set_dark_color(Color(1, 1, 1, 0.6));
+ graphsbcomment->set_border_width_all(border_width);
+ graphsbcomment->set_border_color_all(Color(1, 1, 1, 0.6));
graphsbcomment = add_additional_border(graphsbcomment, 0, -22, 0, 0);
Ref<StyleBoxFlat> graphsbcommentselected = make_flat_stylebox(Color(0, 0, 0, 0.4), 16, 24, 16, 5);
- graphsbcommentselected->set_border_blend(false);
- graphsbcommentselected->set_border_size(border_width);
- graphsbcommentselected->set_light_color(Color(1, 1, 1, 0.9));
- graphsbcommentselected->set_dark_color(Color(1, 1, 1, 0.9));
+ graphsbcommentselected->set_border_width_all(border_width);
+ graphsbcommentselected->set_border_color_all(Color(1, 1, 1, 0.9));
graphsbcommentselected = add_additional_border(graphsbcommentselected, 0, -22, 0, 0);
theme->set_stylebox("frame", "GraphNode", graphsb);
theme->set_stylebox("selectedframe", "GraphNode", graphsbselected);
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 77898aa6c2..2ec0c38815 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -158,7 +158,7 @@ private:
void _favorites_pressed();
void _open_pressed();
- void _dir_rmb_pressed(const Vector2 &local_mouse_pos);
+ void _dir_rmb_pressed(const Vector2 &p_pos);
void _search_changed(const String &p_text);
void _files_list_rmb_select(int p_item, const Vector2 &p_pos);
diff --git a/editor/icons/2x/icon_editor_control_anchor.png b/editor/icons/2x/icon_editor_control_anchor.png
new file mode 100644
index 0000000000..838f85b763
--- /dev/null
+++ b/editor/icons/2x/icon_editor_control_anchor.png
Binary files differ
diff --git a/editor/icons/icon_GUI_scroll_grabber_pressed.png b/editor/icons/icon_GUI_scroll_grabber_pressed.png
new file mode 100644
index 0000000000..a46d242ddd
--- /dev/null
+++ b/editor/icons/icon_GUI_scroll_grabber_pressed.png
Binary files differ
diff --git a/editor/icons/icon_editor_control_anchor.png b/editor/icons/icon_editor_control_anchor.png
new file mode 100644
index 0000000000..158dd62a7b
--- /dev/null
+++ b/editor/icons/icon_editor_control_anchor.png
Binary files differ
diff --git a/editor/icons/source/icon_GUI_scroll_grabber_pressed.svg b/editor/icons/source/icon_GUI_scroll_grabber_pressed.svg
new file mode 100644
index 0000000000..852e985c4c
--- /dev/null
+++ b/editor/icons/source/icon_GUI_scroll_grabber_pressed.svg
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="12"
+ height="12"
+ viewBox="0 0 12 11.999999"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="icon_GUI_scroll_grabber_pressed.svg"
+ inkscape:export-filename="D:\HDD Documents\Other Projects\godot\editor\icons\icon_GUI_scroll_grabber_pressed.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="69.166667"
+ inkscape:cx="3.7445783"
+ inkscape:cy="6"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1017"
+ inkscape:window-x="-8"
+ inkscape:window-y="-8"
+ inkscape:window-maximized="1"
+ inkscape:snap-nodes="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid4136"
+ empspacing="4" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3623)">
+ <circle
+ style="opacity:1;fill:#afafaf;fill-opacity:0.72941178;stroke:none;stroke-width:2.24999642000000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path4239"
+ cx="6"
+ cy="1046.3623"
+ r="2.9999952"
+ inkscape:export-filename="/mnt/2TB/Development/godot_dev/editor/icons/icon_scroll_grabber_hl.png"
+ inkscape:export-xdpi="96"
+ inkscape:export-ydpi="96"
+ d="m 8.9999952,1046.3623 c 0,1.6569 -1.3431436,3 -2.9999952,3 -1.6568516,0 -2.9999952,-1.3431 -2.9999952,-3 0,-1.6568 1.3431436,-3 2.9999952,-3 1.6568516,0 2.9999952,1.3432 2.9999952,3 z" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_editor_control_anchor.svg b/editor/icons/source/icon_editor_control_anchor.svg
new file mode 100644
index 0000000000..473b69d060
--- /dev/null
+++ b/editor/icons/source/icon_editor_control_anchor.svg
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.1 r"
+ inkscape:export-filename="/home/gilles/godot/editor/icons/icon_editor_control_anchor.png"
+ inkscape:export-xdpi="96"
+ inkscape:export-ydpi="96"
+ sodipodi:docname="icon_editor_control_anchor.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.627416"
+ inkscape:cx="0.71312079"
+ inkscape:cy="11.175116"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1356"
+ inkscape:window-height="742"
+ inkscape:window-x="4"
+ inkscape:window-y="20"
+ inkscape:window-maximized="0"
+ inkscape:pagecheckerboard="true"
+ showguides="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <path
+ style="fill:#a5efac;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
+ d="M 8.8320312 6.1445312 A 4 4.0000234 0 0 1 6.140625 8.8300781 L 16 16 L 8.8320312 6.1445312 z "
+ transform="translate(0,1036.3622)"
+ id="path7188" />
+ <ellipse
+ r="2"
+ style="opacity:1;fill:#6e6e6e;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="ellipse4152"
+ cx="3"
+ cy="1039.3622" />
+ <ellipse
+ style="fill:#a5efac;fill-opacity:1;stroke:none;stroke-width:0.53333384;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:fill markers stroke"
+ id="path31"
+ cx="4"
+ cy="1040.3622"
+ rx="4"
+ ry="4.0000091" />
+ <circle
+ style="fill:#a5efac;fill-opacity:1;stroke:none;stroke-width:0.5333333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:fill markers stroke"
+ id="path31-3"
+ cx="5"
+ cy="1041.3622"
+ r="0" />
+ </g>
+</svg>
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 3626c6be59..a75147a3a9 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -87,8 +87,8 @@ struct ColladaImport {
Error _create_scene_skeletons(Collada::Node *p_node);
Error _create_scene(Collada::Node *p_node, Spatial *p_parent);
Error _create_resources(Collada::Node *p_node);
- Error _create_material(const String &p_material);
- Error _create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes = Vector<Ref<ArrayMesh> >(), bool p_for_morph = false, bool p_use_mesh_material = false);
+ Error _create_material(const String &p_target);
+ Error _create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes = Vector<Ref<ArrayMesh> >(), bool p_for_morph = false, bool p_use_mesh_material = false);
Error load(const String &p_path, int p_flags, bool p_force_make_tangents = false);
void _fix_param_animation_tracks();
void create_animation(int p_clip, bool p_make_tracks_in_all_bones, bool p_import_value_tracks);
@@ -390,7 +390,7 @@ Error ColladaImport::_create_material(const String &p_target) {
}
}
} else {
- //material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,effect.diffuse.color);
+ material->set_albedo(effect.diffuse.color);
}
// SPECULAR
@@ -591,7 +591,7 @@ static void _generate_tangents_and_binormals(const PoolVector<int> &p_indices, c
}
}
-Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes, bool p_for_morph, bool p_use_mesh_material) {
+Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes, bool p_for_morph, bool p_use_mesh_material) {
bool local_xform_mirror = p_local_xform.basis.determinant() < 0;
@@ -714,35 +714,35 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
bool has_weights = false;
- if (skin_controller) {
+ if (p_skin_controller) {
const Collada::SkinControllerData::Source *weight_src = NULL;
int weight_ofs = 0;
- if (skin_controller->weights.sources.has("WEIGHT")) {
+ if (p_skin_controller->weights.sources.has("WEIGHT")) {
- String weight_id = skin_controller->weights.sources["WEIGHT"].source;
- weight_ofs = skin_controller->weights.sources["WEIGHT"].offset;
- if (skin_controller->sources.has(weight_id)) {
+ String weight_id = p_skin_controller->weights.sources["WEIGHT"].source;
+ weight_ofs = p_skin_controller->weights.sources["WEIGHT"].offset;
+ if (p_skin_controller->sources.has(weight_id)) {
- weight_src = &skin_controller->sources[weight_id];
+ weight_src = &p_skin_controller->sources[weight_id];
}
}
int joint_ofs = 0;
- if (skin_controller->weights.sources.has("JOINT")) {
+ if (p_skin_controller->weights.sources.has("JOINT")) {
- joint_ofs = skin_controller->weights.sources["JOINT"].offset;
+ joint_ofs = p_skin_controller->weights.sources["JOINT"].offset;
}
//should be OK, given this was pre-checked.
int index_ofs = 0;
- int wstride = skin_controller->weights.sources.size();
- for (int w_i = 0; w_i < skin_controller->weights.sets.size(); w_i++) {
+ int wstride = p_skin_controller->weights.sources.size();
+ for (int w_i = 0; w_i < p_skin_controller->weights.sets.size(); w_i++) {
- int amount = skin_controller->weights.sets[w_i];
+ int amount = p_skin_controller->weights.sets[w_i];
Vector<Collada::Vertex::Weight> weights;
@@ -751,13 +751,13 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
Collada::Vertex::Weight w;
int read_from = index_ofs + a_i * wstride;
- ERR_FAIL_INDEX_V(read_from + wstride - 1, skin_controller->weights.indices.size(), ERR_INVALID_DATA);
- int weight_index = skin_controller->weights.indices[read_from + weight_ofs];
+ ERR_FAIL_INDEX_V(read_from + wstride - 1, p_skin_controller->weights.indices.size(), ERR_INVALID_DATA);
+ int weight_index = p_skin_controller->weights.indices[read_from + weight_ofs];
ERR_FAIL_INDEX_V(weight_index, weight_src->array.size(), ERR_INVALID_DATA);
w.weight = weight_src->array[weight_index];
- int bone_index = skin_controller->weights.indices[read_from + joint_ofs];
+ int bone_index = p_skin_controller->weights.indices[read_from + joint_ofs];
if (bone_index == -1)
continue; //ignore this weight (refers to bind shape)
ERR_FAIL_INDEX_V(bone_index, bone_remap.size(), ERR_INVALID_DATA);
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index ae89dfd77f..798f57f8c3 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -104,7 +104,7 @@ bool ResourceImporterScene::get_option_visibility(const String &p_option, const
}
}
- if (p_option == "materials/keep_files" && int(p_options["materials/storage"]) == 0) {
+ if (p_option == "materials/keep_on_reimport" && int(p_options["materials/storage"]) == 0) {
return false;
}
@@ -986,6 +986,8 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
List<PropertyInfo> pi;
+ print_line("node: " + String(p_node->get_name()));
+
p_node->get_property_list(&pi);
for (List<PropertyInfo>::Element *E = pi.front(); E; E = E->next()) {
@@ -993,6 +995,7 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
if (E->get().type == Variant::OBJECT) {
Ref<Material> mat = p_node->get(E->get().name);
+
if (p_make_materials && mat.is_valid() && mat->get_name() != "") {
if (!p_materials.has(mat)) {
@@ -1045,7 +1048,8 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
if (!p_materials.has(mat)) {
- String ext_name = p_base_path + "." + _make_extname(mat->get_name()) + ".material";
+ String ext_name = p_base_path.plus_file(_make_extname(mat->get_name()) + ".material");
+ ;
if (FileAccess::exists(ext_name)) {
//if exists, use it
Ref<Material> existing = ResourceLoader::load(ext_name);
@@ -1103,10 +1107,10 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "nodes/storage", PROPERTY_HINT_ENUM, "Single Scene,Instanced Sub-Scenes"), scenes_out ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/location", PROPERTY_HINT_ENUM, "Node,Mesh"), meshes_out ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), materials_out ? 1 : 0));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_files"), materials_out ? true : false));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "geometry/compress"), true));
- r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "geometry/ensure_tangents"), true));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "geometry/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), meshes_out ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_on_reimport"), materials_out ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/compress"), true));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/ensure_tangents"), true));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "meshes/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), meshes_out ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "external_files/store_in_subdir"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/fps", PROPERTY_HINT_RANGE, "1,120,1"), 15));
@@ -1176,7 +1180,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
if (bool(p_options["animation/import"]))
import_flags |= EditorSceneImporter::IMPORT_ANIMATION;
- if (bool(p_options["geometry/ensure_tangents"]))
+ if (bool(p_options["meshes/ensure_tangents"]))
import_flags |= EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS;
if (int(p_options["materials/location"]) == 0)
@@ -1250,7 +1254,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
}
bool external_materials = p_options["materials/storage"];
- bool external_meshes = p_options["geometry/storage"];
+ bool external_meshes = p_options["meshes/storage"];
bool external_scenes = int(p_options["nodes/storage"]) == 1;
String base_path = p_source_file.get_base_dir();
@@ -1272,7 +1276,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
Map<Ref<Material>, Ref<Material> > mat_map;
Map<Ref<ArrayMesh>, Ref<ArrayMesh> > mesh_map;
- bool keep_materials = bool(p_options["materials/keep_files"]);
+ bool keep_materials = bool(p_options["materials/keep_on_reimport"]);
_make_external_resources(scene, base_path, external_materials, keep_materials, external_meshes, mat_map, mesh_map);
}
diff --git a/editor/io_plugins/editor_font_import_plugin.cpp b/editor/io_plugins/editor_font_import_plugin.cpp
index 9831e08cf1..25d8a5b7eb 100644
--- a/editor/io_plugins/editor_font_import_plugin.cpp
+++ b/editor/io_plugins/editor_font_import_plugin.cpp
@@ -1536,8 +1536,8 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe
Vector<Point2i> res;
Size2i res_size;
EditorAtlas::fit(sizes,res,res_size);
- res_size.x=nearest_power_of_2(res_size.x);
- res_size.y=nearest_power_of_2(res_size.y);
+ res_size.x=next_power_of_2(res_size.x);
+ res_size.y=next_power_of_2(res_size.y);
print_line("Atlas size: "+res_size);
Image atlas(res_size.x,res_size.y,0,Image::FORMAT_RGBA8);
diff --git a/editor/io_plugins/editor_scene_import_plugin.cpp b/editor/io_plugins/editor_scene_import_plugin.cpp
index aa96f731ce..1890ca906a 100644
--- a/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -1307,7 +1307,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce
//confirm_import->set_child_rect(cvb);
PanelContainer *pc = memnew( PanelContainer );
- pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
+ pc->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal","TextEdit"));
//ec->add_child(pc);
missing_files = memnew( RichTextLabel );
cvb->add_margin_child(TTR("The Following Files are Missing:"),pc,true);
diff --git a/editor/io_plugins/editor_texture_import_plugin.cpp b/editor/io_plugins/editor_texture_import_plugin.cpp
index 095bc02fa0..1dc2641474 100644
--- a/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -1280,8 +1280,8 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
int atlas_w=dst_size.width;
int atlas_h=dst_size.height;
if (blit_to_po2) {
- atlas_w=nearest_power_of_2(dst_size.width);
- atlas_h=nearest_power_of_2(dst_size.height);
+ atlas_w=next_power_of_2(dst_size.width);
+ atlas_h=next_power_of_2(dst_size.height);
}
Image atlas;
atlas.create(atlas_w,atlas_h,0,alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8);
diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp
index 0f3f4b96f5..b1a538ed2e 100644
--- a/editor/node_dock.cpp
+++ b/editor/node_dock.cpp
@@ -63,6 +63,11 @@ void NodeDock::_notification(int p_what) {
NodeDock *NodeDock::singleton = NULL;
+void NodeDock::update_lists() {
+
+ connections->update_tree();
+}
+
void NodeDock::set_node(Node *p_node) {
connections->set_node(p_node);
diff --git a/editor/node_dock.h b/editor/node_dock.h
index 0af65719c9..29e5dc5169 100644
--- a/editor/node_dock.h
+++ b/editor/node_dock.h
@@ -59,6 +59,8 @@ public:
void show_groups();
void show_connections();
+ void update_lists();
+
NodeDock();
};
diff --git a/editor/output_strings.cpp b/editor/output_strings.cpp
index eb2fc62f03..8c9f8386ef 100644
--- a/editor/output_strings.cpp
+++ b/editor/output_strings.cpp
@@ -38,15 +38,15 @@ void OutputStrings::update_scrollbars() {
v_scroll->set_anchor(MARGIN_RIGHT, ANCHOR_END);
v_scroll->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
- v_scroll->set_begin(Point2(vmin.width, 0));
+ v_scroll->set_begin(Point2(-vmin.width, 0));
v_scroll->set_end(Point2(0, 0));
h_scroll->set_anchor(MARGIN_RIGHT, ANCHOR_END);
h_scroll->set_anchor(MARGIN_TOP, ANCHOR_END);
h_scroll->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
- h_scroll->set_begin(Point2(0, hmin.y));
- h_scroll->set_end(Point2(vmin.x, 0));
+ h_scroll->set_begin(Point2(0, -hmin.y));
+ h_scroll->set_end(Point2(-vmin.x, 0));
margin.y = hmin.y;
margin.x = vmin.x;
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index c4e79bf263..ecae272b6d 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -1246,7 +1246,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
set_focus_mode(FOCUS_ALL);
player = NULL;
- add_style_override("panel", get_stylebox("panel", "Panel"));
+ add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
Label *l;
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index ceaa73569a..bcf40f52d3 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -155,7 +155,7 @@ class AnimationPlayerEditor : public VBoxContainer {
void _animation_player_changed(Object *p_pl);
void _animation_key_editor_seek(float p_pos, bool p_drag);
- void _animation_key_editor_anim_len_changed(float p_new);
+ void _animation_key_editor_anim_len_changed(float p_len);
void _animation_key_editor_anim_step_changed(float p_len);
void _unhandled_key_input(const Ref<InputEvent> &p_ev);
@@ -198,8 +198,8 @@ public:
virtual String get_name() const { return "Anim"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
AnimationPlayerEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index a4f1217502..55975bdefa 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -676,16 +676,16 @@ AnimationTreeEditor::ClickType AnimationTreeEditor::_locate_click(const Point2 &
return CLICK_NONE;
}
-Point2 AnimationTreeEditor::_get_slot_pos(const StringName &p_node, bool p_input, int p_slot) {
+Point2 AnimationTreeEditor::_get_slot_pos(const StringName &p_node_id, bool p_input, int p_slot) {
Ref<StyleBox> style = get_stylebox("panel", "PopupMenu");
Ref<Font> font = get_font("font", "PopupMenu");
Ref<Texture> slot_icon = get_icon("NodeRealSlot", "EditorIcons");
- Size2 size = get_node_size(p_node);
- Point2 pos = anim_tree->node_get_pos(p_node);
+ Size2 size = get_node_size(p_node_id);
+ Point2 pos = anim_tree->node_get_pos(p_node_id);
- if (click_type == CLICK_NODE && click_node == p_node) {
+ if (click_type == CLICK_NODE && click_node == p_node_id) {
pos += click_motion - click_pos;
if (pos.x < 5)
@@ -1371,7 +1371,7 @@ AnimationTreeEditor::AnimationTreeEditor() {
edit_option = memnew(OptionButton);
edit_option->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- edit_option->set_margin(MARGIN_RIGHT, 10);
+ edit_option->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(edit_option);
edit_option->connect("item_selected", this, "_edit_dialog_changedf");
edit_option->hide();
@@ -1379,7 +1379,7 @@ AnimationTreeEditor::AnimationTreeEditor() {
for (int i = 0; i < 2; i++) {
edit_scroll[i] = memnew(HSlider);
edit_scroll[i]->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- edit_scroll[i]->set_margin(MARGIN_RIGHT, 10);
+ edit_scroll[i]->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(edit_scroll[i]);
edit_scroll[i]->hide();
edit_scroll[i]->connect("value_changed", this, "_edit_dialog_changedf");
@@ -1387,7 +1387,7 @@ AnimationTreeEditor::AnimationTreeEditor() {
for (int i = 0; i < 4; i++) {
edit_line[i] = memnew(LineEdit);
edit_line[i]->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- edit_line[i]->set_margin(MARGIN_RIGHT, 10);
+ edit_line[i]->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(edit_line[i]);
edit_line[i]->hide();
edit_line[i]->connect("text_changed", this, "_edit_dialog_changeds");
@@ -1399,14 +1399,14 @@ AnimationTreeEditor::AnimationTreeEditor() {
edit_button = memnew(Button);
edit_button->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- edit_button->set_margin(MARGIN_RIGHT, 10);
+ edit_button->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(edit_button);
edit_button->hide();
edit_button->connect("pressed", this, "_edit_oneshot_start");
edit_check = memnew(CheckButton);
edit_check->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- edit_check->set_margin(MARGIN_RIGHT, 10);
+ edit_check->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(edit_check);
edit_check->hide();
edit_check->connect("pressed", this, "_edit_dialog_changed");
@@ -1428,7 +1428,7 @@ AnimationTreeEditor::AnimationTreeEditor() {
filter_button = memnew(Button);
filter_button->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- filter_button->set_margin(MARGIN_RIGHT, 10);
+ filter_button->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(filter_button);
filter_button->hide();
filter_button->set_text(TTR("Filters.."));
diff --git a/editor/plugins/animation_tree_editor_plugin.h b/editor/plugins/animation_tree_editor_plugin.h
index 785f042dd9..972c6c9b47 100644
--- a/editor/plugins/animation_tree_editor_plugin.h
+++ b/editor/plugins/animation_tree_editor_plugin.h
@@ -160,7 +160,7 @@ protected:
public:
virtual Size2 get_minimum_size() const;
- void edit(AnimationTreePlayer *p_player);
+ void edit(AnimationTreePlayer *p_anim_tree);
AnimationTreeEditor();
};
@@ -175,8 +175,8 @@ class AnimationTreeEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "AnimTree"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
AnimationTreeEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/baked_light_baker.cpp b/editor/plugins/baked_light_baker.cpp
index 036229a7af..bef35647d4 100644
--- a/editor/plugins/baked_light_baker.cpp
+++ b/editor/plugins/baked_light_baker.cpp
@@ -1460,7 +1460,7 @@ void BakedLightBaker::_make_octree_texture() {
} else {
baked_light_texture_w=otex_w;
- baked_light_texture_h=nearest_power_of_2(row);
+ baked_light_texture_h=next_power_of_2(row);
print_line("w: "+itos(otex_w));
print_line("h: "+itos(row));
break;
@@ -1558,7 +1558,7 @@ void BakedLightBaker::_make_octree_texture() {
}
- baked_octree_texture_h=nearest_power_of_2(baked_octree_texture_h);
+ baked_octree_texture_h=next_power_of_2(baked_octree_texture_h);
print_line("RESULT! "+itos(baked_octree_texture_w)+","+itos(baked_octree_texture_h));
}
diff --git a/editor/plugins/camera_editor_plugin.cpp b/editor/plugins/camera_editor_plugin.cpp
index b8f8464bae..8e625c4a73 100644
--- a/editor/plugins/camera_editor_plugin.cpp
+++ b/editor/plugins/camera_editor_plugin.cpp
@@ -88,7 +88,7 @@ CameraEditor::CameraEditor() {
preview->set_toggle_mode(true);
preview->set_anchor(MARGIN_LEFT, Control::ANCHOR_END);
preview->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
- preview->set_margin(MARGIN_LEFT, 60);
+ preview->set_margin(MARGIN_LEFT, -60);
preview->set_margin(MARGIN_RIGHT, 0);
preview->set_margin(MARGIN_TOP, 0);
preview->set_margin(MARGIN_BOTTOM, 10);
diff --git a/editor/plugins/camera_editor_plugin.h b/editor/plugins/camera_editor_plugin.h
index f4b26fcdac..a0f98687cb 100644
--- a/editor/plugins/camera_editor_plugin.h
+++ b/editor/plugins/camera_editor_plugin.h
@@ -68,8 +68,8 @@ class CameraEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Camera"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
CameraEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 69d4481d17..79bf68b061 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -709,8 +709,8 @@ CanvasItem *CanvasItemEditor::get_single_item() {
return single_item;
}
-CanvasItemEditor::DragType CanvasItemEditor::_find_drag_type(const Point2 &p_click, Vector2 &r_point) {
-
+CanvasItemEditor::DragType CanvasItemEditor::_get_resize_handle_drag_type(const Point2 &p_click, Vector2 &r_point) {
+ // Returns a drag type if a resize handle is clicked
CanvasItem *canvas_item = get_single_item();
ERR_FAIL_COND_V(!canvas_item, DRAG_NONE);
@@ -775,6 +775,90 @@ CanvasItemEditor::DragType CanvasItemEditor::_find_drag_type(const Point2 &p_cli
return DRAG_NONE;
}
+float CanvasItemEditor::_anchor_snap(float p_anchor, bool *p_snapped, float p_opposite_anchor) {
+ bool snapped = false;
+ float dist, dist_min = 0.0;
+ float radius = 0.05 / zoom;
+ float basic_anchors[3] = { 0.0, 0.5, 1.0 };
+ for (int i = 0; i < 3; i++) {
+ if ((dist = fabs(p_anchor - basic_anchors[i])) < radius) {
+ if (!snapped || dist <= dist_min) {
+ p_anchor = basic_anchors[i];
+ dist_min = dist;
+ snapped = true;
+ }
+ }
+ }
+ if (p_opposite_anchor >= 0 && (dist = fabs(p_anchor - p_opposite_anchor)) < radius) {
+ if (!snapped || dist <= dist_min) {
+ p_anchor = p_opposite_anchor;
+ dist_min = dist;
+ snapped = true;
+ }
+ }
+ if (p_snapped)
+ *p_snapped = snapped;
+ return p_anchor;
+}
+
+Vector2 CanvasItemEditor::_anchor_to_position(Control *p_control, Vector2 anchor) {
+ ERR_FAIL_COND_V(!p_control, Vector2());
+
+ Transform2D parent_transform = p_control->get_transform().affine_inverse();
+ Size2 parent_size = p_control->get_parent_area_size();
+
+ return parent_transform.xform(Vector2(parent_size.x * anchor.x, parent_size.y * anchor.y));
+}
+
+Vector2 CanvasItemEditor::_position_to_anchor(Control *p_control, Vector2 position) {
+ ERR_FAIL_COND_V(!p_control, Vector2());
+ Size2 parent_size = p_control->get_parent_area_size();
+
+ return p_control->get_transform().xform(position) / parent_size;
+}
+
+CanvasItemEditor::DragType CanvasItemEditor::_get_anchor_handle_drag_type(const Point2 &p_click, Vector2 &r_point) {
+ // Returns a drag type if an anchor handle is clicked
+ CanvasItem *canvas_item = get_single_item();
+ ERR_FAIL_COND_V(!canvas_item, DRAG_NONE);
+
+ Control *control = canvas_item->cast_to<Control>();
+ ERR_FAIL_COND_V(!control, DRAG_NONE);
+
+ Vector2 anchor_pos[4];
+ anchor_pos[0] = Vector2(control->get_anchor(MARGIN_LEFT), control->get_anchor(MARGIN_TOP));
+ anchor_pos[1] = Vector2(control->get_anchor(MARGIN_RIGHT), control->get_anchor(MARGIN_TOP));
+ anchor_pos[2] = Vector2(control->get_anchor(MARGIN_RIGHT), control->get_anchor(MARGIN_BOTTOM));
+ anchor_pos[3] = Vector2(control->get_anchor(MARGIN_LEFT), control->get_anchor(MARGIN_BOTTOM));
+
+ Rect2 anchor_rects[4];
+ for (int i = 0; i < 4; i++) {
+ anchor_pos[i] = (transform * control->get_global_transform_with_canvas()).xform(_anchor_to_position(control, anchor_pos[i]));
+ anchor_rects[i] = Rect2(anchor_pos[i], anchor_handle->get_size());
+ anchor_rects[i].position -= anchor_handle->get_size() * Vector2(i == 0 || i == 3, i <= 1);
+ }
+
+ DragType dragger[] = {
+ DRAG_ANCHOR_TOP_LEFT,
+ DRAG_ANCHOR_TOP_RIGHT,
+ DRAG_ANCHOR_BOTTOM_RIGHT,
+ DRAG_ANCHOR_BOTTOM_LEFT,
+ };
+
+ for (int i = 0; i < 4; i++) {
+ if (anchor_rects[i].has_point(p_click)) {
+ r_point = transform.affine_inverse().xform(anchor_pos[i]);
+ if ((anchor_pos[0] == anchor_pos[2]) && (anchor_pos[0].distance_to(p_click) < anchor_handle->get_size().length() / 3.0)) {
+ return DRAG_ANCHOR_ALL;
+ } else {
+ return dragger[i];
+ }
+ }
+ }
+
+ return DRAG_NONE;
+}
+
void CanvasItemEditor::_prepare_drag(const Point2 &p_click_pos) {
List<Node *> &selection = editor_selection->get_selected_node_list();
@@ -863,9 +947,9 @@ void CanvasItemEditor::incend(float &beg, float &end, float inc, float minsize,
}
}
-void CanvasItemEditor::_append_canvas_item(CanvasItem *c) {
+void CanvasItemEditor::_append_canvas_item(CanvasItem *p_item) {
- editor_selection->add_node(c);
+ editor_selection->add_node(p_item);
}
void CanvasItemEditor::_snap_changed() {
@@ -1265,6 +1349,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
if (b) {
bool ik_found = false;
+
bool first = true;
while (b) {
@@ -1336,8 +1421,8 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
}
- // Drag
- drag = _find_drag_type(click, drag_point_from);
+ // Drag resize handles
+ drag = _get_resize_handle_drag_type(click, drag_point_from);
if (drag != DRAG_NONE) {
drag_from = transform.affine_inverse().xform(click);
se->undo_state = canvas_item->edit_get_state();
@@ -1347,6 +1432,16 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
se->undo_pivot = canvas_item->cast_to<Control>()->get_pivot_offset();
return;
}
+
+ // Drag anchor handles
+ if (canvas_item->cast_to<Control>()) {
+ drag = _get_anchor_handle_drag_type(click, drag_point_from);
+ if (drag != DRAG_NONE) {
+ drag_from = transform.affine_inverse().xform(click);
+ se->undo_state = canvas_item->edit_get_state();
+ return;
+ }
+ }
}
}
@@ -1423,9 +1518,8 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
if (drag == DRAG_NONE) {
-
if ((m->get_button_mask() & BUTTON_MASK_LEFT && tool == TOOL_PAN) || m->get_button_mask() & BUTTON_MASK_MIDDLE || (m->get_button_mask() & BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE))) {
-
+ // Pan the viewport
Point2i relative;
if (bool(EditorSettings::get_singleton()->get("editors/2d/warped_mouse_panning"))) {
relative = Input::get_singleton()->warp_mouse_motion(m, viewport->get_global_rect());
@@ -1441,7 +1535,6 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
List<Node *> &selection = editor_selection->get_selected_node_list();
-
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
@@ -1470,7 +1563,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
continue;
if (drag == DRAG_ROTATE) {
-
+ // Rotate the node
Vector2 center = canvas_item->get_global_transform_with_canvas().get_origin();
{
Node2D *node = canvas_item->cast_to<Node2D>();
@@ -1499,10 +1592,47 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
continue;
}
+ Control *control = canvas_item->cast_to<Control>();
+ if (control) {
+ // Drag and snap the anchor
+ Vector2 anchor = _position_to_anchor(control, canvas_item->get_global_transform_with_canvas().affine_inverse().xform(dto - drag_from + drag_point_from));
+
+ switch (drag) {
+ case DRAG_ANCHOR_TOP_LEFT:
+ control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_RIGHT)), false, false);
+ control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_BOTTOM)), false, false);
+ continue;
+ break;
+ case DRAG_ANCHOR_TOP_RIGHT:
+ control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_LEFT)), false, false);
+ control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_BOTTOM)), false, false);
+ continue;
+ break;
+ case DRAG_ANCHOR_BOTTOM_RIGHT:
+ control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_LEFT)), false, false);
+ control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_TOP)), false, false);
+ continue;
+ break;
+ case DRAG_ANCHOR_BOTTOM_LEFT:
+ control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_RIGHT)), false, false);
+ control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_TOP)), false, false);
+ continue;
+ break;
+ case DRAG_ANCHOR_ALL:
+ control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x));
+ control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x));
+ control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y));
+ control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y));
+ continue;
+ break;
+ }
+ }
+
bool uniform = m->get_shift();
bool symmetric = m->get_alt();
- dto = dto - (drag == DRAG_ALL || drag == DRAG_NODE_2D ? drag_from - drag_point_from : Vector2(0, 0));
+ if (drag == DRAG_ALL || drag == DRAG_NODE_2D)
+ dto -= drag_from - drag_point_from;
if (uniform && (drag == DRAG_ALL || drag == DRAG_NODE_2D)) {
if (ABS(dto.x - drag_point_from.x) > ABS(dto.y - drag_point_from.y)) {
@@ -1528,76 +1658,75 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
// Keep the height/width ratio of the item
float aspect = local_rect.size.aspect();
switch (drag) {
- case DRAG_LEFT: {
+ case DRAG_LEFT:
drag_vector.y = -drag_vector.x / aspect;
- } break;
- case DRAG_RIGHT: {
+ break;
+ case DRAG_RIGHT:
drag_vector.y = drag_vector.x / aspect;
- } break;
- case DRAG_TOP: {
+ break;
+ case DRAG_TOP:
drag_vector.x = -drag_vector.y * aspect;
- } break;
- case DRAG_BOTTOM: {
+ break;
+ case DRAG_BOTTOM:
drag_vector.x = drag_vector.y * aspect;
- } break;
+ break;
case DRAG_BOTTOM_LEFT:
- case DRAG_TOP_RIGHT: {
+ case DRAG_TOP_RIGHT:
if (aspect > 1.0) { // width > height, take x as reference
drag_vector.y = -drag_vector.x / aspect;
} else { // height > width, take y as reference
drag_vector.x = -drag_vector.y * aspect;
}
- } break;
+ break;
case DRAG_BOTTOM_RIGHT:
- case DRAG_TOP_LEFT: {
+ case DRAG_TOP_LEFT:
if (aspect > 1.0) { // width > height, take x as reference
drag_vector.y = drag_vector.x / aspect;
} else { // height > width, take y as reference
drag_vector.x = drag_vector.y * aspect;
}
- } break;
+ break;
}
} else {
switch (drag) {
case DRAG_RIGHT:
- case DRAG_LEFT: {
+ case DRAG_LEFT:
drag_vector.y = 0;
- } break;
+ break;
case DRAG_TOP:
- case DRAG_BOTTOM: {
+ case DRAG_BOTTOM:
drag_vector.x = 0;
- } break;
+ break;
}
}
switch (drag) {
- case DRAG_ALL: {
+ case DRAG_ALL:
begin += drag_vector;
end += drag_vector;
- } break;
+ break;
case DRAG_RIGHT:
case DRAG_BOTTOM:
- case DRAG_BOTTOM_RIGHT: {
+ case DRAG_BOTTOM_RIGHT:
incend(begin.x, end.x, drag_vector.x, minsize.x, symmetric);
incend(begin.y, end.y, drag_vector.y, minsize.y, symmetric);
- } break;
-
- case DRAG_TOP_LEFT: {
+ break;
+ case DRAG_TOP_LEFT:
incbeg(begin.x, end.x, drag_vector.x, minsize.x, symmetric);
incbeg(begin.y, end.y, drag_vector.y, minsize.y, symmetric);
- } break;
-
+ break;
case DRAG_TOP:
- case DRAG_TOP_RIGHT: {
+ case DRAG_TOP_RIGHT:
incbeg(begin.y, end.y, drag_vector.y, minsize.y, symmetric);
incend(begin.x, end.x, drag_vector.x, minsize.x, symmetric);
- } break;
+ break;
case DRAG_LEFT:
- case DRAG_BOTTOM_LEFT: {
+ case DRAG_BOTTOM_LEFT:
incbeg(begin.x, end.x, drag_vector.x, minsize.x, symmetric);
incend(begin.y, end.y, drag_vector.y, minsize.y, symmetric);
- } break;
- case DRAG_PIVOT: {
+ break;
+
+ case DRAG_PIVOT:
if (canvas_item->cast_to<Node2D>()) {
Node2D *n2d = canvas_item->cast_to<Node2D>();
@@ -1607,15 +1736,13 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
canvas_item->cast_to<Control>()->set_pivot_offset(se->undo_pivot + drag_vector);
}
continue;
- } break;
- case DRAG_NODE_2D: {
+ break;
+ case DRAG_NODE_2D:
ERR_FAIL_COND(!canvas_item->cast_to<Node2D>());
canvas_item->cast_to<Node2D>()->set_global_position(dto);
continue;
- } break;
-
- default: {}
+ break;
}
if (!dragging_bone) {
@@ -1768,6 +1895,30 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
}
+void CanvasItemEditor::_draw_percentage_at_position(float p_value, Point2 p_position, Margin p_side) {
+ if (p_value != 0) {
+ Color color = Color(0.8, 0.8, 0.8, 0.5);
+ Ref<Font> font = get_font("font", "Label");
+ String str = vformat("%.1f %%", p_value * 100.0);
+ Size2 text_size = font->get_string_size(str);
+ switch (p_side) {
+ case MARGIN_LEFT:
+ p_position += Vector2(-text_size.x - 5, text_size.y / 2);
+ break;
+ case MARGIN_TOP:
+ p_position += Vector2(-text_size.x / 2, -5);
+ break;
+ case MARGIN_RIGHT:
+ p_position += Vector2(5, text_size.y / 2);
+ break;
+ case MARGIN_BOTTOM:
+ p_position += Vector2(-text_size.x / 2, text_size.y + 5);
+ break;
+ }
+ viewport->draw_string(font, p_position, str, color);
+ }
+}
+
void CanvasItemEditor::_viewport_draw() {
// TODO fetch the viewport?
@@ -1870,13 +2021,99 @@ void CanvasItemEditor::_viewport_draw() {
pivot_found = true;
}
}
- if (canvas_item->cast_to<Control>()) {
- Vector2 pivot_ofs = canvas_item->cast_to<Control>()->get_pivot_offset();
+
+ Control *control = canvas_item->cast_to<Control>();
+ if (control) {
+ Vector2 pivot_ofs = control->get_pivot_offset();
if (pivot_ofs != Vector2()) {
viewport->draw_texture(pivot, xform.xform(pivot_ofs) + (-pivot->get_size() / 2).floor());
}
can_move_pivot = true;
pivot_found = true;
+
+ if (tool == TOOL_SELECT) {
+ float anchors_values[4];
+ anchors_values[0] = control->get_anchor(MARGIN_LEFT);
+ anchors_values[1] = control->get_anchor(MARGIN_TOP);
+ anchors_values[2] = control->get_anchor(MARGIN_RIGHT);
+ anchors_values[3] = control->get_anchor(MARGIN_BOTTOM);
+
+ // Draw the anchors
+ Vector2 anchors[4];
+ Vector2 anchors_pos[4];
+ for (int i = 0; i < 4; i++) {
+ anchors[i] = Vector2((i % 2 == 0) ? anchors_values[i] : anchors_values[(i + 1) % 4], (i % 2 == 1) ? anchors_values[i] : anchors_values[(i + 1) % 4]);
+ anchors_pos[i] = xform.xform(_anchor_to_position(control, anchors[i]));
+ }
+
+ // Get which anchor is dragged
+ int dragged_anchor = -1;
+ switch (drag) {
+ case DRAG_ANCHOR_ALL:
+ case DRAG_ANCHOR_TOP_LEFT:
+ dragged_anchor = 0;
+ break;
+ case DRAG_ANCHOR_TOP_RIGHT:
+ dragged_anchor = 1;
+ break;
+ case DRAG_ANCHOR_BOTTOM_RIGHT:
+ dragged_anchor = 2;
+ break;
+ case DRAG_ANCHOR_BOTTOM_LEFT:
+ dragged_anchor = 3;
+ break;
+ }
+
+ if (dragged_anchor >= 0) {
+ // Draw the 4 lines when dragged
+ bool snapped;
+ Color color_snapped = Color(0.64, 0.93, 0.67, 0.5);
+ Color color_base = Color(0.8, 0.8, 0.8, 0.5);
+
+ Vector2 corners_pos[4];
+ for (int i = 0; i < 4; i++) {
+ corners_pos[i] = xform.xform(_anchor_to_position(control, Vector2((i == 0 || i == 3) ? ANCHOR_BEGIN : ANCHOR_END, (i <= 1) ? ANCHOR_BEGIN : ANCHOR_END)));
+ }
+
+ Vector2 line_starts[4];
+ Vector2 line_ends[4];
+ for (int i = 0; i < 4; i++) {
+ float anchor_val = (i >= 2) ? ANCHOR_END - anchors_values[i] : anchors_values[i];
+ line_starts[i] = Vector2::linear_interpolate(corners_pos[i], corners_pos[(i + 1) % 4], anchor_val);
+ line_ends[i] = Vector2::linear_interpolate(corners_pos[(i + 3) % 4], corners_pos[(i + 2) % 4], anchor_val);
+ _anchor_snap(anchors_values[i], &snapped);
+ viewport->draw_line(line_starts[i], line_ends[i], snapped ? color_snapped : color_base, (i == dragged_anchor || (i + 3) % 4 == dragged_anchor) ? 2 : 1);
+ }
+
+ // Display the percentages next to the lines
+ float percent_val;
+ percent_val = anchors_values[(dragged_anchor + 2) % 4] - anchors_values[dragged_anchor];
+ percent_val = (dragged_anchor >= 2) ? -percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 1) % 4]) / 2, (Margin)((dragged_anchor + 1) % 4));
+
+ percent_val = anchors_values[(dragged_anchor + 3) % 4] - anchors_values[(dragged_anchor + 1) % 4];
+ percent_val = ((dragged_anchor + 1) % 4 >= 2) ? -percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 3) % 4]) / 2, (Margin)(dragged_anchor));
+
+ percent_val = anchors_values[(dragged_anchor + 1) % 4];
+ percent_val = ((dragged_anchor + 1) % 4 >= 2) ? ANCHOR_END - percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (line_starts[dragged_anchor] + anchors_pos[dragged_anchor]) / 2, (Margin)(dragged_anchor));
+
+ percent_val = anchors_values[dragged_anchor];
+ percent_val = (dragged_anchor >= 2) ? ANCHOR_END - percent_val : percent_val;
+ _draw_percentage_at_position(percent_val, (line_ends[(dragged_anchor + 1) % 4] + anchors_pos[dragged_anchor]) / 2, (Margin)((dragged_anchor + 1) % 4));
+ }
+
+ Rect2 anchor_rects[4];
+ anchor_rects[0] = Rect2(anchors_pos[0] - anchor_handle->get_size(), anchor_handle->get_size());
+ anchor_rects[1] = Rect2(anchors_pos[1] - Vector2(0.0, anchor_handle->get_size().y), Point2(-anchor_handle->get_size().x, anchor_handle->get_size().y));
+ anchor_rects[2] = Rect2(anchors_pos[2], -anchor_handle->get_size());
+ anchor_rects[3] = Rect2(anchors_pos[3] - Vector2(anchor_handle->get_size().x, 0.0), Point2(anchor_handle->get_size().x, -anchor_handle->get_size().y));
+
+ for (int i = 0; i < 4; i++) {
+ anchor_handle->draw_rect(ci, anchor_rects[i]);
+ }
+ }
}
if (tool == TOOL_SELECT) {
@@ -2063,29 +2300,34 @@ void CanvasItemEditor::_notification(int p_what) {
continue;
Rect2 r = canvas_item->get_item_rect();
-
Transform2D xform = canvas_item->get_transform();
+ float anchors[4];
Vector2 pivot;
if (canvas_item->cast_to<Control>()) {
pivot = canvas_item->cast_to<Control>()->get_pivot_offset();
+ anchors[MARGIN_LEFT] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_LEFT);
+ anchors[MARGIN_RIGHT] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_RIGHT);
+ anchors[MARGIN_TOP] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_TOP);
+ anchors[MARGIN_BOTTOM] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_BOTTOM);
}
- if (r != se->prev_rect || xform != se->prev_xform || pivot != se->prev_pivot) {
+ if (r != se->prev_rect || xform != se->prev_xform || pivot != se->prev_pivot || anchors[MARGIN_LEFT] != se->prev_anchors[MARGIN_LEFT] || anchors[MARGIN_RIGHT] != se->prev_anchors[MARGIN_RIGHT] || anchors[MARGIN_TOP] != se->prev_anchors[MARGIN_TOP] || anchors[MARGIN_BOTTOM] != se->prev_anchors[MARGIN_BOTTOM]) {
viewport->update();
se->prev_rect = r;
se->prev_xform = xform;
se->prev_pivot = pivot;
+ se->prev_anchors[MARGIN_LEFT] = anchors[MARGIN_LEFT];
+ se->prev_anchors[MARGIN_RIGHT] = anchors[MARGIN_RIGHT];
+ se->prev_anchors[MARGIN_TOP] = anchors[MARGIN_TOP];
+ se->prev_anchors[MARGIN_BOTTOM] = anchors[MARGIN_BOTTOM];
}
}
- bool show_anchor = all_control && has_control;
- if (show_anchor != anchor_menu->is_visible()) {
- if (show_anchor)
- anchor_menu->show();
- else
- anchor_menu->hide();
- }
+ if (all_control && has_control)
+ anchor_menu->show();
+ else
+ anchor_menu->hide();
for (Map<ObjectID, BoneList>::Element *E = bone_list.front(); E; E = E->next()) {
@@ -2124,6 +2366,7 @@ void CanvasItemEditor::_notification(int p_what) {
pan_button->set_icon(get_icon("ToolPan", "EditorIcons"));
pivot_button->set_icon(get_icon("EditPivot", "EditorIcons"));
select_handle = get_icon("EditorHandle", "EditorIcons");
+ anchor_handle = get_icon("EditorControlAnchor", "EditorIcons");
lock_button->set_icon(get_icon("Lock", "EditorIcons"));
unlock_button->set_icon(get_icon("Unlock", "EditorIcons"));
group_button->set_icon(get_icon("Group", "EditorIcons"));
@@ -2338,7 +2581,7 @@ void CanvasItemEditor::_update_scroll(float) {
viewport->update();
}
-void CanvasItemEditor::_set_anchor(Control::AnchorType p_left, Control::AnchorType p_top, Control::AnchorType p_right, Control::AnchorType p_bottom) {
+void CanvasItemEditor::_set_anchors_preset(Control::LayoutPreset p_preset) {
List<Node *> &selection = editor_selection->get_selected_node_list();
undo_redo->create_action(TTR("Change Anchors"));
@@ -2346,10 +2589,7 @@ void CanvasItemEditor::_set_anchor(Control::AnchorType p_left, Control::AnchorTy
Control *c = E->get()->cast_to<Control>();
- undo_redo->add_do_method(c, "set_anchor", MARGIN_LEFT, p_left);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_TOP, p_top);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_RIGHT, p_right);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_BOTTOM, p_bottom);
+ undo_redo->add_do_method(c, "set_anchors_preset", p_preset);
undo_redo->add_undo_method(c, "set_anchor", MARGIN_LEFT, c->get_anchor(MARGIN_LEFT));
undo_redo->add_undo_method(c, "set_anchor", MARGIN_TOP, c->get_anchor(MARGIN_TOP));
undo_redo->add_undo_method(c, "set_anchor", MARGIN_RIGHT, c->get_anchor(MARGIN_RIGHT));
@@ -2367,10 +2607,7 @@ void CanvasItemEditor::_set_full_rect() {
Control *c = E->get()->cast_to<Control>();
- undo_redo->add_do_method(c, "set_anchor", MARGIN_LEFT, ANCHOR_BEGIN);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_TOP, ANCHOR_BEGIN);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_RIGHT, ANCHOR_END);
- undo_redo->add_do_method(c, "set_anchor", MARGIN_BOTTOM, ANCHOR_END);
+ undo_redo->add_do_method(c, "set_anchors_preset", PRESET_WIDE);
undo_redo->add_do_method(c, "set_margin", MARGIN_LEFT, 0);
undo_redo->add_do_method(c, "set_margin", MARGIN_TOP, 0);
undo_redo->add_do_method(c, "set_margin", MARGIN_RIGHT, 0);
@@ -2591,53 +2828,52 @@ void CanvasItemEditor::_popup_callback(int p_op) {
//space_selected_items< proj_vector2_y, compare_items_y >();
} break;
case ANCHOR_ALIGN_TOP_LEFT: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_BEGIN);
+ _set_anchors_preset(PRESET_TOP_LEFT);
} break;
case ANCHOR_ALIGN_TOP_RIGHT: {
- _set_anchor(ANCHOR_END, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_BEGIN);
+ _set_anchors_preset(PRESET_TOP_RIGHT);
} break;
case ANCHOR_ALIGN_BOTTOM_LEFT: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_END, ANCHOR_BEGIN, ANCHOR_END);
+ _set_anchors_preset(PRESET_BOTTOM_LEFT);
} break;
case ANCHOR_ALIGN_BOTTOM_RIGHT: {
- _set_anchor(ANCHOR_END, ANCHOR_END, ANCHOR_END, ANCHOR_END);
+ _set_anchors_preset(PRESET_BOTTOM_RIGHT);
} break;
case ANCHOR_ALIGN_CENTER_LEFT: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_BEGIN, ANCHOR_CENTER);
+ _set_anchors_preset(PRESET_CENTER_LEFT);
} break;
case ANCHOR_ALIGN_CENTER_RIGHT: {
-
- _set_anchor(ANCHOR_END, ANCHOR_CENTER, ANCHOR_END, ANCHOR_CENTER);
+ _set_anchors_preset(PRESET_CENTER_RIGHT);
} break;
case ANCHOR_ALIGN_CENTER_TOP: {
- _set_anchor(ANCHOR_CENTER, ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_BEGIN);
+ _set_anchors_preset(PRESET_CENTER_TOP);
} break;
case ANCHOR_ALIGN_CENTER_BOTTOM: {
- _set_anchor(ANCHOR_CENTER, ANCHOR_END, ANCHOR_CENTER, ANCHOR_END);
+ _set_anchors_preset(PRESET_CENTER_BOTTOM);
} break;
case ANCHOR_ALIGN_CENTER: {
- _set_anchor(ANCHOR_CENTER, ANCHOR_CENTER, ANCHOR_CENTER, ANCHOR_CENTER);
+ _set_anchors_preset(PRESET_CENTER);
} break;
case ANCHOR_ALIGN_TOP_WIDE: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_BEGIN);
+ _set_anchors_preset(PRESET_TOP_WIDE);
} break;
case ANCHOR_ALIGN_LEFT_WIDE: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_END);
+ _set_anchors_preset(PRESET_LEFT_WIDE);
} break;
case ANCHOR_ALIGN_RIGHT_WIDE: {
- _set_anchor(ANCHOR_END, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_END);
+ _set_anchors_preset(PRESET_RIGHT_WIDE);
} break;
case ANCHOR_ALIGN_BOTTOM_WIDE: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_END, ANCHOR_END, ANCHOR_END);
+ _set_anchors_preset(PRESET_BOTTOM_WIDE);
} break;
case ANCHOR_ALIGN_VCENTER_WIDE: {
- _set_anchor(ANCHOR_CENTER, ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_END);
+ _set_anchors_preset(PRESET_VCENTER_WIDE);
} break;
case ANCHOR_ALIGN_HCENTER_WIDE: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_END, ANCHOR_CENTER);
+ _set_anchors_preset(PRESET_HCENTER_WIDE);
} break;
case ANCHOR_ALIGN_WIDE: {
- _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_END);
+ _set_anchors_preset(PRESET_WIDE);
} break;
case ANCHOR_ALIGN_WIDE_FIT: {
_set_full_rect();
@@ -3372,7 +3608,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
dialog_val = memnew(SpinBox);
dialog_val->set_anchor(MARGIN_RIGHT, ANCHOR_END);
dialog_val->set_begin(Point2(15, 25));
- dialog_val->set_end(Point2(10, 25));
+ dialog_val->set_end(Point2(-10, 25));
value_dialog->add_child(dialog_val);
dialog_val->connect("value_changed", this, "_dialog_value_changed");
select_sb = Ref<StyleBoxTexture>(memnew(StyleBoxTexture));
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 4383be251c..9b027fda60 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -57,6 +57,7 @@ public:
float prev_rot;
Rect2 prev_rect;
Vector2 prev_pivot;
+ float prev_anchors[4];
CanvasItemEditorSelectedItem() { prev_rot = 0; }
};
@@ -143,11 +144,15 @@ class CanvasItemEditor : public VBoxContainer {
DRAG_BOTTOM_RIGHT,
DRAG_BOTTOM,
DRAG_BOTTOM_LEFT,
+ DRAG_ANCHOR_TOP_LEFT,
+ DRAG_ANCHOR_TOP_RIGHT,
+ DRAG_ANCHOR_BOTTOM_RIGHT,
+ DRAG_ANCHOR_BOTTOM_LEFT,
+ DRAG_ANCHOR_ALL,
DRAG_ALL,
DRAG_ROTATE,
DRAG_PIVOT,
DRAG_NODE_2D,
-
};
enum KeyMoveMODE {
@@ -300,6 +305,7 @@ class CanvasItemEditor : public VBoxContainer {
#endif
Ref<StyleBoxTexture> select_sb;
Ref<Texture> select_handle;
+ Ref<Texture> anchor_handle;
int handle_len;
bool _is_part_of_subscene(CanvasItem *p_item);
@@ -325,8 +331,13 @@ class CanvasItemEditor : public VBoxContainer {
void _key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE p_move_mode);
void _list_select(const Ref<InputEventMouseButton> &b);
- DragType _find_drag_type(const Point2 &p_click, Vector2 &r_point);
+ DragType _get_resize_handle_drag_type(const Point2 &p_click, Vector2 &r_point);
void _prepare_drag(const Point2 &p_click_pos);
+ DragType _get_anchor_handle_drag_type(const Point2 &p_click, Vector2 &r_point);
+
+ float _anchor_snap(float anchor, bool *snapped = NULL, float p_opposite_anchor = -1);
+ Vector2 _anchor_to_position(Control *p_control, Vector2 anchor);
+ Vector2 _position_to_anchor(Control *p_control, Vector2 position);
void _popup_callback(int p_op);
bool updating_scroll;
@@ -355,12 +366,14 @@ class CanvasItemEditor : public VBoxContainer {
void _unhandled_key_input(const Ref<InputEvent> &p_ev);
+ void _draw_percentage_at_position(float p_value, Point2 p_position, Margin p_side);
+
void _viewport_gui_input(const Ref<InputEvent> &p_event);
void _viewport_draw();
void _focus_selection(int p_op);
- void _set_anchor(Control::AnchorType p_left, Control::AnchorType p_top, Control::AnchorType p_right, Control::AnchorType p_bottom);
+ void _set_anchors_preset(Control::LayoutPreset p_preset);
void _set_full_rect();
HSplitContainer *palette_split;
diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.h b/editor/plugins/collision_polygon_2d_editor_plugin.h
index 382c0d6c37..b2f32d8491 100644
--- a/editor/plugins/collision_polygon_2d_editor_plugin.h
+++ b/editor/plugins/collision_polygon_2d_editor_plugin.h
@@ -97,8 +97,8 @@ public:
virtual String get_name() const { return "CollisionPolygon2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
CollisionPolygon2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/collision_polygon_editor_plugin.h b/editor/plugins/collision_polygon_editor_plugin.h
index 3a8428fc62..9f8b52d7f2 100644
--- a/editor/plugins/collision_polygon_editor_plugin.h
+++ b/editor/plugins/collision_polygon_editor_plugin.h
@@ -109,8 +109,8 @@ public:
virtual String get_name() const { return "CollisionPolygon"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
CollisionPolygonEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp
index 9a6ee8153e..fb2aa16383 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -585,12 +585,12 @@ void CollisionShape2DEditorPlugin::make_visible(bool visible) {
}
}
-CollisionShape2DEditorPlugin::CollisionShape2DEditorPlugin(EditorNode *p_node) {
+CollisionShape2DEditorPlugin::CollisionShape2DEditorPlugin(EditorNode *p_editor) {
- editor = p_node;
+ editor = p_editor;
- collision_shape_2d_editor = memnew(CollisionShape2DEditor(p_node));
- p_node->get_gui_base()->add_child(collision_shape_2d_editor);
+ collision_shape_2d_editor = memnew(CollisionShape2DEditor(p_editor));
+ p_editor->get_gui_base()->add_child(collision_shape_2d_editor);
}
CollisionShape2DEditorPlugin::~CollisionShape2DEditorPlugin() {
diff --git a/editor/plugins/cube_grid_theme_editor_plugin.cpp b/editor/plugins/cube_grid_theme_editor_plugin.cpp
index 17149ef868..1fcd514b31 100644
--- a/editor/plugins/cube_grid_theme_editor_plugin.cpp
+++ b/editor/plugins/cube_grid_theme_editor_plugin.cpp
@@ -29,7 +29,6 @@
/*************************************************************************/
#include "cube_grid_theme_editor_plugin.h"
-#if 0
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "main/main.h"
@@ -39,214 +38,236 @@
#include "scene/main/viewport.h"
#include "scene/resources/packed_scene.h"
-void MeshLibraryEditor::edit(const Ref<MeshLibrary>& p_theme) {
+void MeshLibraryEditor::edit(const Ref<MeshLibrary> &p_theme) {
- theme=p_theme;
+ theme = p_theme;
if (theme.is_valid())
- menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE),!theme->has_meta("_editor_source_scene"));
-
+ menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), !theme->has_meta("_editor_source_scene"));
}
void MeshLibraryEditor::_menu_confirm() {
+ switch (option) {
- switch(option) {
-
- case MENU_OPTION_REMOVE_ITEM: {
+ case MENU_OPTION_REMOVE_ITEM: {
- theme->remove_item(to_erase);
- } break;
- case MENU_OPTION_UPDATE_FROM_SCENE: {
+ theme->remove_item(to_erase);
+ } break;
+ case MENU_OPTION_UPDATE_FROM_SCENE: {
String existing = theme->get_meta("_editor_source_scene");
- ERR_FAIL_COND(existing=="");
+ ERR_FAIL_COND(existing == "");
_import_scene_cbk(existing);
- } break;
- default: {};
+ } break;
+ default: {};
}
-
}
-
void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library, bool p_merge) {
if (!p_merge)
p_library->clear();
-
- for(int i=0;i<p_scene->get_child_count();i++) {
-
+ for (int i = 0; i < p_scene->get_child_count(); i++) {
Node *child = p_scene->get_child(i);
if (!child->cast_to<MeshInstance>()) {
- if (child->get_child_count()>0) {
- child=child->get_child(0);
+ if (child->get_child_count() > 0) {
+ child = child->get_child(0);
if (!child->cast_to<MeshInstance>()) {
continue;
}
} else
continue;
-
-
}
MeshInstance *mi = child->cast_to<MeshInstance>();
- Ref<Mesh> mesh=mi->get_mesh();
+ Ref<Mesh> mesh = mi->get_mesh();
if (mesh.is_null())
- continue;
+ continue;
int id = p_library->find_item_name(mi->get_name());
- if (id<0) {
+ if (id < 0) {
- id=p_library->get_last_unused_item_id();
+ id = p_library->get_last_unused_item_id();
p_library->create_item(id);
- p_library->set_item_name(id,mi->get_name());
+ p_library->set_item_name(id, mi->get_name());
}
-
- p_library->set_item_mesh(id,mesh);
+ p_library->set_item_mesh(id, mesh);
Ref<Shape> collision;
+ for (int j = 0; j < mi->get_child_count(); j++) {
- for(int j=0;j<mi->get_child_count();j++) {
-#if 1
Node *child2 = mi->get_child(j);
if (!child2->cast_to<StaticBody>())
continue;
+
StaticBody *sb = child2->cast_to<StaticBody>();
- if (sb->get_shape_count()==0)
- continue;
- collision=sb->get_shape(0);
- if (!collision.is_null())
- break;
-#endif
+ List<uint32_t> shapes;
+ sb->get_shape_owners(&shapes);
+
+ for (List<uint32_t>::Element *E = shapes.front(); E; E = E->next()) {
+ if (sb->is_shape_owner_disabled(E->get())) continue;
+
+ //Transform shape_transform = sb->shape_owner_get_transform(E->get());
+
+ //shape_transform.set_origin(shape_transform.get_origin() - phys_offset);
+
+ for (int k = 0; k < sb->shape_owner_get_shape_count(E->get()); k++) {
+
+ collision = sb->shape_owner_get_shape(E->get(), k);
+ if (collision.is_valid())
+ break;
+ /* TileSet::ShapeData shape_data;
+ shape_data.shape = shape;
+ shape_data.shape_transform = shape_transform;
+ shape_data.one_way_collision = one_way;
+ collisions.push_back(shape_data);*/
+ }
+ if (collision.is_valid())
+ break;
+ }
}
if (!collision.is_null()) {
- p_library->set_item_shape(id,collision);
+ p_library->set_item_shape(id, collision);
}
Ref<NavigationMesh> navmesh;
- for(int j=0;j<mi->get_child_count();j++) {
- Node *child2 = mi->get_child(j);
- if (!child2->cast_to<NavigationMeshInstance>())
- continue;
- NavigationMeshInstance *sb = child2->cast_to<NavigationMeshInstance>();
- navmesh=sb->get_navigation_mesh();
- if (!navmesh.is_null())
- break;
+ for (int j = 0; j < mi->get_child_count(); j++) {
+ Node *child2 = mi->get_child(j);
+ if (!child2->cast_to<NavigationMeshInstance>())
+ continue;
+ NavigationMeshInstance *sb = child2->cast_to<NavigationMeshInstance>();
+ navmesh = sb->get_navigation_mesh();
+ if (!navmesh.is_null())
+ break;
}
- if(!navmesh.is_null()){
+ if (!navmesh.is_null()) {
p_library->set_item_navmesh(id, navmesh);
}
- }
-
- //generate previews!
-
- if (1) {
- Vector<int> ids = p_library->get_item_list();
- RID vp = VS::get_singleton()->viewport_create();
- VS::ViewportRect vr;
- vr.x=0;
- vr.y=0;
- vr.width=EditorSettings::get_singleton()->get("editors/grid_map/preview_size");
- vr.height=EditorSettings::get_singleton()->get("editors/grid_map/preview_size");
- VS::get_singleton()->viewport_set_rect(vp,vr);
- VS::get_singleton()->viewport_set_as_render_target(vp,true);
- VS::get_singleton()->viewport_set_render_target_update_mode(vp,VS::RENDER_TARGET_UPDATE_ALWAYS);
- RID scen = VS::get_singleton()->scenario_create();
- VS::get_singleton()->viewport_set_scenario(vp,scen);
- RID cam = VS::get_singleton()->camera_create();
- VS::get_singleton()->camera_set_transform(cam, Transform() );
- VS::get_singleton()->viewport_attach_camera(vp,cam);
- RID light = VS::get_singleton()->light_create(VS::LIGHT_DIRECTIONAL);
- RID lightinst = VS::get_singleton()->instance_create2(light,scen);
- VS::get_singleton()->camera_set_orthogonal(cam,1.0,0.01,1000.0);
-
-
- EditorProgress ep("mlib",TTR("Creating Mesh Library"),ids.size());
-
- for(int i=0;i<ids.size();i++) {
-
- int id=ids[i];
+ }
+
+ //generate previews!
+
+ if (1) {
+ Vector<int> ids = p_library->get_item_list();
+ RID vp = VS::get_singleton()->viewport_create();
+ int size = EditorSettings::get_singleton()->get("editors/grid_map/preview_size");
+
+ RID scenario = VS::get_singleton()->scenario_create();
+
+ RID viewport = VS::get_singleton()->viewport_create();
+ VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_ALWAYS);
+ VS::get_singleton()->viewport_set_vflip(viewport, true);
+ VS::get_singleton()->viewport_set_scenario(viewport, scenario);
+ VS::get_singleton()->viewport_set_size(viewport, size, size);
+ VS::get_singleton()->viewport_set_transparent_background(viewport, true);
+ VS::get_singleton()->viewport_set_active(viewport, true);
+ RID viewport_texture = VS::get_singleton()->viewport_get_texture(viewport);
+
+ RID camera = VS::get_singleton()->camera_create();
+ VS::get_singleton()->viewport_attach_camera(viewport, camera);
+ VS::get_singleton()->camera_set_transform(camera, Transform(Basis(), Vector3(0, 0, 3)));
+ //VS::get_singleton()->camera_set_perspective(camera,45,0.1,10);
+ VS::get_singleton()->camera_set_orthogonal(camera, 1.0, 0.01, 1000.0);
+
+ RID light = VS::get_singleton()->light_create(VS::LIGHT_DIRECTIONAL);
+ RID light_instance = VS::get_singleton()->instance_create2(light, scenario);
+ VS::get_singleton()->instance_set_transform(light_instance, Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
+
+ RID light2 = VS::get_singleton()->light_create(VS::LIGHT_DIRECTIONAL);
+ VS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
+ //VS::get_singleton()->light_set_color(light2, VS::LIGHT_COLOR_SPECULAR, Color(0.0, 0.0, 0.0));
+ RID light_instance2 = VS::get_singleton()->instance_create2(light2, scenario);
+
+ VS::get_singleton()->instance_set_transform(light_instance2, Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
+
+ //sphere = VS::get_singleton()->mesh_create();
+ RID mesh_instance = VS::get_singleton()->instance_create();
+ VS::get_singleton()->instance_set_scenario(mesh_instance, scenario);
+
+ EditorProgress ep("mlib", TTR("Creating Mesh Library"), ids.size());
+
+ for (int i = 0; i < ids.size(); i++) {
+
+ int id = ids[i];
Ref<Mesh> mesh = p_library->get_item_mesh(id);
if (!mesh.is_valid())
continue;
- AABB aabb= mesh->get_aabb();
- print_line("aabb: "+aabb);
- Vector3 ofs = aabb.pos + aabb.size*0.5;
- aabb.pos-=ofs;
+ Rect3 aabb = mesh->get_aabb();
+ print_line("aabb: " + aabb);
+ Vector3 ofs = aabb.position + aabb.size * 0.5;
+ aabb.position -= ofs;
Transform xform;
- xform.basis=Matrix3().rotated(Vector3(0,1,0),-Math_PI*0.25);
- xform.basis = Matrix3().rotated(Vector3(1,0,0),Math_PI*0.25)*xform.basis;
- AABB rot_aabb = xform.xform(aabb);
- print_line("rot_aabb: "+rot_aabb);
- float m = MAX(rot_aabb.size.x,rot_aabb.size.y)*0.5;
- if (m==0)
+ xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI * 0.25);
+ xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI * 0.25) * xform.basis;
+ Rect3 rot_aabb = xform.xform(aabb);
+ print_line("rot_aabb: " + rot_aabb);
+ float m = MAX(rot_aabb.size.x, rot_aabb.size.y) * 0.5;
+ if (m == 0)
continue;
- m=1.0/m;
- m*=0.5;
- print_line("scale: "+rtos(m));
- xform.basis.scale(Vector3(m,m,m));
- xform.origin=-xform.basis.xform(ofs); //-ofs*m;
- xform.origin.z-=rot_aabb.size.z*2;
- RID inst = VS::get_singleton()->instance_create2(mesh->get_rid(),scen);
- VS::get_singleton()->instance_set_transform(inst,xform);
- ep.step(TTR("Thumbnail.."),i);
- VS::get_singleton()->viewport_queue_screen_capture(vp);
+ m = 1.0 / m;
+ m *= 0.5;
+ print_line("scale: " + rtos(m));
+ xform.basis.scale(Vector3(m, m, m));
+ xform.origin = -xform.basis.xform(ofs); //-ofs*m;
+ xform.origin.z -= rot_aabb.size.z * 2;
+ RID inst = VS::get_singleton()->instance_create2(mesh->get_rid(), scenario);
+ VS::get_singleton()->instance_set_transform(inst, xform);
+ ep.step(TTR("Thumbnail.."), i);
+ Main::iteration();
Main::iteration();
- Image img = VS::get_singleton()->viewport_get_screen_capture(vp);
- ERR_CONTINUE(img.empty());
- Ref<ImageTexture> it( memnew( ImageTexture ));
+ Ref<Image> img = VS::get_singleton()->texture_get_data(viewport_texture);
+ ERR_CONTINUE(!img.is_valid() || img->empty());
+ Ref<ImageTexture> it(memnew(ImageTexture));
it->create_from_image(img);
- p_library->set_item_preview(id,it);
+ p_library->set_item_preview(id, it);
//print_line("loaded image, size: "+rtos(m)+" dist: "+rtos(dist)+" empty?"+itos(img.empty())+" w: "+itos(it->get_width())+" h: "+itos(it->get_height()));
VS::get_singleton()->free(inst);
- }
+ }
- VS::get_singleton()->free(lightinst);
- VS::get_singleton()->free(light);
- VS::get_singleton()->free(vp);
- VS::get_singleton()->free(cam);
- VS::get_singleton()->free(scen);
+ VS::get_singleton()->free(mesh_instance);
+ VS::get_singleton()->free(viewport);
+ VS::get_singleton()->free(light);
+ VS::get_singleton()->free(light_instance);
+ VS::get_singleton()->free(light2);
+ VS::get_singleton()->free(light_instance2);
+ VS::get_singleton()->free(camera);
+ VS::get_singleton()->free(scenario);
}
-
-
}
-
-void MeshLibraryEditor::_import_scene_cbk(const String& p_str) {
-
+void MeshLibraryEditor::_import_scene_cbk(const String &p_str) {
print_line("Impot Callback!");
- Ref<PackedScene> ps = ResourceLoader::load(p_str,"PackedScene");
+ Ref<PackedScene> ps = ResourceLoader::load(p_str, "PackedScene");
ERR_FAIL_COND(ps.is_null());
Node *scene = ps->instance();
- _import_scene(scene,theme,option==MENU_OPTION_UPDATE_FROM_SCENE);
+ _import_scene(scene, theme, option == MENU_OPTION_UPDATE_FROM_SCENE);
memdelete(scene);
- theme->set_meta("_editor_source_scene",p_str);
- menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE),false);
-
+ theme->set_meta("_editor_source_scene", p_str);
+ menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), false);
}
-Error MeshLibraryEditor::update_library_file(Node *p_base_scene, Ref<MeshLibrary> ml,bool p_merge) {
+Error MeshLibraryEditor::update_library_file(Node *p_base_scene, Ref<MeshLibrary> ml, bool p_merge) {
- _import_scene(p_base_scene,ml,p_merge);
+ _import_scene(p_base_scene, ml, p_merge);
return OK;
}
-
void MeshLibraryEditor::_menu_cbk(int p_option) {
- option=p_option;
- switch(p_option) {
+ option = p_option;
+ switch (p_option) {
case MENU_OPTION_ADD_ITEM: {
@@ -255,86 +276,84 @@ void MeshLibraryEditor::_menu_cbk(int p_option) {
case MENU_OPTION_REMOVE_ITEM: {
String p = editor->get_property_editor()->get_selected_path();
- if (p.begins_with("/MeshLibrary/item") && p.get_slice_count("/")>=3) {
+ if (p.begins_with("/MeshLibrary/item") && p.get_slice_count("/") >= 3) {
- to_erase = p.get_slice("/",3).to_int();
- cd->set_text(vformat(TTR("Remove item %d?"),to_erase));
- cd->popup_centered(Size2(300,60));
+ to_erase = p.get_slice("/", 3).to_int();
+ cd->set_text(vformat(TTR("Remove item %d?"), to_erase));
+ cd->popup_centered(Size2(300, 60));
}
} break;
case MENU_OPTION_IMPORT_FROM_SCENE: {
file->popup_centered_ratio();
} break;
- case MENU_OPTION_UPDATE_FROM_SCENE: {
+ case MENU_OPTION_UPDATE_FROM_SCENE: {
- cd->set_text("Update from existing scene?:\n"+String(theme->get_meta("_editor_source_scene")));
- cd->popup_centered(Size2(500,60));
- } break;
+ cd->set_text("Update from existing scene?:\n" + String(theme->get_meta("_editor_source_scene")));
+ cd->popup_centered(Size2(500, 60));
+ } break;
}
}
-
void MeshLibraryEditor::_bind_methods() {
- ClassDB::bind_method("_menu_cbk",&MeshLibraryEditor::_menu_cbk);
- ClassDB::bind_method("_menu_confirm",&MeshLibraryEditor::_menu_confirm);
- ClassDB::bind_method("_import_scene_cbk",&MeshLibraryEditor::_import_scene_cbk);
+ ClassDB::bind_method("_menu_cbk", &MeshLibraryEditor::_menu_cbk);
+ ClassDB::bind_method("_menu_confirm", &MeshLibraryEditor::_menu_confirm);
+ ClassDB::bind_method("_import_scene_cbk", &MeshLibraryEditor::_import_scene_cbk);
}
MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) {
- file = memnew( EditorFileDialog );
+ file = memnew(EditorFileDialog);
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
//not for now?
List<String> extensions;
- ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions);
+ ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions);
file->clear_filters();
file->set_title(TTR("Import Scene"));
- for(int i=0;i<extensions.size();i++) {
+ for (int i = 0; i < extensions.size(); i++) {
- file->add_filter("*."+extensions[i]+" ; "+extensions[i].to_upper());
+ file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
}
add_child(file);
- file->connect("file_selected",this,"_import_scene_cbk");
+ file->connect("file_selected", this, "_import_scene_cbk");
- Panel *panel = memnew( Panel );
+ Panel *panel = memnew(Panel);
panel->set_area_as_parent_rect();
add_child(panel);
- MenuButton * options = memnew( MenuButton );
+ MenuButton *options = memnew(MenuButton);
panel->add_child(options);
- options->set_position(Point2(1,1));
+ options->set_position(Point2(1, 1));
options->set_text("Theme");
- options->get_popup()->add_item(TTR("Add Item"),MENU_OPTION_ADD_ITEM);
- options->get_popup()->add_item(TTR("Remove Selected Item"),MENU_OPTION_REMOVE_ITEM);
+ options->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM);
+ options->get_popup()->add_item(TTR("Remove Selected Item"), MENU_OPTION_REMOVE_ITEM);
options->get_popup()->add_separator();
- options->get_popup()->add_item(TTR("Import from Scene"),MENU_OPTION_IMPORT_FROM_SCENE);
- options->get_popup()->add_item(TTR("Update from Scene"),MENU_OPTION_UPDATE_FROM_SCENE);
- options->get_popup()->set_item_disabled(options->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE),true);
- options->get_popup()->connect("id_pressed", this,"_menu_cbk");
- menu=options;
- editor=p_editor;
+ options->get_popup()->add_item(TTR("Import from Scene"), MENU_OPTION_IMPORT_FROM_SCENE);
+ options->get_popup()->add_item(TTR("Update from Scene"), MENU_OPTION_UPDATE_FROM_SCENE);
+ options->get_popup()->set_item_disabled(options->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), true);
+ options->get_popup()->connect("id_pressed", this, "_menu_cbk");
+ menu = options;
+ editor = p_editor;
cd = memnew(ConfirmationDialog);
add_child(cd);
- cd->get_ok()->connect("pressed", this,"_menu_confirm");
-
+ cd->get_ok()->connect("pressed", this, "_menu_confirm");
}
void MeshLibraryEditorPlugin::edit(Object *p_node) {
if (p_node && p_node->cast_to<MeshLibrary>()) {
- theme_editor->edit( p_node->cast_to<MeshLibrary>() );
+ theme_editor->edit(p_node->cast_to<MeshLibrary>());
theme_editor->show();
} else
theme_editor->hide();
}
-bool MeshLibraryEditorPlugin::handles(Object *p_node) const{
+bool MeshLibraryEditorPlugin::handles(Object *p_node) const {
- return p_node->is_type("MeshLibrary");
+ return p_node->is_class("MeshLibrary");
}
-void MeshLibraryEditorPlugin::make_visible(bool p_visible){
+void MeshLibraryEditorPlugin::make_visible(bool p_visible) {
if (p_visible)
theme_editor->show();
@@ -344,15 +363,12 @@ void MeshLibraryEditorPlugin::make_visible(bool p_visible){
MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) {
- EDITOR_DEF("editors/grid_map/preview_size",64);
- theme_editor = memnew( MeshLibraryEditor(p_node) );
+ EDITOR_DEF("editors/grid_map/preview_size", 64);
+ theme_editor = memnew(MeshLibraryEditor(p_node));
p_node->get_viewport()->add_child(theme_editor);
theme_editor->set_area_as_parent_rect();
- theme_editor->set_anchor( MARGIN_RIGHT, Control::ANCHOR_END );
- theme_editor->set_anchor( MARGIN_BOTTOM, Control::ANCHOR_BEGIN );
- theme_editor->set_end( Point2(0,22) );
+ theme_editor->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_BEGIN);
+ theme_editor->set_end(Point2(0, 22));
theme_editor->hide();
-
}
-#endif
diff --git a/editor/plugins/cube_grid_theme_editor_plugin.h b/editor/plugins/cube_grid_theme_editor_plugin.h
index ed5875a999..6fe5fc4235 100644
--- a/editor/plugins/cube_grid_theme_editor_plugin.h
+++ b/editor/plugins/cube_grid_theme_editor_plugin.h
@@ -33,10 +33,9 @@
#include "editor/editor_node.h"
#include "scene/resources/mesh_library.h"
-#if 0
class MeshLibraryEditor : public Control {
- GDCLASS( MeshLibraryEditor, Control );
+ GDCLASS(MeshLibraryEditor, Control);
Ref<MeshLibrary> theme;
@@ -55,7 +54,7 @@ class MeshLibraryEditor : public Control {
};
int option;
- void _import_scene_cbk(const String& p_str);
+ void _import_scene_cbk(const String &p_str);
void _menu_cbk(int p_option);
void _menu_confirm();
@@ -63,25 +62,22 @@ class MeshLibraryEditor : public Control {
protected:
static void _bind_methods();
-public:
- void edit(const Ref<MeshLibrary>& p_theme);
- static Error update_library_file(Node *p_base_scene, Ref<MeshLibrary> ml,bool p_merge=true);
+public:
+ void edit(const Ref<MeshLibrary> &p_theme);
+ static Error update_library_file(Node *p_base_scene, Ref<MeshLibrary> ml, bool p_merge = true);
MeshLibraryEditor(EditorNode *p_editor);
};
-
-
class MeshLibraryEditorPlugin : public EditorPlugin {
- GDCLASS( MeshLibraryEditorPlugin, EditorPlugin );
+ GDCLASS(MeshLibraryEditorPlugin, EditorPlugin);
MeshLibraryEditor *theme_editor;
EditorNode *editor;
public:
-
virtual String get_name() const { return "MeshLibrary"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_node);
@@ -89,8 +85,6 @@ public:
virtual void make_visible(bool p_visible);
MeshLibraryEditorPlugin(EditorNode *p_node);
-
};
#endif // CUBE_GRID_THEME_EDITOR_PLUGIN_H
-#endif
diff --git a/editor/plugins/gi_probe_editor_plugin.h b/editor/plugins/gi_probe_editor_plugin.h
index b8f63e0b2e..e4151d4b8c 100644
--- a/editor/plugins/gi_probe_editor_plugin.h
+++ b/editor/plugins/gi_probe_editor_plugin.h
@@ -52,8 +52,8 @@ protected:
public:
virtual String get_name() const { return "GIProbe"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
GIProbeEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/gradient_editor_plugin.h b/editor/plugins/gradient_editor_plugin.h
index c319a13a01..1acf5f7e57 100644
--- a/editor/plugins/gradient_editor_plugin.h
+++ b/editor/plugins/gradient_editor_plugin.h
@@ -50,8 +50,8 @@ protected:
public:
virtual String get_name() const { return "ColorRamp"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
GradientEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/item_list_editor_plugin.h b/editor/plugins/item_list_editor_plugin.h
index bc009b3d7a..3bfe2c88e0 100644
--- a/editor/plugins/item_list_editor_plugin.h
+++ b/editor/plugins/item_list_editor_plugin.h
@@ -243,8 +243,8 @@ class ItemListEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "ItemList"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
ItemListEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.h b/editor/plugins/light_occluder_2d_editor_plugin.h
index d6579fc94c..435d650a69 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.h
+++ b/editor/plugins/light_occluder_2d_editor_plugin.h
@@ -101,8 +101,8 @@ public:
virtual String get_name() const { return "LightOccluder2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
LightOccluder2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp
index 4a7ad74fbe..41327fb07e 100644
--- a/editor/plugins/line_2d_editor_plugin.cpp
+++ b/editor/plugins/line_2d_editor_plugin.cpp
@@ -54,9 +54,9 @@ void Line2DEditor::_notification(int p_what) {
}
}
-Vector2 Line2DEditor::mouse_to_local_pos(Vector2 gpoint, bool alt) {
+Vector2 Line2DEditor::mouse_to_local_pos(Vector2 gpos, bool alt) {
Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- return !alt ? canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint)) : node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)));
+ return !alt ? canvas_item_editor->snap_point(xform.affine_inverse().xform(gpos)) : node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpos)));
}
int Line2DEditor::get_point_index_at(Vector2 gpos) {
diff --git a/editor/plugins/line_2d_editor_plugin.h b/editor/plugins/line_2d_editor_plugin.h
index 3a1f841556..f2979e4330 100644
--- a/editor/plugins/line_2d_editor_plugin.h
+++ b/editor/plugins/line_2d_editor_plugin.h
@@ -101,8 +101,8 @@ public:
virtual String get_name() const { return "Line2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
Line2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/mesh_editor_plugin.h b/editor/plugins/mesh_editor_plugin.h
index 72d93c4126..305d24ba07 100644
--- a/editor/plugins/mesh_editor_plugin.h
+++ b/editor/plugins/mesh_editor_plugin.h
@@ -81,8 +81,8 @@ class MeshEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Mesh"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
MeshEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/mesh_instance_editor_plugin.h b/editor/plugins/mesh_instance_editor_plugin.h
index d80ffa071d..614dcac0b9 100644
--- a/editor/plugins/mesh_instance_editor_plugin.h
+++ b/editor/plugins/mesh_instance_editor_plugin.h
@@ -82,8 +82,8 @@ class MeshInstanceEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "MeshInstance"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
MeshInstanceEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp
index 9520cc5297..a9689cce56 100644
--- a/editor/plugins/multimesh_editor_plugin.cpp
+++ b/editor/plugins/multimesh_editor_plugin.cpp
@@ -381,7 +381,7 @@ MultiMeshEditor::MultiMeshEditor() {
populate_amount = memnew(SpinBox);
populate_amount->set_anchor(MARGIN_RIGHT, ANCHOR_END);
populate_amount->set_begin(Point2(20, 232));
- populate_amount->set_end(Point2(5, 237));
+ populate_amount->set_end(Point2(-5, 237));
populate_amount->set_min(1);
populate_amount->set_max(65536);
populate_amount->set_value(128);
diff --git a/editor/plugins/multimesh_editor_plugin.h b/editor/plugins/multimesh_editor_plugin.h
index 0c633a4f60..a93fa73a2e 100644
--- a/editor/plugins/multimesh_editor_plugin.h
+++ b/editor/plugins/multimesh_editor_plugin.h
@@ -95,8 +95,8 @@ class MultiMeshEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "MultiMesh"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
MultiMeshEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/navigation_polygon_editor_plugin.h b/editor/plugins/navigation_polygon_editor_plugin.h
index 62a83983fd..6ec9b14cc1 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.h
+++ b/editor/plugins/navigation_polygon_editor_plugin.h
@@ -102,8 +102,8 @@ public:
virtual String get_name() const { return "NavigationPolygonInstance"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
NavigationPolygonEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/particles_2d_editor_plugin.h b/editor/plugins/particles_2d_editor_plugin.h
index cea60fbeaf..ccfec1a25f 100644
--- a/editor/plugins/particles_2d_editor_plugin.h
+++ b/editor/plugins/particles_2d_editor_plugin.h
@@ -87,8 +87,8 @@ protected:
public:
virtual String get_name() const { return "Particles2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
Particles2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h
index e9f9f43468..a6e14266c7 100644
--- a/editor/plugins/particles_editor_plugin.h
+++ b/editor/plugins/particles_editor_plugin.h
@@ -102,8 +102,8 @@ class ParticlesEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Particles"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
ParticlesEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/path_2d_editor_plugin.h b/editor/plugins/path_2d_editor_plugin.h
index 70911444ad..61ff700118 100644
--- a/editor/plugins/path_2d_editor_plugin.h
+++ b/editor/plugins/path_2d_editor_plugin.h
@@ -112,8 +112,8 @@ public:
virtual String get_name() const { return "Path2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
Path2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp
index c32ed1064f..96a98f3c48 100644
--- a/editor/plugins/path_editor_plugin.cpp
+++ b/editor/plugins/path_editor_plugin.cpp
@@ -222,8 +222,10 @@ void PathSpatialGizmo::redraw() {
//v3p.push_back(r[i]+Vector3(0,0.2,0));
}
- add_lines(v3p, PathEditorPlugin::singleton->path_material);
- add_collision_segments(v3p);
+ if (v3p.size() > 1) {
+ add_lines(v3p, PathEditorPlugin::singleton->path_material);
+ add_collision_segments(v3p);
+ }
if (PathEditorPlugin::singleton->get_edited_path() == path) {
v3p.clear();
@@ -247,9 +249,15 @@ void PathSpatialGizmo::redraw() {
}
}
- add_lines(v3p, PathEditorPlugin::singleton->path_thin_material);
- add_handles(handles);
- add_handles(sec_handles, false, true);
+ if (v3p.size() > 1) {
+ add_lines(v3p, PathEditorPlugin::singleton->path_thin_material);
+ }
+ if (handles.size()) {
+ add_handles(handles);
+ }
+ if (sec_handles.size()) {
+ add_handles(sec_handles, false, true);
+ }
}
}
diff --git a/editor/plugins/path_editor_plugin.h b/editor/plugins/path_editor_plugin.h
index 651dcdaa78..43df9d460f 100644
--- a/editor/plugins/path_editor_plugin.h
+++ b/editor/plugins/path_editor_plugin.h
@@ -83,8 +83,8 @@ public:
virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
virtual String get_name() const { return "Path"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
PathEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h
index 0901cc9082..4fcb1d81c2 100644
--- a/editor/plugins/polygon_2d_editor_plugin.h
+++ b/editor/plugins/polygon_2d_editor_plugin.h
@@ -152,8 +152,8 @@ public:
virtual String get_name() const { return "Polygon2D"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
Polygon2DEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 2703da12fe..ccefbc1843 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -362,7 +362,7 @@ void ResourcePreloaderEditor::_bind_methods() {
ResourcePreloaderEditor::ResourcePreloaderEditor() {
- //add_style_override("panel", get_stylebox("panel","Panel"));
+ //add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
VBoxContainer *vbc = memnew(VBoxContainer);
add_child(vbc);
diff --git a/editor/plugins/resource_preloader_editor_plugin.h b/editor/plugins/resource_preloader_editor_plugin.h
index 1f54620ba4..6e4726748d 100644
--- a/editor/plugins/resource_preloader_editor_plugin.h
+++ b/editor/plugins/resource_preloader_editor_plugin.h
@@ -91,8 +91,8 @@ class ResourcePreloaderEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "ResourcePreloader"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
ResourcePreloaderEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/rich_text_editor_plugin.h b/editor/plugins/rich_text_editor_plugin.h
index 8d42adc236..2665db2993 100644
--- a/editor/plugins/rich_text_editor_plugin.h
+++ b/editor/plugins/rich_text_editor_plugin.h
@@ -79,8 +79,8 @@ class RichTextEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "RichText"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
RichTextEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/sample_editor_plugin.cpp b/editor/plugins/sample_editor_plugin.cpp
index 739a8abb53..2dd6de1683 100644
--- a/editor/plugins/sample_editor_plugin.cpp
+++ b/editor/plugins/sample_editor_plugin.cpp
@@ -360,22 +360,22 @@ SampleEditor::SampleEditor() {
player = memnew(SamplePlayer);
add_child(player);
- add_style_override("panel", get_stylebox("panel","Panel"));
+ add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
library = Ref<SampleLibrary>(memnew(SampleLibrary));
player->set_sample_library(library);
sample_texframe = memnew( TextureRect );
add_child(sample_texframe);
sample_texframe->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5);
- sample_texframe->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5);
+ sample_texframe->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,-5);
sample_texframe->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,30);
- sample_texframe->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,5);
+ sample_texframe->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,-5);
info_label = memnew( Label );
sample_texframe->add_child(info_label);
info_label->set_area_as_parent_rect();
- info_label->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,15);
- info_label->set_margin(MARGIN_BOTTOM,4);
- info_label->set_margin(MARGIN_RIGHT,4);
+ info_label->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,-15);
+ info_label->set_margin(MARGIN_BOTTOM,-4);
+ info_label->set_margin(MARGIN_RIGHT,-4);
info_label->set_align(Label::ALIGN_RIGHT);
diff --git a/editor/plugins/sample_library_editor_plugin.cpp b/editor/plugins/sample_library_editor_plugin.cpp
index 5ccfde15ff..3deb634491 100644
--- a/editor/plugins/sample_library_editor_plugin.cpp
+++ b/editor/plugins/sample_library_editor_plugin.cpp
@@ -432,7 +432,7 @@ SampleLibraryEditor::SampleLibraryEditor() {
player = memnew(SamplePlayer);
add_child(player);
- add_style_override("panel", get_stylebox("panel","Panel"));
+ add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
load = memnew( Button );
@@ -452,9 +452,9 @@ SampleLibraryEditor::SampleLibraryEditor() {
tree->set_columns(6);
add_child(tree);
tree->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5);
- tree->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5);
+ tree->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,-5);
tree->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,30);
- tree->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,5);
+ tree->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,-5);
tree->set_column_titles_visible(true);
tree->set_column_title(0,TTR("Name"));
tree->set_column_title(1,TTR("Preview"));
diff --git a/editor/plugins/sample_player_editor_plugin.cpp b/editor/plugins/sample_player_editor_plugin.cpp
index 25f1fe9e17..ea9b646a9b 100644
--- a/editor/plugins/sample_player_editor_plugin.cpp
+++ b/editor/plugins/sample_player_editor_plugin.cpp
@@ -120,8 +120,8 @@ SamplePlayerEditor::SamplePlayerEditor() {
play->set_position(Point2( 5, 5 ));
play->set_toggle_mode(true);
- play->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,250);
- play->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,230);
+ play->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,-250);
+ play->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,-230);
play->set_anchor_and_margin(MARGIN_TOP,Control::ANCHOR_BEGIN,0);
play->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_BEGIN,0);
@@ -131,15 +131,15 @@ SamplePlayerEditor::SamplePlayerEditor() {
stop->set_position(Point2( 35, 5 ));
stop->set_toggle_mode(true);
- stop->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,220);
- stop->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,200);
+ stop->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,-220);
+ stop->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,-200);
stop->set_anchor_and_margin(MARGIN_TOP,Control::ANCHOR_BEGIN,0);
stop->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_BEGIN,0);
add_child(stop);
samples = memnew( OptionButton );
- samples->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,190);
- samples->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,5);
+ samples->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,-190);
+ samples->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,-5);
samples->set_anchor_and_margin(MARGIN_TOP,Control::ANCHOR_BEGIN,0);
samples->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_BEGIN,0);
add_child(samples);
@@ -182,7 +182,7 @@ SamplePlayerEditorPlugin::SamplePlayerEditorPlugin(EditorNode *p_node) {
sample_player_editor->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
sample_player_editor->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
- sample_player_editor->set_margin(MARGIN_LEFT,250);
+ sample_player_editor->set_margin(MARGIN_LEFT,-250);
sample_player_editor->set_margin(MARGIN_RIGHT,0);
sample_player_editor->set_margin(MARGIN_TOP,0);
sample_player_editor->set_margin(MARGIN_BOTTOM,10);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 1873a3f58b..6db732ba5d 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -34,18 +34,19 @@
#include "editor/script_editor_debugger.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
+#include "node_dock.h"
#include "os/file_access.h"
#include "os/input.h"
#include "os/keyboard.h"
#include "os/os.h"
#include "project_settings.h"
#include "scene/main/viewport.h"
-
/*** SCRIPT EDITOR ****/
void ScriptEditorBase::_bind_methods() {
ADD_SIGNAL(MethodInfo("name_changed"));
+ ADD_SIGNAL(MethodInfo("script_changed"));
ADD_SIGNAL(MethodInfo("request_help_search", PropertyInfo(Variant::STRING, "topic")));
ADD_SIGNAL(MethodInfo("request_help_index"));
ADD_SIGNAL(MethodInfo("request_open_script_at_line", PropertyInfo(Variant::OBJECT, "script"), PropertyInfo(Variant::INT, "line")));
@@ -1125,10 +1126,6 @@ void ScriptEditor::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
tab_container->add_style_override("panel", editor->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles"));
-
- Ref<StyleBox> sb = editor->get_gui_base()->get_stylebox("panel", "TabContainer")->duplicate();
- sb->set_default_margin(MARGIN_TOP, 0);
- add_style_override("panel", sb);
} break;
default:
@@ -1714,6 +1711,7 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool
_update_script_names();
_save_layout();
se->connect("name_changed", this, "_update_script_names");
+ se->connect("script_changed", this, "_script_changed");
se->connect("request_help_search", this, "_help_search");
se->connect("request_open_script_at_line", this, "_goto_script_line");
se->connect("go_to_help", this, "_help_class_goto");
@@ -2200,6 +2198,11 @@ void ScriptEditor::register_create_script_editor_function(CreateScriptEditorFunc
script_editor_funcs[script_editor_func_count++] = p_func;
}
+void ScriptEditor::_script_changed() {
+
+ NodeDock::singleton->update_lists();
+}
+
void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_file_dialog_action", &ScriptEditor::_file_dialog_action);
@@ -2241,6 +2244,7 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_history_back", &ScriptEditor::_history_back);
ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts);
ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input);
+ ClassDB::bind_method("_script_changed", &ScriptEditor::_script_changed);
ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script);
ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts);
@@ -2261,9 +2265,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
members_overview_enabled = true;
editor = p_editor;
- Ref<StyleBox> sb = p_editor->get_gui_base()->get_stylebox("panel", "TabContainer")->duplicate();
- sb->set_default_margin(MARGIN_TOP, 0);
- add_style_override("panel", sb);
VBoxContainer *main_container = memnew(VBoxContainer);
add_child(main_container);
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index d8a9415df1..f87a20a1f0 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -65,7 +65,7 @@ protected:
static void _bind_methods();
public:
- void popup(const Vector<String> &p_base, bool p_dontclear = false);
+ void popup(const Vector<String> &p_functions, bool p_dontclear = false);
ScriptEditorQuickOpen();
};
@@ -223,14 +223,14 @@ class ScriptEditor : public PanelContainer {
EditorHelpIndex *help_index;
void _tab_changed(int p_which);
- void _menu_option(int p_optin);
+ void _menu_option(int p_option);
Tree *disk_changed_list;
ConfirmationDialog *disk_changed;
bool restoring_layout;
- String _get_debug_tooltip(const String &p_text, Node *_ste);
+ String _get_debug_tooltip(const String &p_text, Node *_se);
void _resave_scripts(const String &p_str);
void _reload_scripts();
@@ -318,6 +318,7 @@ class ScriptEditor : public PanelContainer {
void _update_script_colors();
void _update_modified_scripts_for_external_editor(Ref<Script> p_for_script = Ref<Script>());
+ void _script_changed();
int file_dialog_option;
void _file_dialog_action(String p_file);
@@ -392,8 +393,8 @@ class ScriptEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Script"; }
bool has_main_screen() const { return true; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
virtual void selected_notify();
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 422c656351..1a3092b6e4 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -524,6 +524,7 @@ void ScriptTextEditor::_validate_script() {
}
emit_signal("name_changed");
+ emit_signal("script_changed");
}
static Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Script> &p_script) {
@@ -866,6 +867,21 @@ void ScriptTextEditor::_edit_option(int p_op) {
//tx->deselect();
} break;
+ case EDIT_DELETE_LINE: {
+
+ TextEdit *tx = code_editor->get_text_edit();
+ Ref<Script> scr = get_edited_script();
+ if (scr.is_null())
+ return;
+
+ tx->begin_complex_operation();
+ int line = tx->cursor_get_line();
+ tx->set_line(tx->cursor_get_line(), "");
+ tx->backspace_at_cursor();
+ tx->cursor_set_line(line);
+ tx->end_complex_operation();
+
+ } break;
case EDIT_CLONE_DOWN: {
TextEdit *tx = code_editor->get_text_edit();
@@ -1391,6 +1407,7 @@ ScriptTextEditor::ScriptTextEditor() {
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_down"), EDIT_MOVE_LINE_DOWN);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
+ edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/clone_down"), EDIT_CLONE_DOWN);
edit_menu->get_popup()->add_separator();
@@ -1465,6 +1482,7 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/select_all", TTR("Select All"), KEY_MASK_CMD | KEY_A);
ED_SHORTCUT("script_text_editor/move_up", TTR("Move Up"), KEY_MASK_ALT | KEY_UP);
ED_SHORTCUT("script_text_editor/move_down", TTR("Move Down"), KEY_MASK_ALT | KEY_DOWN);
+ ED_SHORTCUT("script_text_editor/delete_line", TTR("Delete Line"), KEY_MASK_CTRL | KEY_MASK_SHIFT | KEY_K);
//leave these at zero, same can be accomplished with tab/shift-tab, including selection
//the next/previous in history shortcut in this case makes a lot more sene.
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index e55847832f..c505976223 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -74,6 +74,7 @@ class ScriptTextEditor : public ScriptEditorBase {
EDIT_MOVE_LINE_DOWN,
EDIT_INDENT_RIGHT,
EDIT_INDENT_LEFT,
+ EDIT_DELETE_LINE,
EDIT_CLONE_DOWN,
EDIT_PICK_COLOR,
EDIT_TO_UPPERCASE,
diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h
index 38d5c3e3a6..8625267a63 100644
--- a/editor/plugins/shader_editor_plugin.h
+++ b/editor/plugins/shader_editor_plugin.h
@@ -92,7 +92,7 @@ class ShaderEditor : public VBoxContainer {
ShaderTextEditor *shader_editor;
- void _menu_option(int p_optin);
+ void _menu_option(int p_option);
void _params_changed();
mutable Ref<Shader> shader;
@@ -130,8 +130,8 @@ class ShaderEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Shader"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
virtual void selected_notify();
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 67dfb94c50..bca1f254b0 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -267,6 +267,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
int selected_handle = -1;
Vector<Spatial *> subscenes = Vector<Spatial *>();
+ Vector<Vector3> subscenes_positions = Vector<Vector3>();
for (int i = 0; i < instances.size(); i++) {
@@ -284,13 +285,16 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
if ((!seg.is_valid()) || found_gizmos.has(seg)) {
Node *subscene_candidate = spat;
+ Vector3 source_click_spatial_pos = spat->get_global_transform().origin;
- while (subscene_candidate->get_owner() != editor->get_edited_scene())
+ while ((subscene_candidate->get_owner() != NULL) && (subscene_candidate->get_owner() != editor->get_edited_scene()))
subscene_candidate = subscene_candidate->get_owner();
spat = subscene_candidate->cast_to<Spatial>();
- if (spat && (spat->get_filename() != ""))
+ if (spat && (spat->get_filename() != "") && (subscene_candidate->get_owner() != NULL)) {
subscenes.push_back(spat);
+ subscenes_positions.push_back(source_click_spatial_pos);
+ }
continue;
}
@@ -324,7 +328,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
for (int idx_subscene = 0; idx_subscene < subscenes.size(); idx_subscene++) {
Spatial *subscene = subscenes.get(idx_subscene);
- float dist = ray.cross(subscene->get_global_transform().origin - pos).length();
+ float dist = ray.cross(subscenes_positions.get(idx_subscene) - pos).length();
if ((dist < 0) || (dist > 1.2))
continue;
@@ -410,7 +414,7 @@ void SpatialEditorViewport::_find_items_at_pos(const Point2 &p_pos, bool &r_incl
results.sort();
}
-Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_pos) {
+Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_vector3) {
CameraMatrix cm;
cm.set_perspective(get_fov(), get_size().aspect(), get_znear(), get_zfar());
@@ -423,7 +427,7 @@ Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_pos) {
camera_transform.basis.rotate(Vector3(0, 1, 0), -cursor.y_rot);
camera_transform.translate(0, 0, cursor.distance);
- return camera_transform.xform(Vector3(((p_pos.x / get_size().width) * 2.0 - 1.0) * screen_w, ((1.0 - (p_pos.y / get_size().height)) * 2.0 - 1.0) * screen_h, -get_znear()));
+ return camera_transform.xform(Vector3(((p_vector3.x / get_size().width) * 2.0 - 1.0) * screen_w, ((1.0 - (p_vector3.y / get_size().height)) * 2.0 - 1.0) * screen_h, -get_znear()));
}
void SpatialEditorViewport::_select_region() {
@@ -1449,8 +1453,12 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
case NAVIGATION_ORBIT: {
Point2i relative = _get_warped_mouse_motion(m);
- cursor.x_rot += relative.y / 80.0;
- cursor.y_rot += relative.x / 80.0;
+
+ real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/orbit_sensitivity");
+ real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
+
+ cursor.x_rot += relative.y * radians_per_pixel;
+ cursor.y_rot += relative.x * radians_per_pixel;
if (cursor.x_rot > Math_PI / 2.0)
cursor.x_rot = Math_PI / 2.0;
if (cursor.x_rot < -Math_PI / 2.0)
@@ -1464,8 +1472,12 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
// It technically works too in ortho, but it's awful for a user due to fov being near zero
if (!orthogonal) {
Point2i relative = _get_warped_mouse_motion(m);
- cursor.x_rot += relative.y / 120.0;
- cursor.y_rot += relative.x / 120.0;
+
+ real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/orbit_sensitivity");
+ real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
+
+ cursor.x_rot += relative.y * radians_per_pixel;
+ cursor.y_rot += relative.x * radians_per_pixel;
if (cursor.x_rot > Math_PI / 2.0)
cursor.x_rot = Math_PI / 2.0;
if (cursor.x_rot < -Math_PI / 2.0)
@@ -2485,7 +2497,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
preview_camera = memnew(Button);
preview_camera->set_toggle_mode(true);
- preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, 90 * EDSCALE);
+ preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE);
preview_camera->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
preview_camera->set_text("preview");
surface->add_child(preview_camera);
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index e9857f8b0c..2fd72739df 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -245,7 +245,7 @@ private:
void _draw();
void _smouseenter();
- void _sinput(const Ref<InputEvent> &p_ie);
+ void _sinput(const Ref<InputEvent> &p_event);
void _update_freelook(real_t delta);
SpatialEditor *spatial_editor;
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 6a010062f2..0608ecec58 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -714,7 +714,7 @@ void SpriteFramesEditor::_bind_methods() {
SpriteFramesEditor::SpriteFramesEditor() {
- //add_style_override("panel", get_stylebox("panel","Panel"));
+ //add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
split = memnew(HSplitContainer);
add_child(split);
@@ -747,7 +747,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
animations->set_hide_root(true);
animations->connect("cell_selected", this, "_animation_select");
animations->connect("item_edited", this, "_animation_name_edited");
- animations->set_single_select_cell_editing_only_when_already_selected(true);
+ animations->set_allow_reselect(true);
anim_speed = memnew(SpinBox);
vbc_animlist->add_margin_child(TTR("Speed (FPS):"), anim_speed);
diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h
index c9081c599a..c0eb1ec3d0 100644
--- a/editor/plugins/sprite_frames_editor_plugin.h
+++ b/editor/plugins/sprite_frames_editor_plugin.h
@@ -121,8 +121,8 @@ class SpriteFramesEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "SpriteFrames"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
SpriteFramesEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h
index 13f8dd7fbd..2b5e7ed629 100644
--- a/editor/plugins/texture_editor_plugin.h
+++ b/editor/plugins/texture_editor_plugin.h
@@ -61,8 +61,8 @@ class TextureEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "Texture"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
TextureEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 4cd18b090a..d878bba427 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -898,12 +898,12 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
edit_draw->set_clip_contents(true);
}
-void TextureRegionEditorPlugin::edit(Object *p_node) {
- region_editor->edit(p_node);
+void TextureRegionEditorPlugin::edit(Object *p_object) {
+ region_editor->edit(p_object);
}
-bool TextureRegionEditorPlugin::handles(Object *p_obj) const {
- return p_obj->is_class("Sprite") || p_obj->is_class("Patch9Rect") || p_obj->is_class("StyleBoxTexture") || p_obj->is_class("AtlasTexture");
+bool TextureRegionEditorPlugin::handles(Object *p_object) const {
+ return p_object->is_class("Sprite") || p_object->is_class("Patch9Rect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture");
}
void TextureRegionEditorPlugin::make_visible(bool p_visible) {
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index cb0b9fc372..265d46cb08 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -139,8 +139,8 @@ class TextureRegionEditorPlugin : public EditorPlugin {
public:
virtual String get_name() const { return "TextureRegion"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
void set_state(const Dictionary &p_state);
Dictionary get_state() const;
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 023424d891..80ff6627b2 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -52,8 +52,15 @@ void TileMapEditor::_notification(int p_what) {
search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
} break;
+
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+ bool new_show_tile_info = EditorSettings::get_singleton()->get("editors/tile_map/show_tile_info_on_hover");
+ if (new_show_tile_info != show_tile_info) {
+ show_tile_info = new_show_tile_info;
+ tile_info->set_visible(show_tile_info);
+ }
+
if (is_visible_in_tree()) {
_update_palette();
}
@@ -912,12 +919,14 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
canvas_item_editor->update();
}
- int tile_under = node->get_cell(over_tile.x, over_tile.y);
- String tile_name = "none";
+ if (show_tile_info) {
+ int tile_under = node->get_cell(over_tile.x, over_tile.y);
+ String tile_name = "none";
- if (node->get_tileset()->has_tile(tile_under))
- tile_name = node->get_tileset()->tile_get_name(tile_under);
- tile_info->set_text(String::num(over_tile.x) + ", " + String::num(over_tile.y) + " [" + tile_name + "]");
+ if (node->get_tileset()->has_tile(tile_under))
+ tile_name = node->get_tileset()->tile_get_name(tile_under);
+ tile_info->set_text(String::num(over_tile.x) + ", " + String::num(over_tile.y) + " [" + tile_name + "]");
+ }
if (tool == TOOL_PAINTING) {
@@ -1439,6 +1448,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
tool = TOOL_NONE;
selection_active = false;
mouse_over = false;
+ show_tile_info = true;
flip_h = false;
flip_v = false;
@@ -1602,6 +1612,7 @@ TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("editors/tile_map/show_tile_ids", false);
EDITOR_DEF("editors/tile_map/sort_tiles_by_name", true);
EDITOR_DEF("editors/tile_map/bucket_fill_preview", true);
+ EDITOR_DEF("editors/tile_map/show_tile_info_on_hover", true);
tile_map_editor = memnew(TileMapEditor(p_node));
add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE, tile_map_editor);
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index 981d5c66a1..d76884e663 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -97,6 +97,7 @@ class TileMapEditor : public VBoxContainer {
bool selection_active;
bool mouse_over;
+ bool show_tile_info;
bool flip_h;
bool flip_v;
@@ -197,8 +198,8 @@ public:
virtual String get_name() const { return "TileMap"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
TileMapEditorPlugin(EditorNode *p_node);
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 3563f70d0b..8396b4d412 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -147,12 +147,12 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
}
}
-void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_merge) {
+void TileSetEditor::_import_scene(Node *p_scene, Ref<TileSet> p_library, bool p_merge) {
if (!p_merge)
p_library->clear();
- _import_node(scene, p_library);
+ _import_node(p_scene, p_library);
}
void TileSetEditor::_menu_confirm() {
@@ -294,7 +294,6 @@ TileSetEditorPlugin::TileSetEditorPlugin(EditorNode *p_node) {
p_node->get_viewport()->add_child(tileset_editor);
tileset_editor->set_area_as_parent_rect();
- tileset_editor->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
tileset_editor->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_BEGIN);
tileset_editor->set_end(Point2(0, 22));
tileset_editor->hide();
diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp
index 51a40faf37..980afee447 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -155,9 +155,10 @@ void ProgressDialog::_popup() {
Ref<StyleBox> style = get_stylebox("panel", "PopupMenu");
ms += style->get_minimum_size();
- for (int i = 0; i < 4; i++) {
- main->set_margin(Margin(i), style->get_margin(Margin(i)));
- }
+ main->set_margin(MARGIN_LEFT, style->get_margin(MARGIN_LEFT));
+ main->set_margin(MARGIN_RIGHT, -style->get_margin(MARGIN_RIGHT));
+ main->set_margin(MARGIN_TOP, style->get_margin(MARGIN_TOP));
+ main->set_margin(MARGIN_BOTTOM, -style->get_margin(MARGIN_BOTTOM));
popup_centered(ms);
}
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 0afbd19274..68dfe7e967 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -848,6 +848,7 @@ void ProjectManager::_load_recent_projects() {
VBoxContainer *vb = memnew(VBoxContainer);
vb->set_name("project");
+ vb->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(vb);
Control *ec = memnew(Control);
ec->set_custom_minimum_size(Size2(0, 1));
@@ -855,12 +856,14 @@ void ProjectManager::_load_recent_projects() {
Label *title = memnew(Label(project_name));
title->add_font_override("font", gui_base->get_font("large", "Fonts"));
title->add_color_override("font_color", font_color);
+ title->set_clip_text(true);
vb->add_child(title);
Label *fpath = memnew(Label(path));
fpath->set_name("path");
vb->add_child(fpath);
fpath->set_modulate(Color(1, 1, 1, 0.5));
fpath->add_color_override("font_color", font_color);
+ fpath->set_clip_text(true);
scroll_childs->add_child(hb);
}
@@ -1216,7 +1219,7 @@ ProjectManager::ProjectManager() {
panel->add_child(vb);
vb->set_area_as_parent_rect(20 * EDSCALE);
vb->set_margin(MARGIN_TOP, 4 * EDSCALE);
- vb->set_margin(MARGIN_BOTTOM, 4 * EDSCALE);
+ vb->set_margin(MARGIN_BOTTOM, -4 * EDSCALE);
vb->add_constant_override("separation", 15 * EDSCALE);
String cp;
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 53d94cdb18..1bd748a083 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -38,6 +38,7 @@
#include "editor_node.h"
#include "editor_settings.h"
#include "io/image_loader.h"
+#include "io/marshalls.h"
#include "io/resource_loader.h"
#include "multi_node_edit.h"
#include "os/input.h"
@@ -434,13 +435,13 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
} else if (hint == PROPERTY_HINT_EXP_EASING) {
easing_draw->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5 * EDSCALE);
- easing_draw->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 5 * EDSCALE);
+ easing_draw->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5 * EDSCALE);
easing_draw->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 5 * EDSCALE);
- easing_draw->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 30 * EDSCALE);
+ easing_draw->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -30 * EDSCALE);
type_button->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 3 * EDSCALE);
- type_button->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 3 * EDSCALE);
- type_button->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, 25 * EDSCALE);
- type_button->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 7 * EDSCALE);
+ type_button->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -3 * EDSCALE);
+ type_button->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -25 * EDSCALE);
+ type_button->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -7 * EDSCALE);
type_button->set_text(TTR("Preset.."));
type_button->get_popup()->clear();
type_button->get_popup()->add_item(TTR("Linear"), EASING_LINEAR);
@@ -523,8 +524,8 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
action_buttons[0]->set_anchor(MARGIN_TOP, ANCHOR_END);
action_buttons[0]->set_anchor(MARGIN_RIGHT, ANCHOR_END);
action_buttons[0]->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
- action_buttons[0]->set_begin(Point2(70 * EDSCALE, button_margin - 5 * EDSCALE));
- action_buttons[0]->set_end(Point2(margin, margin));
+ action_buttons[0]->set_begin(Point2(-70 * EDSCALE, -button_margin + 5 * EDSCALE));
+ action_buttons[0]->set_end(Point2(-margin, -margin));
action_buttons[0]->set_text(TTR("Close"));
action_buttons[0]->show();
@@ -1938,10 +1939,8 @@ CustomPropertyEditor::CustomPropertyEditor() {
text_edit = memnew(TextEdit);
add_child(text_edit);
- text_edit->set_area_as_parent_rect();
- for (int i = 0; i < 4; i++)
- text_edit->set_margin((Margin)i, 5);
- text_edit->set_margin(MARGIN_BOTTOM, 30);
+ text_edit->set_area_as_parent_rect(5);
+ text_edit->set_margin(MARGIN_BOTTOM, -30);
text_edit->hide();
text_edit->connect("text_changed", this, "_text_edit_changed");
@@ -2320,7 +2319,15 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p
} break;
case Variant::OBJECT: {
- if (obj->get(p_name).get_type() == Variant::NIL || obj->get(p_name).operator RefPtr().is_null()) {
+ Ref<EncodedObjectAsID> encoded = obj->get(p_name); //for debugger and remote tools
+
+ if (encoded.is_valid()) {
+
+ p_item->set_text(1, "Object: " + itos(encoded->get_object_id()));
+ p_item->set_icon(1, Ref<Texture>());
+ p_item->set_custom_as_button(1, true);
+
+ } else if (obj->get(p_name).get_type() == Variant::NIL || obj->get(p_name).operator RefPtr().is_null()) {
p_item->set_text(1, "<null>");
p_item->set_icon(1, Ref<Texture>());
p_item->set_custom_as_button(1, false);
@@ -2474,11 +2481,14 @@ bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Diction
String allowed_type = d["hint_text"];
+ print_line("allowed type " + allowed_type);
+
Dictionary drag_data = p_drag_data;
if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
Ref<Resource> res = drag_data["resource"];
for (int i = 0; i < allowed_type.get_slice_count(","); i++) {
String at = allowed_type.get_slice(",", i).strip_edges();
+ print_line("RES vs " + at);
if (res.is_valid() && ClassDB::is_parent_class(res->get_class(), at)) {
return true;
}
@@ -2489,13 +2499,18 @@ bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Diction
Vector<String> files = drag_data["files"];
+ print_line("fileS: " + String(Variant(files)));
if (files.size() == 1) {
String file = files[0];
String ftype = EditorFileSystem::get_singleton()->get_file_type(file);
+
+ print_line("file: " + file);
+ print_line("type: " + ftype);
if (ftype != "") {
for (int i = 0; i < allowed_type.get_slice_count(","); i++) {
String at = allowed_type.get_slice(",", i).strip_edges();
+ print_line("FILE vs " + at);
if (ClassDB::is_parent_class(ftype, at)) {
return true;
}
@@ -3602,7 +3617,16 @@ void PropertyEditor::update_tree() {
RES res = obj->get(p.name).operator RefPtr();
- if (obj->get(p.name).get_type() == Variant::NIL || res.is_null()) {
+ Ref<EncodedObjectAsID> encoded = obj->get(p.name); //for debugger and remote tools
+
+ if (encoded.is_valid()) {
+
+ item->set_text(1, "Object: " + itos(encoded->get_object_id()));
+ item->set_icon(1, Ref<Texture>());
+ item->set_custom_as_button(1, true);
+ item->set_editable(1, true);
+
+ } else if (obj->get(p.name).get_type() == Variant::NIL || res.is_null()) {
item->set_text(1, "<null>");
item->set_icon(1, Ref<Texture>());
item->set_custom_as_button(1, false);
@@ -3931,6 +3955,13 @@ void PropertyEditor::_item_edited() {
if (!item->is_custom_set_as_button(1))
break;
+ Ref<EncodedObjectAsID> encoded = obj->get(name); //for debugger and remote tools
+
+ if (encoded.is_valid()) {
+
+ emit_signal("object_id_selected", encoded->get_object_id());
+ }
+
RES res = obj->get(name);
if (res.is_valid()) {
emit_signal("resource_selected", res.get_ref_ptr(), name);
@@ -4183,9 +4214,9 @@ void PropertyEditor::set_keying(bool p_active) {
update_tree();
}
-void PropertyEditor::_draw_flags(Object *t, const Rect2 &p_rect) {
+void PropertyEditor::_draw_flags(Object *p_object, const Rect2 &p_rect) {
- TreeItem *ti = t->cast_to<TreeItem>();
+ TreeItem *ti = p_object->cast_to<TreeItem>();
if (!ti)
return;
@@ -4766,20 +4797,20 @@ double PropertyValueEvaluator::eval(const String &p_text) {
return _default_eval(p_text);
}
- ScriptInstance *script_instance = script->instance_create(this);
+ Object dummy;
+ ScriptInstance *script_instance = script->instance_create(&dummy);
if (!script_instance)
return _default_eval(p_text);
Variant::CallError call_err;
- script_instance->call("set_this", obj);
- double result = script_instance->call("e", NULL, 0, call_err);
+ Variant arg = obj;
+ const Variant *args[] = { &arg };
+ double result = script_instance->call("eval", args, 1, call_err);
if (call_err.error == Variant::CallError::CALL_OK) {
return result;
}
print_line("[PropertyValueEvaluator]: Error eval! Error code: " + itos(call_err.error));
- memdelete(script_instance);
-
return _default_eval(p_text);
}
@@ -4788,9 +4819,8 @@ void PropertyValueEvaluator::edit(Object *p_obj) {
}
String PropertyValueEvaluator::_build_script(const String &p_text) {
- String script_text = "tool\nvar this\nfunc set_this(p_this):\n\tthis=p_this\nfunc e():\n\treturn ";
- script_text += p_text.strip_edges();
- script_text += "\n";
+ String script_text =
+ "tool\nextends Object\nfunc eval(s):\n\tself = s\n\treturn " + p_text.strip_edges() + "\n";
return script_text;
}
diff --git a/editor/property_editor.h b/editor/property_editor.h
index cc507d248f..3dd09268ec 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -217,8 +217,8 @@ class PropertyEditor : public Control {
TreeItem *find_item(TreeItem *p_item, const String &p_name);
- virtual void _changed_callback(Object *p_changed, const char *p_what);
- virtual void _changed_callbacks(Object *p_changed, const String &p_callback);
+ virtual void _changed_callback(Object *p_changed, const char *p_prop);
+ virtual void _changed_callbacks(Object *p_changed, const String &p_prop);
void _check_reload_status(const String &p_name, TreeItem *item);
@@ -228,7 +228,7 @@ class PropertyEditor : public Control {
friend class ProjectExportDialog;
void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all = false, const String &p_changed_field = "");
- void _draw_flags(Object *ti, const Rect2 &p_rect);
+ void _draw_flags(Object *p_object, const Rect2 &p_rect);
bool _might_be_in_instance();
bool _get_instanced_node_original_property(const StringName &p_prop, Variant &value);
diff --git a/editor/resources_dock.h b/editor/resources_dock.h
index f58f8e4c54..e5470b1a3c 100644
--- a/editor/resources_dock.h
+++ b/editor/resources_dock.h
@@ -73,7 +73,7 @@ class ResourcesDock : public VBoxContainer {
bool block_add;
int current_action;
- void _file_action(const String &p_action);
+ void _file_action(const String &p_path);
void _delete(Object *p_item, int p_column, int p_id);
void _resource_selected();
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index ce3b85332f..e984098bd4 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -2030,6 +2030,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
tb->set_tooltip(TTR("Attach a new or existing script for the selected node."));
tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/attach_script"));
filter_hbc->add_child(tb);
+ tb->hide();
button_create_script = tb;
tb = memnew(ToolButton);
@@ -2038,6 +2039,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/clear_script"));
filter_hbc->add_child(tb);
button_clear_script = tb;
+ tb->hide();
scene_tree = memnew(SceneTreeEditor(false, true, true));
vbc->add_child(scene_tree);
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index 5872c5a25d..5a6bc94125 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -189,7 +189,7 @@ public:
void import_subscene();
void set_edited_scene(Node *p_scene);
- void instance(const String &p_path);
+ void instance(const String &p_file);
void instance_scenes(const Vector<String> &p_files, Node *p_parent = NULL);
void set_selected(Node *p_node, bool p_emit_selected = false);
void fill_path_renames(Node *p_node, Node *p_new_parent, List<Pair<NodePath, NodePath> > *p_renames);
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 94ef712c25..2fab78e8c0 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -573,8 +573,10 @@ void SceneTreeEditor::set_selected(Node *p_node, bool p_emit_selected) {
selected = NULL;
_update_tree();
selected = p_node;
- if (p_emit_selected)
- emit_signal("node_selected");
+ }
+
+ if (p_emit_selected) {
+ emit_signal("node_selected");
}
}
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index c6283af7b5..c666b6a8d5 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -101,7 +101,7 @@ class SceneTreeEditor : public Control {
static void _bind_methods();
void _cell_button_pressed(Object *p_item, int p_column, int p_id);
- void _cell_multi_selected(Object *p_object, int p_cel, bool p_selected);
+ void _cell_multi_selected(Object *p_object, int p_cell, bool p_selected);
void _update_selection(TreeItem *item);
void _node_script_changed(Node *p_node);
void _node_visibility_changed(Node *p_node);
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index f503b878f5..c8f199b53a 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -74,7 +74,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
void _path_changed(const String &p_path = String());
void _lang_changed(int l = 0);
void _built_in_pressed();
- bool _validate(const String &p_strin);
+ bool _validate(const String &p_string);
void _class_name_changed(const String &p_name);
void _parent_name_changed(const String &p_parent);
void _template_changed(int p_template = 0);
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 01cfdc1b57..bcf24b98f6 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -372,7 +372,13 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
if (has_icon(p_data[i + 2], "EditorIcons"))
it->set_icon(0, get_icon(p_data[i + 2], "EditorIcons"));
it->set_metadata(0, id);
+
if (id == inspected_object_id) {
+ TreeItem *cti = it->get_parent(); //ensure selected is always uncollapsed
+ while (cti) {
+ cti->set_collapsed(false);
+ cti = cti->get_parent();
+ }
it->select(0);
}
@@ -385,6 +391,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
it->set_collapsed(true);
}
}
+
lv[level] = it;
}
updating_scene_tree = false;
@@ -439,11 +446,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
inspected_object->last_edited_id = id;
- if (tabs->get_current_tab() == 2) {
- inspect_properties->edit(inspected_object);
- } else {
- editor->push_item(inspected_object);
- }
+ tabs->set_current_tab(inspect_info->get_index());
+ inspect_properties->edit(inspected_object);
} else if (p_msg == "message:video_mem") {
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 24be2095ce..0e6e7420e2 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -1150,7 +1150,7 @@ CameraSpatialGizmo::CameraSpatialGizmo(Camera *p_camera) {
void MeshInstanceSpatialGizmo::redraw() {
- Ref<ArrayMesh> m = mesh->get_mesh();
+ Ref<Mesh> m = mesh->get_mesh();
if (!m.is_valid())
return; //none
diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h
index 469a2d594a..28feee3fcc 100644
--- a/editor/spatial_editor_gizmos.h
+++ b/editor/spatial_editor_gizmos.h
@@ -278,7 +278,7 @@ public:
virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false);
void redraw();
- ReflectionProbeGizmo(ReflectionProbe *p_notifier = NULL);
+ ReflectionProbeGizmo(ReflectionProbe *p_probe = NULL);
};
class GIProbeGizmo : public EditorSpatialGizmo {
@@ -294,7 +294,7 @@ public:
virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false);
void redraw();
- GIProbeGizmo(GIProbe *p_notifier = NULL);
+ GIProbeGizmo(GIProbe *p_probe = NULL);
};
class CollisionShapeSpatialGizmo : public EditorSpatialGizmo {
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 4e2fd6f9d4..d496717460 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -775,7 +775,7 @@ static const char *s_ControllerMappings[] = {
"4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
"532e542e442e20496e74657261637420,3dfx InterAct HammerHead FX,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b25,rightshoulder:b27,rightx:a2,start:b31,righty:a3,dpleft:h0.8,lefttrigger:b28,x:b20,dpup:h0.1,back:b30,leftstick:b22,leftshoulder:b26,y:b21,a:b23,dpright:h0.2,righttrigger:b29,b:b24,",
"506572666f726d616e63652044657369,PDP Rock Candy Wireless Controller for PS3,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b6,rightshoulder:b18,rightx:a2,start:b16,righty:a3,dpleft:h0.8,lefttrigger:b9,x:b0,dpup:h0.1,back:h0.2,leftstick:b4,leftshoulder:b3,y:b2,a:b1,dpright:h0.2,righttrigger:b10,b:b17,",
- "4f5559412047616d6520436f6e74726f,OUYA Game Controller,leftx:a0,lefty:a1,dpdown:b9,rightstick:b7,rightshoulder:b5,rightx:a3,start:b16,righty:a4,dpleft:b10,lefttrigger:b12,x:b1,dpup:b8,back:b14,leftstick:b6,leftshoulder:b4,y:b2,a:b0,dpright:b11,righttrigger:b13,b:b3,",
+ "4f5559412047616d6520436f6e74726f,OUYA Game Controller,leftx:a1,lefty:a3,dpdown:b12,rightstick:b8,rightshoulder:b10,rightx:a6,start:b-86,righty:a7,dpleft:b13,lefttrigger:b15,x:b2,dpup:b11,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:b14,righttrigger:b16,b:b1,",
#endif
#ifdef JAVASCRIPT_ENABLED
@@ -899,8 +899,14 @@ void InputDefault::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
return;
}
- if (ABS(joy.last_axis[p_axis]) > 0.5 && joy.last_axis[p_axis] * p_value.value < 0) {
- //changed direction quickly, insert fake event to release pending inputmap actions
+ //when changing direction quickly, insert fake event to release pending inputmap actions
+ float last = joy.last_axis[p_axis];
+ if (p_value.min == 0 && (last < 0.25 || last > 0.75) && (last - 0.5) * (p_value.value - 0.5) < 0) {
+ JoyAxis jx;
+ jx.min = p_value.min;
+ jx.value = p_value.value < 0.5 ? 0.6 : 0.4;
+ joy_axis(p_device, p_axis, jx);
+ } else if (ABS(last) > 0.5 && last * p_value.value < 0) {
JoyAxis jx;
jx.min = p_value.min;
jx.value = p_value.value < 0 ? 0.1 : -0.1;
diff --git a/main/input_default.h b/main/input_default.h
index 35e841a488..92ef67c7b5 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -214,7 +214,7 @@ public:
virtual void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration = 0);
virtual void stop_joy_vibration(int p_device);
- void set_main_loop(MainLoop *main_loop);
+ void set_main_loop(MainLoop *p_main_loop);
void set_mouse_position(const Point2 &p_posf);
void action_press(const StringName &p_action);
diff --git a/main/main.cpp b/main/main.cpp
index 131c7bc62f..5d4c26ea89 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1049,7 +1049,7 @@ bool Main::start() {
String script;
String test;
String screen;
- String _export_platform;
+ String _export_preset;
String _import;
String _import_script;
bool noquit = false;
@@ -1084,10 +1084,10 @@ bool Main::start() {
test = args[i + 1];
} else if (args[i] == "-export") {
editor = true; //needs editor
- _export_platform = args[i + 1];
+ _export_preset = args[i + 1];
} else if (args[i] == "-export_debug") {
editor = true; //needs editor
- _export_platform = args[i + 1];
+ _export_preset = args[i + 1];
export_debug = true;
} else if (args[i] == "-import") {
editor = true; //needs editor
@@ -1137,7 +1137,7 @@ bool Main::start() {
#endif
- if (_export_platform != "") {
+ if (_export_preset != "") {
if (game_path == "") {
String err = "Command line param ";
err += export_debug ? "-export_debug" : "-export";
@@ -1244,9 +1244,9 @@ bool Main::start() {
//root_node->set_editor(editor);
//startup editor
- if (_export_platform != "") {
+ if (_export_preset != "") {
- editor_node->export_platform(_export_platform, game_path, export_debug, "", true);
+ editor_node->export_preset(_export_preset, game_path, export_debug, "", true);
game_path = ""; //no load anything
}
}
@@ -1276,6 +1276,8 @@ bool Main::start() {
sml_aspect = SceneTree::STRETCH_ASPECT_KEEP_WIDTH;
else if (stretch_aspect == "keep_height")
sml_aspect = SceneTree::STRETCH_ASPECT_KEEP_HEIGHT;
+ else if (stretch_aspect == "expand")
+ sml_aspect = SceneTree::STRETCH_ASPECT_EXPAND;
sml->set_screen_stretch(sml_sm, sml_aspect, stretch_size, stretch_shrink);
@@ -1303,7 +1305,7 @@ bool Main::start() {
GLOBAL_DEF("display/window/stretch/mode", "disabled");
ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/mode", PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport"));
GLOBAL_DEF("display/window/stretch/aspect", "ignore");
- ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/aspect", PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height"));
+ ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/aspect", PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height,expand"));
GLOBAL_DEF("display/window/stretch/shrink", 1);
ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/shrink", PropertyInfo(Variant::STRING, "display/window/stretch/shrink", PROPERTY_HINT_RANGE, "1,8,1"));
sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true));
@@ -1465,6 +1467,7 @@ bool Main::start() {
String iconpath = GLOBAL_DEF("application/config/icon", "Variant()");
if (iconpath != "") {
Ref<Image> icon;
+ icon.instance();
if (icon->load(iconpath) == OK)
OS::get_singleton()->set_icon(icon);
}
diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp
index 95147d8467..0607360d88 100644
--- a/main/tests/test_gdscript.cpp
+++ b/main/tests/test_gdscript.cpp
@@ -911,7 +911,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
}
}
-MainLoop *test(TestType p_test) {
+MainLoop *test(TestType p_type) {
List<String> cmdlargs = OS::get_singleton()->get_cmdline_args();
@@ -950,7 +950,7 @@ MainLoop *test(TestType p_test) {
}
}
- if (p_test == TEST_TOKENIZER) {
+ if (p_type == TEST_TOKENIZER) {
GDTokenizerText tk;
tk.set_code(code);
@@ -993,7 +993,7 @@ MainLoop *test(TestType p_test) {
}
}
- if (p_test == TEST_PARSER) {
+ if (p_type == TEST_PARSER) {
GDParser parser;
Error err = parser.parse(code);
@@ -1010,7 +1010,7 @@ MainLoop *test(TestType p_test) {
_parser_show_class(cnode, 0, lines);
}
- if (p_test == TEST_COMPILER) {
+ if (p_type == TEST_COMPILER) {
GDParser parser;
@@ -1044,7 +1044,7 @@ MainLoop *test(TestType p_test) {
current = current->get_base();
}
- } else if (p_test == TEST_BYTECODE) {
+ } else if (p_type == TEST_BYTECODE) {
Vector<uint8_t> buf = GDTokenizerBuffer::parse_code_string(code);
String dst = test.get_basename() + ".gdc";
@@ -1073,7 +1073,7 @@ MainLoop *test(TestType p_test) {
namespace TestGDScript {
-MainLoop *test(TestType p_test) {
+MainLoop *test(TestType p_type) {
return NULL;
}
diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp
index 3c6a708cd8..44d4464aac 100644
--- a/main/tests/test_gui.cpp
+++ b/main/tests/test_gui.cpp
@@ -278,7 +278,7 @@ public:
richtext->set_position(Point2(600, 210));
richtext->set_size(Point2(180, 250));
- richtext->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, 20);
+ richtext->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -20);
frame->add_child(richtext);
@@ -319,8 +319,6 @@ public:
///richtext->add_text("Hello!\n");
//richtext->pop();
- richtext->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
-
TabContainer *tabc = memnew(TabContainer);
Control *ctl = memnew(Control);
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index 8b971adf55..f2c3b838e4 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -113,7 +113,7 @@ public:
virtual int get_packet_peer() const;
- Error create_server(int p_port, int p_max_peers = 32, int p_in_bandwidth = 0, int p_out_bandwidth = 0);
+ Error create_server(int p_port, int p_max_clients = 32, int p_in_bandwidth = 0, int p_out_bandwidth = 0);
Error create_client(const IP_Address &p_ip, int p_port, int p_in_bandwidth = 0, int p_out_bandwidth = 0);
void close_connection();
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
index 353bd1274a..ccc1733c43 100644
--- a/modules/etc/image_etc.cpp
+++ b/modules/etc/image_etc.cpp
@@ -118,7 +118,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
}
int imgw = p_img->get_width(), imgh = p_img->get_height();
- ERR_FAIL_COND(nearest_power_of_2(imgw) != imgw || nearest_power_of_2(imgh) != imgh);
+ ERR_FAIL_COND(next_power_of_2(imgw) != imgw || next_power_of_2(imgh) != imgh);
Image::Format etc_format = force_etc1_format ? Image::FORMAT_ETC : _get_etc2_mode(detected_channels);
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index b03866f432..003ec46a25 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -137,7 +137,7 @@ public:
bool initialize();
bool terminate();
- Variant call_native(StringName p_call_type, StringName p_procedure_name, Array p_arguments = Array());
+ Variant call_native(StringName p_native_call_type, StringName p_procedure_name, Array p_arguments = Array());
void call_native_raw(StringName p_raw_call_type, StringName p_procedure_name, void *data, int num_args, void **args, void *r_return);
};
diff --git a/modules/gdnative/godot/dictionary.cpp b/modules/gdnative/godot/dictionary.cpp
index b92c8125bb..c538456432 100644
--- a/modules/gdnative/godot/dictionary.cpp
+++ b/modules/gdnative/godot/dictionary.cpp
@@ -30,7 +30,7 @@
#include <godot/dictionary.h>
#include "core/variant.h"
-
+// core/variant.h before to avoid compile errors with MSVC
#include "core/dictionary.h"
#include "core/io/json.h"
diff --git a/modules/gdnative/godot/string.cpp b/modules/gdnative/godot/string.cpp
index 76cf1fba12..2235c12a2d 100644
--- a/modules/gdnative/godot/string.cpp
+++ b/modules/gdnative/godot/string.cpp
@@ -63,13 +63,13 @@ void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *p_
memnew_placement(dest, String(p_contents, p_size));
}
-void GDAPI godot_string_get_data(const godot_string *p_self, char *r_dest, int *p_size) {
+void GDAPI godot_string_get_data(const godot_string *p_self, char *p_dest, int *p_size) {
String *self = (String *)p_self;
if (p_size != NULL) {
*p_size = self->utf8().length();
}
- if (r_dest != NULL) {
- memcpy(r_dest, self->utf8().get_data(), *p_size);
+ if (p_dest != NULL) {
+ memcpy(p_dest, self->utf8().get_data(), *p_size);
}
}
@@ -277,11 +277,11 @@ godot_int GDAPI godot_string_hex_to_int_without_prefix(const godot_string *p_sel
return self->hex_to_int(true);
}
-godot_string GDAPI godot_string_insert(const godot_string *p_self, godot_int at_pos, godot_string p_content) {
+godot_string GDAPI godot_string_insert(const godot_string *p_self, godot_int p_at_pos, godot_string p_string) {
const String *self = (const String *)p_self;
- String *content = (String *)&p_content;
+ String *content = (String *)&p_string;
godot_string result;
- memnew_placement(&result, String(self->insert(at_pos, *content)));
+ memnew_placement(&result, String(self->insert(p_at_pos, *content)));
return result;
}
diff --git a/modules/gdnative/godot/string.h b/modules/gdnative/godot/string.h
index bfe66aa5ec..7695cd7931 100644
--- a/modules/gdnative/godot/string.h
+++ b/modules/gdnative/godot/string.h
@@ -83,8 +83,8 @@ godot_int GDAPI godot_string_findmk_from_in_place(const godot_string *p_self, co
godot_int GDAPI godot_string_findn(const godot_string *p_self, godot_string p_what);
godot_int GDAPI godot_string_findn_from(const godot_string *p_self, godot_string p_what, godot_int p_from);
godot_int GDAPI find_last(const godot_string *p_self, godot_string p_what);
-godot_string GDAPI godot_string_format(const godot_string *p_self, const godot_variant *values);
-godot_string GDAPI godot_string_format_with_custom_placeholder(const godot_string *p_self, const godot_variant *values, const char *placeholder);
+godot_string GDAPI godot_string_format(const godot_string *p_self, const godot_variant *p_values);
+godot_string GDAPI godot_string_format_with_custom_placeholder(const godot_string *p_self, const godot_variant *p_values, const char *p_placeholder);
godot_string GDAPI godot_string_hex_encode_buffer(const uint8_t *p_buffer, godot_int p_len);
godot_int GDAPI godot_string_hex_to_int(const godot_string *p_self);
godot_int GDAPI godot_string_hex_to_int_without_prefix(const godot_string *p_self);
@@ -172,7 +172,7 @@ void GDAPI godot_string_utf8(godot_string *p_self, char *result);
godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8);
godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len);
godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8);
-godot_string GDAPI godot_string_chars_utf8_with_len(const char *p_utf8, godot_int p_len);
+godot_string GDAPI godot_string_chars_to_utf8_with_len(const char *p_utf8, godot_int p_len);
uint32_t GDAPI godot_string_hash(const godot_string *p_self);
uint64_t GDAPI godot_string_hash64(const godot_string *p_self);
diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp
index cafcc1e965..13a7480a36 100644
--- a/modules/gdscript/gd_function.cpp
+++ b/modules/gdscript/gd_function.cpp
@@ -1233,10 +1233,10 @@ int GDFunction::get_default_argument_count() const {
return default_arguments.size();
}
-int GDFunction::get_default_argument_addr(int p_arg) const {
+int GDFunction::get_default_argument_addr(int p_idx) const {
- ERR_FAIL_INDEX_V(p_arg, default_arguments.size(), -1);
- return default_arguments[p_arg];
+ ERR_FAIL_INDEX_V(p_idx, default_arguments.size(), -1);
+ return default_arguments[p_idx];
}
StringName GDFunction::get_name() const {
diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp
index 209bdadd67..094dd287e6 100644
--- a/modules/gdscript/gd_functions.cpp
+++ b/modules/gdscript/gd_functions.cpp
@@ -446,7 +446,7 @@ void GDFunctions::call(Function p_func, const Variant **p_args, int p_arg_count,
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
int64_t num = *p_args[0];
- r_ret = nearest_power_of_2(num);
+ r_ret = next_power_of_2(num);
} break;
case OBJ_WEAKREF: {
VALIDATE_ARG_COUNT(1);
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 9d304c6d34..2d06c0f5d2 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -615,7 +615,7 @@ Error GDScript::reload(bool p_keep_state) {
if (basedir != "")
basedir = basedir.get_base_dir();
- if (basedir.find("res://") == -1 && basedir.find("user://") == -1) {
+ if (basedir != "" && basedir.find("res://") == -1 && basedir.find("user://") == -1) {
//loading a template, don't parse
return OK;
}
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index f241a96e58..1205776882 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -1049,21 +1049,21 @@ void GridMap::_update_area_instances() {
}
}
-Error GridMap::create_area(int p_id, const Rect3 &p_bounds) {
+Error GridMap::create_area(int p_id, const Rect3 &p_area) {
ERR_FAIL_COND_V(area_map.has(p_id), ERR_ALREADY_EXISTS);
ERR_EXPLAIN("ID 0 is taken as global area, start from 1");
ERR_FAIL_COND_V(p_id == 0, ERR_INVALID_PARAMETER);
- ERR_FAIL_COND_V(p_bounds.has_no_area(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_area.has_no_area(), ERR_INVALID_PARAMETER);
// FIRST VALIDATE AREA
IndexKey from, to;
- from.x = p_bounds.position.x;
- from.y = p_bounds.position.y;
- from.z = p_bounds.position.z;
- to.x = p_bounds.position.x + p_bounds.size.x;
- to.y = p_bounds.position.y + p_bounds.size.y;
- to.z = p_bounds.position.z + p_bounds.size.z;
+ from.x = p_area.position.x;
+ from.y = p_area.position.y;
+ from.z = p_area.position.z;
+ to.x = p_area.position.x + p_area.size.x;
+ to.y = p_area.position.y + p_area.size.y;
+ to.z = p_area.position.z + p_area.size.z;
for (Map<int, Area *>::Element *E = area_map.front(); E; E = E->next()) {
//this should somehow be faster...
diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h
index c386e4f66b..106bf82dc2 100644
--- a/modules/gridmap/grid_map.h
+++ b/modules/gridmap/grid_map.h
@@ -242,7 +242,7 @@ public:
void set_center_z(bool p_enable);
bool get_center_z() const;
- void set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_orientation = 0);
+ void set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_rot = 0);
int get_cell_item(int p_x, int p_y, int p_z) const;
int get_cell_item_orientation(int p_x, int p_y, int p_z) const;
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 954e865bcd..7bb80c2510 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -1203,7 +1203,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
edit_mode = memnew(OptionButton);
edit_mode->set_area_as_parent_rect();
edit_mode->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 24);
- edit_mode->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 14);
+ edit_mode->set_margin(MARGIN_RIGHT, -14);
edit_mode->add_item("Tiles");
edit_mode->add_item("Areas");
hb->add_child(edit_mode);
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 1572f4fbe5..a1b2c96ccd 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -239,8 +239,8 @@ public:
virtual bool forward_spatial_input_event(Camera *p_camera, const Ref<InputEvent> &p_event) { return gridmap_editor->forward_spatial_input_event(p_camera, p_event); }
virtual String get_name() const { return "GridMap"; }
bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
GridMapEditorPlugin(EditorNode *p_node);
diff --git a/modules/nativescript/nativescript.h b/modules/nativescript/nativescript.h
index c60effd0c1..b62fefec40 100644
--- a/modules/nativescript/nativescript.h
+++ b/modules/nativescript/nativescript.h
@@ -120,7 +120,7 @@ public:
void set_class_name(String p_class_name);
String get_class_name() const;
- void set_library(Ref<GDNativeLibrary> library);
+ void set_library(Ref<GDNativeLibrary> p_library);
Ref<GDNativeLibrary> get_library() const;
virtual bool can_instance() const;
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index fd4ae9fc5a..b4bdbe16b4 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -1578,12 +1578,15 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
VisualScriptNodeInstance::StartMode start_mode;
{
- if (p_resuming_yield)
+ if (p_resuming_yield) {
start_mode = VisualScriptNodeInstance::START_MODE_RESUME_YIELD;
- else if (!flow_stack || !(flow_stack[flow_stack_pos] & VisualScriptNodeInstance::FLOW_STACK_PUSHED_BIT)) //if there is a push bit, it means we are continuing a sequence
- start_mode = VisualScriptNodeInstance::START_MODE_BEGIN_SEQUENCE;
- else
+ p_resuming_yield = false; // should resume only the first time
+ } else if (flow_stack && (flow_stack[flow_stack_pos] & VisualScriptNodeInstance::FLOW_STACK_PUSHED_BIT)) {
+ //if there is a push bit, it means we are continuing a sequence
start_mode = VisualScriptNodeInstance::START_MODE_CONTINUE_SEQUENCE;
+ } else {
+ start_mode = VisualScriptNodeInstance::START_MODE_BEGIN_SEQUENCE;
+ }
}
VSDEBUG("STEP - STARTSEQ: " + itos(start_mode));
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 63ac5769c6..b61b67a890 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -291,8 +291,8 @@ public:
void data_disconnect(const StringName &p_func, int p_from_node, int p_from_port, int p_to_node, int p_to_port);
bool has_data_connection(const StringName &p_func, int p_from_node, int p_from_port, int p_to_node, int p_to_port) const;
void get_data_connection_list(const StringName &p_func, List<DataConnection> *r_connection) const;
- bool is_input_value_port_connected(const StringName &p_name, int p_node, int p_port) const;
- bool get_input_value_port_connection_source(const StringName &p_name, int p_node, int p_port, int *r_node, int *r_port) const;
+ bool is_input_value_port_connected(const StringName &p_func, int p_node, int p_port) const;
+ bool get_input_value_port_connection_source(const StringName &p_func, int p_node, int p_port, int *r_node, int *r_port) const;
void add_variable(const StringName &p_name, const Variant &p_default_value = Variant(), bool p_export = false);
bool has_variable(const StringName &p_name) const;
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 203e0bb483..9cbd70d4ca 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -915,7 +915,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
VALIDATE_ARG_NUM(0);
int64_t num = *p_inputs[0];
- *r_return = nearest_power_of_2(num);
+ *r_return = next_power_of_2(num);
} break;
case VisualScriptBuiltinFunc::OBJ_WEAKREF: {
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 8912227692..b9e7a6ffc4 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -886,6 +886,8 @@ void VisualScriptEditor::_member_edited() {
undo_redo->add_undo_method(this, "_update_members");
undo_redo->add_do_method(this, "_update_graph");
undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->add_do_method(this, "emit_signal", "script_changed");
+ undo_redo->add_undo_method(this, "emit_signal", "script_changed");
undo_redo->commit_action();
// _update_graph();
@@ -901,6 +903,8 @@ void VisualScriptEditor::_member_edited() {
undo_redo->add_undo_method(script.ptr(), "rename_variable", new_name, name);
undo_redo->add_do_method(this, "_update_members");
undo_redo->add_undo_method(this, "_update_members");
+ undo_redo->add_do_method(this, "emit_signal", "script_changed");
+ undo_redo->add_undo_method(this, "emit_signal", "script_changed");
undo_redo->commit_action();
return; //or crash because it will become invalid
@@ -914,6 +918,8 @@ void VisualScriptEditor::_member_edited() {
undo_redo->add_undo_method(script.ptr(), "rename_custom_signal", new_name, name);
undo_redo->add_do_method(this, "_update_members");
undo_redo->add_undo_method(this, "_update_members");
+ undo_redo->add_do_method(this, "emit_signal", "script_changed");
+ undo_redo->add_undo_method(this, "emit_signal", "script_changed");
undo_redo->commit_action();
return; //or crash because it will become invalid
@@ -1051,7 +1057,8 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt
undo_redo->add_undo_method(this, "_update_members");
undo_redo->add_do_method(this, "_update_graph");
undo_redo->add_undo_method(this, "_update_graph");
-
+ undo_redo->add_do_method(this, "emit_signal", "script_changed");
+ undo_redo->add_undo_method(this, "emit_signal", "script_changed");
undo_redo->commit_action();
_update_graph();
@@ -1070,6 +1077,8 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt
undo_redo->add_undo_method(script.ptr(), "remove_variable", name);
undo_redo->add_do_method(this, "_update_members");
undo_redo->add_undo_method(this, "_update_members");
+ undo_redo->add_do_method(this, "emit_signal", "script_changed");
+ undo_redo->add_undo_method(this, "emit_signal", "script_changed");
undo_redo->commit_action();
return; //or crash because it will become invalid
}
@@ -1084,6 +1093,8 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt
undo_redo->add_undo_method(script.ptr(), "remove_custom_signal", name);
undo_redo->add_do_method(this, "_update_members");
undo_redo->add_undo_method(this, "_update_members");
+ undo_redo->add_do_method(this, "emit_signal", "script_changed");
+ undo_redo->add_undo_method(this, "emit_signal", "script_changed");
undo_redo->commit_action();
return; //or crash because it will become invalid
}
@@ -2450,17 +2461,17 @@ void VisualScriptEditor::_graph_connect_to_empty(const String &p_from, int p_fro
port_action_popup->popup();
}
-VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_node, int p_output, Set<int> &visited_nodes) {
+VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_port_action_node, int p_port_action_output, Set<int> &visited_nodes) {
VisualScriptNode::TypeGuess tg;
tg.type = Variant::NIL;
- if (visited_nodes.has(p_node))
+ if (visited_nodes.has(p_port_action_node))
return tg; //no loop
- visited_nodes.insert(p_node);
+ visited_nodes.insert(p_port_action_node);
- Ref<VisualScriptNode> node = script->get_node(edited_func, p_node);
+ Ref<VisualScriptNode> node = script->get_node(edited_func, p_port_action_node);
if (!node.is_valid()) {
@@ -2479,7 +2490,7 @@ VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_node, i
int from_node;
int from_port;
- if (script->get_input_value_port_connection_source(edited_func, p_node, i, &from_node, &from_port)) {
+ if (script->get_input_value_port_connection_source(edited_func, p_port_action_node, i, &from_node, &from_port)) {
g = _guess_output_type(from_node, from_port, visited_nodes);
} else {
@@ -2501,7 +2512,7 @@ VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_node, i
in_guesses.push_back(g);
}
- return node->guess_output_type(in_guesses.ptr(), p_output);
+ return node->guess_output_type(in_guesses.ptr(), p_port_action_output);
}
void VisualScriptEditor::_port_action_menu(int p_option) {
@@ -3223,7 +3234,7 @@ VisualScriptEditor::VisualScriptEditor() {
members->connect("button_pressed", this, "_member_button");
members->connect("item_edited", this, "_member_edited");
members->connect("cell_selected", this, "_member_selected", varray(), CONNECT_DEFERRED);
- members->set_single_select_cell_editing_only_when_already_selected(true);
+ members->set_allow_reselect(true);
members->set_hide_folding(true);
members->set_drag_forwarding(this);
@@ -3268,10 +3279,9 @@ VisualScriptEditor::VisualScriptEditor() {
select_func_text->set_valign(Label::VALIGN_CENTER);
select_func_text->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(select_func_text);
- graph->set_area_as_parent_rect();
hint_text = memnew(Label);
- hint_text->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, 100);
+ hint_text->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -100);
hint_text->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
hint_text->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
hint_text->set_align(Label::ALIGN_CENTER);
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 7992a4e803..e94bb8fba5 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -341,12 +341,12 @@ String VisualScriptFunctionCall::get_base_script() const {
return base_script;
}
-void VisualScriptFunctionCall::set_singleton(const StringName &p_path) {
+void VisualScriptFunctionCall::set_singleton(const StringName &p_type) {
- if (singleton == p_path)
+ if (singleton == p_type)
return;
- singleton = p_path;
+ singleton = p_type;
Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
if (obj) {
base_type = obj->get_class();
diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h
index 7839748661..3b38d0d08f 100644
--- a/modules/visual_script/visual_script_func_nodes.h
+++ b/modules/visual_script/visual_script_func_nodes.h
@@ -70,7 +70,7 @@ private:
MethodInfo method_cache;
void _update_method_cache();
- void _set_argument_cache(const Dictionary &p_args);
+ void _set_argument_cache(const Dictionary &p_cache);
Dictionary _get_argument_cache() const;
protected:
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 923e425997..4f9cd4a33b 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -1208,6 +1208,7 @@ void VisualScriptPreload::set_preload(const Ref<Resource> &p_preload) {
preload = p_preload;
ports_changed_notify();
}
+
Ref<Resource> VisualScriptPreload::get_preload() const {
return preload;
diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h
index ff49417114..6ce906efe0 100644
--- a/modules/visual_script/visual_script_nodes.h
+++ b/modules/visual_script/visual_script_nodes.h
@@ -196,7 +196,7 @@ public:
virtual String get_text() const;
virtual String get_category() const { return "data"; }
- void set_variable(StringName p_var);
+ void set_variable(StringName p_variable);
StringName get_variable() const;
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
@@ -230,7 +230,7 @@ public:
virtual String get_text() const;
virtual String get_category() const { return "data"; }
- void set_variable(StringName p_var);
+ void set_variable(StringName p_variable);
StringName get_variable() const;
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
@@ -301,7 +301,7 @@ public:
virtual String get_text() const;
virtual String get_category() const { return "data"; }
- void set_preload(const Ref<Resource> &p_value);
+ void set_preload(const Ref<Resource> &p_preload);
Ref<Resource> get_preload() const;
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index d293f3ed30..763eff2863 100644
--- a/platform/android/audio_driver_jandroid.cpp
+++ b/platform/android/audio_driver_jandroid.cpp
@@ -81,7 +81,7 @@ Error AudioDriverAndroid::init() {
int latency = GLOBAL_DEF("audio/output_latency", 25);
latency = 50;
- unsigned int buffer_size = nearest_power_of_2(latency * mix_rate / 1000);
+ unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000);
if (OS::get_singleton()->is_stdout_verbose()) {
print_line("audio buffer size: " + itos(buffer_size));
}
diff --git a/platform/android/audio_driver_jandroid.h b/platform/android/audio_driver_jandroid.h
index e2bb5ede86..3697ca6f21 100644
--- a/platform/android/audio_driver_jandroid.h
+++ b/platform/android/audio_driver_jandroid.h
@@ -71,7 +71,7 @@ public:
virtual void set_pause(bool p_pause);
- static void setup(jobject act);
+ static void setup(jobject p_io);
static void thread_func(JNIEnv *env);
AudioDriverAndroid();
diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h
index 0175595543..21d1f697b7 100644
--- a/platform/android/dir_access_jandroid.h
+++ b/platform/android/dir_access_jandroid.h
@@ -79,7 +79,7 @@ public:
//virtual FileType get_file_type() const;
size_t get_space_left();
- static void setup(jobject io);
+ static void setup(jobject p_io);
DirAccessJAndroid();
~DirAccessJAndroid();
diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h
index 9bb471246a..a04f28d0d7 100644
--- a/platform/android/file_access_jandroid.h
+++ b/platform/android/file_access_jandroid.h
@@ -71,7 +71,7 @@ public:
virtual bool file_exists(const String &p_path); ///< return true if a file exists
- static void setup(jobject io);
+ static void setup(jobject p_io);
virtual uint64_t _get_modified_time(const String &p_file) { return 0; }
diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp
index 71db03049a..6fbd42d7b3 100644
--- a/platform/android/godot_android.cpp
+++ b/platform/android/godot_android.cpp
@@ -739,21 +739,21 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) {
}
}
-void android_main(struct android_app *state) {
+void android_main(struct android_app *app) {
struct engine engine;
// Make sure glue isn't stripped.
app_dummy();
memset(&engine, 0, sizeof(engine));
- state->userData = &engine;
- state->onAppCmd = engine_handle_cmd;
- state->onInputEvent = engine_handle_input;
- engine.app = state;
+ app->userData = &engine;
+ app->onAppCmd = engine_handle_cmd;
+ app->onInputEvent = engine_handle_input;
+ engine.app = app;
engine.requested_quit = false;
engine.os = NULL;
engine.display_active = false;
- FileAccessAndroid::asset_manager = state->activity->assetManager;
+ FileAccessAndroid::asset_manager = app->activity->assetManager;
// Prepare to monitor sensors
engine.sensorManager = ASensorManager_getInstance();
@@ -764,11 +764,11 @@ void android_main(struct android_app *state) {
engine.gyroscopeSensor = ASensorManager_getDefaultSensor(engine.sensorManager,
ASENSOR_TYPE_GYROSCOPE);
engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager,
- state->looper, LOOPER_ID_USER, NULL, NULL);
+ app->looper, LOOPER_ID_USER, NULL, NULL);
- ANativeActivity_setWindowFlags(state->activity, AWINDOW_FLAG_FULLSCREEN | AWINDOW_FLAG_KEEP_SCREEN_ON, 0);
+ ANativeActivity_setWindowFlags(app->activity, AWINDOW_FLAG_FULLSCREEN | AWINDOW_FLAG_KEEP_SCREEN_ON, 0);
- state->activity->vm->AttachCurrentThread(&engine.jni, NULL);
+ app->activity->vm->AttachCurrentThread(&engine.jni, NULL);
// loop waiting for stuff to do.
@@ -790,7 +790,7 @@ void android_main(struct android_app *state) {
if (source != NULL) {
// LOGI("process\n");
- source->process(state, source);
+ source->process(app, source);
} else {
nullmax--;
if (nullmax < 0)
@@ -824,11 +824,11 @@ void android_main(struct android_app *state) {
}
// Check if we are exiting.
- if (state->destroyRequested != 0) {
+ if (app->destroyRequested != 0) {
if (engine.os) {
engine.os->main_loop_request_quit();
}
- state->destroyRequested = 0;
+ app->destroyRequested = 0;
}
if (engine.requested_quit) {
diff --git a/platform/android/java_glue.h b/platform/android/java_glue.h
index f400f41e28..bcb3304c3e 100644
--- a/platform/android/java_glue.h
+++ b/platform/android/java_glue.h
@@ -56,8 +56,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env,
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv *env, jobject obj, jstring name, jobject p_object);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_method(JNIEnv *env, jobject obj, jstring sname, jstring name, jstring ret, jobjectArray args);
JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *env, jobject obj, jstring path);
-JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *env, jobject obj, jint ID, jstring method, jobjectArray params);
-JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jobject obj, jint ID, jstring method, jobjectArray params);
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *env, jobject p_obj, jint ID, jstring method, jobjectArray params);
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jobject p_obj, jint ID, jstring method, jobjectArray params);
}
#endif
diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp
index 93351e0799..802f6b2d32 100644
--- a/platform/haiku/audio_driver_media_kit.cpp
+++ b/platform/haiku/audio_driver_media_kit.cpp
@@ -43,7 +43,7 @@ Error AudioDriverMediaKit::init() {
channels = 2;
int latency = GLOBAL_DEF("audio/output_latency", 25);
- buffer_size = nearest_power_of_2(latency * mix_rate / 1000);
+ buffer_size = next_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_size * channels);
media_raw_audio_format format;
diff --git a/platform/osx/audio_driver_osx.cpp b/platform/osx/audio_driver_osx.cpp
index d7a91b1653..da5cd8f65e 100644
--- a/platform/osx/audio_driver_osx.cpp
+++ b/platform/osx/audio_driver_osx.cpp
@@ -30,6 +30,10 @@
#ifdef OSX_ENABLED
#include "audio_driver_osx.h"
+#include "core/project_settings.h"
+#include "os/os.h"
+
+#define kOutputBus 0
static OSStatus outputDeviceAddressCB(AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *__nullable inClientData) {
AudioDriverOSX *driver = (AudioDriverOSX *)inClientData;
@@ -40,42 +44,69 @@ static OSStatus outputDeviceAddressCB(AudioObjectID inObjectID, UInt32 inNumberA
}
Error AudioDriverOSX::initDevice() {
+ AudioComponentDescription desc;
+ zeromem(&desc, sizeof(desc));
+ desc.componentType = kAudioUnitType_Output;
+ desc.componentSubType = kAudioUnitSubType_HALOutput;
+ desc.componentManufacturer = kAudioUnitManufacturer_Apple;
+
+ AudioComponent comp = AudioComponentFindNext(NULL, &desc);
+ ERR_FAIL_COND_V(comp == NULL, FAILED);
+
+ OSStatus result = AudioComponentInstanceNew(comp, &audio_unit);
+ ERR_FAIL_COND_V(result != noErr, FAILED);
+
AudioStreamBasicDescription strdesc;
+
+ // TODO: Implement this
+ /*zeromem(&strdesc, sizeof(strdesc));
+ UInt32 size = sizeof(strdesc);
+ result = AudioUnitGetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kOutputBus, &strdesc, &size);
+ ERR_FAIL_COND_V(result != noErr, FAILED);
+
+ switch (strdesc.mChannelsPerFrame) {
+ case 2: // Stereo
+ case 6: // Surround 5.1
+ case 8: // Surround 7.1
+ channels = strdesc.mChannelsPerFrame;
+ break;
+
+ default:
+ // Unknown number of channels, default to stereo
+ channels = 2;
+ break;
+ }*/
+
+ mix_rate = GLOBAL_DEF("audio/mix_rate", 44100);
+
+ zeromem(&strdesc, sizeof(strdesc));
strdesc.mFormatID = kAudioFormatLinearPCM;
strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
strdesc.mChannelsPerFrame = channels;
- strdesc.mSampleRate = 44100;
+ strdesc.mSampleRate = mix_rate;
strdesc.mFramesPerPacket = 1;
strdesc.mBitsPerChannel = 16;
strdesc.mBytesPerFrame = strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
strdesc.mBytesPerPacket = strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
- OSStatus result;
- AURenderCallbackStruct callback;
- AudioComponentDescription desc;
- AudioComponent comp = NULL;
- const AudioUnitElement output_bus = 0;
- const AudioUnitElement bus = output_bus;
- const AudioUnitScope scope = kAudioUnitScope_Input;
-
- zeromem(&desc, sizeof(desc));
- desc.componentType = kAudioUnitType_Output;
- desc.componentSubType = kAudioUnitSubType_HALOutput;
- desc.componentManufacturer = kAudioUnitManufacturer_Apple;
+ result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &strdesc, sizeof(strdesc));
+ ERR_FAIL_COND_V(result != noErr, FAILED);
- comp = AudioComponentFindNext(NULL, &desc);
- ERR_FAIL_COND_V(comp == NULL, FAILED);
+ int latency = GLOBAL_DEF("audio/output_latency", 25);
+ unsigned int buffer_size = closest_power_of_2(latency * mix_rate / 1000);
- result = AudioComponentInstanceNew(comp, &audio_unit);
- ERR_FAIL_COND_V(result != noErr, FAILED);
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ print_line("audio buffer size: " + itos(buffer_size) + " calculated latency: " + itos(buffer_size * 1000 / mix_rate));
+ }
- result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_StreamFormat, scope, bus, &strdesc, sizeof(strdesc));
- ERR_FAIL_COND_V(result != noErr, FAILED);
+ samples_in.resize(buffer_size);
+ buffer_frames = buffer_size / channels;
+ AURenderCallbackStruct callback;
zeromem(&callback, sizeof(AURenderCallbackStruct));
callback.inputProc = &AudioDriverOSX::output_callback;
callback.inputProcRefCon = this;
- result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, scope, bus, &callback, sizeof(callback));
+ result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
ERR_FAIL_COND_V(result != noErr, FAILED);
result = AudioUnitInitialize(audio_unit);
@@ -114,15 +145,10 @@ Error AudioDriverOSX::init() {
result = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this);
ERR_FAIL_COND_V(result != noErr, FAILED);
- const int samples = 1024;
- samples_in = memnew_arr(int32_t, samples); // whatever
- buffer_frames = samples / channels;
-
return initDevice();
};
Error AudioDriverOSX::reopen() {
- Error err;
bool restart = false;
lock();
@@ -131,7 +157,7 @@ Error AudioDriverOSX::reopen() {
restart = true;
}
- err = finishDevice();
+ Error err = finishDevice();
if (err != OK) {
ERR_PRINT("finishDevice failed");
unlock();
@@ -179,7 +205,7 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon,
while (frames_left) {
int frames = MIN(frames_left, ad->buffer_frames);
- ad->audio_server_process(frames, ad->samples_in);
+ ad->audio_server_process(frames, ad->samples_in.ptr());
for (int j = 0; j < frames * ad->channels; j++) {
@@ -232,29 +258,33 @@ bool AudioDriverOSX::try_lock() {
}
void AudioDriverOSX::finish() {
- OSStatus result;
-
finishDevice();
- result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this);
+ OSStatus result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this);
if (result != noErr) {
ERR_PRINT("AudioObjectRemovePropertyListener failed");
}
+ AURenderCallbackStruct callback;
+ zeromem(&callback, sizeof(AURenderCallbackStruct));
+ result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
+ if (result != noErr) {
+ ERR_PRINT("AudioUnitSetProperty failed");
+ }
+
if (mutex) {
memdelete(mutex);
mutex = NULL;
}
-
- if (samples_in) {
- memdelete_arr(samples_in);
- samples_in = NULL;
- }
};
AudioDriverOSX::AudioDriverOSX() {
+ active = false;
mutex = NULL;
- samples_in = NULL;
+
+ mix_rate = 44100;
+ channels = 2;
+ samples_in.clear();
};
AudioDriverOSX::~AudioDriverOSX(){};
diff --git a/platform/osx/audio_driver_osx.h b/platform/osx/audio_driver_osx.h
index 287c9d6cbf..4576100690 100644
--- a/platform/osx/audio_driver_osx.h
+++ b/platform/osx/audio_driver_osx.h
@@ -44,10 +44,12 @@ class AudioDriverOSX : public AudioDriver {
bool active;
Mutex *mutex;
+ int mix_rate;
int channels;
- int32_t *samples_in;
int buffer_frames;
+ Vector<int32_t> samples_in;
+
static OSStatus output_callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index a1aa58a5e7..39717196aa 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -171,7 +171,7 @@ class AppxPackager {
}
Vector<uint8_t> make_file_header(FileMeta p_file_meta);
- void store_central_dir_header(const FileMeta p_file, bool p_do_hash = true);
+ void store_central_dir_header(const FileMeta &p_file, bool p_do_hash = true);
Vector<uint8_t> make_end_of_central_record();
String content_type(String p_extension);
@@ -329,7 +329,7 @@ Vector<uint8_t> AppxPackager::make_file_header(FileMeta p_file_meta) {
return buf;
}
-void AppxPackager::store_central_dir_header(const FileMeta p_file, bool p_do_hash) {
+void AppxPackager::store_central_dir_header(const FileMeta &p_file, bool p_do_hash) {
Vector<uint8_t> &buf = central_dir_data;
int offs = buf.size();
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 4d93b3f244..882e1a808e 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -14,69 +14,56 @@ def get_name():
def can_build():
if (os.name == "nt"):
- # building natively on windows!
- if (os.getenv("VCINSTALLDIR")):
+ # Building natively on Windows
+ if (os.getenv("VCINSTALLDIR")): # MSVC
return True
- else:
- print("\nMSVC not detected, attempting MinGW.")
- mingw32 = ""
- mingw64 = ""
- if (os.getenv("MINGW32_PREFIX")):
- mingw32 = os.getenv("MINGW32_PREFIX")
- if (os.getenv("MINGW64_PREFIX")):
- mingw64 = os.getenv("MINGW64_PREFIX")
-
- test = "gcc --version > NUL 2>&1"
- if os.system(test) != 0 and os.system(mingw32 + test) != 0 and os.system(mingw64 + test) != 0:
- print("- could not detect gcc.")
- print("Please, make sure a path to a MinGW /bin directory is accessible into the environment PATH.\n")
- return False
- else:
- print("- gcc detected.")
+ print("MSVC not detected (no VCINSTALLDIR environment variable), attempting MinGW.")
+ mingw32 = ""
+ mingw64 = ""
+ if (os.getenv("MINGW32_PREFIX")):
+ mingw32 = os.getenv("MINGW32_PREFIX")
+ if (os.getenv("MINGW64_PREFIX")):
+ mingw64 = os.getenv("MINGW64_PREFIX")
+
+ test = "gcc --version > NUL 2>&1"
+ if (os.system(test) == 0 or os.system(mingw32 + test) == 0 or os.system(mingw64 + test) == 0):
return True
if (os.name == "posix"):
-
- mingw = "i586-mingw32msvc-"
- mingw64 = "x86_64-w64-mingw32-"
+ # Cross-compiling with MinGW-w64 (old MinGW32 is not supported)
mingw32 = "i686-w64-mingw32-"
+ mingw64 = "x86_64-w64-mingw32-"
if (os.getenv("MINGW32_PREFIX")):
mingw32 = os.getenv("MINGW32_PREFIX")
- mingw = mingw32
if (os.getenv("MINGW64_PREFIX")):
mingw64 = os.getenv("MINGW64_PREFIX")
test = "gcc --version > /dev/null 2>&1"
- if (os.system(mingw + test) == 0 or os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0):
+ if (os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0):
return True
+ print("Could not detect MinGW. Ensure its binaries are in your PATH or that MINGW32_PREFIX or MINGW64_PREFIX are properly defined.")
return False
def get_opts():
- mingw = ""
mingw32 = ""
mingw64 = ""
if (os.name == "posix"):
- mingw = "i586-mingw32msvc-"
mingw32 = "i686-w64-mingw32-"
mingw64 = "x86_64-w64-mingw32-"
- if os.system(mingw32 + "gcc --version > /dev/null 2>&1") != 0:
- mingw32 = mingw
-
if (os.getenv("MINGW32_PREFIX")):
mingw32 = os.getenv("MINGW32_PREFIX")
- mingw = mingw32
if (os.getenv("MINGW64_PREFIX")):
mingw64 = os.getenv("MINGW64_PREFIX")
return [
- ('mingw_prefix', 'MinGW Prefix', mingw32),
- ('mingw_prefix_64', 'MinGW Prefix 64 bits', mingw64),
+ ('mingw_prefix_32', 'MinGW prefix (Win32)', mingw32),
+ ('mingw_prefix_64', 'MinGW prefix (Win64)', mingw64),
]
@@ -88,12 +75,10 @@ def get_flags():
def build_res_file(target, source, env):
- cmdbase = ""
if (env["bits"] == "32"):
- cmdbase = env['mingw_prefix']
+ cmdbase = env['mingw_prefix_32']
else:
cmdbase = env['mingw_prefix_64']
- CPPPATH = env['CPPPATH']
cmdbase = cmdbase + 'windres --include-dir . '
import subprocess
for x in range(len(source)):
@@ -111,8 +96,10 @@ def configure(env):
env.Append(CPPPATH=['#platform/windows'])
- # Targeted Windows version: Vista (and later)
- winver = "0x0600" # Windows Vista is the minimum target for windows builds
+ # Targeted Windows version: 7 (and later), minimum supported version
+ # XP support dropped after EOL due to missing API for IPv6 and other issues
+ # Vista support dropped after EOL due to GH-10243
+ winver = "0x0601"
if (os.name == "nt" and os.getenv("VCINSTALLDIR")): # MSVC
@@ -247,7 +234,7 @@ def configure(env):
env.Append(LINKFLAGS=['-static'])
env.Append(LINKFLAGS=['-static-libgcc'])
env.Append(LINKFLAGS=['-static-libstdc++'])
- mingw_prefix = env["mingw_prefix"]
+ mingw_prefix = env["mingw_prefix_32"]
else:
env.Append(LINKFLAGS=['-static'])
mingw_prefix = env["mingw_prefix_64"]
diff --git a/platform/windows/joypad.cpp b/platform/windows/joypad.cpp
index 7263e89c1a..e8a5084daf 100644
--- a/platform/windows/joypad.cpp
+++ b/platform/windows/joypad.cpp
@@ -235,13 +235,13 @@ void JoypadWindows::setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_
}
}
-BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE *instance, void *pContext) {
+BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE *p_instance, void *p_context) {
- JoypadWindows *self = (JoypadWindows *)pContext;
- if (self->is_xinput_device(&instance->guidProduct)) {
+ JoypadWindows *self = (JoypadWindows *)p_context;
+ if (self->is_xinput_device(&p_instance->guidProduct)) {
return DIENUM_CONTINUE;
}
- self->setup_dinput_joypad(instance);
+ self->setup_dinput_joypad(p_instance);
return DIENUM_CONTINUE;
}
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index f72e5ef595..72f6068eb6 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -63,12 +63,11 @@ __attribute__((visibility("default"))) DWORD NvOptimusEnablement = 0x00000001;
#endif
}
-#ifndef WM_MOUSEHWHEEL
-#define WM_MOUSEHWHEEL 0x020e
+// Workaround mingw-w64 < 4.0 bug
+#ifndef WM_TOUCH
+#define WM_TOUCH 576
#endif
-//#define STDOUT_FILE
-
extern HINSTANCE godot_hinstance;
void RedirectIOToConsole() {
@@ -889,23 +888,6 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau
return (dpiX + dpiY) / 2;
}
-BOOL CALLBACK OS_Windows::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
- OS_Windows *self = (OS_Windows *)OS::get_singleton();
- MonitorInfo minfo;
- minfo.hMonitor = hMonitor;
- minfo.hdcMonitor = hdcMonitor;
- minfo.rect.position.x = lprcMonitor->left;
- minfo.rect.position.y = lprcMonitor->top;
- minfo.rect.size.x = lprcMonitor->right - lprcMonitor->left;
- minfo.rect.size.y = lprcMonitor->bottom - lprcMonitor->top;
-
- minfo.dpi = QueryDpiForMonitor(hMonitor);
-
- self->monitor_info.push_back(minfo);
-
- return TRUE;
-}
-
void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
main_loop = NULL;
@@ -941,9 +923,6 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
return; // Return
}
- EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, 0);
-
- print_line("DETECTED MONITORS: " + itos(monitor_info.size()));
pre_fs_valid = true;
if (video_mode.fullscreen) {
@@ -1217,8 +1196,6 @@ void OS_Windows::finalize() {
physics_2d_server->finish();
memdelete(physics_2d_server);
-
- monitor_info.clear();
}
void OS_Windows::finalize_core() {
@@ -1344,51 +1321,131 @@ OS::VideoMode OS_Windows::get_video_mode(int p_screen) const {
void OS_Windows::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
}
+static BOOL CALLBACK _MonitorEnumProcCount(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
+
+ int *data = (int *)dwData;
+ (*data)++;
+ return TRUE;
+}
+
int OS_Windows::get_screen_count() const {
- return monitor_info.size();
+ int data = 0;
+ EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcCount, (LPARAM)&data);
+ return data;
}
-int OS_Windows::get_current_screen() const {
- HMONITOR monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
- for (int i = 0; i < monitor_info.size(); i++) {
- if (monitor_info[i].hMonitor == monitor)
- return i;
+typedef struct {
+ int count;
+ int screen;
+ HMONITOR monitor;
+} EnumScreenData;
+
+static BOOL CALLBACK _MonitorEnumProcScreen(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
+
+ EnumScreenData *data = (EnumScreenData *)dwData;
+ if (data->monitor == hMonitor) {
+ data->screen = data->count;
}
- return 0;
+ data->count++;
+ return TRUE;
}
-void OS_Windows::set_current_screen(int p_screen) {
- ERR_FAIL_INDEX(p_screen, monitor_info.size());
+int OS_Windows::get_current_screen() const {
+
+ EnumScreenData data = { 0, 0, MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST) };
+ EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcScreen, (LPARAM)&data);
+ return data.screen;
+}
+
+void OS_Windows::set_current_screen(int p_screen) {
Vector2 ofs = get_window_position() - get_screen_position(get_current_screen());
set_window_position(ofs + get_screen_position(p_screen));
}
+typedef struct {
+ int count;
+ int screen;
+ Point2 pos;
+} EnumPosData;
+
+static BOOL CALLBACK _MonitorEnumProcPos(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
+
+ EnumPosData *data = (EnumPosData *)dwData;
+ if (data->count == data->screen) {
+ data->pos.x = lprcMonitor->left;
+ data->pos.y = lprcMonitor->top;
+ }
+
+ data->count++;
+ return TRUE;
+}
+
Point2 OS_Windows::get_screen_position(int p_screen) const {
- ERR_FAIL_INDEX_V(p_screen, monitor_info.size(), Point2());
- return Vector2(monitor_info[p_screen].rect.position);
+ EnumPosData data = { 0, p_screen, Point2() };
+ EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcPos, (LPARAM)&data);
+ return data.pos;
}
+
+typedef struct {
+ int count;
+ int screen;
+ Size2 size;
+} EnumSizeData;
+
+static BOOL CALLBACK _MonitorEnumProcSize(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
+
+ EnumSizeData *data = (EnumSizeData *)dwData;
+ if (data->count == data->screen) {
+ data->size.x = lprcMonitor->right - lprcMonitor->left;
+ data->size.y = lprcMonitor->bottom - lprcMonitor->top;
+ }
+
+ data->count++;
+ return TRUE;
+}
+
Size2 OS_Windows::get_screen_size(int p_screen) const {
- ERR_FAIL_INDEX_V(p_screen, monitor_info.size(), Point2());
- return Vector2(monitor_info[p_screen].rect.size);
+ EnumSizeData data = { 0, p_screen, Size2() };
+ EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcSize, (LPARAM)&data);
+ return data.size;
+}
+
+typedef struct {
+ int count;
+ int screen;
+ int dpi;
+} EnumDpiData;
+
+static BOOL CALLBACK _MonitorEnumProcDpi(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
+
+ EnumDpiData *data = (EnumDpiData *)dwData;
+ if (data->count == data->screen) {
+ data->dpi = QueryDpiForMonitor(hMonitor);
+ }
+
+ data->count++;
+ return TRUE;
}
int OS_Windows::get_screen_dpi(int p_screen) const {
- ERR_FAIL_INDEX_V(p_screen, monitor_info.size(), 72);
- UINT dpix, dpiy;
- return monitor_info[p_screen].dpi;
+ EnumDpiData data = { 0, p_screen, 72 };
+ EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcDpi, (LPARAM)&data);
+ return data.dpi;
}
+
Point2 OS_Windows::get_window_position() const {
RECT r;
GetWindowRect(hWnd, &r);
return Point2(r.left, r.top);
}
+
void OS_Windows::set_window_position(const Point2 &p_position) {
if (video_mode.fullscreen) return;
@@ -1571,7 +1628,6 @@ Error OS_Windows::close_dynamic_library(void *p_library_handle) {
}
Error OS_Windows::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional) {
- char *error;
p_symbol_handle = (void *)GetProcAddress((HMODULE)p_library_handle, p_name.utf8().get_data());
if (!p_symbol_handle) {
if (!p_optional) {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index beaf5d5e35..e9af14f11c 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -164,22 +164,12 @@ protected:
};
Map<ProcessID, ProcessInfo> *process_map;
- struct MonitorInfo {
- HMONITOR hMonitor;
- HDC hdcMonitor;
- Rect2 rect;
- int dpi;
- };
-
bool pre_fs_valid;
RECT pre_fs_rect;
- Vector<MonitorInfo> monitor_info;
bool maximized;
bool minimized;
bool borderless;
- static BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
-
public:
LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
diff --git a/platform/windows/packet_peer_udp_winsock.cpp b/platform/windows/packet_peer_udp_winsock.cpp
index f3b91c1b56..3991a90423 100644
--- a/platform/windows/packet_peer_udp_winsock.cpp
+++ b/platform/windows/packet_peer_udp_winsock.cpp
@@ -118,7 +118,7 @@ void PacketPeerUDPWinsock::_set_sock_blocking(bool p_blocking) {
};
}
-Error PacketPeerUDPWinsock::listen(int p_port, IP_Address p_bind_address, int p_recv_buffer_size) {
+Error PacketPeerUDPWinsock::listen(int p_port, const IP_Address &p_bind_address, int p_recv_buffer_size) {
ERR_FAIL_COND_V(sockfd != -1, ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
diff --git a/platform/windows/packet_peer_udp_winsock.h b/platform/windows/packet_peer_udp_winsock.h
index ceb6df71aa..01f2e5113f 100644
--- a/platform/windows/packet_peer_udp_winsock.h
+++ b/platform/windows/packet_peer_udp_winsock.h
@@ -67,7 +67,7 @@ public:
virtual int get_max_packet_size() const;
- virtual Error listen(int p_port, IP_Address p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536);
+ virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536);
virtual void close();
virtual Error wait();
virtual bool is_listening() const;
diff --git a/platform/windows/tcp_server_winsock.cpp b/platform/windows/tcp_server_winsock.cpp
index 3292813d4e..cc17c8a631 100644
--- a/platform/windows/tcp_server_winsock.cpp
+++ b/platform/windows/tcp_server_winsock.cpp
@@ -63,7 +63,7 @@ void TCPServerWinsock::cleanup() {
};
};
-Error TCPServerWinsock::listen(uint16_t p_port, const IP_Address p_bind_address) {
+Error TCPServerWinsock::listen(uint16_t p_port, const IP_Address &p_bind_address) {
ERR_FAIL_COND_V(listen_sockfd != -1, ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER);
diff --git a/platform/windows/tcp_server_winsock.h b/platform/windows/tcp_server_winsock.h
index 7e5d1e750e..077acb94d7 100644
--- a/platform/windows/tcp_server_winsock.h
+++ b/platform/windows/tcp_server_winsock.h
@@ -40,7 +40,7 @@ class TCPServerWinsock : public TCP_Server {
static TCP_Server *_create();
public:
- virtual Error listen(uint16_t p_port, const IP_Address p_bind_address = IP_Address("*"));
+ virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*"));
virtual bool is_connection_available() const;
virtual Ref<StreamPeerTCP> take_connection();
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index ddf17481b1..f055d730db 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.cpp
@@ -83,6 +83,19 @@ static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) {
return 0;
}
+static void set_class_hint(Display *p_display, Window p_window) {
+ XClassHint *classHint;
+
+ /* set the name and class hints for the window manager to use */
+ classHint = XAllocClassHint();
+ if (classHint) {
+ classHint->res_name = (char *)"Godot_Engine";
+ classHint->res_class = (char *)"Godot";
+ }
+ XSetClassHint(p_display, p_window, classHint);
+ XFree(classHint);
+}
+
Error ContextGL_X11::initialize() {
GLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = NULL;
@@ -127,6 +140,7 @@ Error ContextGL_X11::initialize() {
*/
x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &swa);
ERR_FAIL_COND_V(!x11_window, ERR_UNCONFIGURED);
+ set_class_hint(x11_display, x11_window);
XMapWindow(x11_display, x11_window);
//};
diff --git a/platform/x11/joypad_linux.h b/platform/x11/joypad_linux.h
index a0ac559b1c..55383885a0 100644
--- a/platform/x11/joypad_linux.h
+++ b/platform/x11/joypad_linux.h
@@ -80,22 +80,22 @@ private:
static void joy_thread_func(void *p_user);
- int get_joy_from_path(String path) const;
+ int get_joy_from_path(String p_path) const;
void setup_joypad_properties(int p_id);
void close_joypad(int p_id = -1);
#ifdef UDEV_ENABLED
- void enumerate_joypads(struct udev *_udev);
- void monitor_joypads(struct udev *_udev);
+ void enumerate_joypads(struct udev *p_udev);
+ void monitor_joypads(struct udev *p_udev);
#endif
void monitor_joypads();
void run_joypad_thread();
- void open_joypad(const char *path);
+ void open_joypad(const char *p_path);
void joypad_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
void joypad_vibration_stop(int p_id, uint64_t p_timestamp);
- InputDefault::JoyAxis axis_correct(const input_absinfo *abs, int value) const;
+ InputDefault::JoyAxis axis_correct(const input_absinfo *p_abs, int p_value) const;
};
#endif
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index ade3a0a0c5..a23f2f1320 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -351,20 +351,9 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
XChangeWindowAttributes(x11_display, x11_window, CWEventMask, &new_attr);
- XClassHint *classHint;
-
/* set the titlebar name */
XStoreName(x11_display, x11_window, "Godot");
- /* set the name and class hints for the window manager to use */
- classHint = XAllocClassHint();
- if (classHint) {
- classHint->res_name = (char *)"Godot_Engine";
- classHint->res_class = (char *)"Godot";
- }
- XSetClassHint(x11_display, x11_window, classHint);
- XFree(classHint);
-
wm_delete = XInternAtom(x11_display, "WM_DELETE_WINDOW", true);
XSetWMProtocols(x11_display, x11_window, &wm_delete, 1);
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index cd8c617ee6..07c3099a72 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -552,11 +552,11 @@ float Camera2D::get_h_offset() const {
return h_ofs;
}
-void Camera2D::_set_old_smoothing(float p_val) {
+void Camera2D::_set_old_smoothing(float p_enable) {
//compatibility
- if (p_val > 0) {
+ if (p_enable > 0) {
smoothing_enabled = true;
- set_follow_smoothing(p_val);
+ set_follow_smoothing(p_enable);
}
}
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 3d0b5047ae..cdd8fdf350 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -734,7 +734,7 @@ void CanvasItem::draw_set_transform_matrix(const Transform2D &p_matrix) {
VisualServer::get_singleton()->canvas_item_add_set_transform(canvas_item, p_matrix);
}
-void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture> p_texture, const Ref<Texture> &p_normal_map) {
+void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture> p_texture, const Ref<Texture> &p_normal_map, bool p_antialiased) {
if (!drawing) {
ERR_EXPLAIN("Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
@@ -744,10 +744,10 @@ void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color
RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
RID rid_normal = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- VisualServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, p_colors, p_uvs, rid, rid_normal);
+ VisualServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, p_colors, p_uvs, rid, rid_normal, p_antialiased);
}
-void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs, Ref<Texture> p_texture, const Ref<Texture> &p_normal_map) {
+void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs, Ref<Texture> p_texture, const Ref<Texture> &p_normal_map, bool p_antialiased) {
if (!drawing) {
ERR_EXPLAIN("Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
@@ -759,7 +759,7 @@ void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Colo
RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
RID rid_normal = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- VisualServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, colors, p_uvs, rid, rid_normal);
+ VisualServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, colors, p_uvs, rid, rid_normal, p_antialiased);
}
void CanvasItem::draw_string(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, const Color &p_modulate, int p_clip_w) {
@@ -985,8 +985,8 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true));
ClassDB::bind_method(D_METHOD("draw_style_box", "style_box", "rect"), &CanvasItem::draw_style_box);
ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture", "width", "normal_map"), &CanvasItem::draw_primitive, DEFVAL(Variant()), DEFVAL(1.0), DEFVAL(Variant()));
- ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture", "normal_map"), &CanvasItem::draw_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()));
- ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture", "normal_map"), &CanvasItem::draw_colored_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture", "normal_map", "antialiased"), &CanvasItem::draw_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture", "normal_map", "antialiased"), &CanvasItem::draw_colored_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_string", "font", "pos", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1)), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("draw_char", "font", "pos", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1)));
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 27842727ac..c6180e07b6 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -251,8 +251,8 @@ public:
void draw_texture_rect_region(const Ref<Texture> &p_texture, 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);
void draw_style_box(const Ref<StyleBox> &p_style_box, const Rect2 &p_rect);
void draw_primitive(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture> p_texture = Ref<Texture>(), float p_width = 1, const Ref<Texture> &p_normal_map = Ref<Texture>());
- void draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture> p_texture = Ref<Texture>(), const Ref<Texture> &p_normal_map = Ref<Texture>());
- void draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture> p_texture = Ref<Texture>(), const Ref<Texture> &p_normal_map = Ref<Texture>());
+ void draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture> p_texture = Ref<Texture>(), const Ref<Texture> &p_normal_map = Ref<Texture>(), bool p_antialiased = false);
+ void draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture> p_texture = Ref<Texture>(), const Ref<Texture> &p_normal_map = Ref<Texture>(), bool p_antialiased = false);
void draw_string(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, const Color &p_modulate = Color(1, 1, 1), int p_clip_w = -1);
float draw_char(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_char, const String &p_next = "", const Color &p_modulate = Color(1, 1, 1));
@@ -297,7 +297,7 @@ public:
void set_use_parent_material(bool p_use_parent_material);
bool get_use_parent_material() const;
- Ref<InputEvent> make_input_local(const Ref<InputEvent> &pevent) const;
+ Ref<InputEvent> make_input_local(const Ref<InputEvent> &p_event) const;
Vector2 make_canvas_pos_local(const Vector2 &screen_point) const;
Vector2 get_global_mouse_position() const;
diff --git a/scene/2d/joints_2d.h b/scene/2d/joints_2d.h
index b52b0f4670..f854ce51ee 100644
--- a/scene/2d/joints_2d.h
+++ b/scene/2d/joints_2d.h
@@ -81,7 +81,7 @@ protected:
static void _bind_methods();
public:
- void set_softness(real_t p_stiffness);
+ void set_softness(real_t p_softness);
real_t get_softness() const;
PinJoint2D();
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index 0eb6e82cc7..2b11913ddf 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -418,7 +418,7 @@ void Light2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "is_editor_only");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_texture_offset", "get_texture_offset");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "scale", PROPERTY_HINT_RANGE, "0.01,50,0.01"), "set_texture_scale", "get_texture_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_scale", PROPERTY_HINT_RANGE, "0.01,50,0.01"), "set_texture_scale", "get_texture_scale");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0.01,100,0.01"), "set_energy", "get_energy");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Add,Sub,Mix,Mask"), "set_mode", "get_mode");
diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp
index e579838903..383236b4ca 100644
--- a/scene/2d/navigation2d.cpp
+++ b/scene/2d/navigation2d.cpp
@@ -646,7 +646,8 @@ debug path
break;
}
- path.push_back(begin_point);
+ if (path[path.size() - 1].distance_to(begin_point) > CMP_EPSILON)
+ path.push_back(begin_point);
path.invert();
}
diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h
index df9a05ff79..a6009851c7 100644
--- a/scene/2d/node_2d.h
+++ b/scene/2d/node_2d.h
@@ -49,7 +49,7 @@ class Node2D : public CanvasItem {
void _update_transform();
// Deprecated, should be removed in a future version.
- void _set_rotd(float p_angle);
+ void _set_rotd(float p_degrees);
float _get_rotd() const;
void _update_xform_values();
diff --git a/scene/2d/parallax_background.h b/scene/2d/parallax_background.h
index 99d8dd3811..fce1bbd928 100644
--- a/scene/2d/parallax_background.h
+++ b/scene/2d/parallax_background.h
@@ -60,7 +60,7 @@ public:
void set_scroll_offset(const Point2 &p_ofs);
Point2 get_scroll_offset() const;
- void set_scroll_scale(float p_ofs);
+ void set_scroll_scale(float p_scale);
float get_scroll_scale() const;
void set_scroll_base_offset(const Point2 &p_ofs);
diff --git a/scene/2d/parallax_layer.h b/scene/2d/parallax_layer.h
index 85e70b0a51..f2d0053342 100644
--- a/scene/2d/parallax_layer.h
+++ b/scene/2d/parallax_layer.h
@@ -48,7 +48,7 @@ protected:
static void _bind_methods();
public:
- void set_motion_offset(const Size2 &p_scale);
+ void set_motion_offset(const Size2 &p_offset);
Size2 get_motion_offset() const;
void set_motion_scale(const Size2 &p_scale);
@@ -57,7 +57,7 @@ public:
void set_mirroring(const Size2 &p_mirroring);
Size2 get_mirroring() const;
- void set_base_offset_and_scale(const Point2 &p_offsetf, float p_scale);
+ void set_base_offset_and_scale(const Point2 &p_offset, float p_scale);
virtual String get_configuration_warning() const;
ParallaxLayer();
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 11e1326b2c..40c16e5062 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -56,6 +56,8 @@ void Particles2D::set_one_shot(bool p_enable) {
one_shot = p_enable;
VS::get_singleton()->particles_set_one_shot(particles, one_shot);
+ if (!one_shot && emitting)
+ VisualServer::get_singleton()->particles_restart(particles);
}
void Particles2D::set_pre_process_time(float p_time) {
diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h
index 23278ce746..a6ac0c37d3 100644
--- a/scene/2d/particles_2d.h
+++ b/scene/2d/particles_2d.h
@@ -80,7 +80,7 @@ public:
void set_emitting(bool p_emitting);
void set_amount(int p_amount);
void set_lifetime(float p_lifetime);
- void set_one_shot(bool p_enabled);
+ void set_one_shot(bool p_enable);
void set_pre_process_time(float p_time);
void set_explosiveness_ratio(float p_ratio);
void set_randomness_ratio(float p_ratio);
diff --git a/scene/2d/path_2d.h b/scene/2d/path_2d.h
index b2dae17735..e80817cd3c 100644
--- a/scene/2d/path_2d.h
+++ b/scene/2d/path_2d.h
@@ -96,7 +96,7 @@ public:
void set_loop(bool p_loop);
bool has_loop() const;
- void set_rotate(bool p_enabled);
+ void set_rotate(bool p_rotate);
bool is_rotating() const;
void set_cubic_interpolation(bool p_enable);
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index f2b55a15fe..3fd442429d 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -984,11 +984,12 @@ Dictionary KinematicBody2D::_move(const Vector2 &p_motion) {
if (move(p_motion, col)) {
Dictionary d;
d["position"] = col.collision;
- d["normal"] = col.collision;
+ d["normal"] = col.normal;
d["local_shape"] = col.local_shape;
d["travel"] = col.travel;
d["remainder"] = col.remainder;
d["collider_id"] = col.collider;
+ d["collider_velocity"] = col.collider_vel;
if (col.collider) {
d["collider"] = ObjectDB::get_instance(col.collider);
} else {
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 5c1c953a37..7e2d6d1b5a 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -176,9 +176,10 @@ void Polygon2D::_notification(int p_what) {
}
}
- Vector<int> indices = Geometry::triangulate_polygon(points);
+ // Vector<int> indices = Geometry::triangulate_polygon(points);
+ // VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, texture.is_valid() ? texture->get_rid() : RID());
- VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, texture.is_valid() ? texture->get_rid() : RID());
+ VS::get_singleton()->canvas_item_add_polygon(get_canvas_item(), points, colors, uvs, texture.is_valid() ? texture->get_rid() : RID(), RID(), antialiased);
} break;
}
@@ -294,6 +295,16 @@ bool Polygon2D::get_invert() const {
return invert;
}
+void Polygon2D::set_antialiased(bool p_antialiased) {
+
+ antialiased = p_antialiased;
+ update();
+}
+bool Polygon2D::get_antialiased() const {
+
+ return antialiased;
+}
+
void Polygon2D::set_invert_border(float p_invert_border) {
invert_border = p_invert_border;
@@ -348,6 +359,9 @@ void Polygon2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_invert", "invert"), &Polygon2D::set_invert);
ClassDB::bind_method(D_METHOD("get_invert"), &Polygon2D::get_invert);
+ ClassDB::bind_method(D_METHOD("set_antialiased", "antialiased"), &Polygon2D::set_antialiased);
+ ClassDB::bind_method(D_METHOD("get_antialiased"), &Polygon2D::get_antialiased);
+
ClassDB::bind_method(D_METHOD("set_invert_border", "invert_border"), &Polygon2D::set_invert_border);
ClassDB::bind_method(D_METHOD("get_invert_border"), &Polygon2D::get_invert_border);
@@ -359,6 +373,7 @@ void Polygon2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "vertex_colors"), "set_vertex_colors", "get_vertex_colors");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_offset", "get_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "antialiased"), "set_antialiased", "get_antialiased");
ADD_GROUP("Texture", "");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture");
ADD_GROUP("Texture", "texture_");
@@ -375,6 +390,7 @@ Polygon2D::Polygon2D() {
invert = 0;
invert_border = 100;
+ antialiased = false;
tex_rot = 0;
tex_tile = true;
tex_scale = Vector2(1, 1);
diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h
index f2cc9452b9..eb47f4d8d1 100644
--- a/scene/2d/polygon_2d.h
+++ b/scene/2d/polygon_2d.h
@@ -47,6 +47,7 @@ class Polygon2D : public Node2D {
float tex_rot;
bool invert;
float invert_border;
+ bool antialiased;
Vector2 offset;
mutable bool rect_cache_dirty;
@@ -84,10 +85,13 @@ public:
void set_texture_scale(const Size2 &p_scale);
Size2 get_texture_scale() const;
- void set_invert(bool p_rot);
+ void set_invert(bool p_invert);
bool get_invert() const;
- void set_invert_border(float p_border);
+ void set_antialiased(bool p_antialiased);
+ bool get_antialiased() const;
+
+ void set_invert_border(float p_invert_border);
float get_invert_border() const;
void set_offset(const Vector2 &p_offset);
diff --git a/scene/2d/screen_button.h b/scene/2d/screen_button.h
index 8923da2ae4..2a5935aaf1 100644
--- a/scene/2d/screen_button.h
+++ b/scene/2d/screen_button.h
@@ -61,7 +61,7 @@ private:
VisibilityMode visibility;
- void _input(const Ref<InputEvent> &p_Event);
+ void _input(const Ref<InputEvent> &p_event);
bool _is_point_inside(const Point2 &p_point);
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index e4494742a1..68b026b1b3 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -1068,20 +1068,20 @@ Transform2D TileMap::get_custom_transform() const {
return custom_transform;
}
-Vector2 TileMap::_map_to_world(int x, int y, bool p_ignore_ofs) const {
+Vector2 TileMap::_map_to_world(int p_x, int p_y, bool p_ignore_ofs) const {
- Vector2 ret = get_cell_transform().xform(Vector2(x, y));
+ Vector2 ret = get_cell_transform().xform(Vector2(p_x, p_y));
if (!p_ignore_ofs) {
switch (half_offset) {
case HALF_OFFSET_X: {
- if (ABS(y) & 1) {
+ if (ABS(p_y) & 1) {
ret += get_cell_transform()[0] * 0.5;
}
} break;
case HALF_OFFSET_Y: {
- if (ABS(x) & 1) {
+ if (ABS(p_x) & 1) {
ret += get_cell_transform()[1] * 0.5;
}
} break;
diff --git a/scene/3d/camera.h b/scene/3d/camera.h
index 43975892b4..70849791e5 100644
--- a/scene/3d/camera.h
+++ b/scene/3d/camera.h
@@ -126,9 +126,9 @@ public:
virtual Transform get_camera_transform() const;
- Vector3 project_ray_normal(const Point2 &p_point) const;
- Vector3 project_ray_origin(const Point2 &p_point) const;
- Vector3 project_local_ray_normal(const Point2 &p_point) const;
+ Vector3 project_ray_normal(const Point2 &p_pos) const;
+ Vector3 project_ray_origin(const Point2 &p_pos) const;
+ Vector3 project_local_ray_normal(const Point2 &p_pos) const;
Point2 unproject_position(const Vector3 &p_pos) const;
bool is_position_behind(const Vector3 &p_pos) const;
Vector3 project_position(const Point2 &p_point) const;
diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp
index 4fd215bd1a..2aa6a95718 100644
--- a/scene/3d/collision_shape.cpp
+++ b/scene/3d/collision_shape.cpp
@@ -89,13 +89,6 @@ void CollisionShape::_notification(int p_what) {
parent->shape_owner_set_transform(owner_id, get_transform());
}
} break;
- case NOTIFICATION_EXIT_TREE: {
- if (parent) {
- parent->remove_shape_owner(owner_id);
- }
- owner_id = 0;
- parent = NULL;
- } break;
case NOTIFICATION_UNPARENTED: {
if (parent) {
parent->remove_shape_owner(owner_id);
diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h
index 2eb4bf1e6b..bc8452c7e0 100644
--- a/scene/3d/immediate_geometry.h
+++ b/scene/3d/immediate_geometry.h
@@ -52,8 +52,8 @@ public:
void set_normal(const Vector3 &p_normal);
void set_tangent(const Plane &p_tangent);
void set_color(const Color &p_color);
- void set_uv(const Vector2 &tex_uv);
- void set_uv2(const Vector2 &tex_uv);
+ void set_uv(const Vector2 &p_uv);
+ void set_uv2(const Vector2 &p_uv2);
void add_vertex(const Vector3 &p_vertex);
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index bc2dfe5aa6..b4a62138fb 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -107,6 +107,16 @@ Color Light::get_shadow_color() const {
return shadow_color;
}
+void Light::set_shadow_reverse_cull_face(bool p_enable) {
+ reverse_cull = p_enable;
+ VS::get_singleton()->light_set_reverse_cull_face_mode(light, reverse_cull);
+}
+
+bool Light::get_shadow_reverse_cull_face() const {
+
+ return reverse_cull;
+}
+
Rect3 Light::get_aabb() const {
if (type == VisualServer::LIGHT_DIRECTIONAL) {
@@ -203,6 +213,9 @@ void Light::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_color", "color"), &Light::set_color);
ClassDB::bind_method(D_METHOD("get_color"), &Light::get_color);
+ ClassDB::bind_method(D_METHOD("set_shadow_reverse_cull_face", "enable"), &Light::set_shadow_reverse_cull_face);
+ ClassDB::bind_method(D_METHOD("get_shadow_reverse_cull_face"), &Light::get_shadow_reverse_cull_face);
+
ClassDB::bind_method(D_METHOD("set_shadow_color", "shadow_color"), &Light::set_shadow_color);
ClassDB::bind_method(D_METHOD("get_shadow_color"), &Light::get_shadow_color);
@@ -218,6 +231,7 @@ void Light::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_bias", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_contact", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_CONTACT_SHADOW_SIZE);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_max_distance", PROPERTY_HINT_RANGE, "0,65536,0.1"), "set_param", "get_param", PARAM_SHADOW_MAX_DISTANCE);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shadow_reverse_cull_face"), "set_shadow_reverse_cull_face", "get_shadow_reverse_cull_face");
ADD_GROUP("Editor", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "is_editor_only");
ADD_GROUP("", "");
@@ -245,6 +259,8 @@ Light::Light(VisualServer::LightType p_type) {
light = VisualServer::get_singleton()->light_create(p_type);
VS::get_singleton()->instance_set_base(get_instance(), light);
+ reverse_cull = false;
+
editor_only = false;
set_color(Color(1, 1, 1, 1));
set_shadow(false);
diff --git a/scene/3d/light.h b/scene/3d/light.h
index 22ff5c0763..788e948536 100644
--- a/scene/3d/light.h
+++ b/scene/3d/light.h
@@ -69,6 +69,7 @@ private:
Color shadow_color;
bool shadow;
bool negative;
+ bool reverse_cull;
uint32_t cull_mask;
VS::LightType type;
bool editor_only;
@@ -110,6 +111,9 @@ public:
void set_shadow_color(const Color &p_shadow_color);
Color get_shadow_color() const;
+ void set_shadow_reverse_cull_face(bool p_enable);
+ bool get_shadow_reverse_cull_face() const;
+
virtual Rect3 get_aabb() const;
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp
index 4c93bcfb5e..5d4568f5d3 100644
--- a/scene/3d/navigation_mesh.cpp
+++ b/scene/3d/navigation_mesh.cpp
@@ -208,6 +208,8 @@ void NavigationMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_polygon", "idx"), &NavigationMesh::get_polygon);
ClassDB::bind_method(D_METHOD("clear_polygons"), &NavigationMesh::clear_polygons);
+ ClassDB::bind_method(D_METHOD("create_from_mesh", "mesh"), &NavigationMesh::create_from_mesh);
+
ClassDB::bind_method(D_METHOD("_set_polygons", "polygons"), &NavigationMesh::_set_polygons);
ClassDB::bind_method(D_METHOD("_get_polygons"), &NavigationMesh::_get_polygons);
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 081caf4419..e88a52c76a 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -63,6 +63,8 @@ void Particles::set_one_shot(bool p_one_shot) {
one_shot = p_one_shot;
VS::get_singleton()->particles_set_one_shot(particles, one_shot);
+ if (!one_shot && emitting)
+ VisualServer::get_singleton()->particles_restart(particles);
}
void Particles::set_pre_process_time(float p_time) {
@@ -406,7 +408,7 @@ void ParticlesMaterial::init_shaders() {
shader_names->anim_speed = "anim_speed";
shader_names->anim_offset = "anim_offset";
- shader_names->initial_linear_velocity = "initial_linear_velocity_random";
+ shader_names->initial_linear_velocity_random = "initial_linear_velocity_random";
shader_names->initial_angle_random = "initial_angle_random";
shader_names->angular_velocity_random = "angular_velocity_random";
shader_names->orbit_velocity_random = "orbit_velocity_random";
@@ -753,18 +755,20 @@ void ParticlesMaterial::_update_shader() {
code += " pos.z=0.0; \n";
}
code += " //apply linear acceleration\n";
- code += " force+=normalize(VELOCITY) * (linear_accel+tex_linear_accel)*mix(1.0,rand_from_seed(alt_seed),linear_accel_random);\n";
+ code += " force+= length(VELOCITY) > 0.0 ? normalize(VELOCITY) * (linear_accel+tex_linear_accel)*mix(1.0,rand_from_seed(alt_seed),linear_accel_random) : vec3(0.0);\n";
code += " //apply radial acceleration\n";
code += " vec3 org = vec3(0.0);\n";
- code += " // if (!p_system->local_coordinates)\n";
- code += " //org=p_transform.origin;\n";
- code += " force+=normalize(pos-org) * (radial_accel+tex_radial_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random);\n";
+ code += " // if (!p_system->local_coordinates)\n";
+ code += " //org=p_transform.origin;\n";
+ code += " vec3 diff = pos-org;\n";
+ code += " force+=length(diff) > 0.0 ? normalize(diff) * (radial_accel+tex_radial_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random) : vec3(0.0);\n";
code += " //apply tangential acceleration;\n";
if (flags[FLAG_DISABLE_Z]) {
- code += " force+=vec3(normalize((pos-org).yx * vec2(-1.0,1.0)),0.0) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random));\n";
+ code += " force+=length(diff.yx) > 0.0 ? vec3(normalize(diff.yx * vec2(-1.0,1.0)),0.0) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random)) : vec3(0.0);\n";
} else {
- code += " force+=normalize(cross(normalize(pos-org),normalize(gravity))) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random));\n";
+ code += " vec3 crossDiff = cross(normalize(diff),normalize(gravity));\n";
+ code += " force+=length(crossDiff) > 0.0 ? normalize(crossDiff) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random)) : vec3(0.0);\n";
}
code += " //apply attractor forces\n";
code += " VELOCITY+=force * DELTA;\n";
@@ -1264,9 +1268,8 @@ int ParticlesMaterial::get_emission_point_count() const {
void ParticlesMaterial::set_trail_divisor(int p_divisor) {
- VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor);
trail_divisor = p_divisor;
- _change_notify();
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor);
}
int ParticlesMaterial::get_trail_divisor() const {
diff --git a/scene/3d/particles.h b/scene/3d/particles.h
index 31ca85a59a..9c1436a47b 100644
--- a/scene/3d/particles.h
+++ b/scene/3d/particles.h
@@ -88,7 +88,7 @@ public:
void set_emitting(bool p_emitting);
void set_amount(int p_amount);
void set_lifetime(float p_lifetime);
- void set_one_shot(bool p_enabled);
+ void set_one_shot(bool p_one_shot);
void set_pre_process_time(float p_time);
void set_explosiveness_ratio(float p_ratio);
void set_randomness_ratio(float p_ratio);
diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp
index 5441904d81..d0410f2c55 100644
--- a/scene/3d/proximity_group.cpp
+++ b/scene/3d/proximity_group.cpp
@@ -116,9 +116,9 @@ void ProximityGroup::set_group_name(String p_group_name) {
group_name = p_group_name;
};
-void ProximityGroup::_notification(int what) {
+void ProximityGroup::_notification(int p_what) {
- switch (what) {
+ switch (p_what) {
case NOTIFICATION_EXIT_TREE:
++group_version;
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index 0d91014314..cee97af244 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -82,9 +82,9 @@ bool Skeleton::_set(const StringName &p_path, const Variant &p_value) {
return true;
}
-bool Skeleton::_get(const StringName &p_name, Variant &r_ret) const {
+bool Skeleton::_get(const StringName &p_path, Variant &r_ret) const {
- String path = p_name;
+ String path = p_path;
if (!path.begins_with("bones/"))
return false;
diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h
index dc0adbb337..a6546af64e 100644
--- a/scene/3d/skeleton.h
+++ b/scene/3d/skeleton.h
@@ -91,8 +91,8 @@ class Skeleton : public Spatial {
}
protected:
- bool _get(const StringName &p_name, Variant &r_ret) const;
- bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_path, Variant &r_ret) const;
+ bool _set(const StringName &p_path, const Variant &p_value);
void _get_property_list(List<PropertyInfo> *p_list) const;
void _notification(int p_what);
static void _bind_methods();
@@ -113,7 +113,7 @@ public:
void set_bone_parent(int p_bone, int p_parent);
int get_bone_parent(int p_bone) const;
- void unparent_bone_and_rest(int p_idx);
+ void unparent_bone_and_rest(int p_bone);
void set_bone_disable_rest(int p_bone, bool p_disable);
bool is_bone_rest_disabled(int p_bone) const;
diff --git a/scene/3d/spatial_velocity_tracker.h b/scene/3d/spatial_velocity_tracker.h
index 65f3eaca93..b8237613a7 100644
--- a/scene/3d/spatial_velocity_tracker.h
+++ b/scene/3d/spatial_velocity_tracker.h
@@ -20,7 +20,7 @@ protected:
public:
void reset(const Vector3 &p_new_pos);
- void set_track_fixed_step(bool p_use_fixed_step);
+ void set_track_fixed_step(bool p_track_fixed_step);
bool is_tracking_fixed_step() const;
void update_position(const Vector3 &p_position);
Vector3 get_tracked_linear_velocity() const;
diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h
index b4600c00b8..7dc4cd4ffb 100644
--- a/scene/3d/sprite_3d.h
+++ b/scene/3d/sprite_3d.h
@@ -119,7 +119,7 @@ public:
void set_pixel_size(float p_amount);
float get_pixel_size() const;
- void set_axis(Vector3::Axis p_amount);
+ void set_axis(Vector3::Axis p_axis);
Vector3::Axis get_axis() const;
void set_draw_flag(DrawFlags p_flag, bool p_enable);
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index 8d927e529e..adf235c525 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -893,9 +893,9 @@ real_t VehicleBody::get_friction() const {
return friction;
}
-void VehicleBody::set_engine_force(float p_force) {
+void VehicleBody::set_engine_force(float p_engine_force) {
- engine_force = p_force;
+ engine_force = p_engine_force;
}
float VehicleBody::get_engine_force() const {
diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h
index 7ed9bce730..d778800814 100644
--- a/scene/3d/vehicle_body.h
+++ b/scene/3d/vehicle_body.h
@@ -196,7 +196,7 @@ public:
void set_engine_force(float p_engine_force);
float get_engine_force() const;
- void set_brake(float p_force);
+ void set_brake(float p_brake);
float get_brake() const;
void set_steering(float p_steering);
diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp
index 1a294d016a..7d61006529 100644
--- a/scene/3d/visual_instance.cpp
+++ b/scene/3d/visual_instance.cpp
@@ -231,14 +231,6 @@ void GeometryInstance::_notification(int p_what) {
void GeometryInstance::set_flag(Flags p_flag, bool p_value) {
ERR_FAIL_INDEX(p_flag, FLAG_MAX);
- if (p_flag == FLAG_CAST_SHADOW) {
- if (p_value == true) {
- set_cast_shadows_setting(SHADOW_CASTING_SETTING_ON);
- } else {
- set_cast_shadows_setting(SHADOW_CASTING_SETTING_OFF);
- }
- }
-
if (flags[p_flag] == p_value)
return;
@@ -252,14 +244,6 @@ bool GeometryInstance::get_flag(Flags p_flag) const {
ERR_FAIL_INDEX_V(p_flag, FLAG_MAX, false);
- if (p_flag == FLAG_CAST_SHADOW) {
- if (shadow_casting_setting == SHADOW_CASTING_SETTING_OFF) {
- return false;
- } else {
- return true;
- }
- }
-
return flags[p_flag];
}
@@ -330,7 +314,6 @@ void GeometryInstance::_bind_methods() {
//ADD_SIGNAL( MethodInfo("visibility_changed"));
- BIND_CONSTANT(FLAG_CAST_SHADOW);
BIND_CONSTANT(FLAG_VISIBLE_IN_ALL_ROOMS);
BIND_CONSTANT(FLAG_MAX);
@@ -350,8 +333,6 @@ GeometryInstance::GeometryInstance() {
flags[i] = false;
}
- flags[FLAG_CAST_SHADOW] = true;
-
shadow_casting_setting = SHADOW_CASTING_SETTING_ON;
extra_cull_margin = 0;
//VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0);
diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h
index 9318198e54..694d0c2499 100644
--- a/scene/3d/visual_instance.h
+++ b/scene/3d/visual_instance.h
@@ -84,7 +84,6 @@ class GeometryInstance : public VisualInstance {
public:
enum Flags {
- FLAG_CAST_SHADOW = VS::INSTANCE_FLAG_CAST_SHADOW,
FLAG_VISIBLE_IN_ALL_ROOMS = VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS,
FLAG_USE_BAKED_LIGHT = VS::INSTANCE_FLAG_USE_BAKED_LIGHT,
FLAG_MAX = VS::INSTANCE_FLAG_MAX,
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index 96fc70a3ad..01b709205a 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -271,7 +271,7 @@ public:
void set_speed_scale(float p_speed);
float get_speed_scale() const;
- void set_autoplay(const String &pname);
+ void set_autoplay(const String &p_name);
String get_autoplay() const;
void set_animation_process_mode(AnimationProcessMode p_mode);
diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h
index 062b4e1eeb..47f18795bd 100644
--- a/scene/animation/animation_tree_player.h
+++ b/scene/animation/animation_tree_player.h
@@ -312,7 +312,7 @@ private:
Map<StringName, NodeBase *> node_map;
// return time left to finish animation
- float _process_node(const StringName &p_node, AnimationNode **r_prev_anim, float p_step, bool p_seek = false, float p_fallback_weight = 1.0, HashMap<NodePath, float> *p_weights = NULL);
+ float _process_node(const StringName &p_node, AnimationNode **r_prev_anim, float p_time, bool p_seek = false, float p_fallback_weight = 1.0, HashMap<NodePath, float> *p_weights = NULL);
void _process_animation(float p_delta);
bool reset_request;
@@ -367,7 +367,7 @@ public:
float oneshot_node_get_autorestart_delay(const StringName &p_node) const;
float oneshot_node_get_autorestart_random_delay(const StringName &p_node) const;
- void oneshot_node_set_mix_mode(const StringName &p_node, bool p_enabled);
+ void oneshot_node_set_mix_mode(const StringName &p_node, bool p_mix);
bool oneshot_node_get_mix_mode(const StringName &p_node) const;
void oneshot_node_start(const StringName &p_node);
@@ -428,8 +428,8 @@ public:
void remove_node(const StringName &p_node);
Error connect_nodes(const StringName &p_src_node, const StringName &p_dst_node, int p_dst_input);
- bool are_nodes_connected(const StringName &p_src_node, const StringName &p_dst_node, int p_input) const;
- void disconnect_nodes(const StringName &p_src_node, int p_input);
+ bool are_nodes_connected(const StringName &p_src_node, const StringName &p_dst_node, int p_dst_input) const;
+ void disconnect_nodes(const StringName &p_node, int p_input);
void set_base_path(const NodePath &p_path);
NodePath get_base_path() const;
diff --git a/scene/animation/tween.h b/scene/animation/tween.h
index f89f3bdc44..43234fab86 100644
--- a/scene/animation/tween.h
+++ b/scene/animation/tween.h
@@ -132,7 +132,7 @@ private:
void _tween_process(float p_delta);
void _set_process(bool p_process, bool p_force = false);
- void _remove(Object *p_node, String p_key, bool first_only);
+ void _remove(Object *p_object, String p_key, bool first_only);
protected:
bool _set(const StringName &p_name, const Variant &p_value);
@@ -156,34 +156,34 @@ public:
float get_speed_scale() const;
bool start();
- bool reset(Object *p_node, String p_key);
+ bool reset(Object *p_object, String p_key);
bool reset_all();
- bool stop(Object *p_node, String p_key);
+ bool stop(Object *p_object, String p_key);
bool stop_all();
- bool resume(Object *p_node, String p_key);
+ bool resume(Object *p_object, String p_key);
bool resume_all();
- bool remove(Object *p_node, String p_key);
+ bool remove(Object *p_object, String p_key);
bool remove_all();
bool seek(real_t p_time);
real_t tell() const;
real_t get_runtime() const;
- bool interpolate_property(Object *p_node, String p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
+ bool interpolate_property(Object *p_object, String p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
- bool interpolate_method(Object *p_node, String p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
+ bool interpolate_method(Object *p_object, String p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
bool interpolate_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE);
bool interpolate_deferred_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE);
- bool follow_property(Object *p_node, String p_property, Variant p_initial_val, Object *p_target, String p_target_property, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
+ bool follow_property(Object *p_object, String p_property, Variant p_initial_val, Object *p_target, String p_target_property, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
- bool follow_method(Object *p_node, String p_method, Variant p_initial_val, Object *p_target, String p_target_method, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
+ bool follow_method(Object *p_object, String p_method, Variant p_initial_val, Object *p_target, String p_target_method, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
- bool targeting_property(Object *p_node, String p_property, Object *p_initial, String p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
+ bool targeting_property(Object *p_object, String p_property, Object *p_initial, String p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
- bool targeting_method(Object *p_node, String p_method, Object *p_initial, String p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
+ bool targeting_method(Object *p_object, String p_method, Object *p_initial, String p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
Tween();
~Tween();
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index 9a0b3b3c89..5036e4f7f6 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -59,7 +59,7 @@ void Button::_notification(int p_what) {
if (p_what == NOTIFICATION_TRANSLATION_CHANGED) {
- xl_text = XL_MESSAGE(text);
+ xl_text = tr(text);
minimum_size_changed();
update();
}
@@ -172,7 +172,7 @@ void Button::set_text(const String &p_text) {
if (text == p_text)
return;
text = p_text;
- xl_text = XL_MESSAGE(p_text);
+ xl_text = tr(p_text);
update();
_change_notify("text");
minimum_size_changed();
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 3368d1cad9..5257f9df35 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -314,9 +314,9 @@ void ColorPicker::_hsv_draw(int p_which, Control *c) {
}
}
-void ColorPicker::_uv_input(const Ref<InputEvent> &ev) {
+void ColorPicker::_uv_input(const Ref<InputEvent> &p_event) {
- Ref<InputEventMouseButton> bev = ev;
+ Ref<InputEventMouseButton> bev = p_event;
if (bev.is_valid()) {
if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
@@ -335,7 +335,7 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &ev) {
}
}
- Ref<InputEventMouseMotion> mev = ev;
+ Ref<InputEventMouseMotion> mev = p_event;
if (mev.is_valid()) {
if (!changing_color)
@@ -352,9 +352,9 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &ev) {
}
}
-void ColorPicker::_w_input(const Ref<InputEvent> &ev) {
+void ColorPicker::_w_input(const Ref<InputEvent> &p_event) {
- Ref<InputEventMouseButton> bev = ev;
+ Ref<InputEventMouseButton> bev = p_event;
if (bev.is_valid()) {
@@ -372,7 +372,7 @@ void ColorPicker::_w_input(const Ref<InputEvent> &ev) {
emit_signal("color_changed", color);
}
- Ref<InputEventMouseMotion> mev = ev;
+ Ref<InputEventMouseMotion> mev = p_event;
if (mev.is_valid()) {
@@ -388,9 +388,9 @@ void ColorPicker::_w_input(const Ref<InputEvent> &ev) {
}
}
-void ColorPicker::_preset_input(const Ref<InputEvent> &ev) {
+void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) {
- Ref<InputEventMouseButton> bev = ev;
+ Ref<InputEventMouseButton> bev = p_event;
if (bev.is_valid()) {
@@ -407,7 +407,7 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &ev) {
emit_signal("color_changed", color);
}
- Ref<InputEventMouseMotion> mev = ev;
+ Ref<InputEventMouseMotion> mev = p_event;
if (mev.is_valid()) {
@@ -423,9 +423,9 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &ev) {
}
}
-void ColorPicker::_screen_input(const Ref<InputEvent> &ev) {
+void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) {
- Ref<InputEventMouseButton> bev = ev;
+ Ref<InputEventMouseButton> bev = p_event;
if (bev.is_valid()) {
@@ -435,7 +435,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &ev) {
}
}
- Ref<InputEventMouseMotion> mev = ev;
+ Ref<InputEventMouseMotion> mev = p_event;
if (mev.is_valid()) {
Viewport *r = get_tree()->get_root();
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index 1a79266409..d35182e062 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -81,10 +81,10 @@ private:
void _sample_draw();
void _hsv_draw(int p_which, Control *c);
- void _uv_input(const Ref<InputEvent> &p_input);
- void _w_input(const Ref<InputEvent> &p_input);
- void _preset_input(const Ref<InputEvent> &p_input);
- void _screen_input(const Ref<InputEvent> &p_input);
+ void _uv_input(const Ref<InputEvent> &p_event);
+ void _w_input(const Ref<InputEvent> &p_event);
+ void _preset_input(const Ref<InputEvent> &p_event);
+ void _screen_input(const Ref<InputEvent> &p_event);
void _add_preset_pressed();
void _screen_pick_pressed();
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 8d934d0a42..279128725a 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -51,6 +51,12 @@ Variant Control::edit_get_state() const {
s["rect"] = get_rect();
s["rot"] = get_rotation();
s["scale"] = get_scale();
+ Array anchors;
+ anchors.push_back(get_anchor(MARGIN_LEFT));
+ anchors.push_back(get_anchor(MARGIN_TOP));
+ anchors.push_back(get_anchor(MARGIN_RIGHT));
+ anchors.push_back(get_anchor(MARGIN_BOTTOM));
+ s["anchors"] = anchors;
return s;
}
void Control::edit_set_state(const Variant &p_state) {
@@ -62,6 +68,11 @@ void Control::edit_set_state(const Variant &p_state) {
set_size(state.size);
set_rotation(s["rot"]);
set_scale(s["scale"]);
+ Array anchors = s["anchors"];
+ set_anchor(MARGIN_LEFT, anchors[0]);
+ set_anchor(MARGIN_TOP, anchors[1]);
+ set_anchor(MARGIN_RIGHT, anchors[2]);
+ set_anchor(MARGIN_BOTTOM, anchors[3]);
}
void Control::set_custom_minimum_size(const Size2 &p_custom) {
@@ -1212,21 +1223,7 @@ void Control::_size_changed() {
for (int i = 0; i < 4; i++) {
float area = parent_size[i & 1];
- switch (data.anchor[i]) {
-
- case ANCHOR_BEGIN: {
-
- margin_pos[i] = data.margin[i];
- } break;
- case ANCHOR_END: {
-
- margin_pos[i] = area - data.margin[i];
- } break;
- case ANCHOR_CENTER: {
-
- margin_pos[i] = (area / 2) - data.margin[i];
- } break;
- }
+ margin_pos[i] = data.margin[i] + (data.anchor[i] * area);
}
Point2 new_pos_cache = Point2(margin_pos[0], margin_pos[1]);
@@ -1299,59 +1296,38 @@ float Control::_get_range(int p_idx) const {
return to - from;
}
-float Control::_s2a(float p_val, AnchorType p_anchor, float p_range) const {
-
- switch (p_anchor) {
-
- case ANCHOR_BEGIN: {
- return p_val;
- } break;
- case ANCHOR_END: {
- return p_range - p_val;
- } break;
- case ANCHOR_CENTER: {
- return (p_range / 2) - p_val;
- } break;
- }
-
- return 0;
+float Control::_s2a(float p_val, float p_anchor, float p_range) const {
+ return p_val - (p_anchor * p_range);
}
-float Control::_a2s(float p_val, AnchorType p_anchor, float p_range) const {
-
- switch (p_anchor) {
-
- case ANCHOR_BEGIN: {
- return Math::floor(p_val);
- } break;
- case ANCHOR_END: {
- return Math::floor(p_range - p_val);
- } break;
- case ANCHOR_CENTER: {
- return Math::floor((p_range / 2) - p_val);
- } break;
- }
- return 0;
+float Control::_a2s(float p_val, float p_anchor, float p_range) const {
+ return Math::floor(p_val + (p_anchor * p_range));
}
-void Control::set_anchor(Margin p_margin, AnchorType p_anchor, bool p_keep_margin) {
+void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bool p_push_opposite_anchor) {
+ bool pushed = false;
+ data.anchor[p_margin] = CLAMP(p_anchor, 0.0, 1.0);
- if (!is_inside_tree()) {
+ if (((p_margin == MARGIN_LEFT || p_margin == MARGIN_TOP) && data.anchor[p_margin] > data.anchor[(p_margin + 2) % 4]) ||
+ ((p_margin == MARGIN_RIGHT || p_margin == MARGIN_BOTTOM) && data.anchor[p_margin] < data.anchor[(p_margin + 2) % 4])) {
+ if (p_push_opposite_anchor) {
+ data.anchor[(p_margin + 2) % 4] = data.anchor[p_margin];
+ pushed = true;
+ } else {
+ data.anchor[p_margin] = data.anchor[(p_margin + 2) % 4];
+ }
+ }
- data.anchor[p_margin] = p_anchor;
- } else if (!p_keep_margin) {
- float pr = _get_parent_range(p_margin);
- float s = _a2s(data.margin[p_margin], data.anchor[p_margin], pr);
- data.anchor[p_margin] = p_anchor;
- data.margin[p_margin] = _s2a(s, p_anchor, pr);
- } else {
- data.anchor[p_margin] = p_anchor;
- _size_changed();
+ if (is_inside_tree()) {
+ if (p_keep_margin) {
+ _size_changed();
+ }
}
+ update();
_change_notify();
}
-void Control::_set_anchor(Margin p_margin, AnchorType p_anchor) {
+void Control::_set_anchor(Margin p_margin, float p_anchor) {
#ifdef TOOLS_ENABLED
if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) {
set_anchor(p_margin, p_anchor, EDITOR_DEF("editors/2d/keep_margins_when_changing_anchors", false));
@@ -1363,13 +1339,127 @@ void Control::_set_anchor(Margin p_margin, AnchorType p_anchor) {
#endif
}
-void Control::set_anchor_and_margin(Margin p_margin, AnchorType p_anchor, float p_pos) {
+void Control::set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos, bool p_push_opposite_anchor) {
- set_anchor(p_margin, p_anchor);
+ set_anchor(p_margin, p_anchor, false, p_push_opposite_anchor);
set_margin(p_margin, p_pos);
}
-Control::AnchorType Control::get_anchor(Margin p_margin) const {
+void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) {
+ //Left
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_CENTER_LEFT:
+ case PRESET_TOP_WIDE:
+ case PRESET_BOTTOM_WIDE:
+ case PRESET_LEFT_WIDE:
+ case PRESET_HCENTER_WIDE:
+ case PRESET_WIDE:
+ set_anchor(MARGIN_LEFT, ANCHOR_BEGIN, p_keep_margin);
+ break;
+
+ case PRESET_CENTER_TOP:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_CENTER:
+ case PRESET_VCENTER_WIDE:
+ set_anchor(MARGIN_LEFT, 0.5, p_keep_margin);
+ break;
+
+ case PRESET_TOP_RIGHT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_RIGHT_WIDE:
+ set_anchor(MARGIN_LEFT, ANCHOR_END, p_keep_margin);
+ break;
+ }
+
+ // Top
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_TOP_RIGHT:
+ case PRESET_CENTER_TOP:
+ case PRESET_LEFT_WIDE:
+ case PRESET_RIGHT_WIDE:
+ case PRESET_TOP_WIDE:
+ case PRESET_VCENTER_WIDE:
+ case PRESET_WIDE:
+ set_anchor(MARGIN_TOP, ANCHOR_BEGIN, p_keep_margin);
+ break;
+
+ case PRESET_CENTER_LEFT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_CENTER:
+ case PRESET_HCENTER_WIDE:
+ set_anchor(MARGIN_TOP, 0.5, p_keep_margin);
+ break;
+
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_BOTTOM_WIDE:
+ set_anchor(MARGIN_TOP, ANCHOR_END, p_keep_margin);
+ break;
+ }
+
+ // Right
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_CENTER_LEFT:
+ case PRESET_LEFT_WIDE:
+ set_anchor(MARGIN_RIGHT, ANCHOR_BEGIN, p_keep_margin);
+ break;
+
+ case PRESET_CENTER_TOP:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_CENTER:
+ case PRESET_VCENTER_WIDE:
+ set_anchor(MARGIN_RIGHT, 0.5, p_keep_margin);
+ break;
+
+ case PRESET_TOP_RIGHT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_TOP_WIDE:
+ case PRESET_RIGHT_WIDE:
+ case PRESET_BOTTOM_WIDE:
+ case PRESET_HCENTER_WIDE:
+ case PRESET_WIDE:
+ set_anchor(MARGIN_RIGHT, ANCHOR_END, p_keep_margin);
+ break;
+ }
+
+ // Bottom
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_TOP_RIGHT:
+ case PRESET_CENTER_TOP:
+ case PRESET_TOP_WIDE:
+ set_anchor(MARGIN_BOTTOM, ANCHOR_BEGIN, p_keep_margin);
+ break;
+
+ case PRESET_CENTER_LEFT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_CENTER:
+ case PRESET_HCENTER_WIDE:
+ set_anchor(MARGIN_BOTTOM, 0.5, p_keep_margin);
+ break;
+
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_LEFT_WIDE:
+ case PRESET_RIGHT_WIDE:
+ case PRESET_BOTTOM_WIDE:
+ case PRESET_VCENTER_WIDE:
+ case PRESET_WIDE:
+ set_anchor(MARGIN_BOTTOM, ANCHOR_END, p_keep_margin);
+ break;
+ }
+}
+
+float Control::get_anchor(Margin p_margin) const {
return data.anchor[p_margin];
}
@@ -1523,11 +1613,13 @@ Rect2 Control::get_item_rect() const {
void Control::set_area_as_parent_rect(int p_margin) {
data.anchor[MARGIN_LEFT] = ANCHOR_BEGIN;
+ data.margin[MARGIN_LEFT] = p_margin;
data.anchor[MARGIN_TOP] = ANCHOR_BEGIN;
+ data.margin[MARGIN_TOP] = p_margin;
data.anchor[MARGIN_RIGHT] = ANCHOR_END;
+ data.margin[MARGIN_RIGHT] = -p_margin;
data.anchor[MARGIN_BOTTOM] = ANCHOR_END;
- for (int i = 0; i < 4; i++)
- data.margin[i] = p_margin;
+ data.margin[MARGIN_BOTTOM] = -p_margin;
_size_changed();
}
@@ -2371,11 +2463,12 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("accept_event"), &Control::accept_event);
ClassDB::bind_method(D_METHOD("get_minimum_size"), &Control::get_minimum_size);
ClassDB::bind_method(D_METHOD("get_combined_minimum_size"), &Control::get_combined_minimum_size);
- ClassDB::bind_method(D_METHOD("set_anchor", "margin", "anchor_mode", "keep_margin"), &Control::set_anchor, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("_set_anchor", "margin", "anchor_mode"), &Control::_set_anchor);
+ ClassDB::bind_method(D_METHOD("set_anchor", "margin", "anchor", "keep_margin", "push_opposite_anchor"), &Control::set_anchor, DEFVAL(false), DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("_set_anchor", "margin", "anchor"), &Control::_set_anchor);
+ ClassDB::bind_method(D_METHOD("set_anchors_preset", "preset", "keep_margin"), &Control::set_anchors_preset, DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_anchor", "margin"), &Control::get_anchor);
ClassDB::bind_method(D_METHOD("set_margin", "margin", "offset"), &Control::set_margin);
- ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor_mode", "offset"), &Control::set_anchor_and_margin);
+ ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor", "offset", "push_opposite_anchor"), &Control::set_anchor_and_margin, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_begin", "pos"), &Control::set_begin);
ClassDB::bind_method(D_METHOD("set_end", "pos"), &Control::set_end);
ClassDB::bind_method(D_METHOD("set_position", "pos"), &Control::set_position);
@@ -2497,10 +2590,10 @@ void Control::_bind_methods() {
BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data")));
ADD_GROUP("Anchor", "anchor_");
- ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_left", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_LEFT);
- ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_top", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_TOP);
- ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_right", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_RIGHT);
- ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_bottom", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_BOTTOM);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_left", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_top", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_right", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_bottom", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_BOTTOM);
ADD_GROUP("Margin", "margin_");
ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "margin_left", PROPERTY_HINT_RANGE, "-4096,4096"), "set_margin", "get_margin", MARGIN_LEFT);
@@ -2541,9 +2634,6 @@ void Control::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), "set_theme", "get_theme");
ADD_GROUP("", "");
- BIND_CONSTANT(ANCHOR_BEGIN);
- BIND_CONSTANT(ANCHOR_END);
- BIND_CONSTANT(ANCHOR_CENTER);
BIND_CONSTANT(FOCUS_NONE);
BIND_CONSTANT(FOCUS_CLICK);
BIND_CONSTANT(FOCUS_ALL);
@@ -2574,6 +2664,23 @@ void Control::_bind_methods() {
BIND_CONSTANT(CURSOR_HSPLIT);
BIND_CONSTANT(CURSOR_HELP);
+ BIND_CONSTANT(PRESET_TOP_LEFT);
+ BIND_CONSTANT(PRESET_TOP_RIGHT);
+ BIND_CONSTANT(PRESET_BOTTOM_LEFT);
+ BIND_CONSTANT(PRESET_BOTTOM_RIGHT);
+ BIND_CONSTANT(PRESET_CENTER_LEFT);
+ BIND_CONSTANT(PRESET_CENTER_TOP);
+ BIND_CONSTANT(PRESET_CENTER_RIGHT);
+ BIND_CONSTANT(PRESET_CENTER_BOTTOM);
+ BIND_CONSTANT(PRESET_CENTER);
+ BIND_CONSTANT(PRESET_LEFT_WIDE);
+ BIND_CONSTANT(PRESET_TOP_WIDE);
+ BIND_CONSTANT(PRESET_RIGHT_WIDE);
+ BIND_CONSTANT(PRESET_BOTTOM_WIDE);
+ BIND_CONSTANT(PRESET_VCENTER_WIDE);
+ BIND_CONSTANT(PRESET_HCENTER_WIDE);
+ BIND_CONSTANT(PRESET_WIDE);
+
BIND_CONSTANT(SIZE_EXPAND);
BIND_CONSTANT(SIZE_FILL);
BIND_CONSTANT(SIZE_EXPAND_FILL);
@@ -2587,6 +2694,9 @@ void Control::_bind_methods() {
BIND_CONSTANT(GROW_DIRECTION_BEGIN);
BIND_CONSTANT(GROW_DIRECTION_END);
+ BIND_CONSTANT(ANCHOR_BEGIN);
+ BIND_CONSTANT(ANCHOR_END);
+
ADD_SIGNAL(MethodInfo("resized"));
ADD_SIGNAL(MethodInfo("gui_input", PropertyInfo(Variant::OBJECT, "ev", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
ADD_SIGNAL(MethodInfo("mouse_entered"));
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 86cf8f6dbd..d73ca3f7c9 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -51,10 +51,10 @@ class Control : public CanvasItem {
OBJ_CATEGORY("GUI Nodes");
public:
- enum AnchorType {
- ANCHOR_BEGIN,
- ANCHOR_END,
- ANCHOR_CENTER,
+ enum Anchor {
+
+ ANCHOR_BEGIN = 0,
+ ANCHOR_END = 1
};
enum GrowDirection {
@@ -105,6 +105,25 @@ public:
CURSOR_MAX
};
+ enum LayoutPreset {
+ PRESET_TOP_LEFT,
+ PRESET_TOP_RIGHT,
+ PRESET_BOTTOM_LEFT,
+ PRESET_BOTTOM_RIGHT,
+ PRESET_CENTER_LEFT,
+ PRESET_CENTER_TOP,
+ PRESET_CENTER_RIGHT,
+ PRESET_CENTER_BOTTOM,
+ PRESET_CENTER,
+ PRESET_LEFT_WIDE,
+ PRESET_TOP_WIDE,
+ PRESET_RIGHT_WIDE,
+ PRESET_BOTTOM_WIDE,
+ PRESET_VCENTER_WIDE,
+ PRESET_HCENTER_WIDE,
+ PRESET_WIDE
+ };
+
private:
struct CComparator {
@@ -122,7 +141,7 @@ private:
Size2 size_cache;
float margin[4];
- AnchorType anchor[4];
+ float anchor[4];
FocusMode focus_mode;
GrowDirection h_grow;
GrowDirection v_grow;
@@ -182,12 +201,12 @@ private:
void _window_find_focus_neighbour(const Vector2 &p_dir, Node *p_at, const Point2 *p_points, float p_min, float &r_closest_dist, Control **r_closest);
Control *_get_focus_neighbour(Margin p_margin, int p_count = 0);
- void _set_anchor(Margin p_margin, AnchorType p_anchor);
+ void _set_anchor(Margin p_margin, float p_anchor);
float _get_parent_range(int p_idx) const;
float _get_range(int p_idx) const;
- float _s2a(float p_val, AnchorType p_anchor, float p_range) const;
- float _a2s(float p_val, AnchorType p_anchor, float p_range) const;
+ float _s2a(float p_val, float p_anchor, float p_range) const;
+ float _a2s(float p_val, float p_anchor, float p_range) const;
void _propagate_theme_changed(CanvasItem *p_at, Control *p_owner, bool p_assign = true);
void _theme_changed();
@@ -275,10 +294,11 @@ public:
/* POSITIONING */
- void set_anchor(Margin p_margin, AnchorType p_anchor, bool p_keep_margin = false);
- void set_anchor_and_margin(Margin p_margin, AnchorType p_anchor, float p_pos);
+ void set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin = false, bool p_push_opposite_anchor = true);
+ void set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos, bool p_push_opposite_anchor = true);
+ void set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin = false);
- AnchorType get_anchor(Margin p_margin) const;
+ float get_anchor(Margin p_margin) const;
void set_margin(Margin p_margin, float p_value);
@@ -425,11 +445,12 @@ public:
~Control();
};
-VARIANT_ENUM_CAST(Control::AnchorType);
VARIANT_ENUM_CAST(Control::FocusMode);
VARIANT_ENUM_CAST(Control::SizeFlags);
VARIANT_ENUM_CAST(Control::CursorShape);
+VARIANT_ENUM_CAST(Control::LayoutPreset);
VARIANT_ENUM_CAST(Control::MouseFilter);
VARIANT_ENUM_CAST(Control::GrowDirection);
+VARIANT_ENUM_CAST(Control::Anchor);
#endif
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index b78a47ff6a..b911a18312 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -67,10 +67,10 @@ void WindowDialog::_fix_size() {
right = panel_texture->get_expand_margin_size(MARGIN_RIGHT);
} else if (panel->get_class() == "StyleBoxFlat") {
Ref<StyleBoxFlat> panel_flat = panel->cast_to<StyleBoxFlat>();
- top = panel_flat->_get_additional_border_size(MARGIN_TOP);
- left = panel_flat->_get_additional_border_size(MARGIN_LEFT);
- bottom = panel_flat->_get_additional_border_size(MARGIN_BOTTOM);
- right = panel_flat->_get_additional_border_size(MARGIN_RIGHT);
+ top = panel_flat->get_expand_margin_size(MARGIN_TOP);
+ left = panel_flat->get_expand_margin_size(MARGIN_LEFT);
+ bottom = panel_flat->get_expand_margin_size(MARGIN_BOTTOM);
+ right = panel_flat->get_expand_margin_size(MARGIN_RIGHT);
}
pos.x = MAX(left, MIN(pos.x, viewport_size.x - size.x - right));
@@ -215,7 +215,7 @@ void WindowDialog::_notification(int p_what) {
close_button->set_pressed_texture(get_icon("close", "WindowDialog"));
close_button->set_hover_texture(get_icon("close_highlight", "WindowDialog"));
close_button->set_anchor(MARGIN_LEFT, ANCHOR_END);
- close_button->set_begin(Point2(get_constant("close_h_ofs", "WindowDialog"), -get_constant("close_v_ofs", "WindowDialog")));
+ close_button->set_begin(Point2(-get_constant("close_h_ofs", "WindowDialog"), -get_constant("close_v_ofs", "WindowDialog")));
} break;
case NOTIFICATION_MOUSE_EXIT: {
@@ -271,7 +271,7 @@ int WindowDialog::_drag_hit_test(const Point2 &pos) const {
void WindowDialog::set_title(const String &p_title) {
- title = XL_MESSAGE(p_title);
+ title = tr(p_title);
update();
}
String WindowDialog::get_title() const {
@@ -546,7 +546,7 @@ AcceptDialog::AcceptDialog() {
label->set_anchor(MARGIN_RIGHT, ANCHOR_END);
label->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
label->set_begin(Point2(margin, margin));
- label->set_end(Point2(margin, button_margin + 10));
+ label->set_end(Point2(-margin, -button_margin - 10));
//label->set_autowrap(true);
add_child(label);
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 74255b38bf..b3530c2971 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -464,7 +464,7 @@ void FileDialog::update_filters() {
String flt = filters[i].get_slice(";", 0).strip_edges();
String desc = filters[i].get_slice(";", 1).strip_edges();
if (desc.length())
- filter->add_item(String(XL_MESSAGE(desc)) + " ( " + flt + " )");
+ filter->add_item(String(tr(desc)) + " ( " + flt + " )");
else
filter->add_item("( " + flt + " )");
}
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index e85ef73f4e..ec1932ed5a 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -269,14 +269,14 @@ void GraphEdit::_notification(int p_what) {
Size2 hmin = h_scroll->get_combined_minimum_size();
Size2 vmin = v_scroll->get_combined_minimum_size();
- v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, vmin.width);
+ v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -vmin.width);
v_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
v_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
h_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
- h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, hmin.height);
+ h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -hmin.height);
h_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
zoom_minus->set_icon(get_icon("minus"));
diff --git a/scene/gui/input_action.h b/scene/gui/input_action.h
index 6d13d8bd40..5c91d2be28 100644
--- a/scene/gui/input_action.h
+++ b/scene/gui/input_action.h
@@ -45,7 +45,7 @@ protected:
public:
void set_shortcut(const Ref<InputEvent> &p_shortcut);
Ref<InputEvent> get_shortcut() const;
- bool is_shortcut(const Ref<InputEvent> &p_Event) const;
+ bool is_shortcut(const Ref<InputEvent> &p_event) const;
bool is_valid() const;
String get_as_text() const;
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 484051f546..b30a6000ff 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -339,7 +339,7 @@ void ItemList::set_same_column_width(bool p_enable) {
update();
shape_changed = true;
}
-int ItemList::is_same_column_width() const {
+bool ItemList::is_same_column_width() const {
return same_column_width;
}
@@ -736,10 +736,10 @@ void ItemList::_notification(int p_what) {
Ref<StyleBox> bg = get_stylebox("bg");
int mw = scroll_bar->get_minimum_size().x;
- scroll_bar->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, mw + bg->get_margin(MARGIN_RIGHT));
- scroll_bar->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, bg->get_margin(MARGIN_RIGHT));
+ scroll_bar->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -mw + bg->get_margin(MARGIN_RIGHT));
+ scroll_bar->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -bg->get_margin(MARGIN_RIGHT));
scroll_bar->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, bg->get_margin(MARGIN_TOP));
- scroll_bar->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, bg->get_margin(MARGIN_BOTTOM));
+ scroll_bar->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -bg->get_margin(MARGIN_BOTTOM));
Size2 size = get_size();
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 137eff8885..a80727f568 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -169,9 +169,9 @@ public:
int get_fixed_column_width() const;
void set_same_column_width(bool p_enable);
- int is_same_column_width() const;
+ bool is_same_column_width() const;
- void set_max_text_lines(int p_amount);
+ void set_max_text_lines(int p_lines);
int get_max_text_lines() const;
void set_max_columns(int p_amount);
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 874156821e..84074f96a8 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -63,7 +63,7 @@ void Label::_notification(int p_what) {
if (p_what == NOTIFICATION_TRANSLATION_CHANGED) {
- String new_text = XL_MESSAGE(text);
+ String new_text = tr(text);
if (new_text == xl_text)
return; //nothing new
xl_text = new_text;
@@ -493,7 +493,10 @@ void Label::regenerate_word_cache() {
minsize.height = (font->get_height() * line_count) + (line_spacing * (line_count - 1));
}
- minimum_size_changed();
+ if (!autowrap || !clip) {
+ //helps speed up some labels that may change a lot, as no resizing is requested. Do not change.
+ minimum_size_changed();
+ }
word_cache_dirty = false;
}
@@ -526,7 +529,7 @@ void Label::set_text(const String &p_string) {
if (text == p_string)
return;
text = p_string;
- xl_text = XL_MESSAGE(p_string);
+ xl_text = tr(p_string);
word_cache_dirty = true;
if (percent_visible < 1)
visible_chars = get_total_character_count() * percent_visible;
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index a5ae7eed66..10c3c84c1e 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -991,7 +991,7 @@ String LineEdit::get_text() const {
void LineEdit::set_placeholder(String p_text) {
- placeholder = XL_MESSAGE(p_text);
+ placeholder = tr(p_text);
update();
}
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 73c5a46937..fb0eaa9446 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -177,7 +177,7 @@ public:
virtual Size2 get_minimum_size() const;
- void set_expand_to_text_length(bool p_len);
+ void set_expand_to_text_length(bool p_enabled);
bool get_expand_to_text_length() const;
virtual bool is_text_field() const;
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 25ac8d5259..00df266a09 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -185,21 +185,21 @@ void OptionButton::clear() {
current = -1;
}
-void OptionButton::_select(int p_idx, bool p_emit) {
+void OptionButton::_select(int p_which, bool p_emit) {
- if (p_idx < 0)
+ if (p_which < 0)
return;
- if (p_idx == current)
+ if (p_which == current)
return;
- ERR_FAIL_INDEX(p_idx, popup->get_item_count());
+ ERR_FAIL_INDEX(p_which, popup->get_item_count());
for (int i = 0; i < popup->get_item_count(); i++) {
- popup->set_item_checked(i, i == p_idx);
+ popup->set_item_checked(i, i == p_which);
}
- current = p_idx;
+ current = p_which;
set_text(popup->get_item_text(current));
set_icon(popup->get_item_icon(current));
diff --git a/scene/gui/patch_9_rect.h b/scene/gui/patch_9_rect.h
index 602a6d22bf..636b9127e7 100644
--- a/scene/gui/patch_9_rect.h
+++ b/scene/gui/patch_9_rect.h
@@ -67,7 +67,7 @@ public:
void set_region_rect(const Rect2 &p_region_rect);
Rect2 get_region_rect() const;
- void set_draw_center(bool p_enable);
+ void set_draw_center(bool p_draw);
bool get_draw_center() const;
void set_h_axis_stretch_mode(AxisStretchMode p_mode);
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 54cc8b86fd..a0cd0eca8b 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -110,13 +110,10 @@ void Popup::set_as_minsize() {
float margin_begin = c->get_margin(m_beg);
float margin_end = c->get_margin(m_end);
- AnchorType anchor_begin = c->get_anchor(m_beg);
- AnchorType anchor_end = c->get_anchor(m_end);
+ float anchor_begin = c->get_anchor(m_beg);
+ float anchor_end = c->get_anchor(m_end);
- if (anchor_begin == ANCHOR_BEGIN)
- minsize[j] += margin_begin;
- if (anchor_end == ANCHOR_END)
- minsize[j] += margin_end;
+ minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end;
}
total_minsize.width = MAX(total_minsize.width, minsize.width);
@@ -147,13 +144,10 @@ void Popup::popup_centered_minsize(const Size2 &p_minsize) {
float margin_begin = c->get_margin(m_beg);
float margin_end = c->get_margin(m_end);
- AnchorType anchor_begin = c->get_anchor(m_beg);
- AnchorType anchor_end = c->get_anchor(m_end);
+ float anchor_begin = c->get_anchor(m_beg);
+ float anchor_end = c->get_anchor(m_end);
- if (anchor_begin == ANCHOR_BEGIN)
- minsize[j] += margin_begin;
- if (anchor_end == ANCHOR_END)
- minsize[j] += margin_end;
+ minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end;
}
total_minsize.width = MAX(total_minsize.width, minsize.width);
@@ -211,15 +205,15 @@ void Popup::popup_centered_ratio(float p_screen_ratio) {
popped_up = true;
}
-void Popup::popup(const Rect2 &bounds) {
+void Popup::popup(const Rect2 &p_bounds) {
emit_signal("about_to_show");
show_modal(exclusive);
// Fit the popup into the optionally provided bounds.
- if (!bounds.has_no_area()) {
- set_position(bounds.position);
- set_size(bounds.size);
+ if (!p_bounds.has_no_area()) {
+ set_position(p_bounds.position);
+ set_size(p_bounds.size);
}
_fix_size();
@@ -284,9 +278,10 @@ void PopupPanel::set_child_rect(Control *p_child) {
Ref<StyleBox> p = get_stylebox("panel");
p_child->set_area_as_parent_rect();
- for (int i = 0; i < 4; i++) {
- p_child->set_margin(Margin(i), p->get_margin(Margin(i)));
- }
+ p_child->set_margin(MARGIN_LEFT, p->get_margin(MARGIN_LEFT));
+ p_child->set_margin(MARGIN_RIGHT, -p->get_margin(MARGIN_RIGHT));
+ p_child->set_margin(MARGIN_TOP, p->get_margin(MARGIN_TOP));
+ p_child->set_margin(MARGIN_BOTTOM, -p->get_margin(MARGIN_BOTTOM));
}
void PopupPanel::_notification(int p_what) {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 46aa0e5054..1ba936c4e9 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -395,7 +395,7 @@ void PopupMenu::_notification(int p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
for (int i = 0; i < items.size(); i++) {
- items[i].xl_text = XL_MESSAGE(items[i].text);
+ items[i].xl_text = tr(items[i].text);
}
minimum_size_changed();
@@ -513,7 +513,7 @@ void PopupMenu::add_icon_item(const Ref<Texture> &p_icon, const String &p_label,
Item item;
item.icon = p_icon;
item.text = p_label;
- item.xl_text = XL_MESSAGE(p_label);
+ item.xl_text = tr(p_label);
item.accel = p_accel;
item.ID = p_ID;
items.push_back(item);
@@ -523,7 +523,7 @@ void PopupMenu::add_item(const String &p_label, int p_ID, uint32_t p_accel) {
Item item;
item.text = p_label;
- item.xl_text = XL_MESSAGE(p_label);
+ item.xl_text = tr(p_label);
item.accel = p_accel;
item.ID = p_ID;
items.push_back(item);
@@ -534,7 +534,7 @@ void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu,
Item item;
item.text = p_label;
- item.xl_text = XL_MESSAGE(p_label);
+ item.xl_text = tr(p_label);
item.ID = p_ID;
item.submenu = p_submenu;
items.push_back(item);
@@ -546,7 +546,7 @@ void PopupMenu::add_icon_check_item(const Ref<Texture> &p_icon, const String &p_
Item item;
item.icon = p_icon;
item.text = p_label;
- item.xl_text = XL_MESSAGE(p_label);
+ item.xl_text = tr(p_label);
item.accel = p_accel;
item.ID = p_ID;
item.checkable = true;
@@ -557,7 +557,7 @@ void PopupMenu::add_check_item(const String &p_label, int p_ID, uint32_t p_accel
Item item;
item.text = p_label;
- item.xl_text = XL_MESSAGE(p_label);
+ item.xl_text = tr(p_label);
item.accel = p_accel;
item.ID = p_ID;
item.checkable = true;
@@ -628,7 +628,7 @@ void PopupMenu::set_item_text(int p_idx, const String &p_text) {
ERR_FAIL_INDEX(p_idx, items.size());
items[p_idx].text = p_text;
- items[p_idx].xl_text = XL_MESSAGE(p_text);
+ items[p_idx].xl_text = tr(p_text);
update();
}
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index cbfe7873e6..37714ee989 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -140,7 +140,7 @@ public:
uint32_t get_item_accelerator(int p_idx) const;
Variant get_item_metadata(int p_idx) const;
bool is_item_disabled(int p_idx) const;
- String get_item_submenu(int p_ID) const;
+ String get_item_submenu(int p_idx) const;
bool is_item_separator(int p_idx) const;
bool is_item_checkable(int p_idx) const;
String get_item_tooltip(int p_idx) const;
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 0e4004c27b..42084ade25 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -594,7 +594,7 @@ void RichTextLabel::_update_scroll() {
main->first_invalid_line = 0;
scroll_w = vscroll->get_combined_minimum_size().width;
vscroll->show();
- vscroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, scroll_w);
+ vscroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -scroll_w);
_validate_line_caches(main);
} else {
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index 409a8f6b3f..71fa766958 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -296,7 +296,7 @@ public:
void push_align(Align p_align);
void push_indent(int p_level);
void push_list(ListType p_list);
- void push_meta(const Variant &p_data);
+ void push_meta(const Variant &p_meta);
void push_table(int p_columns);
void set_table_column_expand(int p_column, bool p_expand, int p_ratio = 1);
int get_current_table_column() const;
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index bd66cd2745..6519cde6d3 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -98,7 +98,18 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (ofs < grabber_ofs) {
- set_value(get_value() - get_page());
+ if (scrolling) {
+ target_scroll = target_scroll - get_page();
+ } else {
+ target_scroll = get_value() - get_page();
+ }
+
+ if (smooth_scroll_enabled) {
+ scrolling = true;
+ set_fixed_process(true);
+ } else {
+ set_value(target_scroll);
+ }
return;
}
@@ -111,8 +122,18 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
drag.value_at_click = get_as_ratio();
update();
} else {
+ if (scrolling) {
+ target_scroll = target_scroll + get_page();
+ } else {
+ target_scroll = get_value() + get_page();
+ }
- set_value(get_value() + get_page());
+ if (smooth_scroll_enabled) {
+ scrolling = true;
+ set_fixed_process(true);
+ } else {
+ set_value(target_scroll);
+ }
}
} else {
@@ -233,7 +254,14 @@ void ScrollBar::_notification(int p_what) {
Ref<Texture> decr = highlight == HIGHLIGHT_DECR ? get_icon("decrement_highlight") : get_icon("decrement");
Ref<Texture> incr = highlight == HIGHLIGHT_INCR ? get_icon("increment_highlight") : get_icon("increment");
Ref<StyleBox> bg = has_focus() ? get_stylebox("scroll_focus") : get_stylebox("scroll");
- Ref<StyleBox> grabber = (drag.active || highlight == HIGHLIGHT_RANGE) ? get_stylebox("grabber_highlight") : get_stylebox("grabber");
+
+ Ref<StyleBox> grabber;
+ if (drag.active)
+ grabber = get_stylebox("grabber_pressed");
+ else if (highlight == HIGHLIGHT_RANGE)
+ grabber = get_stylebox("grabber_highlight");
+ else
+ grabber = get_stylebox("grabber");
Point2 ofs;
@@ -304,7 +332,22 @@ void ScrollBar::_notification(int p_what) {
if (p_what == NOTIFICATION_FIXED_PROCESS) {
- if (drag_slave_touching) {
+ if (scrolling) {
+ if (get_value() != target_scroll) {
+ double target = target_scroll - get_value();
+ double dist = sqrt(target * target);
+ double vel = ((target / dist) * 500) * get_fixed_process_delta_time();
+
+ if (vel >= dist) {
+ set_value(target_scroll);
+ } else {
+ set_value(get_value() + vel);
+ }
+ } else {
+ scrolling = false;
+ set_fixed_process(false);
+ }
+ } else if (drag_slave_touching) {
if (drag_slave_touching_deaccel) {
@@ -632,6 +675,14 @@ NodePath ScrollBar::get_drag_slave() const {
return drag_slave_path;
}
+void ScrollBar::set_smooth_scroll_enabled(bool p_enable) {
+ smooth_scroll_enabled = p_enable;
+}
+
+bool ScrollBar::is_smooth_scroll_enabled() const {
+ return smooth_scroll_enabled;
+}
+
#if 0
void ScrollBar::mouse_button(const Point2& p_pos, int b->get_button_index(),bool b->is_pressed(),int p_modifier_mask) {
@@ -788,6 +839,10 @@ ScrollBar::ScrollBar(Orientation p_orientation) {
drag_slave_touching = false;
drag_slave_touching_deaccel = false;
+ scrolling = false;
+ target_scroll = 0;
+ smooth_scroll_enabled = false;
+
if (focus_by_default)
set_focus_mode(FOCUS_ALL);
set_step(0);
diff --git a/scene/gui/scroll_bar.h b/scene/gui/scroll_bar.h
index 8310e12590..e22d4da46d 100644
--- a/scene/gui/scroll_bar.h
+++ b/scene/gui/scroll_bar.h
@@ -83,6 +83,10 @@ class ScrollBar : public Range {
bool drag_slave_touching_deaccel;
bool click_handled;
+ bool scrolling;
+ double target_scroll;
+ bool smooth_scroll_enabled;
+
void _drag_slave_exit();
void _drag_slave_input(const Ref<InputEvent> &p_input);
@@ -100,6 +104,9 @@ public:
void set_drag_slave(const NodePath &p_path);
NodePath get_drag_slave() const;
+ void set_smooth_scroll_enabled(bool p_enable);
+ bool is_smooth_scroll_enabled() const;
+
virtual Size2 get_minimum_size() const;
ScrollBar(Orientation p_orientation = VERTICAL);
~ScrollBar();
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index cc1a637d2b..939bdd8d0c 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -187,14 +187,14 @@ void ScrollContainer::_update_scrollbar_pos() {
Size2 hmin = h_scroll->get_combined_minimum_size();
Size2 vmin = v_scroll->get_combined_minimum_size();
- v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, vmin.width);
+ v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -vmin.width);
v_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
v_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
h_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
- h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, hmin.height);
+ h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -hmin.height);
h_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
h_scroll->raise();
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 4b8b180b0e..d32b899de7 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -231,7 +231,7 @@ void TabContainer::_notification(int p_what) {
// Draw the tab contents.
Control *control = tabs[i + first_tab_cache]->cast_to<Control>();
- String text = control->has_meta("_tab_name") ? String(XL_MESSAGE(String(control->get_meta("_tab_name")))) : String(control->get_name());
+ String text = control->has_meta("_tab_name") ? String(tr(String(control->get_meta("_tab_name")))) : String(control->get_name());
int x_content = tab_rect.position.x + tab_style->get_margin(MARGIN_LEFT);
int top_margin = tab_style->get_margin(MARGIN_TOP);
@@ -299,7 +299,7 @@ int TabContainer::_get_tab_width(int p_index) const {
// Get the width of the text displayed on the tab.
Ref<Font> font = get_font("font");
- String text = control->has_meta("_tab_name") ? String(XL_MESSAGE(String(control->get_meta("_tab_name")))) : String(control->get_name());
+ String text = control->has_meta("_tab_name") ? String(tr(String(control->get_meta("_tab_name")))) : String(control->get_name());
int width = font->get_string_size(text).width;
// Add space for a tab icon.
@@ -371,8 +371,10 @@ void TabContainer::add_child_notify(Node *p_child) {
if (tabs_visible)
c->set_margin(MARGIN_TOP, _get_top_margin());
Ref<StyleBox> sb = get_stylebox("panel");
- for (int i = 0; i < 4; i++)
- c->set_margin(Margin(i), c->get_margin(Margin(i)) + sb->get_margin(Margin(i)));
+ c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP)));
+ c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT)));
+ c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT)));
+ c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM)));
update();
p_child->connect("renamed", this, "_child_renamed_callback");
@@ -402,8 +404,10 @@ void TabContainer::set_current_tab(int p_current) {
c->set_area_as_parent_rect();
if (tabs_visible)
c->set_margin(MARGIN_TOP, _get_top_margin());
- for (int i = 0; i < 4; i++)
- c->set_margin(Margin(i), c->get_margin(Margin(i)) + sb->get_margin(Margin(i)));
+ c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP)));
+ c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT)));
+ c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT)));
+ c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM)));
} else
c->hide();
@@ -544,11 +548,11 @@ Ref<Texture> TabContainer::get_tab_icon(int p_tab) const {
return Ref<Texture>();
}
-void TabContainer::set_tab_disabled(int p_tab, bool p_enabled) {
+void TabContainer::set_tab_disabled(int p_tab, bool p_disabled) {
Control *child = _get_tab(p_tab);
ERR_FAIL_COND(!child);
- child->set_meta("_tab_disabled", p_enabled);
+ child->set_meta("_tab_disabled", p_disabled);
update();
}
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 1105c6b298..3e1a2c1598 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -54,7 +54,7 @@ private:
bool tabs_visible;
bool buttons_visible_cache;
TabAlign align;
- Control *_get_tab(int idx) const;
+ Control *_get_tab(int p_idx) const;
int _get_top_margin() const;
Popup *popup;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 7b0d14c1a9..f99cbbad89 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -338,6 +338,11 @@ void TextEdit::_update_scrollbars() {
v_scroll->show();
v_scroll->set_max(total_rows);
v_scroll->set_page(visible_rows);
+ if (smooth_scroll_enabled) {
+ v_scroll->set_step(0.25);
+ } else {
+ v_scroll->set_step(1);
+ }
if (fabs(v_scroll->get_value() - (double)cursor.line_ofs) >= 1) {
v_scroll->set_value(cursor.line_ofs);
@@ -420,6 +425,24 @@ void TextEdit::_notification(int p_what) {
draw_caret = false;
update();
} break;
+ case NOTIFICATION_FIXED_PROCESS: {
+ if (scrolling && v_scroll->get_value() != target_v_scroll) {
+ double target_y = target_v_scroll - v_scroll->get_value();
+ double dist = sqrt(target_y * target_y);
+ double vel = ((target_y / dist) * 50) * get_fixed_process_delta_time();
+
+ if (vel >= dist) {
+ v_scroll->set_value(target_v_scroll);
+ scrolling = false;
+ set_fixed_process(false);
+ } else {
+ v_scroll->set_value(v_scroll->get_value() + vel);
+ }
+ } else {
+ scrolling = false;
+ set_fixed_process(false);
+ }
+ } break;
case NOTIFICATION_DRAW: {
if ((!has_focus() && !menu->has_focus()) || !window_has_focus) {
@@ -454,6 +477,7 @@ void TextEdit::_notification(int p_what) {
_update_scrollbars();
RID ci = get_canvas_item();
+ VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true);
int xmargin_beg = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width;
int xmargin_end = cache.size.width - cache.style_normal->get_margin(MARGIN_RIGHT);
//let's do it easy for now:
@@ -463,7 +487,7 @@ void TextEdit::_notification(int p_what) {
int ascent = cache.font->get_ascent();
- int visible_rows = get_visible_rows();
+ int visible_rows = get_visible_rows() + 1;
int tab_w = cache.font->get_char_size(' ').width * indent_size;
@@ -674,7 +698,11 @@ void TextEdit::_notification(int p_what) {
int char_margin = xmargin_beg - cursor.x_ofs;
int char_ofs = 0;
- int ofs_y = i * get_row_height() + cache.line_spacing / 2;
+ int ofs_y = (i * get_row_height() + cache.line_spacing / 2);
+ if (smooth_scroll_enabled) {
+ ofs_y -= (v_scroll->get_value() - cursor.line_ofs) * get_row_height();
+ }
+
bool prev_is_char = false;
bool prev_is_number = false;
bool in_keyword = false;
@@ -1028,6 +1056,8 @@ void TextEdit::_notification(int p_what) {
if (cursor.column == j && cursor.line == line && block_caret && draw_caret && !insert_mode) {
color = cache.caret_background_color;
+ } else if (!syntax_coloring && block_caret) {
+ color = cache.font_color;
}
if (str[j] >= 32) {
@@ -1498,7 +1528,7 @@ void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) co
float rows = p_mouse.y;
rows -= cache.style_normal->get_margin(MARGIN_TOP);
rows /= get_row_height();
- int row = cursor.line_ofs + rows;
+ int row = cursor.line_ofs + (rows + (v_scroll->get_value() - cursor.line_ofs));
if (row < 0)
row = 0;
@@ -1564,10 +1594,43 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (mb->is_pressed()) {
if (mb->get_button_index() == BUTTON_WHEEL_UP && !mb->get_command()) {
- v_scroll->set_value(v_scroll->get_value() - (3 * mb->get_factor()));
+ if (scrolling) {
+ target_v_scroll = (target_v_scroll - (3 * mb->get_factor()));
+ } else {
+ target_v_scroll = (v_scroll->get_value() - (3 * mb->get_factor()));
+ }
+
+ if (smooth_scroll_enabled) {
+ if (target_v_scroll <= 0) {
+ target_v_scroll = 0;
+ }
+ scrolling = true;
+ set_fixed_process(true);
+ } else {
+ v_scroll->set_value(target_v_scroll);
+ }
}
if (mb->get_button_index() == BUTTON_WHEEL_DOWN && !mb->get_command()) {
- v_scroll->set_value(v_scroll->get_value() + (3 * mb->get_factor()));
+ if (scrolling) {
+ target_v_scroll = (target_v_scroll + (3 * mb->get_factor()));
+ } else {
+ target_v_scroll = (v_scroll->get_value() + (3 * mb->get_factor()));
+ }
+
+ if (smooth_scroll_enabled) {
+ int max_v_scroll = get_line_count() - 1;
+ if (!scroll_past_end_of_file_enabled) {
+ max_v_scroll -= get_visible_rows() - 1;
+ }
+
+ if (target_v_scroll > max_v_scroll) {
+ target_v_scroll = max_v_scroll;
+ }
+ scrolling = true;
+ set_fixed_process(true);
+ } else {
+ v_scroll->set_value(target_v_scroll);
+ }
}
if (mb->get_button_index() == BUTTON_WHEEL_LEFT) {
h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor()));
@@ -2248,6 +2311,13 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
#endif
bool prev_char = false;
int cc = cursor.column;
+
+ if (cc == 0 && cursor.line > 0) {
+ cursor_set_line(cursor.line - 1);
+ cursor_set_column(text[cursor.line].length());
+ break;
+ }
+
while (cc > 0) {
bool ischar = _is_text_char(text[cursor.line][cc - 1]);
@@ -2305,6 +2375,13 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
#endif
bool prev_char = false;
int cc = cursor.column;
+
+ if (cc == text[cursor.line].length() && cursor.line < text.size() - 1) {
+ cursor_set_line(cursor.line + 1);
+ cursor_set_column(0);
+ break;
+ }
+
while (cc < text[cursor.line].length()) {
bool ischar = _is_text_char(text[cursor.line][cc]);
@@ -2933,7 +3010,7 @@ void TextEdit::_base_remove_text(int p_from_line, int p_from_column, int p_to_li
}
}
-void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r_end_line, int *r_end_column) {
+void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r_end_line, int *r_end_char) {
if (!setting_text)
idle_detect->start();
@@ -2946,8 +3023,8 @@ void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r
_base_insert_text(p_line, p_char, p_text, retline, retchar);
if (r_end_line)
*r_end_line = retline;
- if (r_end_column)
- *r_end_column = retchar;
+ if (r_end_char)
+ *r_end_char = retchar;
if (!undo_enabled)
return;
@@ -3095,7 +3172,7 @@ void TextEdit::adjust_viewport_to_cursor() {
visible_rows -= ((h_scroll->get_combined_minimum_size().height - 1) / get_row_height());
if (cursor.line >= (cursor.line_ofs + visible_rows))
- cursor.line_ofs = cursor.line - visible_rows + 1;
+ cursor.line_ofs = cursor.line - visible_rows;
if (cursor.line < cursor.line_ofs)
cursor.line_ofs = cursor.line;
@@ -4178,6 +4255,15 @@ void TextEdit::set_h_scroll(int p_scroll) {
h_scroll->set_value(p_scroll);
}
+void TextEdit::set_smooth_scroll_enabled(bool p_enable) {
+ v_scroll->set_smooth_scroll_enabled(p_enable);
+ smooth_scroll_enabled = p_enable;
+}
+
+bool TextEdit::is_smooth_scroll_enabled() const {
+ return smooth_scroll_enabled;
+}
+
void TextEdit::set_completion(bool p_enabled, const Vector<String> &p_prefixes) {
completion_prefixes.clear();
@@ -4678,6 +4764,9 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_syntax_coloring", "enable"), &TextEdit::set_syntax_coloring);
ClassDB::bind_method(D_METHOD("is_syntax_coloring_enabled"), &TextEdit::is_syntax_coloring_enabled);
+ ClassDB::bind_method(D_METHOD("set_smooth_scroll_enable", "enable"), &TextEdit::set_smooth_scroll_enabled);
+ ClassDB::bind_method(D_METHOD("is_smooth_scroll_enabled"), &TextEdit::is_smooth_scroll_enabled);
+
ClassDB::bind_method(D_METHOD("add_keyword_color", "keyword", "color"), &TextEdit::add_keyword_color);
ClassDB::bind_method(D_METHOD("add_color_region", "begin_key", "end_key", "color", "line_only"), &TextEdit::add_color_region, DEFVAL(false));
ClassDB::bind_method(D_METHOD("clear_colors"), &TextEdit::clear_colors);
@@ -4687,6 +4776,7 @@ void TextEdit::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "syntax_highlighting"), "set_syntax_coloring", "is_syntax_coloring_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_line_numbers"), "set_show_line_numbers", "is_show_line_numbers_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "highlight_all_occurrences"), "set_highlight_all_occurrences", "is_highlight_all_occurrences_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_scrolling"), "set_smooth_scroll_enable", "is_smooth_scroll_enabled");
ADD_GROUP("Caret", "caret_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret_block_mode"), "cursor_set_block_mode", "cursor_is_block_mode");
@@ -4823,6 +4913,9 @@ TextEdit::TextEdit() {
insert_mode = false;
window_has_focus = true;
select_identifiers_enabled = false;
+ smooth_scroll_enabled = false;
+ scrolling = false;
+ target_v_scroll = 0;
raised_from_completion = false;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index afb4b1c547..c4e0700531 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -152,7 +152,7 @@ class TextEdit : public Control {
int get_line_width(int p_line) const;
int get_max_width() const;
const Map<int, ColorRegionInfo> &get_color_region_info(int p_line);
- void set(int p_line, const String &p_string);
+ void set(int p_line, const String &p_text);
void set_marked(int p_line, bool p_marked) { text[p_line].marked = p_marked; }
bool is_marked(int p_line) const { return text[p_line].marked; }
void set_breakpoint(int p_line, bool p_breakpoint) { text[p_line].breakpoint = p_breakpoint; }
@@ -256,6 +256,10 @@ class TextEdit : public Control {
bool insert_mode;
bool select_identifiers_enabled;
+ bool smooth_scroll_enabled;
+ bool scrolling;
+ float target_v_scroll;
+
bool raised_from_completion;
String highlighted_word;
@@ -288,8 +292,8 @@ class TextEdit : public Control {
int get_char_count();
- int get_char_pos_for(int p_px, String p_pos) const;
- int get_column_x_offset(int p_column, String p_pos);
+ int get_char_pos_for(int p_px, String p_str) const;
+ int get_column_x_offset(int p_char, String p_str);
void adjust_viewport_to_cursor();
void _scroll_moved(double);
@@ -320,7 +324,7 @@ class TextEdit : public Control {
/* super internal api, undo/redo builds on it */
- void _base_insert_text(int p_line, int p_column, const String &p_text, int &r_end_line, int &r_end_column);
+ void _base_insert_text(int p_line, int p_char, const String &p_text, int &r_end_line, int &r_end_column);
String _base_get_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column) const;
void _base_remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column);
@@ -339,10 +343,10 @@ class TextEdit : public Control {
protected:
virtual String get_tooltip(const Point2 &p_pos) const;
- void _insert_text(int p_line, int p_column, const String &p_text, int *r_end_line = NULL, int *r_end_char = NULL);
+ void _insert_text(int p_line, int p_char, const String &p_text, int *r_end_line = NULL, int *r_end_char = NULL);
void _remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column);
void _insert_text_at_cursor(const String &p_text);
- void _gui_input(const Ref<InputEvent> &p_input);
+ void _gui_input(const Ref<InputEvent> &p_gui_input);
void _notification(int p_what);
void _consume_pair_symbol(CharType ch);
@@ -487,6 +491,9 @@ public:
int get_h_scroll() const;
void set_h_scroll(int p_scroll);
+ void set_smooth_scroll_enabled(bool p_enable);
+ bool is_smooth_scroll_enabled() const;
+
uint32_t get_version() const;
uint32_t get_saved_version() const;
void tag_saved_version();
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp
index 00849c4e5a..7abf8380ce 100644
--- a/scene/gui/texture_button.cpp
+++ b/scene/gui/texture_button.cpp
@@ -286,8 +286,8 @@ void TextureButton::set_expand(bool p_expand) {
update();
}
-void TextureButton::set_stretch_mode(StretchMode p_mode) {
- stretch_mode = p_mode;
+void TextureButton::set_stretch_mode(StretchMode p_stretch_mode) {
+ stretch_mode = p_stretch_mode;
update();
}
diff --git a/scene/gui/texture_button.h b/scene/gui/texture_button.h
index 9c31912a32..8df30cd35a 100644
--- a/scene/gui/texture_button.h
+++ b/scene/gui/texture_button.h
@@ -69,7 +69,7 @@ public:
void set_hover_texture(const Ref<Texture> &p_hover);
void set_disabled_texture(const Ref<Texture> &p_disabled);
void set_focused_texture(const Ref<Texture> &p_focused);
- void set_click_mask(const Ref<BitMap> &p_image);
+ void set_click_mask(const Ref<BitMap> &p_click_mask);
Ref<Texture> get_normal_texture() const;
Ref<Texture> get_pressed_texture() const;
@@ -81,7 +81,7 @@ public:
bool get_expand() const;
void set_expand(bool p_expand);
- void set_stretch_mode(StretchMode stretch_mode);
+ void set_stretch_mode(StretchMode p_stretch_mode);
StretchMode get_stretch_mode() const;
TextureButton();
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index fa499ff277..3e8d8aed8a 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1455,7 +1455,7 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c
if (select_mode == SELECT_ROW) {
- if (p_selected == p_current && !c.selected) {
+ if (p_selected == p_current && (!c.selected || allow_reselect)) {
c.selected = true;
selected_item = p_selected;
selected_col = 0;
@@ -1478,7 +1478,7 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c
if (!r_in_range && &selected_cell == &c) {
- if (!selected_cell.selected || force_select_on_already_selected) {
+ if (!selected_cell.selected || allow_reselect) {
selected_cell.selected = true;
@@ -1743,7 +1743,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
/* editing */
- bool bring_up_editor = force_select_on_already_selected ? (c.selected && already_selected) : c.selected;
+ bool bring_up_editor = allow_reselect ? (c.selected && already_selected) : c.selected;
String editor_text = c.text;
switch (c.mode) {
@@ -3557,16 +3557,6 @@ int Tree::get_drop_mode_flags() const {
return drop_mode_flags;
}
-void Tree::set_single_select_cell_editing_only_when_already_selected(bool p_enable) {
-
- force_select_on_already_selected = p_enable;
-}
-
-bool Tree::get_single_select_cell_editing_only_when_already_selected() const {
-
- return force_select_on_already_selected;
-}
-
void Tree::set_edit_checkbox_cell_only_when_checkbox_is_pressed(bool p_enable) {
force_edit_checkbox_only_on_checkbox = p_enable;
@@ -3587,6 +3577,15 @@ bool Tree::get_allow_rmb_select() const {
return allow_rmb_select;
}
+void Tree::set_allow_reselect(bool p_allow) {
+ allow_reselect = p_allow;
+}
+
+bool Tree::get_allow_reselect() const {
+
+ return allow_reselect;
+}
+
void Tree::_bind_methods() {
ClassDB::bind_method(D_METHOD("_range_click_timeout"), &Tree::_range_click_timeout);
@@ -3640,8 +3639,8 @@ void Tree::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_allow_rmb_select", "allow"), &Tree::set_allow_rmb_select);
ClassDB::bind_method(D_METHOD("get_allow_rmb_select"), &Tree::get_allow_rmb_select);
- ClassDB::bind_method(D_METHOD("set_single_select_cell_editing_only_when_already_selected", "enable"), &Tree::set_single_select_cell_editing_only_when_already_selected);
- ClassDB::bind_method(D_METHOD("get_single_select_cell_editing_only_when_already_selected"), &Tree::get_single_select_cell_editing_only_when_already_selected);
+ ClassDB::bind_method(D_METHOD("set_allow_reselect", "allow"), &Tree::set_allow_reselect);
+ ClassDB::bind_method(D_METHOD("get_allow_reselect"), &Tree::get_allow_reselect);
ADD_SIGNAL(MethodInfo("item_selected"));
ADD_SIGNAL(MethodInfo("cell_selected"));
@@ -3751,7 +3750,6 @@ Tree::Tree() {
drop_mode_over = NULL;
drop_mode_section = 0;
single_select_defer = NULL;
- force_select_on_already_selected = false;
allow_rmb_select = false;
force_edit_checkbox_only_on_checkbox = false;
@@ -3760,6 +3758,8 @@ Tree::Tree() {
cache.hover_item = NULL;
cache.hover_cell = -1;
+
+ allow_reselect = false;
}
Tree::~Tree() {
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index d3715c3c43..1e46956cd9 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -471,7 +471,7 @@ private:
TreeItem *_search_item_text(TreeItem *p_at, const String &p_find, int *r_col, bool p_selectable, bool p_backwards = false);
- TreeItem *_find_item_at_pos(TreeItem *p_current, const Point2 &p_pos, int &r_column, int &h, int &section) const;
+ TreeItem *_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_column, int &h, int &section) const;
/* float drag_speed;
float drag_accum;
@@ -490,7 +490,8 @@ private:
bool allow_rmb_select;
bool scrolling;
- bool force_select_on_already_selected;
+ bool allow_reselect;
+
bool force_edit_checkbox_only_on_checkbox;
bool hide_folding;
@@ -524,7 +525,7 @@ public:
void set_column_expand(int p_column, bool p_expand);
int get_column_width(int p_column) const;
- void set_hide_root(bool p_eanbled);
+ void set_hide_root(bool p_enabled);
TreeItem *get_next_selected(TreeItem *p_item);
TreeItem *get_selected() const;
int get_selected_column() const;
@@ -566,15 +567,15 @@ public:
void set_drop_mode_flags(int p_flags);
int get_drop_mode_flags() const;
- void set_single_select_cell_editing_only_when_already_selected(bool p_enable);
- bool get_single_select_cell_editing_only_when_already_selected() const;
-
void set_edit_checkbox_cell_only_when_checkbox_is_pressed(bool p_enable);
bool get_edit_checkbox_cell_only_when_checkbox_is_pressed() const;
void set_allow_rmb_select(bool p_allow);
bool get_allow_rmb_select() const;
+ void set_allow_reselect(bool p_allow);
+ bool get_allow_reselect() const;
+
void set_value_evaluator(ValueEvaluator *p_evaluator);
Tree();
diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h
index 1d70718a6a..87c452509b 100644
--- a/scene/gui/video_player.h
+++ b/scene/gui/video_player.h
@@ -105,7 +105,7 @@ public:
String get_stream_name() const;
float get_stream_pos() const;
- void set_autoplay(bool p_vol);
+ void set_autoplay(bool p_enable);
bool has_autoplay() const;
void set_audio_track(int p_track);
diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h
index 1be6f8be24..b14a915fe8 100644
--- a/scene/main/canvas_layer.h
+++ b/scene/main/canvas_layer.h
@@ -55,7 +55,7 @@ class CanvasLayer : public Node {
int sort_index;
// Deprecated, should be removed in a future version.
- void _set_rotationd(real_t p_rotation);
+ void _set_rotationd(real_t p_degrees);
real_t _get_rotationd() const;
void _update_xform();
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 0d872d906e..0474c6fd26 100755
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1301,8 +1301,9 @@ String Node::_generate_serial_child_name(Node *p_child) {
}
}
+ int num_places = nums.length();
for (;;) {
- String attempt = (name + (num > 0 || explicit_zero ? nnsep + itos(num) : "")).strip_edges();
+ String attempt = (name + (num > 0 || explicit_zero ? nnsep + itos(num).pad_zeros(num_places) : "")).strip_edges();
bool found = false;
for (int i = 0; i < data.children.size(); i++) {
if (data.children[i] == p_child)
diff --git a/scene/main/node.h b/scene/main/node.h
index 0447deccc1..bb8d80a0c8 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -32,8 +32,8 @@
#include "class_db.h"
#include "map.h"
-#include "object.h"
#include "node_path.h"
+#include "object.h"
#include "project_settings.h"
#include "scene/main/scene_tree.h"
#include "script_language.h"
@@ -303,14 +303,14 @@ public:
float get_fixed_process_delta_time() const;
bool is_fixed_processing() const;
- void set_process(bool p_process);
+ void set_process(bool p_idle_process);
float get_process_delta_time() const;
bool is_processing() const;
- void set_fixed_process_internal(bool p_process);
+ void set_fixed_process_internal(bool p_process_internal);
bool is_fixed_processing_internal() const;
- void set_process_internal(bool p_process);
+ void set_process_internal(bool p_idle_process_internal);
bool is_processing_internal() const;
void set_process_input(bool p_enable);
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 432f4c94a5..8c0733e8b2 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -392,86 +392,11 @@ void SceneTree::input_event(const Ref<InputEvent> &p_event) {
Ref<InputEvent> ev = p_event;
ev->set_id(++last_id); //this should work better
-#if 0
- switch(ev.type) {
-
- case InputEvent::MOUSE_BUTTON: {
-
- Matrix32 ai = root->get_final_transform().affine_inverse();
- Vector2 g = ai.xform(Vector2(ev.mouse_button.global_x,ev.mouse_button.global_y));
- Vector2 l = ai.xform(Vector2(ev->get_pos().x,ev->get_pos().y));
- ev->get_pos().x=l.x;
- ev->get_pos().y=l.y;
- ev.mouse_button.global_x=g.x;
- ev.mouse_button.global_y=g.y;
-
- } break;
- case InputEvent::MOUSE_MOTION: {
-
- Matrix32 ai = root->get_final_transform().affine_inverse();
- Vector2 g = ai.xform(Vector2(ev.mouse_motion.global_x,ev.mouse_motion.global_y));
- Vector2 l = ai.xform(Vector2(ev.mouse_motion.x,ev.mouse_motion.y));
- Vector2 r = ai.xform(Vector2(ev->get_relative().x,ev->get_relative().y));
- ev.mouse_motion.x=l.x;
- ev.mouse_motion.y=l.y;
- ev.mouse_motion.global_x=g.x;
- ev.mouse_motion.global_y=g.y;
- ev->get_relative().x=r.x;
- ev->get_relative().y=r.y;
-
- } break;
- case InputEvent::SCREEN_TOUCH: {
-
- Matrix32 ai = root->get_final_transform().affine_inverse();
- Vector2 t = ai.xform(Vector2(ev.screen_touch.x,ev.screen_touch.y));
- ev.screen_touch.x=t.x;
- ev.screen_touch.y=t.y;
-
- } break;
- case InputEvent::SCREEN_DRAG: {
-
- Matrix32 ai = root->get_final_transform().affine_inverse();
- Vector2 t = ai.xform(Vector2(ev.screen_drag.x,ev.screen_drag.y));
- Vector2 r = ai.xform(Vector2(ev.screen_drag.relative_x,ev.screen_drag.relative_y));
- Vector2 s = ai.xform(Vector2(ev.screen_drag.speed_x,ev.screen_drag.speed_y));
- ev.screen_drag.x=t.x;
- ev.screen_drag.y=t.y;
- ev.screen_drag.relative_x=r.x;
- ev.screen_drag.relative_y=r.y;
- ev.screen_drag.speed_x=s.x;
- ev.screen_drag.speed_y=s.y;
- } break;
- }
-
-#endif
MainLoop::input_event(ev);
-#if 0
- _call_input_pause("input","_input",ev);
-
- call_group(GROUP_CALL_REVERSE|GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"_gui_input","_gui_input",p_event); //special one for GUI, as controls use their own process check
-
- //call_group(GROUP_CALL_REVERSE|GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"input","_input",ev);
-
- /*
- if (ev.type==InputEvent::KEY && ev->is_pressed() && !ev->is_echo() && ev->get_scancode()==KEY_F12) {
-
- print_line("RAM: "+itos(Memory::get_static_mem_usage()));
- print_line("DRAM: "+itos(Memory::get_dynamic_mem_usage()));
- }
- if (ev.type==InputEvent::KEY && ev->is_pressed() && !ev->is_echo() && ev->get_scancode()==KEY_F11) {
-
- Memory::dump_static_mem_to_file("memdump.txt");
- }
- */
-
- //transform for the rest
-#else
call_group_flags(GROUP_CALL_REALTIME, "_viewports", "_vp_input", ev); //special one for GUI, as controls use their own process check
-#endif
-
if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_remote()) {
//quit from game window using F8
Ref<InputEventKey> k = ev;
@@ -482,7 +407,7 @@ void SceneTree::input_event(const Ref<InputEvent> &p_event) {
_flush_ugc();
root_lock--;
- MessageQueue::get_singleton()->flush(); //small little hack
+ //MessageQueue::get_singleton()->flush(); //flushing here causes UI and other places slowness
root_lock++;
@@ -503,7 +428,7 @@ void SceneTree::input_event(const Ref<InputEvent> &p_event) {
input_handled = true;
_flush_ugc();
root_lock--;
- MessageQueue::get_singleton()->flush(); //small little hack
+ //MessageQueue::get_singleton()->flush(); //flushing here causes UI and other places slowness
} else {
input_handled = true;
root_lock--;
@@ -792,11 +717,11 @@ Ref<Material> SceneTree::get_debug_navigation_material() {
return navigation_material;
Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
- /* line_material->set_flag(Material::FLAG_UNSHADED, true);
- line_material->set_line_width(3.0);
- line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true);
- line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true);
- line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_color());*/
+ line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ line_material->set_albedo(get_debug_navigation_color());
navigation_material = line_material;
@@ -809,11 +734,11 @@ Ref<Material> SceneTree::get_debug_navigation_disabled_material() {
return navigation_disabled_material;
Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
- /* line_material->set_flag(Material::FLAG_UNSHADED, true);
- line_material->set_line_width(3.0);
- line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true);
- line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true);
- line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color());*/
+ line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ line_material->set_albedo(get_debug_navigation_disabled_color());
navigation_disabled_material = line_material;
@@ -825,11 +750,11 @@ Ref<Material> SceneTree::get_debug_collision_material() {
return collision_material;
Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
- /*line_material->set_flag(Material::FLAG_UNSHADED, true);
- line_material->set_line_width(3.0);
- line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true);
- line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true);
- line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_collisions_color());*/
+ line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ line_material->set_albedo(get_debug_collisions_color());
collision_material = line_material;
@@ -843,11 +768,12 @@ Ref<ArrayMesh> SceneTree::get_debug_contact_mesh() {
debug_contact_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
- Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
- /*mat->set_flag(Material::FLAG_UNSHADED,true);
- mat->set_flag(Material::FLAG_DOUBLE_SIDED,true);
- mat->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA,true);
- mat->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color());*/
+ Ref<SpatialMaterial> mat = Ref<SpatialMaterial>(memnew(SpatialMaterial));
+ mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
+ mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
+ mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ mat->set_albedo(get_debug_collision_contact_color());
Vector3 diamond[6] = {
Vector3(-1, 0, 0),
@@ -1172,7 +1098,7 @@ void SceneTree::_update_root_rect() {
} else if (viewport_aspect < video_mode_aspect) {
// screen ratio is smaller vertically
- if (stretch_aspect == STRETCH_ASPECT_KEEP_HEIGHT) {
+ if (stretch_aspect == STRETCH_ASPECT_KEEP_HEIGHT || stretch_aspect == STRETCH_ASPECT_EXPAND) {
//will stretch horizontally
viewport_size.x = desired_res.y * video_mode_aspect;
@@ -1187,7 +1113,7 @@ void SceneTree::_update_root_rect() {
}
} else {
//screen ratio is smaller horizontally
- if (stretch_aspect == STRETCH_ASPECT_KEEP_WIDTH) {
+ if (stretch_aspect == STRETCH_ASPECT_KEEP_WIDTH || stretch_aspect == STRETCH_ASPECT_EXPAND) {
//will stretch horizontally
viewport_size.x = desired_res.x;
@@ -1208,12 +1134,11 @@ void SceneTree::_update_root_rect() {
Size2 margin;
Size2 offset;
//black bars and margin
- if (screen_size.x < video_mode.x) {
+ if (stretch_aspect != STRETCH_ASPECT_EXPAND && screen_size.x < video_mode.x) {
margin.x = Math::round((video_mode.x - screen_size.x) / 2.0);
VisualServer::get_singleton()->black_bars_set_margins(margin.x, 0, margin.x, 0);
offset.x = Math::round(margin.x * viewport_size.y / screen_size.y);
- } else if (screen_size.y < video_mode.y) {
-
+ } else if (stretch_aspect != STRETCH_ASPECT_EXPAND && screen_size.y < video_mode.y) {
margin.y = Math::round((video_mode.y - screen_size.y) / 2.0);
VisualServer::get_singleton()->black_bars_set_margins(0, margin.y, 0, margin.y);
offset.y = Math::round(margin.y * viewport_size.x / screen_size.x);
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index a519d4f19a..5563bd33be 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -90,6 +90,7 @@ public:
STRETCH_ASPECT_KEEP,
STRETCH_ASPECT_KEEP_WIDTH,
STRETCH_ASPECT_KEEP_HEIGHT,
+ STRETCH_ASPECT_EXPAND,
};
private:
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 06743afbb8..7148cda5c4 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1473,8 +1473,8 @@ void Viewport::_gui_show_tooltip() {
gui.tooltip_label->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_LEFT));
gui.tooltip_label->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_TOP));
- gui.tooltip_label->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, ttp->get_margin(MARGIN_RIGHT));
- gui.tooltip_label->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, ttp->get_margin(MARGIN_BOTTOM));
+ gui.tooltip_label->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -ttp->get_margin(MARGIN_RIGHT));
+ gui.tooltip_label->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -ttp->get_margin(MARGIN_BOTTOM));
gui.tooltip_label->set_text(tooltip);
Rect2 r(gui.tooltip_pos + Point2(10, 10), gui.tooltip_label->get_combined_minimum_size() + ttp->get_minimum_size());
Rect2 vr = gui.tooltip_label->get_viewport_rect();
@@ -1932,8 +1932,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
Control *top = gui.modal_stack.back()->get();
if (over != top && !top->is_a_parent_of(over)) {
-
- return; // don't send motion event to anything below modal stack top
+ over = NULL; //nothing can be found outside the modal stack
}
}
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 459d3ffe41..a2ff45c623 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -733,7 +733,7 @@ int Animation::track_find_key(int p_track, float p_time, bool p_exact) const {
return -1;
}
-void Animation::track_insert_key(int p_track, float p_time, const Variant &p_value, float p_transition) {
+void Animation::track_insert_key(int p_track, float p_time, const Variant &p_key, float p_transition) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
@@ -742,7 +742,7 @@ void Animation::track_insert_key(int p_track, float p_time, const Variant &p_val
case TYPE_TRANSFORM: {
- Dictionary d = p_value;
+ Dictionary d = p_key;
Vector3 loc;
if (d.has("loc"))
loc = d["loc"];
@@ -766,7 +766,7 @@ void Animation::track_insert_key(int p_track, float p_time, const Variant &p_val
TKey<Variant> k;
k.time = p_time;
k.transition = p_transition;
- k.value = p_value;
+ k.value = p_key;
_insert(p_time, vt->values, k);
} break;
@@ -774,9 +774,9 @@ void Animation::track_insert_key(int p_track, float p_time, const Variant &p_val
MethodTrack *mt = static_cast<MethodTrack *>(t);
- ERR_FAIL_COND(p_value.get_type() != Variant::DICTIONARY);
+ ERR_FAIL_COND(p_key.get_type() != Variant::DICTIONARY);
- Dictionary d = p_value;
+ Dictionary d = p_key;
ERR_FAIL_COND(!d.has("method") || d["method"].get_type() != Variant::STRING);
ERR_FAIL_COND(!d.has("args") || !d["args"].is_array());
@@ -1871,7 +1871,7 @@ bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, cons
return erase;
}
-void Animation::_transform_track_optimize(int p_idx, float p_alowed_linear_err, float p_alowed_angular_err, float p_max_optimizable_angle) {
+void Animation::_transform_track_optimize(int p_idx, float p_allowed_linear_err, float p_allowed_angular_err, float p_max_optimizable_angle) {
ERR_FAIL_INDEX(p_idx, tracks.size());
ERR_FAIL_COND(tracks[p_idx]->type != TYPE_TRANSFORM);
@@ -1887,12 +1887,12 @@ void Animation::_transform_track_optimize(int p_idx, float p_alowed_linear_err,
TKey<TransformKey> &t1 = tt->transforms[i];
TKey<TransformKey> &t2 = tt->transforms[i + 1];
- bool erase = _transform_track_optimize_key(t0, t1, t2, p_alowed_linear_err, p_alowed_angular_err, p_max_optimizable_angle, norm);
+ bool erase = _transform_track_optimize_key(t0, t1, t2, p_allowed_linear_err, p_allowed_angular_err, p_max_optimizable_angle, norm);
if (erase && !prev_erased) {
norm = (t2.value.loc - t1.value.loc).normalized();
}
- if (prev_erased && !_transform_track_optimize_key(t0, first_erased, t2, p_alowed_linear_err, p_alowed_angular_err, p_max_optimizable_angle, norm)) {
+ if (prev_erased && !_transform_track_optimize_key(t0, first_erased, t2, p_allowed_linear_err, p_allowed_angular_err, p_max_optimizable_angle, norm)) {
//avoid error to go beyond first erased key
erase = false;
}
@@ -1914,12 +1914,12 @@ void Animation::_transform_track_optimize(int p_idx, float p_alowed_linear_err,
}
}
-void Animation::optimize(float p_allowed_linear_err, float p_allowed_angular_err, float p_angle_max) {
+void Animation::optimize(float p_allowed_linear_err, float p_allowed_angular_err, float p_max_optimizable_angle) {
for (int i = 0; i < tracks.size(); i++) {
if (tracks[i]->type == TYPE_TRANSFORM)
- _transform_track_optimize(i, p_allowed_linear_err, p_allowed_angular_err, p_angle_max);
+ _transform_track_optimize(i, p_allowed_linear_err, p_allowed_angular_err, p_max_optimizable_angle);
}
}
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index b363f2b666..27c58aba8c 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -212,7 +212,7 @@ private:
}
bool _transform_track_optimize_key(const TKey<TransformKey> &t0, const TKey<TransformKey> &t1, const TKey<TransformKey> &t2, float p_alowed_linear_err, float p_alowed_angular_err, float p_max_optimizable_angle, const Vector3 &p_norm);
- void _transform_track_optimize(int p_idx, float p_allowed_err = 0.05, float p_alowed_angular_err = 0.01, float p_max_optimizable_angle = Math_PI * 0.125);
+ void _transform_track_optimize(int p_idx, float p_allowed_linear_err = 0.05, float p_allowed_angular_err = 0.01, float p_max_optimizable_angle = Math_PI * 0.125);
protected:
bool _set(const StringName &p_name, const Variant &p_value);
diff --git a/scene/resources/color_ramp.h b/scene/resources/color_ramp.h
index d7ec20b324..d9f14205bb 100644
--- a/scene/resources/color_ramp.h
+++ b/scene/resources/color_ramp.h
@@ -60,7 +60,7 @@ public:
void add_point(float p_offset, const Color &p_color);
void remove_point(int p_index);
- void set_points(Vector<Point> &points);
+ void set_points(Vector<Point> &p_points);
Vector<Point> &get_points();
void set_offset(int pos, const float offset);
@@ -69,10 +69,10 @@ public:
void set_color(int pos, const Color &color);
Color get_color(int pos) const;
- void set_offsets(const Vector<float> &offsets);
+ void set_offsets(const Vector<float> &p_offsets);
Vector<float> get_offsets() const;
- void set_colors(const Vector<Color> &colors);
+ void set_colors(const Vector<Color> &p_colors);
Vector<Color> get_colors() const;
_FORCE_INLINE_ Color get_color_at_offset(float p_offset) {
diff --git a/scene/resources/curve.h b/scene/resources/curve.h
index 2815c12c4b..e302f1e0af 100644
--- a/scene/resources/curve.h
+++ b/scene/resources/curve.h
@@ -174,7 +174,7 @@ public:
void bake();
int get_bake_resolution() const { return _bake_resolution; }
- void set_bake_resolution(int p_interval);
+ void set_bake_resolution(int p_resolution);
real_t interpolate_baked(real_t offset);
protected:
@@ -242,7 +242,7 @@ public:
Vector2 interpolate(int p_index, float p_offset) const;
Vector2 interpolatef(real_t p_findex) const;
- void set_bake_interval(float p_distance);
+ void set_bake_interval(float p_tolerance);
float get_bake_interval() const;
float get_baked_length() const;
@@ -309,7 +309,7 @@ public:
Vector3 interpolate(int p_index, float p_offset) const;
Vector3 interpolatef(real_t p_findex) const;
- void set_bake_interval(float p_distance);
+ void set_bake_interval(float p_tolerance);
float get_bake_interval() const;
float get_baked_length() const;
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 3e612c745f..03288e45bf 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -203,7 +203,7 @@ static Ref<StyleBox> make_empty_stylebox(float p_margin_left = -1, float p_margi
return style;
}
-void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<Font> &large_font, Ref<Texture> &default_icon, Ref<StyleBox> &default_style, float p_scale) {
+void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const Ref<Font> &large_font, Ref<Texture> &default_icon, Ref<StyleBox> &default_style, float p_scale) {
scale = p_scale;
@@ -223,7 +223,7 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
// Panel
- t->set_stylebox("panel", "Panel", make_stylebox(panel_bg_png, 0, 0, 0, 0));
+ theme->set_stylebox("panel", "Panel", make_stylebox(panel_bg_png, 0, 0, 0, 0));
// Focus
@@ -240,63 +240,63 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
Ref<StyleBox> sb_button_disabled = sb_expand(make_stylebox(button_disabled_png, 4, 4, 4, 4, 6, 2, 6, 2), 2, 2, 2, 2);
Ref<StyleBox> sb_button_focus = sb_expand(make_stylebox(button_focus_png, 4, 4, 4, 4, 6, 2, 6, 2), 2, 2, 2, 2);
- t->set_stylebox("normal", "Button", sb_button_normal);
- t->set_stylebox("pressed", "Button", sb_button_pressed);
- t->set_stylebox("hover", "Button", sb_button_hover);
- t->set_stylebox("disabled", "Button", sb_button_disabled);
- t->set_stylebox("focus", "Button", sb_button_focus);
+ theme->set_stylebox("normal", "Button", sb_button_normal);
+ theme->set_stylebox("pressed", "Button", sb_button_pressed);
+ theme->set_stylebox("hover", "Button", sb_button_hover);
+ theme->set_stylebox("disabled", "Button", sb_button_disabled);
+ theme->set_stylebox("focus", "Button", sb_button_focus);
- t->set_font("font", "Button", default_font);
+ theme->set_font("font", "Button", default_font);
- t->set_color("font_color", "Button", control_font_color);
- t->set_color("font_color_pressed", "Button", control_font_color_pressed);
- t->set_color("font_color_hover", "Button", control_font_color_hover);
- t->set_color("font_color_disabled", "Button", control_font_color_disabled);
+ theme->set_color("font_color", "Button", control_font_color);
+ theme->set_color("font_color_pressed", "Button", control_font_color_pressed);
+ theme->set_color("font_color_hover", "Button", control_font_color_hover);
+ theme->set_color("font_color_disabled", "Button", control_font_color_disabled);
- t->set_constant("hseparation", "Button", 2 * scale);
+ theme->set_constant("hseparation", "Button", 2 * scale);
// LinkButton
- t->set_font("font", "LinkButton", default_font);
+ theme->set_font("font", "LinkButton", default_font);
- t->set_color("font_color", "LinkButton", control_font_color);
- t->set_color("font_color_pressed", "LinkButton", control_font_color_pressed);
- t->set_color("font_color_hover", "LinkButton", control_font_color_hover);
+ theme->set_color("font_color", "LinkButton", control_font_color);
+ theme->set_color("font_color_pressed", "LinkButton", control_font_color_pressed);
+ theme->set_color("font_color_hover", "LinkButton", control_font_color_hover);
- t->set_constant("underline_spacing", "LinkButton", 2 * scale);
+ theme->set_constant("underline_spacing", "LinkButton", 2 * scale);
// ColorPickerButton
- t->set_stylebox("normal", "ColorPickerButton", sb_button_normal);
- t->set_stylebox("pressed", "ColorPickerButton", sb_button_pressed);
- t->set_stylebox("hover", "ColorPickerButton", sb_button_hover);
- t->set_stylebox("disabled", "ColorPickerButton", sb_button_disabled);
- t->set_stylebox("focus", "ColorPickerButton", sb_button_focus);
+ theme->set_stylebox("normal", "ColorPickerButton", sb_button_normal);
+ theme->set_stylebox("pressed", "ColorPickerButton", sb_button_pressed);
+ theme->set_stylebox("hover", "ColorPickerButton", sb_button_hover);
+ theme->set_stylebox("disabled", "ColorPickerButton", sb_button_disabled);
+ theme->set_stylebox("focus", "ColorPickerButton", sb_button_focus);
- t->set_font("font", "ColorPickerButton", default_font);
+ theme->set_font("font", "ColorPickerButton", default_font);
- t->set_color("font_color", "ColorPickerButton", Color(1, 1, 1, 1));
- t->set_color("font_color_pressed", "ColorPickerButton", Color(0.8, 0.8, 0.8, 1));
- t->set_color("font_color_hover", "ColorPickerButton", Color(1, 1, 1, 1));
- t->set_color("font_color_disabled", "ColorPickerButton", Color(0.9, 0.9, 0.9, 0.3));
+ theme->set_color("font_color", "ColorPickerButton", Color(1, 1, 1, 1));
+ theme->set_color("font_color_pressed", "ColorPickerButton", Color(0.8, 0.8, 0.8, 1));
+ theme->set_color("font_color_hover", "ColorPickerButton", Color(1, 1, 1, 1));
+ theme->set_color("font_color_disabled", "ColorPickerButton", Color(0.9, 0.9, 0.9, 0.3));
- t->set_constant("hseparation", "ColorPickerButton", 2 * scale);
+ theme->set_constant("hseparation", "ColorPickerButton", 2 * scale);
// ToolButton
- t->set_stylebox("normal", "ToolButton", make_empty_stylebox(6, 4, 6, 4));
- t->set_stylebox("pressed", "ToolButton", make_stylebox(button_pressed_png, 4, 4, 4, 4, 6, 4, 6, 4));
- t->set_stylebox("hover", "ToolButton", make_stylebox(button_normal_png, 4, 4, 4, 4, 6, 4, 6, 4));
- t->set_stylebox("disabled", "ToolButton", make_empty_stylebox(6, 4, 6, 4));
- t->set_stylebox("focus", "ToolButton", focus);
- t->set_font("font", "ToolButton", default_font);
+ theme->set_stylebox("normal", "ToolButton", make_empty_stylebox(6, 4, 6, 4));
+ theme->set_stylebox("pressed", "ToolButton", make_stylebox(button_pressed_png, 4, 4, 4, 4, 6, 4, 6, 4));
+ theme->set_stylebox("hover", "ToolButton", make_stylebox(button_normal_png, 4, 4, 4, 4, 6, 4, 6, 4));
+ theme->set_stylebox("disabled", "ToolButton", make_empty_stylebox(6, 4, 6, 4));
+ theme->set_stylebox("focus", "ToolButton", focus);
+ theme->set_font("font", "ToolButton", default_font);
- t->set_color("font_color", "ToolButton", control_font_color);
- t->set_color("font_color_pressed", "ToolButton", control_font_color_pressed);
- t->set_color("font_color_hover", "ToolButton", control_font_color_hover);
- t->set_color("font_color_disabled", "ToolButton", Color(0.9, 0.95, 1, 0.3));
+ theme->set_color("font_color", "ToolButton", control_font_color);
+ theme->set_color("font_color_pressed", "ToolButton", control_font_color_pressed);
+ theme->set_color("font_color_hover", "ToolButton", control_font_color_hover);
+ theme->set_color("font_color_disabled", "ToolButton", Color(0.9, 0.95, 1, 0.3));
- t->set_constant("hseparation", "ToolButton", 3);
+ theme->set_constant("hseparation", "ToolButton", 3);
// OptionButton
@@ -306,44 +306,44 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
Ref<StyleBox> sb_optbutton_disabled = sb_expand(make_stylebox(option_button_disabled_png, 4, 4, 21, 4, 6, 2, 21, 2), 2, 2, 2, 2);
Ref<StyleBox> sb_optbutton_focus = sb_expand(make_stylebox(button_focus_png, 4, 4, 4, 4, 6, 2, 6, 2), 2, 2, 2, 2);
- t->set_stylebox("normal", "OptionButton", sb_optbutton_normal);
- t->set_stylebox("pressed", "OptionButton", sb_optbutton_pressed);
- t->set_stylebox("hover", "OptionButton", sb_optbutton_hover);
- t->set_stylebox("disabled", "OptionButton", sb_optbutton_disabled);
- t->set_stylebox("focus", "OptionButton", sb_button_focus);
+ theme->set_stylebox("normal", "OptionButton", sb_optbutton_normal);
+ theme->set_stylebox("pressed", "OptionButton", sb_optbutton_pressed);
+ theme->set_stylebox("hover", "OptionButton", sb_optbutton_hover);
+ theme->set_stylebox("disabled", "OptionButton", sb_optbutton_disabled);
+ theme->set_stylebox("focus", "OptionButton", sb_button_focus);
- t->set_icon("arrow", "OptionButton", make_icon(option_arrow_png));
+ theme->set_icon("arrow", "OptionButton", make_icon(option_arrow_png));
- t->set_font("font", "OptionButton", default_font);
+ theme->set_font("font", "OptionButton", default_font);
- t->set_color("font_color", "OptionButton", control_font_color);
- t->set_color("font_color_pressed", "OptionButton", control_font_color_pressed);
- t->set_color("font_color_hover", "OptionButton", control_font_color_hover);
- t->set_color("font_color_disabled", "OptionButton", control_font_color_disabled);
+ theme->set_color("font_color", "OptionButton", control_font_color);
+ theme->set_color("font_color_pressed", "OptionButton", control_font_color_pressed);
+ theme->set_color("font_color_hover", "OptionButton", control_font_color_hover);
+ theme->set_color("font_color_disabled", "OptionButton", control_font_color_disabled);
- t->set_constant("hseparation", "OptionButton", 2 * scale);
- t->set_constant("arrow_margin", "OptionButton", 2 * scale);
+ theme->set_constant("hseparation", "OptionButton", 2 * scale);
+ theme->set_constant("arrow_margin", "OptionButton", 2 * scale);
// MenuButton
- t->set_stylebox("normal", "MenuButton", sb_button_normal);
- t->set_stylebox("pressed", "MenuButton", sb_button_pressed);
- t->set_stylebox("hover", "MenuButton", sb_button_pressed);
- t->set_stylebox("disabled", "MenuButton", make_empty_stylebox(0, 0, 0, 0));
- t->set_stylebox("focus", "MenuButton", sb_button_focus);
+ theme->set_stylebox("normal", "MenuButton", sb_button_normal);
+ theme->set_stylebox("pressed", "MenuButton", sb_button_pressed);
+ theme->set_stylebox("hover", "MenuButton", sb_button_pressed);
+ theme->set_stylebox("disabled", "MenuButton", make_empty_stylebox(0, 0, 0, 0));
+ theme->set_stylebox("focus", "MenuButton", sb_button_focus);
- t->set_font("font", "MenuButton", default_font);
+ theme->set_font("font", "MenuButton", default_font);
- t->set_color("font_color", "MenuButton", control_font_color);
- t->set_color("font_color_pressed", "MenuButton", control_font_color_pressed);
- t->set_color("font_color_hover", "MenuButton", control_font_color_hover);
- t->set_color("font_color_disabled", "MenuButton", Color(1, 1, 1, 0.3));
+ theme->set_color("font_color", "MenuButton", control_font_color);
+ theme->set_color("font_color_pressed", "MenuButton", control_font_color_pressed);
+ theme->set_color("font_color_hover", "MenuButton", control_font_color_hover);
+ theme->set_color("font_color_disabled", "MenuButton", Color(1, 1, 1, 0.3));
- t->set_constant("hseparation", "MenuButton", 3 * scale);
+ theme->set_constant("hseparation", "MenuButton", 3 * scale);
// ButtonGroup
- t->set_stylebox("panel", "ButtonGroup", memnew(StyleBoxEmpty));
+ theme->set_stylebox("panel", "ButtonGroup", memnew(StyleBoxEmpty));
// CheckBox
@@ -358,26 +358,26 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
cbx_focus->set_default_margin(MARGIN_TOP, 4 * scale);
cbx_focus->set_default_margin(MARGIN_BOTTOM, 5 * scale);
- t->set_stylebox("normal", "CheckBox", cbx_empty);
- t->set_stylebox("pressed", "CheckBox", cbx_empty);
- t->set_stylebox("disabled", "CheckBox", cbx_empty);
- t->set_stylebox("hover", "CheckBox", cbx_empty);
- t->set_stylebox("focus", "CheckBox", cbx_focus);
+ theme->set_stylebox("normal", "CheckBox", cbx_empty);
+ theme->set_stylebox("pressed", "CheckBox", cbx_empty);
+ theme->set_stylebox("disabled", "CheckBox", cbx_empty);
+ theme->set_stylebox("hover", "CheckBox", cbx_empty);
+ theme->set_stylebox("focus", "CheckBox", cbx_focus);
- t->set_icon("checked", "CheckBox", make_icon(checked_png));
- t->set_icon("unchecked", "CheckBox", make_icon(unchecked_png));
- t->set_icon("radio_checked", "CheckBox", make_icon(radio_checked_png));
- t->set_icon("radio_unchecked", "CheckBox", make_icon(radio_unchecked_png));
+ theme->set_icon("checked", "CheckBox", make_icon(checked_png));
+ theme->set_icon("unchecked", "CheckBox", make_icon(unchecked_png));
+ theme->set_icon("radio_checked", "CheckBox", make_icon(radio_checked_png));
+ theme->set_icon("radio_unchecked", "CheckBox", make_icon(radio_unchecked_png));
- t->set_font("font", "CheckBox", default_font);
+ theme->set_font("font", "CheckBox", default_font);
- t->set_color("font_color", "CheckBox", control_font_color);
- t->set_color("font_color_pressed", "CheckBox", control_font_color_pressed);
- t->set_color("font_color_hover", "CheckBox", control_font_color_hover);
- t->set_color("font_color_disabled", "CheckBox", control_font_color_disabled);
+ theme->set_color("font_color", "CheckBox", control_font_color);
+ theme->set_color("font_color_pressed", "CheckBox", control_font_color_pressed);
+ theme->set_color("font_color_hover", "CheckBox", control_font_color_hover);
+ theme->set_color("font_color_disabled", "CheckBox", control_font_color_disabled);
- t->set_constant("hseparation", "CheckBox", 4 * scale);
- t->set_constant("check_vadjust", "CheckBox", 0 * scale);
+ theme->set_constant("hseparation", "CheckBox", 4 * scale);
+ theme->set_constant("check_vadjust", "CheckBox", 0 * scale);
// CheckButton
@@ -387,170 +387,172 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
cb_empty->set_default_margin(MARGIN_TOP, 4 * scale);
cb_empty->set_default_margin(MARGIN_BOTTOM, 4 * scale);
- t->set_stylebox("normal", "CheckButton", cb_empty);
- t->set_stylebox("pressed", "CheckButton", cb_empty);
- t->set_stylebox("disabled", "CheckButton", cb_empty);
- t->set_stylebox("hover", "CheckButton", cb_empty);
- t->set_stylebox("focus", "CheckButton", focus);
+ theme->set_stylebox("normal", "CheckButton", cb_empty);
+ theme->set_stylebox("pressed", "CheckButton", cb_empty);
+ theme->set_stylebox("disabled", "CheckButton", cb_empty);
+ theme->set_stylebox("hover", "CheckButton", cb_empty);
+ theme->set_stylebox("focus", "CheckButton", focus);
- t->set_icon("on", "CheckButton", make_icon(toggle_on_png));
- t->set_icon("off", "CheckButton", make_icon(toggle_off_png));
+ theme->set_icon("on", "CheckButton", make_icon(toggle_on_png));
+ theme->set_icon("off", "CheckButton", make_icon(toggle_off_png));
- t->set_font("font", "CheckButton", default_font);
+ theme->set_font("font", "CheckButton", default_font);
- t->set_color("font_color", "CheckButton", control_font_color);
- t->set_color("font_color_pressed", "CheckButton", control_font_color_pressed);
- t->set_color("font_color_hover", "CheckButton", control_font_color_hover);
- t->set_color("font_color_disabled", "CheckButton", control_font_color_disabled);
+ theme->set_color("font_color", "CheckButton", control_font_color);
+ theme->set_color("font_color_pressed", "CheckButton", control_font_color_pressed);
+ theme->set_color("font_color_hover", "CheckButton", control_font_color_hover);
+ theme->set_color("font_color_disabled", "CheckButton", control_font_color_disabled);
- t->set_constant("hseparation", "CheckButton", 4 * scale);
- t->set_constant("check_vadjust", "CheckButton", 0 * scale);
+ theme->set_constant("hseparation", "CheckButton", 4 * scale);
+ theme->set_constant("check_vadjust", "CheckButton", 0 * scale);
// Label
- t->set_font("font", "Label", default_font);
+ theme->set_font("font", "Label", default_font);
- t->set_color("font_color", "Label", Color(1, 1, 1));
- t->set_color("font_color_shadow", "Label", Color(0, 0, 0, 0));
+ theme->set_color("font_color", "Label", Color(1, 1, 1));
+ theme->set_color("font_color_shadow", "Label", Color(0, 0, 0, 0));
- t->set_constant("shadow_offset_x", "Label", 1 * scale);
- t->set_constant("shadow_offset_y", "Label", 1 * scale);
- t->set_constant("shadow_as_outline", "Label", 0 * scale);
- t->set_constant("line_spacing", "Label", 3 * scale);
+ theme->set_constant("shadow_offset_x", "Label", 1 * scale);
+ theme->set_constant("shadow_offset_y", "Label", 1 * scale);
+ theme->set_constant("shadow_as_outline", "Label", 0 * scale);
+ theme->set_constant("line_spacing", "Label", 3 * scale);
// LineEdit
- t->set_stylebox("normal", "LineEdit", make_stylebox(line_edit_png, 5, 5, 5, 5));
- t->set_stylebox("focus", "LineEdit", focus);
- t->set_stylebox("read_only", "LineEdit", make_stylebox(line_edit_disabled_png, 6, 6, 6, 6));
+ theme->set_stylebox("normal", "LineEdit", make_stylebox(line_edit_png, 5, 5, 5, 5));
+ theme->set_stylebox("focus", "LineEdit", focus);
+ theme->set_stylebox("read_only", "LineEdit", make_stylebox(line_edit_disabled_png, 6, 6, 6, 6));
- t->set_font("font", "LineEdit", default_font);
+ theme->set_font("font", "LineEdit", default_font);
- t->set_color("font_color", "LineEdit", control_font_color);
- t->set_color("font_color_selected", "LineEdit", Color(0, 0, 0));
- t->set_color("cursor_color", "LineEdit", control_font_color_hover);
- t->set_color("selection_color", "LineEdit", font_color_selection);
+ theme->set_color("font_color", "LineEdit", control_font_color);
+ theme->set_color("font_color_selected", "LineEdit", Color(0, 0, 0));
+ theme->set_color("cursor_color", "LineEdit", control_font_color_hover);
+ theme->set_color("selection_color", "LineEdit", font_color_selection);
- t->set_constant("minimum_spaces", "LineEdit", 12 * scale);
+ theme->set_constant("minimum_spaces", "LineEdit", 12 * scale);
// ProgressBar
- t->set_stylebox("bg", "ProgressBar", make_stylebox(progress_bar_png, 4, 4, 4, 4, 0, 0, 0, 0));
- t->set_stylebox("fg", "ProgressBar", make_stylebox(progress_fill_png, 6, 6, 6, 6, 2, 1, 2, 1));
+ theme->set_stylebox("bg", "ProgressBar", make_stylebox(progress_bar_png, 4, 4, 4, 4, 0, 0, 0, 0));
+ theme->set_stylebox("fg", "ProgressBar", make_stylebox(progress_fill_png, 6, 6, 6, 6, 2, 1, 2, 1));
- t->set_font("font", "ProgressBar", default_font);
+ theme->set_font("font", "ProgressBar", default_font);
- t->set_color("font_color", "ProgressBar", control_font_color_hover);
- t->set_color("font_color_shadow", "ProgressBar", Color(0, 0, 0));
+ theme->set_color("font_color", "ProgressBar", control_font_color_hover);
+ theme->set_color("font_color_shadow", "ProgressBar", Color(0, 0, 0));
// TextEdit
- t->set_stylebox("normal", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3));
- t->set_stylebox("focus", "TextEdit", focus);
- t->set_stylebox("completion", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3));
-
- t->set_icon("tab", "TextEdit", make_icon(tab_png));
-
- t->set_font("font", "TextEdit", default_font);
-
- t->set_color("background_color", "TextEdit", Color(0, 0, 0, 0));
- t->set_color("completion_background_color", "TextEdit", Color::html("2C2A32"));
- t->set_color("completion_selected_color", "TextEdit", Color::html("434244"));
- t->set_color("completion_existing_color", "TextEdit", Color::html("21dfdfdf"));
- t->set_color("completion_scroll_color", "TextEdit", control_font_color_pressed);
- t->set_color("completion_font_color", "TextEdit", Color::html("aaaaaa"));
- t->set_color("font_color", "TextEdit", control_font_color);
- t->set_color("font_color_selected", "TextEdit", Color(0, 0, 0));
- t->set_color("selection_color", "TextEdit", font_color_selection);
- t->set_color("mark_color", "TextEdit", Color(1.0, 0.4, 0.4, 0.4));
- t->set_color("breakpoint_color", "TextEdit", Color(0.8, 0.8, 0.4, 0.2));
- t->set_color("current_line_color", "TextEdit", Color(0.25, 0.25, 0.26, 0.8));
- t->set_color("caret_color", "TextEdit", control_font_color);
- t->set_color("caret_background_color", "TextEdit", Color::html("000000"));
- t->set_color("symbol_color", "TextEdit", control_font_color_hover);
- t->set_color("brace_mismatch_color", "TextEdit", Color(1, 0.2, 0.2));
- t->set_color("line_number_color", "TextEdit", Color::html("66aaaaaa"));
- t->set_color("function_color", "TextEdit", Color::html("66a2ce"));
- t->set_color("member_variable_color", "TextEdit", Color::html("e64e59"));
- t->set_color("number_color", "TextEdit", Color::html("EB9532"));
- t->set_color("word_highlighted_color", "TextEdit", Color(0.8, 0.9, 0.9, 0.15));
-
- t->set_constant("completion_lines", "TextEdit", 7);
- t->set_constant("completion_max_width", "TextEdit", 50);
- t->set_constant("completion_scroll_width", "TextEdit", 3);
- t->set_constant("line_spacing", "TextEdit", 4 * scale);
+ theme->set_stylebox("normal", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3));
+ theme->set_stylebox("focus", "TextEdit", focus);
+ theme->set_stylebox("completion", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3));
+
+ theme->set_icon("tab", "TextEdit", make_icon(tab_png));
+
+ theme->set_font("font", "TextEdit", default_font);
+
+ theme->set_color("background_color", "TextEdit", Color(0, 0, 0, 0));
+ theme->set_color("completion_background_color", "TextEdit", Color::html("2C2A32"));
+ theme->set_color("completion_selected_color", "TextEdit", Color::html("434244"));
+ theme->set_color("completion_existing_color", "TextEdit", Color::html("21dfdfdf"));
+ theme->set_color("completion_scroll_color", "TextEdit", control_font_color_pressed);
+ theme->set_color("completion_font_color", "TextEdit", Color::html("aaaaaa"));
+ theme->set_color("font_color", "TextEdit", control_font_color);
+ theme->set_color("font_color_selected", "TextEdit", Color(0, 0, 0));
+ theme->set_color("selection_color", "TextEdit", font_color_selection);
+ theme->set_color("mark_color", "TextEdit", Color(1.0, 0.4, 0.4, 0.4));
+ theme->set_color("breakpoint_color", "TextEdit", Color(0.8, 0.8, 0.4, 0.2));
+ theme->set_color("current_line_color", "TextEdit", Color(0.25, 0.25, 0.26, 0.8));
+ theme->set_color("caret_color", "TextEdit", control_font_color);
+ theme->set_color("caret_background_color", "TextEdit", Color::html("000000"));
+ theme->set_color("symbol_color", "TextEdit", control_font_color_hover);
+ theme->set_color("brace_mismatch_color", "TextEdit", Color(1, 0.2, 0.2));
+ theme->set_color("line_number_color", "TextEdit", Color::html("66aaaaaa"));
+ theme->set_color("function_color", "TextEdit", Color::html("66a2ce"));
+ theme->set_color("member_variable_color", "TextEdit", Color::html("e64e59"));
+ theme->set_color("number_color", "TextEdit", Color::html("EB9532"));
+ theme->set_color("word_highlighted_color", "TextEdit", Color(0.8, 0.9, 0.9, 0.15));
+
+ theme->set_constant("completion_lines", "TextEdit", 7);
+ theme->set_constant("completion_max_width", "TextEdit", 50);
+ theme->set_constant("completion_scroll_width", "TextEdit", 3);
+ theme->set_constant("line_spacing", "TextEdit", 4 * scale);
Ref<Texture> empty_icon = memnew(ImageTexture);
// HScrollBar
- t->set_stylebox("scroll", "HScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0));
- t->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0));
- t->set_stylebox("grabber", "HScrollBar", make_stylebox(scroll_grabber_png, 5, 5, 5, 5, 2, 2, 2, 2));
- t->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(scroll_grabber_hl_png, 5, 5, 5, 5, 2, 2, 2, 2));
+ theme->set_stylebox("scroll", "HScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0));
+ theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0));
+ theme->set_stylebox("grabber", "HScrollBar", make_stylebox(scroll_grabber_png, 5, 5, 5, 5, 2, 2, 2, 2));
+ theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(scroll_grabber_hl_png, 5, 5, 5, 5, 2, 2, 2, 2));
+ theme->set_stylebox("grabber_pressed", "HScrollBar", make_stylebox(scroll_grabber_pressed_png, 5, 5, 5, 5, 2, 2, 2, 2));
- t->set_icon("increment", "HScrollBar", empty_icon);
- t->set_icon("increment_highlight", "HScrollBar", empty_icon);
- t->set_icon("decrement", "HScrollBar", empty_icon);
- t->set_icon("decrement_highlight", "HScrollBar", empty_icon);
+ theme->set_icon("increment", "HScrollBar", empty_icon);
+ theme->set_icon("increment_highlight", "HScrollBar", empty_icon);
+ theme->set_icon("decrement", "HScrollBar", empty_icon);
+ theme->set_icon("decrement_highlight", "HScrollBar", empty_icon);
// VScrollBar
- t->set_stylebox("scroll", "VScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0));
- t->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0));
- t->set_stylebox("grabber", "VScrollBar", make_stylebox(scroll_grabber_png, 5, 5, 5, 5, 2, 2, 2, 2));
- t->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(scroll_grabber_hl_png, 5, 5, 5, 5, 2, 2, 2, 2));
+ theme->set_stylebox("scroll", "VScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0));
+ theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0));
+ theme->set_stylebox("grabber", "VScrollBar", make_stylebox(scroll_grabber_png, 5, 5, 5, 5, 2, 2, 2, 2));
+ theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(scroll_grabber_hl_png, 5, 5, 5, 5, 2, 2, 2, 2));
+ theme->set_stylebox("grabber_pressed", "VScrollBar", make_stylebox(scroll_grabber_pressed_png, 5, 5, 5, 5, 2, 2, 2, 2));
- t->set_icon("increment", "VScrollBar", empty_icon);
- t->set_icon("increment_highlight", "VScrollBar", empty_icon);
- t->set_icon("decrement", "VScrollBar", empty_icon);
- t->set_icon("decrement_highlight", "VScrollBar", empty_icon);
+ theme->set_icon("increment", "VScrollBar", empty_icon);
+ theme->set_icon("increment_highlight", "VScrollBar", empty_icon);
+ theme->set_icon("decrement", "VScrollBar", empty_icon);
+ theme->set_icon("decrement_highlight", "VScrollBar", empty_icon);
// HSlider
- t->set_stylebox("slider", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4));
- t->set_stylebox("grabber_highlight", "HSlider", make_stylebox(hslider_grabber_hl_png, 6, 6, 6, 6));
- t->set_stylebox("grabber_disabled", "HSlider", make_stylebox(hslider_grabber_disabled_png, 6, 6, 6, 6));
- t->set_stylebox("focus", "HSlider", focus);
+ theme->set_stylebox("slider", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4));
+ theme->set_stylebox("grabber_highlight", "HSlider", make_stylebox(hslider_grabber_hl_png, 6, 6, 6, 6));
+ theme->set_stylebox("grabber_disabled", "HSlider", make_stylebox(hslider_grabber_disabled_png, 6, 6, 6, 6));
+ theme->set_stylebox("focus", "HSlider", focus);
- t->set_icon("grabber", "HSlider", make_icon(hslider_grabber_png));
- t->set_icon("grabber_highlight", "HSlider", make_icon(hslider_grabber_hl_png));
- t->set_icon("grabber_disabled", "HSlider", make_icon(hslider_grabber_disabled_png));
- t->set_icon("tick", "HSlider", make_icon(hslider_tick_png));
+ theme->set_icon("grabber", "HSlider", make_icon(hslider_grabber_png));
+ theme->set_icon("grabber_highlight", "HSlider", make_icon(hslider_grabber_hl_png));
+ theme->set_icon("grabber_disabled", "HSlider", make_icon(hslider_grabber_disabled_png));
+ theme->set_icon("tick", "HSlider", make_icon(hslider_tick_png));
// VSlider
- t->set_stylebox("slider", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4));
- t->set_stylebox("grabber_highlight", "VSlider", make_stylebox(vslider_grabber_hl_png, 6, 6, 6, 6));
- t->set_stylebox("grabber_disabled", "VSlider", make_stylebox(vslider_grabber_disabled_png, 6, 6, 6, 6));
- t->set_stylebox("focus", "HSlider", focus);
+ theme->set_stylebox("slider", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4));
+ theme->set_stylebox("grabber_highlight", "VSlider", make_stylebox(vslider_grabber_hl_png, 6, 6, 6, 6));
+ theme->set_stylebox("grabber_disabled", "VSlider", make_stylebox(vslider_grabber_disabled_png, 6, 6, 6, 6));
+ theme->set_stylebox("focus", "HSlider", focus);
- t->set_icon("grabber", "VSlider", make_icon(vslider_grabber_png));
- t->set_icon("grabber_highlight", "VSlider", make_icon(vslider_grabber_hl_png));
- t->set_icon("grabber_disabled", "VSlider", make_icon(vslider_grabber_disabled_png));
- t->set_icon("tick", "VSlider", make_icon(vslider_tick_png));
+ theme->set_icon("grabber", "VSlider", make_icon(vslider_grabber_png));
+ theme->set_icon("grabber_highlight", "VSlider", make_icon(vslider_grabber_hl_png));
+ theme->set_icon("grabber_disabled", "VSlider", make_icon(vslider_grabber_disabled_png));
+ theme->set_icon("tick", "VSlider", make_icon(vslider_tick_png));
// SpinBox
- t->set_icon("updown", "SpinBox", make_icon(spinbox_updown_png));
+ theme->set_icon("updown", "SpinBox", make_icon(spinbox_updown_png));
// WindowDialog
- t->set_stylebox("panel", "WindowDialog", sb_expand(make_stylebox(popup_window_png, 10, 26, 10, 8), 8, 24, 8, 6));
- t->set_constant("scaleborder_size", "WindowDialog", 4 * scale);
+ theme->set_stylebox("panel", "WindowDialog", sb_expand(make_stylebox(popup_window_png, 10, 26, 10, 8), 8, 24, 8, 6));
+ theme->set_constant("scaleborder_size", "WindowDialog", 4 * scale);
- t->set_font("title_font", "WindowDialog", large_font);
- t->set_color("title_color", "WindowDialog", Color(0, 0, 0));
- t->set_constant("title_height", "WindowDialog", 20 * scale);
+ theme->set_font("title_font", "WindowDialog", large_font);
+ theme->set_color("title_color", "WindowDialog", Color(0, 0, 0));
+ theme->set_constant("title_height", "WindowDialog", 20 * scale);
- t->set_icon("close", "WindowDialog", make_icon(close_png));
- t->set_icon("close_highlight", "WindowDialog", make_icon(close_hl_png));
- t->set_constant("close_h_ofs", "WindowDialog", 18 * scale);
- t->set_constant("close_v_ofs", "WindowDialog", 18 * scale);
+ theme->set_icon("close", "WindowDialog", make_icon(close_png));
+ theme->set_icon("close_highlight", "WindowDialog", make_icon(close_hl_png));
+ theme->set_constant("close_h_ofs", "WindowDialog", 18 * scale);
+ theme->set_constant("close_v_ofs", "WindowDialog", 18 * scale);
// File Dialog
- t->set_icon("reload", "FileDialog", make_icon(icon_reload_png));
+ theme->set_icon("reload", "FileDialog", make_icon(icon_reload_png));
// Popup
@@ -561,28 +563,28 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
selected->set_expand_margin_size(Margin(i), 2 * scale);
}
- t->set_stylebox("panel", "PopupPanel", style_pp);
+ theme->set_stylebox("panel", "PopupPanel", style_pp);
// PopupMenu
- t->set_stylebox("panel", "PopupMenu", make_stylebox(popup_bg_png, 4, 4, 4, 4, 10, 10, 10, 10));
- t->set_stylebox("panel_disabled", "PopupMenu", make_stylebox(popup_bg_disabled_png, 4, 4, 4, 4));
- t->set_stylebox("hover", "PopupMenu", selected);
- t->set_stylebox("separator", "PopupMenu", make_stylebox(vseparator_png, 3, 3, 3, 3));
+ theme->set_stylebox("panel", "PopupMenu", make_stylebox(popup_bg_png, 4, 4, 4, 4, 10, 10, 10, 10));
+ theme->set_stylebox("panel_disabled", "PopupMenu", make_stylebox(popup_bg_disabled_png, 4, 4, 4, 4));
+ theme->set_stylebox("hover", "PopupMenu", selected);
+ theme->set_stylebox("separator", "PopupMenu", make_stylebox(vseparator_png, 3, 3, 3, 3));
- t->set_icon("checked", "PopupMenu", make_icon(checked_png));
- t->set_icon("unchecked", "PopupMenu", make_icon(unchecked_png));
- t->set_icon("submenu", "PopupMenu", make_icon(submenu_png));
+ theme->set_icon("checked", "PopupMenu", make_icon(checked_png));
+ theme->set_icon("unchecked", "PopupMenu", make_icon(unchecked_png));
+ theme->set_icon("submenu", "PopupMenu", make_icon(submenu_png));
- t->set_font("font", "PopupMenu", default_font);
+ theme->set_font("font", "PopupMenu", default_font);
- t->set_color("font_color", "PopupMenu", control_font_color);
- t->set_color("font_color_accel", "PopupMenu", Color(0.7, 0.7, 0.7, 0.8));
- t->set_color("font_color_disabled", "PopupMenu", Color(0.4, 0.4, 0.4, 0.8));
- t->set_color("font_color_hover", "PopupMenu", control_font_color);
+ theme->set_color("font_color", "PopupMenu", control_font_color);
+ theme->set_color("font_color_accel", "PopupMenu", Color(0.7, 0.7, 0.7, 0.8));
+ theme->set_color("font_color_disabled", "PopupMenu", Color(0.4, 0.4, 0.4, 0.8));
+ theme->set_color("font_color_hover", "PopupMenu", control_font_color);
- t->set_constant("hseparation", "PopupMenu", 4 * scale);
- t->set_constant("vseparation", "PopupMenu", 4 * scale);
+ theme->set_constant("hseparation", "PopupMenu", 4 * scale);
+ theme->set_constant("vseparation", "PopupMenu", 4 * scale);
// GraphNode
@@ -597,90 +599,90 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
//graphsb->set_expand_margin_size(MARGIN_LEFT,10);
//graphsb->set_expand_margin_size(MARGIN_RIGHT,10);
- t->set_stylebox("frame", "GraphNode", graphsb);
- t->set_stylebox("selectedframe", "GraphNode", graphsbselected);
- t->set_stylebox("defaultframe", "GraphNode", graphsbdefault);
- t->set_stylebox("defaultfocus", "GraphNode", graphsbdeffocus);
- t->set_stylebox("comment", "GraphNode", graphsbcomment);
- t->set_stylebox("commentfocus", "GraphNode", graphsbcommentselected);
- t->set_stylebox("breakpoint", "GraphNode", graph_bpoint);
- t->set_stylebox("position", "GraphNode", graph_position);
- t->set_constant("separation", "GraphNode", 1 * scale);
- t->set_icon("port", "GraphNode", make_icon(graph_port_png));
- t->set_icon("close", "GraphNode", make_icon(graph_node_close_png));
- t->set_icon("resizer", "GraphNode", make_icon(window_resizer_png));
- t->set_font("title_font", "GraphNode", default_font);
- t->set_color("title_color", "GraphNode", Color(0, 0, 0, 1));
- t->set_constant("title_offset", "GraphNode", 20 * scale);
- t->set_constant("close_offset", "GraphNode", 18 * scale);
- t->set_constant("port_offset", "GraphNode", 3 * scale);
+ theme->set_stylebox("frame", "GraphNode", graphsb);
+ theme->set_stylebox("selectedframe", "GraphNode", graphsbselected);
+ theme->set_stylebox("defaultframe", "GraphNode", graphsbdefault);
+ theme->set_stylebox("defaultfocus", "GraphNode", graphsbdeffocus);
+ theme->set_stylebox("comment", "GraphNode", graphsbcomment);
+ theme->set_stylebox("commentfocus", "GraphNode", graphsbcommentselected);
+ theme->set_stylebox("breakpoint", "GraphNode", graph_bpoint);
+ theme->set_stylebox("position", "GraphNode", graph_position);
+ theme->set_constant("separation", "GraphNode", 1 * scale);
+ theme->set_icon("port", "GraphNode", make_icon(graph_port_png));
+ theme->set_icon("close", "GraphNode", make_icon(graph_node_close_png));
+ theme->set_icon("resizer", "GraphNode", make_icon(window_resizer_png));
+ theme->set_font("title_font", "GraphNode", default_font);
+ theme->set_color("title_color", "GraphNode", Color(0, 0, 0, 1));
+ theme->set_constant("title_offset", "GraphNode", 20 * scale);
+ theme->set_constant("close_offset", "GraphNode", 18 * scale);
+ theme->set_constant("port_offset", "GraphNode", 3 * scale);
// Tree
Ref<StyleBoxTexture> tree_selected = make_stylebox(selection_png, 4, 4, 4, 4, 8, 0, 8, 0);
Ref<StyleBoxTexture> tree_selected_oof = make_stylebox(selection_oof_png, 4, 4, 4, 4, 8, 0, 8, 0);
- t->set_stylebox("bg", "Tree", make_stylebox(tree_bg_png, 4, 4, 4, 5));
- t->set_stylebox("bg_focus", "Tree", focus);
- t->set_stylebox("selected", "Tree", tree_selected_oof);
- t->set_stylebox("selected_focus", "Tree", tree_selected);
- t->set_stylebox("cursor", "Tree", focus);
- t->set_stylebox("cursor_unfocused", "Tree", focus);
- t->set_stylebox("button_pressed", "Tree", make_stylebox(button_pressed_png, 4, 4, 4, 4));
- t->set_stylebox("title_button_normal", "Tree", make_stylebox(tree_title_png, 4, 4, 4, 4));
- t->set_stylebox("title_button_pressed", "Tree", make_stylebox(tree_title_pressed_png, 4, 4, 4, 4));
- t->set_stylebox("title_button_hover", "Tree", make_stylebox(tree_title_png, 4, 4, 4, 4));
- t->set_stylebox("custom_button", "Tree", sb_button_normal);
- t->set_stylebox("custom_button_pressed", "Tree", sb_button_pressed);
- t->set_stylebox("custom_button_hover", "Tree", sb_button_hover);
-
- t->set_icon("checked", "Tree", make_icon(checked_png));
- t->set_icon("unchecked", "Tree", make_icon(unchecked_png));
- t->set_icon("updown", "Tree", make_icon(updown_png));
- t->set_icon("select_arrow", "Tree", make_icon(dropdown_png));
- t->set_icon("arrow", "Tree", make_icon(arrow_down_png));
- t->set_icon("arrow_collapsed", "Tree", make_icon(arrow_right_png));
-
- t->set_font("title_button_font", "Tree", default_font);
- t->set_font("font", "Tree", default_font);
-
- t->set_color("title_button_color", "Tree", control_font_color);
- t->set_color("font_color", "Tree", control_font_color_low);
- t->set_color("font_color_selected", "Tree", control_font_color_pressed);
- t->set_color("selection_color", "Tree", Color(0.1, 0.1, 1, 0.8));
- t->set_color("cursor_color", "Tree", Color(0, 0, 0));
- t->set_color("guide_color", "Tree", Color(0, 0, 0, 0.1));
- t->set_color("drop_position_color", "Tree", Color(1, 0.3, 0.2));
- t->set_color("relationship_line_color", "Tree", Color::html("464646"));
- t->set_color("custom_button_font_highlight", "Tree", control_font_color_hover);
-
- t->set_constant("hseparation", "Tree", 4 * scale);
- t->set_constant("vseparation", "Tree", 4 * scale);
- t->set_constant("guide_width", "Tree", 2 * scale);
- t->set_constant("item_margin", "Tree", 12 * scale);
- t->set_constant("button_margin", "Tree", 4 * scale);
- t->set_constant("draw_relationship_lines", "Tree", 0);
- t->set_constant("scroll_border", "Tree", 4);
- t->set_constant("scroll_speed", "Tree", 12);
+ theme->set_stylebox("bg", "Tree", make_stylebox(tree_bg_png, 4, 4, 4, 5));
+ theme->set_stylebox("bg_focus", "Tree", focus);
+ theme->set_stylebox("selected", "Tree", tree_selected_oof);
+ theme->set_stylebox("selected_focus", "Tree", tree_selected);
+ theme->set_stylebox("cursor", "Tree", focus);
+ theme->set_stylebox("cursor_unfocused", "Tree", focus);
+ theme->set_stylebox("button_pressed", "Tree", make_stylebox(button_pressed_png, 4, 4, 4, 4));
+ theme->set_stylebox("title_button_normal", "Tree", make_stylebox(tree_title_png, 4, 4, 4, 4));
+ theme->set_stylebox("title_button_pressed", "Tree", make_stylebox(tree_title_pressed_png, 4, 4, 4, 4));
+ theme->set_stylebox("title_button_hover", "Tree", make_stylebox(tree_title_png, 4, 4, 4, 4));
+ theme->set_stylebox("custom_button", "Tree", sb_button_normal);
+ theme->set_stylebox("custom_button_pressed", "Tree", sb_button_pressed);
+ theme->set_stylebox("custom_button_hover", "Tree", sb_button_hover);
+
+ theme->set_icon("checked", "Tree", make_icon(checked_png));
+ theme->set_icon("unchecked", "Tree", make_icon(unchecked_png));
+ theme->set_icon("updown", "Tree", make_icon(updown_png));
+ theme->set_icon("select_arrow", "Tree", make_icon(dropdown_png));
+ theme->set_icon("arrow", "Tree", make_icon(arrow_down_png));
+ theme->set_icon("arrow_collapsed", "Tree", make_icon(arrow_right_png));
+
+ theme->set_font("title_button_font", "Tree", default_font);
+ theme->set_font("font", "Tree", default_font);
+
+ theme->set_color("title_button_color", "Tree", control_font_color);
+ theme->set_color("font_color", "Tree", control_font_color_low);
+ theme->set_color("font_color_selected", "Tree", control_font_color_pressed);
+ theme->set_color("selection_color", "Tree", Color(0.1, 0.1, 1, 0.8));
+ theme->set_color("cursor_color", "Tree", Color(0, 0, 0));
+ theme->set_color("guide_color", "Tree", Color(0, 0, 0, 0.1));
+ theme->set_color("drop_position_color", "Tree", Color(1, 0.3, 0.2));
+ theme->set_color("relationship_line_color", "Tree", Color::html("464646"));
+ theme->set_color("custom_button_font_highlight", "Tree", control_font_color_hover);
+
+ theme->set_constant("hseparation", "Tree", 4 * scale);
+ theme->set_constant("vseparation", "Tree", 4 * scale);
+ theme->set_constant("guide_width", "Tree", 2 * scale);
+ theme->set_constant("item_margin", "Tree", 12 * scale);
+ theme->set_constant("button_margin", "Tree", 4 * scale);
+ theme->set_constant("draw_relationship_lines", "Tree", 0);
+ theme->set_constant("scroll_border", "Tree", 4);
+ theme->set_constant("scroll_speed", "Tree", 12);
// ItemList
Ref<StyleBoxTexture> item_selected = make_stylebox(selection_png, 4, 4, 4, 4, 8, 2, 8, 2);
Ref<StyleBoxTexture> item_selected_oof = make_stylebox(selection_oof_png, 4, 4, 4, 4, 8, 2, 8, 2);
- t->set_stylebox("bg", "ItemList", make_stylebox(tree_bg_png, 4, 4, 4, 5));
- t->set_stylebox("bg_focus", "ItemList", focus);
- t->set_constant("hseparation", "ItemList", 4);
- t->set_constant("vseparation", "ItemList", 2);
- t->set_constant("icon_margin", "ItemList", 4);
- t->set_constant("line_separation", "ItemList", 2 * scale);
- t->set_font("font", "ItemList", default_font);
- t->set_color("font_color", "ItemList", control_font_color_lower);
- t->set_color("font_color_selected", "ItemList", control_font_color_pressed);
- t->set_color("guide_color", "ItemList", Color(0, 0, 0, 0.1));
- t->set_stylebox("selected", "ItemList", item_selected_oof);
- t->set_stylebox("selected_focus", "ItemList", item_selected);
- t->set_stylebox("cursor", "ItemList", focus);
- t->set_stylebox("cursor_unfocused", "ItemList", focus);
+ theme->set_stylebox("bg", "ItemList", make_stylebox(tree_bg_png, 4, 4, 4, 5));
+ theme->set_stylebox("bg_focus", "ItemList", focus);
+ theme->set_constant("hseparation", "ItemList", 4);
+ theme->set_constant("vseparation", "ItemList", 2);
+ theme->set_constant("icon_margin", "ItemList", 4);
+ theme->set_constant("line_separation", "ItemList", 2 * scale);
+ theme->set_font("font", "ItemList", default_font);
+ theme->set_color("font_color", "ItemList", control_font_color_lower);
+ theme->set_color("font_color_selected", "ItemList", control_font_color_pressed);
+ theme->set_color("guide_color", "ItemList", Color(0, 0, 0, 0.1));
+ theme->set_stylebox("selected", "ItemList", item_selected_oof);
+ theme->set_stylebox("selected_focus", "ItemList", item_selected);
+ theme->set_stylebox("cursor", "ItemList", focus);
+ theme->set_stylebox("cursor_unfocused", "ItemList", focus);
// TabContainer
@@ -689,88 +691,88 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
tc_sb->set_expand_margin_size(MARGIN_TOP, 2 * scale);
tc_sb->set_default_margin(MARGIN_TOP, 8 * scale);
- t->set_stylebox("tab_fg", "TabContainer", sb_expand(make_stylebox(tab_current_png, 4, 4, 4, 1, 16, 4, 16, 4), 2, 2, 2, 2));
- t->set_stylebox("tab_bg", "TabContainer", sb_expand(make_stylebox(tab_behind_png, 5, 5, 5, 1, 16, 6, 16, 4), 3, 0, 3, 3));
- t->set_stylebox("panel", "TabContainer", tc_sb);
+ theme->set_stylebox("tab_fg", "TabContainer", sb_expand(make_stylebox(tab_current_png, 4, 4, 4, 1, 16, 4, 16, 4), 2, 2, 2, 2));
+ theme->set_stylebox("tab_bg", "TabContainer", sb_expand(make_stylebox(tab_behind_png, 5, 5, 5, 1, 16, 6, 16, 4), 3, 0, 3, 3));
+ theme->set_stylebox("panel", "TabContainer", tc_sb);
- t->set_icon("increment", "TabContainer", make_icon(scroll_button_right_png));
- t->set_icon("increment_highlight", "TabContainer", make_icon(scroll_button_right_hl_png));
- t->set_icon("decrement", "TabContainer", make_icon(scroll_button_left_png));
- t->set_icon("decrement_highlight", "TabContainer", make_icon(scroll_button_left_hl_png));
- t->set_icon("menu", "TabContainer", make_icon(tab_menu_png));
- t->set_icon("menu_highlight", "TabContainer", make_icon(tab_menu_hl_png));
+ theme->set_icon("increment", "TabContainer", make_icon(scroll_button_right_png));
+ theme->set_icon("increment_highlight", "TabContainer", make_icon(scroll_button_right_hl_png));
+ theme->set_icon("decrement", "TabContainer", make_icon(scroll_button_left_png));
+ theme->set_icon("decrement_highlight", "TabContainer", make_icon(scroll_button_left_hl_png));
+ theme->set_icon("menu", "TabContainer", make_icon(tab_menu_png));
+ theme->set_icon("menu_highlight", "TabContainer", make_icon(tab_menu_hl_png));
- t->set_font("font", "TabContainer", default_font);
+ theme->set_font("font", "TabContainer", default_font);
- t->set_color("font_color_fg", "TabContainer", control_font_color_hover);
- t->set_color("font_color_bg", "TabContainer", control_font_color_low);
- t->set_color("font_color_disabled", "TabContainer", control_font_color_disabled);
+ theme->set_color("font_color_fg", "TabContainer", control_font_color_hover);
+ theme->set_color("font_color_bg", "TabContainer", control_font_color_low);
+ theme->set_color("font_color_disabled", "TabContainer", control_font_color_disabled);
- t->set_constant("side_margin", "TabContainer", 8 * scale);
- t->set_constant("top_margin", "TabContainer", 24 * scale);
- t->set_constant("label_valign_fg", "TabContainer", 0 * scale);
- t->set_constant("label_valign_bg", "TabContainer", 2 * scale);
- t->set_constant("hseparation", "TabContainer", 4 * scale);
+ theme->set_constant("side_margin", "TabContainer", 8 * scale);
+ theme->set_constant("top_margin", "TabContainer", 24 * scale);
+ theme->set_constant("label_valign_fg", "TabContainer", 0 * scale);
+ theme->set_constant("label_valign_bg", "TabContainer", 2 * scale);
+ theme->set_constant("hseparation", "TabContainer", 4 * scale);
// Tabs
- t->set_stylebox("tab_fg", "Tabs", sb_expand(make_stylebox(tab_current_png, 4, 3, 4, 1, 16, 3, 16, 2), 2, 2, 2, 2));
- t->set_stylebox("tab_bg", "Tabs", sb_expand(make_stylebox(tab_behind_png, 5, 4, 5, 1, 16, 5, 16, 2), 3, 3, 3, 3));
- t->set_stylebox("panel", "Tabs", tc_sb);
- t->set_stylebox("button_pressed", "Tabs", make_stylebox(button_pressed_png, 4, 4, 4, 4));
- t->set_stylebox("button", "Tabs", make_stylebox(button_normal_png, 4, 4, 4, 4));
+ theme->set_stylebox("tab_fg", "Tabs", sb_expand(make_stylebox(tab_current_png, 4, 3, 4, 1, 16, 3, 16, 2), 2, 2, 2, 2));
+ theme->set_stylebox("tab_bg", "Tabs", sb_expand(make_stylebox(tab_behind_png, 5, 4, 5, 1, 16, 5, 16, 2), 3, 3, 3, 3));
+ theme->set_stylebox("panel", "Tabs", tc_sb);
+ theme->set_stylebox("button_pressed", "Tabs", make_stylebox(button_pressed_png, 4, 4, 4, 4));
+ theme->set_stylebox("button", "Tabs", make_stylebox(button_normal_png, 4, 4, 4, 4));
- t->set_icon("increment", "Tabs", make_icon(scroll_button_right_png));
- t->set_icon("increment_highlight", "Tabs", make_icon(scroll_button_right_hl_png));
- t->set_icon("decrement", "Tabs", make_icon(scroll_button_left_png));
- t->set_icon("decrement_highlight", "Tabs", make_icon(scroll_button_left_hl_png));
- t->set_icon("close", "Tabs", make_icon(tab_close_png));
+ theme->set_icon("increment", "Tabs", make_icon(scroll_button_right_png));
+ theme->set_icon("increment_highlight", "Tabs", make_icon(scroll_button_right_hl_png));
+ theme->set_icon("decrement", "Tabs", make_icon(scroll_button_left_png));
+ theme->set_icon("decrement_highlight", "Tabs", make_icon(scroll_button_left_hl_png));
+ theme->set_icon("close", "Tabs", make_icon(tab_close_png));
- t->set_font("font", "Tabs", default_font);
+ theme->set_font("font", "Tabs", default_font);
- t->set_color("font_color_fg", "Tabs", control_font_color_hover);
- t->set_color("font_color_bg", "Tabs", control_font_color_low);
- t->set_color("font_color_disabled", "Tabs", control_font_color_disabled);
+ theme->set_color("font_color_fg", "Tabs", control_font_color_hover);
+ theme->set_color("font_color_bg", "Tabs", control_font_color_low);
+ theme->set_color("font_color_disabled", "Tabs", control_font_color_disabled);
- t->set_constant("top_margin", "Tabs", 24 * scale);
- t->set_constant("label_valign_fg", "Tabs", 0 * scale);
- t->set_constant("label_valign_bg", "Tabs", 2 * scale);
- t->set_constant("hseparation", "Tabs", 4 * scale);
+ theme->set_constant("top_margin", "Tabs", 24 * scale);
+ theme->set_constant("label_valign_fg", "Tabs", 0 * scale);
+ theme->set_constant("label_valign_bg", "Tabs", 2 * scale);
+ theme->set_constant("hseparation", "Tabs", 4 * scale);
// Separators
- t->set_stylebox("separator", "HSeparator", make_stylebox(vseparator_png, 3, 3, 3, 3));
- t->set_stylebox("separator", "VSeparator", make_stylebox(hseparator_png, 3, 3, 3, 3));
+ theme->set_stylebox("separator", "HSeparator", make_stylebox(vseparator_png, 3, 3, 3, 3));
+ theme->set_stylebox("separator", "VSeparator", make_stylebox(hseparator_png, 3, 3, 3, 3));
- t->set_icon("close", "Icons", make_icon(icon_close_png));
- t->set_font("normal", "Fonts", default_font);
- t->set_font("large", "Fonts", large_font);
+ theme->set_icon("close", "Icons", make_icon(icon_close_png));
+ theme->set_font("normal", "Fonts", default_font);
+ theme->set_font("large", "Fonts", large_font);
- t->set_constant("separation", "HSeparator", 4 * scale);
- t->set_constant("separation", "VSeparator", 4 * scale);
+ theme->set_constant("separation", "HSeparator", 4 * scale);
+ theme->set_constant("separation", "VSeparator", 4 * scale);
// Dialogs
- t->set_constant("margin", "Dialogs", 8 * scale);
- t->set_constant("button_margin", "Dialogs", 32 * scale);
+ theme->set_constant("margin", "Dialogs", 8 * scale);
+ theme->set_constant("button_margin", "Dialogs", 32 * scale);
// FileDialog
- t->set_icon("folder", "FileDialog", make_icon(icon_folder_png));
- t->set_color("files_disabled", "FileDialog", Color(0, 0, 0, 0.7));
+ theme->set_icon("folder", "FileDialog", make_icon(icon_folder_png));
+ theme->set_color("files_disabled", "FileDialog", Color(0, 0, 0, 0.7));
// colorPicker
- t->set_constant("margin", "ColorPicker", 4 * scale);
- t->set_constant("sv_width", "ColorPicker", 256 * scale);
- t->set_constant("sv_height", "ColorPicker", 256 * scale);
- t->set_constant("h_width", "ColorPicker", 30 * scale);
- t->set_constant("label_width", "ColorPicker", 10 * scale);
+ theme->set_constant("margin", "ColorPicker", 4 * scale);
+ theme->set_constant("sv_width", "ColorPicker", 256 * scale);
+ theme->set_constant("sv_height", "ColorPicker", 256 * scale);
+ theme->set_constant("h_width", "ColorPicker", 30 * scale);
+ theme->set_constant("label_width", "ColorPicker", 10 * scale);
- t->set_icon("screen_picker", "ColorPicker", make_icon(icon_color_pick_png));
- t->set_icon("add_preset", "ColorPicker", make_icon(icon_add_png));
- t->set_icon("color_hue", "ColorPicker", make_icon(color_picker_hue_png));
- t->set_icon("color_sample", "ColorPicker", make_icon(color_picker_sample_png));
+ theme->set_icon("screen_picker", "ColorPicker", make_icon(icon_color_pick_png));
+ theme->set_icon("add_preset", "ColorPicker", make_icon(icon_add_png));
+ theme->set_icon("color_hue", "ColorPicker", make_icon(color_picker_hue_png));
+ theme->set_icon("color_sample", "ColorPicker", make_icon(color_picker_sample_png));
// TooltipPanel
@@ -778,111 +780,111 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
for (int i = 0; i < 4; i++)
style_tt->set_expand_margin_size((Margin)i, 4 * scale);
- t->set_stylebox("panel", "TooltipPanel", style_tt);
+ theme->set_stylebox("panel", "TooltipPanel", style_tt);
- t->set_font("font", "TooltipLabel", default_font);
+ theme->set_font("font", "TooltipLabel", default_font);
- t->set_color("font_color", "TooltipLabel", Color(0, 0, 0));
- t->set_color("font_color_shadow", "TooltipLabel", Color(0, 0, 0, 0.1));
+ theme->set_color("font_color", "TooltipLabel", Color(0, 0, 0));
+ theme->set_color("font_color_shadow", "TooltipLabel", Color(0, 0, 0, 0.1));
- t->set_constant("shadow_offset_x", "TooltipLabel", 1);
- t->set_constant("shadow_offset_y", "TooltipLabel", 1);
+ theme->set_constant("shadow_offset_x", "TooltipLabel", 1);
+ theme->set_constant("shadow_offset_y", "TooltipLabel", 1);
// RichTextLabel
- t->set_stylebox("focus", "RichTextLabel", focus);
+ theme->set_stylebox("focus", "RichTextLabel", focus);
- t->set_font("normal_font", "RichTextLabel", default_font);
- t->set_font("bold_font", "RichTextLabel", default_font);
- t->set_font("italics_font", "RichTextLabel", default_font);
- t->set_font("bold_italics_font", "RichTextLabel", default_font);
- t->set_font("mono_font", "RichTextLabel", default_font);
+ theme->set_font("normal_font", "RichTextLabel", default_font);
+ theme->set_font("bold_font", "RichTextLabel", default_font);
+ theme->set_font("italics_font", "RichTextLabel", default_font);
+ theme->set_font("bold_italics_font", "RichTextLabel", default_font);
+ theme->set_font("mono_font", "RichTextLabel", default_font);
- t->set_color("default_color", "RichTextLabel", control_font_color);
- t->set_color("font_color_selected", "RichTextLabel", font_color_selection);
- t->set_color("selection_color", "RichTextLabel", Color(0.1, 0.1, 1, 0.8));
+ theme->set_color("default_color", "RichTextLabel", control_font_color);
+ theme->set_color("font_color_selected", "RichTextLabel", font_color_selection);
+ theme->set_color("selection_color", "RichTextLabel", Color(0.1, 0.1, 1, 0.8));
- t->set_constant("line_separation", "RichTextLabel", 1 * scale);
- t->set_constant("table_hseparation", "RichTextLabel", 3 * scale);
- t->set_constant("table_vseparation", "RichTextLabel", 3 * scale);
+ theme->set_constant("line_separation", "RichTextLabel", 1 * scale);
+ theme->set_constant("table_hseparation", "RichTextLabel", 3 * scale);
+ theme->set_constant("table_vseparation", "RichTextLabel", 3 * scale);
// Containers
- t->set_stylebox("bg", "VSplitContainer", make_stylebox(vsplit_bg_png, 1, 1, 1, 1));
- t->set_stylebox("bg", "HSplitContainer", make_stylebox(hsplit_bg_png, 1, 1, 1, 1));
-
- t->set_icon("grabber", "VSplitContainer", make_icon(vsplitter_png));
- t->set_icon("grabber", "HSplitContainer", make_icon(hsplitter_png));
-
- t->set_constant("separation", "HBoxContainer", 4 * scale);
- t->set_constant("separation", "VBoxContainer", 4 * scale);
- t->set_constant("margin_left", "MarginContainer", 8 * scale);
- t->set_constant("margin_top", "MarginContainer", 0 * scale);
- t->set_constant("margin_right", "MarginContainer", 0 * scale);
- t->set_constant("margin_bottom", "MarginContainer", 0 * scale);
- t->set_constant("hseparation", "GridContainer", 4 * scale);
- t->set_constant("vseparation", "GridContainer", 4 * scale);
- t->set_constant("separation", "HSplitContainer", 12 * scale);
- t->set_constant("separation", "VSplitContainer", 12 * scale);
- t->set_constant("autohide", "HSplitContainer", 1 * scale);
- t->set_constant("autohide", "VSplitContainer", 1 * scale);
+ theme->set_stylebox("bg", "VSplitContainer", make_stylebox(vsplit_bg_png, 1, 1, 1, 1));
+ theme->set_stylebox("bg", "HSplitContainer", make_stylebox(hsplit_bg_png, 1, 1, 1, 1));
+
+ theme->set_icon("grabber", "VSplitContainer", make_icon(vsplitter_png));
+ theme->set_icon("grabber", "HSplitContainer", make_icon(hsplitter_png));
+
+ theme->set_constant("separation", "HBoxContainer", 4 * scale);
+ theme->set_constant("separation", "VBoxContainer", 4 * scale);
+ theme->set_constant("margin_left", "MarginContainer", 8 * scale);
+ theme->set_constant("margin_top", "MarginContainer", 0 * scale);
+ theme->set_constant("margin_right", "MarginContainer", 0 * scale);
+ theme->set_constant("margin_bottom", "MarginContainer", 0 * scale);
+ theme->set_constant("hseparation", "GridContainer", 4 * scale);
+ theme->set_constant("vseparation", "GridContainer", 4 * scale);
+ theme->set_constant("separation", "HSplitContainer", 12 * scale);
+ theme->set_constant("separation", "VSplitContainer", 12 * scale);
+ theme->set_constant("autohide", "HSplitContainer", 1 * scale);
+ theme->set_constant("autohide", "VSplitContainer", 1 * scale);
// HButtonArray
- t->set_stylebox("normal", "HButtonArray", sb_button_normal);
- t->set_stylebox("selected", "HButtonArray", sb_button_pressed);
- t->set_stylebox("hover", "HButtonArray", sb_button_hover);
+ theme->set_stylebox("normal", "HButtonArray", sb_button_normal);
+ theme->set_stylebox("selected", "HButtonArray", sb_button_pressed);
+ theme->set_stylebox("hover", "HButtonArray", sb_button_hover);
- t->set_font("font", "HButtonArray", default_font);
- t->set_font("font_selected", "HButtonArray", default_font);
+ theme->set_font("font", "HButtonArray", default_font);
+ theme->set_font("font_selected", "HButtonArray", default_font);
- t->set_color("font_color", "HButtonArray", control_font_color_low);
- t->set_color("font_color_selected", "HButtonArray", control_font_color_hover);
+ theme->set_color("font_color", "HButtonArray", control_font_color_low);
+ theme->set_color("font_color_selected", "HButtonArray", control_font_color_hover);
- t->set_constant("icon_separator", "HButtonArray", 2 * scale);
- t->set_constant("button_separator", "HButtonArray", 4 * scale);
+ theme->set_constant("icon_separator", "HButtonArray", 2 * scale);
+ theme->set_constant("button_separator", "HButtonArray", 4 * scale);
- t->set_stylebox("focus", "HButtonArray", focus);
+ theme->set_stylebox("focus", "HButtonArray", focus);
// VButtonArray
- t->set_stylebox("normal", "VButtonArray", sb_button_normal);
- t->set_stylebox("selected", "VButtonArray", sb_button_pressed);
- t->set_stylebox("hover", "VButtonArray", sb_button_hover);
+ theme->set_stylebox("normal", "VButtonArray", sb_button_normal);
+ theme->set_stylebox("selected", "VButtonArray", sb_button_pressed);
+ theme->set_stylebox("hover", "VButtonArray", sb_button_hover);
- t->set_font("font", "VButtonArray", default_font);
- t->set_font("font_selected", "VButtonArray", default_font);
+ theme->set_font("font", "VButtonArray", default_font);
+ theme->set_font("font_selected", "VButtonArray", default_font);
- t->set_color("font_color", "VButtonArray", control_font_color_low);
- t->set_color("font_color_selected", "VButtonArray", control_font_color_hover);
+ theme->set_color("font_color", "VButtonArray", control_font_color_low);
+ theme->set_color("font_color_selected", "VButtonArray", control_font_color_hover);
- t->set_constant("icon_separator", "VButtonArray", 2 * scale);
- t->set_constant("button_separator", "VButtonArray", 4 * scale);
+ theme->set_constant("icon_separator", "VButtonArray", 2 * scale);
+ theme->set_constant("button_separator", "VButtonArray", 4 * scale);
- t->set_stylebox("focus", "VButtonArray", focus);
+ theme->set_stylebox("focus", "VButtonArray", focus);
// ReferenceRect
Ref<StyleBoxTexture> ttnc = make_stylebox(full_panel_bg_png, 8, 8, 8, 8);
ttnc->set_draw_center(false);
- t->set_stylebox("border", "ReferenceRect", make_stylebox(reference_border_png, 4, 4, 4, 4));
- t->set_stylebox("panelnc", "Panel", ttnc);
- t->set_stylebox("panelf", "Panel", tc_sb);
+ theme->set_stylebox("border", "ReferenceRect", make_stylebox(reference_border_png, 4, 4, 4, 4));
+ theme->set_stylebox("panelnc", "Panel", ttnc);
+ theme->set_stylebox("panelf", "Panel", tc_sb);
Ref<StyleBoxTexture> sb_pc = make_stylebox(tab_container_bg_png, 4, 4, 4, 4, 7, 7, 7, 7);
- t->set_stylebox("panel", "PanelContainer", sb_pc);
-
- t->set_icon("minus", "GraphEdit", make_icon(icon_zoom_less_png));
- t->set_icon("reset", "GraphEdit", make_icon(icon_zoom_reset_png));
- t->set_icon("more", "GraphEdit", make_icon(icon_zoom_more_png));
- t->set_icon("snap", "GraphEdit", make_icon(icon_snap_png));
- t->set_stylebox("bg", "GraphEdit", make_stylebox(tree_bg_png, 4, 4, 4, 5));
- t->set_color("grid_minor", "GraphEdit", Color(1, 1, 1, 0.05));
- t->set_color("grid_major", "GraphEdit", Color(1, 1, 1, 0.2));
- t->set_constant("bezier_len_pos", "GraphEdit", 80 * scale);
- t->set_constant("bezier_len_neg", "GraphEdit", 160 * scale);
-
- t->set_icon("logo", "Icons", make_icon(logo_png));
+ theme->set_stylebox("panel", "PanelContainer", sb_pc);
+
+ theme->set_icon("minus", "GraphEdit", make_icon(icon_zoom_less_png));
+ theme->set_icon("reset", "GraphEdit", make_icon(icon_zoom_reset_png));
+ theme->set_icon("more", "GraphEdit", make_icon(icon_zoom_more_png));
+ theme->set_icon("snap", "GraphEdit", make_icon(icon_snap_png));
+ theme->set_stylebox("bg", "GraphEdit", make_stylebox(tree_bg_png, 4, 4, 4, 5));
+ theme->set_color("grid_minor", "GraphEdit", Color(1, 1, 1, 0.05));
+ theme->set_color("grid_major", "GraphEdit", Color(1, 1, 1, 0.2));
+ theme->set_constant("bezier_len_pos", "GraphEdit", 80 * scale);
+ theme->set_constant("bezier_len_neg", "GraphEdit", 160 * scale);
+
+ theme->set_icon("logo", "Icons", make_icon(logo_png));
// Theme
diff --git a/scene/resources/default_theme/scroll_grabber_pressed.png b/scene/resources/default_theme/scroll_grabber_pressed.png
new file mode 100644
index 0000000000..a46d242ddd
--- /dev/null
+++ b/scene/resources/default_theme/scroll_grabber_pressed.png
Binary files differ
diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h
index 70a8ad12cb..bed4bdb760 100644
--- a/scene/resources/default_theme/theme_data.h
+++ b/scene/resources/default_theme/theme_data.h
@@ -334,6 +334,10 @@ static const unsigned char scroll_grabber_hl_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0xc, 0x8, 0x3, 0x0, 0x0, 0x0, 0x61, 0xab, 0xac, 0xd5, 0x0, 0x0, 0x0, 0x4, 0x67, 0x41, 0x4d, 0x41, 0x0, 0x0, 0xb1, 0x8f, 0xb, 0xfc, 0x61, 0x5, 0x0, 0x0, 0x0, 0x20, 0x63, 0x48, 0x52, 0x4d, 0x0, 0x0, 0x7a, 0x26, 0x0, 0x0, 0x80, 0x84, 0x0, 0x0, 0xfa, 0x0, 0x0, 0x0, 0x80, 0xe8, 0x0, 0x0, 0x75, 0x30, 0x0, 0x0, 0xea, 0x60, 0x0, 0x0, 0x3a, 0x98, 0x0, 0x0, 0x17, 0x70, 0x9c, 0xba, 0x51, 0x3c, 0x0, 0x0, 0x0, 0x6c, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0x97, 0xd0, 0xdf, 0x92, 0xcb, 0xdc, 0x84, 0xbb, 0xd4, 0x92, 0xca, 0xdc, 0x95, 0xd0, 0xdd, 0x83, 0xbb, 0xd3, 0x8b, 0xc8, 0xd7, 0x79, 0xb5, 0xcb, 0x78, 0xb4, 0xca, 0x73, 0xb0, 0xc7, 0x73, 0xb0, 0xc7, 0x7b, 0xc0, 0xcf, 0x79, 0xc5, 0xd1, 0x6b, 0xae, 0xc1, 0x75, 0xc6, 0xcf, 0x70, 0xbc, 0xca, 0x64, 0xa6, 0xbc, 0x71, 0xbc, 0xc9, 0x82, 0xba, 0xd4, 0x6a, 0xa2, 0xc6, 0x62, 0x9a, 0xc2, 0x61, 0x9a, 0xc1, 0x68, 0x9f, 0xc2, 0x5d, 0x92, 0xbb, 0x5c, 0x92, 0xb8, 0x58, 0x8d, 0xb6, 0x59, 0x8e, 0xb3, 0x56, 0x89, 0xb0, 0x5c, 0x91, 0xb2, 0x53, 0x84, 0xa9, 0x58, 0x8f, 0xae, 0x54, 0x83, 0xa4, 0x57, 0x8e, 0xad, 0x64, 0xa5, 0xba, 0xff, 0xff, 0xff, 0xbb, 0x65, 0x65, 0x27, 0x0, 0x0, 0x0, 0x13, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x25, 0xad, 0xf1, 0xad, 0x27, 0xef, 0xad, 0xf1, 0xf3, 0xf1, 0xf3, 0xad, 0x28, 0xef, 0x27, 0xad, 0xf2, 0xad, 0xcd, 0x8a, 0x27, 0xfe, 0x0, 0x0, 0x0, 0x1, 0x62, 0x4b, 0x47, 0x44, 0x23, 0x2a, 0x62, 0x6c, 0x3a, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xb, 0x13, 0x0, 0x0, 0xb, 0x13, 0x1, 0x0, 0x9a, 0x9c, 0x18, 0x0, 0x0, 0x0, 0x7, 0x74, 0x49, 0x4d, 0x45, 0x7, 0xe0, 0x6, 0x16, 0x12, 0x2b, 0x5, 0x39, 0x1a, 0x32, 0x39, 0x0, 0x0, 0x0, 0x50, 0x49, 0x44, 0x41, 0x54, 0x8, 0xd7, 0x63, 0x60, 0xc0, 0x7, 0x18, 0x99, 0x98, 0x85, 0x59, 0x18, 0x21, 0x6c, 0x56, 0x36, 0x11, 0x51, 0x31, 0x11, 0x36, 0x56, 0x30, 0x87, 0x5d, 0x5c, 0x2, 0x8, 0xc4, 0xd9, 0xc1, 0x1c, 0xe, 0x49, 0x29, 0x20, 0x90, 0xe4, 0x4, 0x73, 0xb8, 0xa4, 0x65, 0x80, 0x40, 0x9a, 0x1b, 0xcc, 0xe1, 0x91, 0x95, 0x3, 0x2, 0x59, 0x1e, 0x30, 0x87, 0x97, 0x4f, 0x5e, 0x41, 0x41, 0x91, 0x8f, 0x17, 0x62, 0x1c, 0xbf, 0x80, 0xa0, 0x92, 0x10, 0x3f, 0x5e, 0xdb, 0x1, 0x41, 0x87, 0x4, 0x7d, 0x15, 0xc4, 0xfd, 0x6a, 0x0, 0x0, 0x0, 0x19, 0x74, 0x45, 0x58, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x0, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x47, 0x49, 0x4d, 0x50, 0x57, 0x81, 0xe, 0x17, 0x0, 0x0, 0x0, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x0, 0x32, 0x30, 0x31, 0x36, 0x2d, 0x30, 0x36, 0x2d, 0x32, 0x32, 0x54, 0x32, 0x30, 0x3a, 0x33, 0x39, 0x3a, 0x32, 0x36, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0xc9, 0xad, 0xc8, 0x52, 0x0, 0x0, 0x0, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0, 0x32, 0x30, 0x31, 0x36, 0x2d, 0x30, 0x36, 0x2d, 0x32, 0x32, 0x54, 0x32, 0x30, 0x3a, 0x33, 0x39, 0x3a, 0x32, 0x36, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0xb8, 0xf0, 0x70, 0xee, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
+static const unsigned char scroll_grabber_pressed_png[] = {
+ 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0xc, 0x8, 0x6, 0x0, 0x0, 0x0, 0x56, 0x75, 0x5c, 0xe7, 0x0, 0x0, 0x0, 0x4, 0x73, 0x42, 0x49, 0x54, 0x8, 0x8, 0x8, 0x8, 0x7c, 0x8, 0x64, 0x88, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xd, 0xd7, 0x0, 0x0, 0xd, 0xd7, 0x1, 0x42, 0x28, 0x9b, 0x78, 0x0, 0x0, 0x0, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x0, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63, 0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a, 0x0, 0x0, 0x0, 0x66, 0x49, 0x44, 0x41, 0x54, 0x28, 0x91, 0xcd, 0x91, 0xb1, 0xa, 0xc0, 0x20, 0x10, 0x43, 0x63, 0x71, 0xbf, 0x5f, 0x12, 0x9c, 0xfd, 0x1a, 0x3f, 0xcd, 0xa9, 0x83, 0xe0, 0x2f, 0x65, 0x2f, 0x9c, 0x8b, 0x83, 0x47, 0xed, 0x60, 0xbb, 0x34, 0xdb, 0x3d, 0x12, 0x48, 0x38, 0xa7, 0xaa, 0xd8, 0xd1, 0xb1, 0xe5, 0x7e, 0x13, 0xf0, 0xf3, 0xd1, 0x5a, 0xf3, 0x24, 0x23, 0x80, 0x34, 0x50, 0x11, 0x91, 0x1a, 0x42, 0xb8, 0x96, 0x1, 0x92, 0x51, 0x55, 0xf3, 0x84, 0x32, 0x49, 0x0, 0x38, 0x9f, 0x2a, 0x25, 0xdc, 0x65, 0xd8, 0xe7, 0xd1, 0x65, 0xe1, 0x31, 0xcc, 0x6c, 0x10, 0x91, 0x3a, 0x3a, 0x9b, 0xd1, 0xb3, 0xc7, 0xfd, 0xef, 0x71, 0x1d, 0x42, 0xe6, 0x21, 0x43, 0xf5, 0x2b, 0xd8, 0x6c, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+};
+
static const unsigned char selection_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x4, 0x3, 0x0, 0x0, 0x0, 0xed, 0xdd, 0xe2, 0x52, 0x0, 0x0, 0x0, 0x4, 0x67, 0x41, 0x4d, 0x41, 0x0, 0x0, 0xb1, 0x8f, 0xb, 0xfc, 0x61, 0x5, 0x0, 0x0, 0x0, 0x20, 0x63, 0x48, 0x52, 0x4d, 0x0, 0x0, 0x7a, 0x26, 0x0, 0x0, 0x80, 0x84, 0x0, 0x0, 0xfa, 0x0, 0x0, 0x0, 0x80, 0xe8, 0x0, 0x0, 0x75, 0x30, 0x0, 0x0, 0xea, 0x60, 0x0, 0x0, 0x3a, 0x98, 0x0, 0x0, 0x17, 0x70, 0x9c, 0xba, 0x51, 0x3c, 0x0, 0x0, 0x0, 0x2d, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfd, 0xfb, 0xff, 0xfd, 0xf7, 0xff, 0xfd, 0xf7, 0xff, 0xfd, 0xf7, 0xff, 0xfd, 0xf6, 0xff, 0xf6, 0xf4, 0xff, 0x15, 0x15, 0x17, 0xff, 0x70, 0xc0, 0x21, 0x0, 0x0, 0x0, 0xe, 0x74, 0x52, 0x4e, 0x53, 0x6, 0xf, 0x16, 0x18, 0x2a, 0x3b, 0x40, 0x3c, 0x6, 0x3d, 0x44, 0x3e, 0x31, 0x25, 0x8, 0x3d, 0x16, 0xb4, 0x0, 0x0, 0x0, 0x1, 0x62, 0x4b, 0x47, 0x44, 0xe, 0x6f, 0xbd, 0x30, 0x4f, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xb, 0x13, 0x0, 0x0, 0xb, 0x13, 0x1, 0x0, 0x9a, 0x9c, 0x18, 0x0, 0x0, 0x0, 0x7, 0x74, 0x49, 0x4d, 0x45, 0x7, 0xe0, 0x6, 0x16, 0x12, 0x2b, 0x5, 0x39, 0x1a, 0x32, 0x39, 0x0, 0x0, 0x0, 0x37, 0x49, 0x44, 0x41, 0x54, 0x8, 0xd7, 0x63, 0x60, 0x54, 0x36, 0x6, 0x2, 0x23, 0x1, 0x6, 0x91, 0xb0, 0x34, 0x20, 0x48, 0x75, 0x64, 0x50, 0xef, 0x5c, 0x5, 0x4, 0x33, 0x8a, 0x18, 0xcc, 0xf6, 0xdc, 0x5, 0x82, 0xd3, 0xc9, 0xc, 0x66, 0x6b, 0x41, 0x8c, 0x5b, 0x94, 0x33, 0x60, 0x6, 0xc2, 0xad, 0x80, 0x5b, 0xa, 0x73, 0x6, 0x0, 0x45, 0x34, 0x48, 0x41, 0xa3, 0xc5, 0x91, 0x23, 0x0, 0x0, 0x0, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x0, 0x32, 0x30, 0x31, 0x36, 0x2d, 0x30, 0x36, 0x2d, 0x32, 0x32, 0x54, 0x32, 0x30, 0x3a, 0x33, 0x39, 0x3a, 0x32, 0x36, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0xc9, 0xad, 0xc8, 0x52, 0x0, 0x0, 0x0, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0, 0x32, 0x30, 0x31, 0x36, 0x2d, 0x30, 0x36, 0x2d, 0x32, 0x32, 0x54, 0x32, 0x30, 0x3a, 0x33, 0x39, 0x3a, 0x32, 0x36, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0xb8, 0xf0, 0x70, 0xee, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 23bf6be68c..e424ee48a8 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -43,10 +43,10 @@ bool DynamicFontData::CacheID::operator<(CacheID right) const {
return false;
}
-Ref<DynamicFontAtSize> DynamicFontData::_get_dynamic_font_at_size(CacheID p_id) {
+Ref<DynamicFontAtSize> DynamicFontData::_get_dynamic_font_at_size(CacheID p_cache_id) {
- if (size_cache.has(p_id)) {
- return Ref<DynamicFontAtSize>(size_cache[p_id]);
+ if (size_cache.has(p_cache_id)) {
+ return Ref<DynamicFontAtSize>(size_cache[p_cache_id]);
}
Ref<DynamicFontAtSize> dfas;
@@ -55,8 +55,8 @@ Ref<DynamicFontAtSize> DynamicFontData::_get_dynamic_font_at_size(CacheID p_id)
dfas->font = Ref<DynamicFontData>(this);
- size_cache[p_id] = dfas.ptr();
- dfas->id = p_id;
+ size_cache[p_cache_id] = dfas.ptr();
+ dfas->id = p_cache_id;
dfas->_load();
return dfas;
@@ -524,7 +524,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
if (mh > texsize)
texsize = mh; //special case, adapt to it?
- texsize = nearest_power_of_2(texsize);
+ texsize = next_power_of_2(texsize);
texsize = MIN(texsize, 4096);
diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h
index 7c94def5aa..9024761b96 100644
--- a/scene/resources/dynamic_font.h
+++ b/scene/resources/dynamic_font.h
@@ -72,7 +72,7 @@ private:
friend class DynamicFont;
- Ref<DynamicFontAtSize> _get_dynamic_font_at_size(CacheID p_cache);
+ Ref<DynamicFontAtSize> _get_dynamic_font_at_size(CacheID p_cache_id);
protected:
static void _bind_methods();
diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp
index 8efad94b9a..fa8cf4723b 100644
--- a/scene/resources/dynamic_font_stb.cpp
+++ b/scene/resources/dynamic_font_stb.cpp
@@ -289,7 +289,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
if (mh > texsize)
texsize = mh; //special case, adapt to it?
- texsize = nearest_power_of_2(texsize);
+ texsize = next_power_of_2(texsize);
texsize = MIN(texsize, 4096);
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index c121dae1f1..0bf6a50d93 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -1135,6 +1135,8 @@ void Environment::_bind_methods() {
Environment::Environment() {
+ environment = VS::get_singleton()->environment_create();
+
bg_mode = BG_CLEAR_COLOR;
bg_sky_scale = 1.0;
bg_energy = 1.0;
@@ -1160,8 +1162,6 @@ Environment::Environment() {
set_adjustment_enable(adjustment_enabled); //update
- environment = VS::get_singleton()->environment_create();
-
ssr_enabled = false;
ssr_max_steps = 64;
ssr_fade_in = 0.15;
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index a7c0e2a03d..3a6906aa27 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -224,10 +224,10 @@ public:
void set_ssr_max_steps(int p_steps);
int get_ssr_max_steps() const;
- void set_ssr_fade_in(float p_transition);
+ void set_ssr_fade_in(float p_fade_in);
float get_ssr_fade_in() const;
- void set_ssr_fade_out(float p_transition);
+ void set_ssr_fade_out(float p_fade_out);
float get_ssr_fade_out() const;
void set_ssr_depth_tolerance(float p_depth_tolerance);
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index d1431176d6..035e514eac 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -179,14 +179,14 @@ Vector<Variant> BitmapFont::_get_textures() const {
return rtextures;
}
-Error BitmapFont::create_from_fnt(const String &p_string) {
+Error BitmapFont::create_from_fnt(const String &p_file) {
//fnt format used by angelcode bmfont
//http://www.angelcode.com/products/bmfont/
- FileAccess *f = FileAccess::open(p_string, FileAccess::READ);
+ FileAccess *f = FileAccess::open(p_file, FileAccess::READ);
if (!f) {
- ERR_EXPLAIN("Can't open font: " + p_string);
+ ERR_EXPLAIN("Can't open font: " + p_file);
ERR_FAIL_V(ERR_FILE_NOT_FOUND);
}
@@ -255,7 +255,7 @@ Error BitmapFont::create_from_fnt(const String &p_string) {
if (keys.has("file")) {
String file = keys["file"];
- file = p_string.get_base_dir() + "/" + file;
+ file = p_file.get_base_dir() + "/" + file;
Ref<Texture> tex = ResourceLoader::load(file);
if (tex.is_null()) {
ERR_PRINT("Can't load font texture!");
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index bc23a41ede..a111f64e06 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -1384,7 +1384,7 @@ static Plane _get_texture_mask(SpatialMaterial::TextureChannel p_channel) {
}
void SpatialMaterial::set_metallic_texture_channel(TextureChannel p_channel) {
-
+ ERR_FAIL_INDEX(p_channel, 5);
metallic_texture_channel = p_channel;
VS::get_singleton()->material_set_param(_get_material(), shader_names->metallic_texture_channel, _get_texture_mask(p_channel));
}
@@ -1395,6 +1395,7 @@ SpatialMaterial::TextureChannel SpatialMaterial::get_metallic_texture_channel()
void SpatialMaterial::set_roughness_texture_channel(TextureChannel p_channel) {
+ ERR_FAIL_INDEX(p_channel, 5);
roughness_texture_channel = p_channel;
VS::get_singleton()->material_set_param(_get_material(), shader_names->roughness_texture_channel, _get_texture_mask(p_channel));
}
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 25628e272a..140b2142c9 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -431,7 +431,7 @@ public:
void set_depth_deep_parallax_max_layers(int p_layer);
int get_depth_deep_parallax_max_layers() const;
- void set_subsurface_scattering_strength(float p_strength);
+ void set_subsurface_scattering_strength(float p_subsurface_scattering_strength);
float get_subsurface_scattering_strength() const;
void set_refraction(float p_refraction);
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index e40ef99237..ad3c10b6bc 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -187,7 +187,7 @@ public:
int get_surface_count() const;
void surface_remove(int p_idx);
- void surface_set_custom_aabb(int p_surface, const Rect3 &p_aabb); //only recognized by driver
+ void surface_set_custom_aabb(int p_idx, const Rect3 &p_aabb); //only recognized by driver
int surface_get_array_len(int p_idx) const;
int surface_get_array_index_len(int p_idx) const;
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index ce1d6f311f..4dfc23fa67 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -242,7 +242,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
value = local_dupe;
}
- res->setup_local_to_scene();
+ //this here may reference nodes not iniialized so this line is commented and used after loading all nodes
+ //res->setup_local_to_scene();
}
//must make a copy, because this res is local to scene
}
@@ -293,6 +294,11 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
}
}
+ for (Map<Ref<Resource>, Ref<Resource> >::Element *E = resources_local_to_scene.front(); E; E = E->next()) {
+
+ E->get()->setup_local_to_scene();
+ }
+
//do connections
int cc = connections.size();
@@ -1127,26 +1133,26 @@ bool SceneState::is_connection(int p_node, const StringName &p_signal, int p_to_
return false;
}
-void SceneState::set_bundled_scene(const Dictionary &d) {
+void SceneState::set_bundled_scene(const Dictionary &p_dictionary) {
- ERR_FAIL_COND(!d.has("names"));
- ERR_FAIL_COND(!d.has("variants"));
- ERR_FAIL_COND(!d.has("node_count"));
- ERR_FAIL_COND(!d.has("nodes"));
- ERR_FAIL_COND(!d.has("conn_count"));
- ERR_FAIL_COND(!d.has("conns"));
- //ERR_FAIL_COND( !d.has("path"));
+ ERR_FAIL_COND(!p_dictionary.has("names"));
+ ERR_FAIL_COND(!p_dictionary.has("variants"));
+ ERR_FAIL_COND(!p_dictionary.has("node_count"));
+ ERR_FAIL_COND(!p_dictionary.has("nodes"));
+ ERR_FAIL_COND(!p_dictionary.has("conn_count"));
+ ERR_FAIL_COND(!p_dictionary.has("conns"));
+ //ERR_FAIL_COND( !p_dictionary.has("path"));
int version = 1;
- if (d.has("version"))
- version = d["version"];
+ if (p_dictionary.has("version"))
+ version = p_dictionary["version"];
if (version > PACK_VERSION) {
ERR_EXPLAIN("Save format version too new!");
ERR_FAIL();
}
- PoolVector<String> snames = d["names"];
+ PoolVector<String> snames = p_dictionary["names"];
if (snames.size()) {
int namecount = snames.size();
@@ -1156,7 +1162,7 @@ void SceneState::set_bundled_scene(const Dictionary &d) {
names[i] = r[i];
}
- Array svariants = d["variants"];
+ Array svariants = p_dictionary["variants"];
if (svariants.size()) {
int varcount = svariants.size();
@@ -1170,10 +1176,10 @@ void SceneState::set_bundled_scene(const Dictionary &d) {
variants.clear();
}
- nodes.resize(d["node_count"]);
+ nodes.resize(p_dictionary["node_count"]);
int nc = nodes.size();
if (nc) {
- PoolVector<int> snodes = d["nodes"];
+ PoolVector<int> snodes = p_dictionary["nodes"];
PoolVector<int>::Read r = snodes.read();
int idx = 0;
for (int i = 0; i < nc; i++) {
@@ -1197,12 +1203,12 @@ void SceneState::set_bundled_scene(const Dictionary &d) {
}
}
- connections.resize(d["conn_count"]);
+ connections.resize(p_dictionary["conn_count"]);
int cc = connections.size();
if (cc) {
- PoolVector<int> sconns = d["conns"];
+ PoolVector<int> sconns = p_dictionary["conns"];
PoolVector<int>::Read r = sconns.read();
int idx = 0;
for (int i = 0; i < cc; i++) {
@@ -1222,8 +1228,8 @@ void SceneState::set_bundled_scene(const Dictionary &d) {
}
Array np;
- if (d.has("node_paths")) {
- np = d["node_paths"];
+ if (p_dictionary.has("node_paths")) {
+ np = p_dictionary["node_paths"];
}
node_paths.resize(np.size());
for (int i = 0; i < np.size(); i++) {
@@ -1231,12 +1237,12 @@ void SceneState::set_bundled_scene(const Dictionary &d) {
}
Array ei;
- if (d.has("editable_instances")) {
- ei = d["editable_instances"];
+ if (p_dictionary.has("editable_instances")) {
+ ei = p_dictionary["editable_instances"];
}
- if (d.has("base_scene")) {
- base_scene_idx = d["base_scene"];
+ if (p_dictionary.has("base_scene")) {
+ base_scene_idx = p_dictionary["base_scene"];
}
editable_instances.resize(ei.size());
@@ -1244,7 +1250,7 @@ void SceneState::set_bundled_scene(const Dictionary &d) {
editable_instances[i] = ei[i];
}
- //path=d["path"];
+ //path=p_dictionary["path"];
}
Dictionary SceneState::get_bundled_scene() const {
@@ -1696,9 +1702,9 @@ SceneState::SceneState() {
////////////////
-void PackedScene::_set_bundled_scene(const Dictionary &d) {
+void PackedScene::_set_bundled_scene(const Dictionary &p_scene) {
- state->set_bundled_scene(d);
+ state->set_bundled_scene(p_scene);
}
Dictionary PackedScene::_get_bundled_scene() const {
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 065e7a84dd..6a3ddde02a 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -618,8 +618,8 @@ Vector3 CubeMesh::get_size() const {
return size;
}
-void CubeMesh::set_subdivide_width(const int p_subdivide) {
- subdivide_w = p_subdivide > 0 ? p_subdivide : 0;
+void CubeMesh::set_subdivide_width(const int p_divisions) {
+ subdivide_w = p_divisions > 0 ? p_divisions : 0;
_request_update();
}
@@ -627,8 +627,8 @@ int CubeMesh::get_subdivide_width() const {
return subdivide_w;
}
-void CubeMesh::set_subdivide_height(const int p_subdivide) {
- subdivide_h = p_subdivide > 0 ? p_subdivide : 0;
+void CubeMesh::set_subdivide_height(const int p_divisions) {
+ subdivide_h = p_divisions > 0 ? p_divisions : 0;
_request_update();
}
@@ -636,8 +636,8 @@ int CubeMesh::get_subdivide_height() const {
return subdivide_h;
}
-void CubeMesh::set_subdivide_depth(const int p_subdivide) {
- subdivide_d = p_subdivide > 0 ? p_subdivide : 0;
+void CubeMesh::set_subdivide_depth(const int p_divisions) {
+ subdivide_d = p_divisions > 0 ? p_divisions : 0;
_request_update();
}
@@ -957,8 +957,8 @@ Size2 PlaneMesh::get_size() const {
return size;
}
-void PlaneMesh::set_subdivide_width(const int p_subdivide) {
- subdivide_w = p_subdivide > 0 ? p_subdivide : 0;
+void PlaneMesh::set_subdivide_width(const int p_divisions) {
+ subdivide_w = p_divisions > 0 ? p_divisions : 0;
_request_update();
}
@@ -966,8 +966,8 @@ int PlaneMesh::get_subdivide_width() const {
return subdivide_w;
}
-void PlaneMesh::set_subdivide_depth(const int p_subdivide) {
- subdivide_d = p_subdivide > 0 ? p_subdivide : 0;
+void PlaneMesh::set_subdivide_depth(const int p_divisions) {
+ subdivide_d = p_divisions > 0 ? p_divisions : 0;
_request_update();
}
diff --git a/scene/resources/room.h b/scene/resources/room.h
index 1bcdec5eb0..ba5c0eee1c 100644
--- a/scene/resources/room.h
+++ b/scene/resources/room.h
@@ -50,7 +50,7 @@ protected:
public:
virtual RID get_rid() const;
- void set_geometry_hint(const PoolVector<Face3> &geometry_hint);
+ void set_geometry_hint(const PoolVector<Face3> &p_geometry_hint);
PoolVector<Face3> get_geometry_hint() const;
RoomBounds();
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index 03a862b744..49cd030a9a 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -621,9 +621,9 @@ ResourceInteractiveLoaderText::~ResourceInteractiveLoaderText() {
memdelete(f);
}
-void ResourceInteractiveLoaderText::get_dependencies(FileAccess *f, List<String> *p_dependencies, bool p_add_types) {
+void ResourceInteractiveLoaderText::get_dependencies(FileAccess *p_f, List<String> *p_dependencies, bool p_add_types) {
- open(f);
+ open(p_f);
ignore_resource_parsing = true;
ERR_FAIL_COND(error != OK);
diff --git a/scene/resources/shape_2d.h b/scene/resources/shape_2d.h
index a752b8dbe2..c020fb9141 100644
--- a/scene/resources/shape_2d.h
+++ b/scene/resources/shape_2d.h
@@ -47,10 +47,10 @@ public:
void set_custom_solver_bias(real_t p_bias);
real_t get_custom_solver_bias() const;
- bool collide_with_motion(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_p_shape_motion);
+ bool collide_with_motion(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_shape_motion);
bool collide(const Transform2D &p_local_xform, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform);
- Variant collide_with_motion_and_get_contacts(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_p_shape_motion);
+ Variant collide_with_motion_and_get_contacts(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_shape_motion);
Variant collide_and_get_contacts(const Transform2D &p_local_xform, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform);
virtual void draw(const RID &p_to_rid, const Color &p_color) {}
diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp
index 5750960845..cc3cfe4dc0 100644
--- a/scene/resources/sky_box.cpp
+++ b/scene/resources/sky_box.cpp
@@ -128,7 +128,7 @@ void ProceduralSky::_radiance_changed() {
VS::get_singleton()->sky_set_texture(sky, texture, size[get_radiance_size()]);
}
-void ProceduralSky::_update_sky() {
+Ref<Image> ProceduralSky::_generate_sky() {
update_queued = false;
@@ -215,9 +215,7 @@ void ProceduralSky::_update_sky() {
image.instance();
image->create(w, h, false, Image::FORMAT_RGBE9995, imgdata);
- VS::get_singleton()->texture_allocate(texture, w, h, Image::FORMAT_RGBE9995, VS::TEXTURE_FLAG_FILTER | VS::TEXTURE_FLAG_REPEAT);
- VS::get_singleton()->texture_set_data(texture, image);
- _radiance_changed();
+ return image;
}
void ProceduralSky::set_sky_top_color(const Color &p_sky_top) {
@@ -385,6 +383,33 @@ RID ProceduralSky::get_rid() const {
return sky;
}
+void ProceduralSky::_update_sky() {
+
+ bool use_thread = true;
+ if (first_time) {
+ use_thread = false;
+ first_time = false;
+ }
+#ifdef NO_THREADS
+ use_thread = false;
+#endif
+ if (use_thread) {
+
+ if (!sky_thread) {
+ sky_thread = Thread::create(_thread_function, this);
+ regen_queued = false;
+ } else {
+ regen_queued = true;
+ }
+
+ } else {
+ Ref<Image> image = _generate_sky();
+ VS::get_singleton()->texture_allocate(texture, image->get_width(), image->get_height(), Image::FORMAT_RGBE9995, VS::TEXTURE_FLAG_FILTER | VS::TEXTURE_FLAG_REPEAT);
+ VS::get_singleton()->texture_set_data(texture, image);
+ _radiance_changed();
+ }
+}
+
void ProceduralSky::_queue_update() {
if (update_queued)
@@ -394,6 +419,26 @@ void ProceduralSky::_queue_update() {
call_deferred("_update_sky");
}
+void ProceduralSky::_thread_done(const Ref<Image> &image) {
+
+ VS::get_singleton()->texture_allocate(texture, image->get_width(), image->get_height(), Image::FORMAT_RGBE9995, VS::TEXTURE_FLAG_FILTER | VS::TEXTURE_FLAG_REPEAT);
+ VS::get_singleton()->texture_set_data(texture, image);
+ _radiance_changed();
+ Thread::wait_to_finish(sky_thread);
+ memdelete(sky_thread);
+ sky_thread = NULL;
+ if (regen_queued) {
+ sky_thread = Thread::create(_thread_function, this);
+ regen_queued = false;
+ }
+}
+
+void ProceduralSky::_thread_function(void *p_ud) {
+
+ ProceduralSky *psky = (ProceduralSky *)p_ud;
+ psky->call_deferred("_thread_done", psky->_generate_sky());
+}
+
void ProceduralSky::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_sky"), &ProceduralSky::_update_sky);
@@ -446,6 +491,8 @@ void ProceduralSky::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_texture_size", "size"), &ProceduralSky::set_texture_size);
ClassDB::bind_method(D_METHOD("get_texture_size"), &ProceduralSky::get_texture_size);
+ ClassDB::bind_method(D_METHOD("_thread_done", "image"), &ProceduralSky::_thread_done);
+
ADD_GROUP("Sky", "sky_");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "sky_top_color"), "set_sky_top_color", "get_sky_top_color");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "sky_horizon_color"), "set_sky_horizon_color", "get_sky_horizon_color");
@@ -503,12 +550,20 @@ ProceduralSky::ProceduralSky() {
sun_energy = 16;
texture_size = TEXTURE_SIZE_1024;
+ sky_thread = NULL;
+ regen_queued = false;
+ first_time = true;
_queue_update();
}
ProceduralSky::~ProceduralSky() {
+ if (sky_thread) {
+ Thread::wait_to_finish(sky_thread);
+ memdelete(sky_thread);
+ sky_thread = NULL;
+ }
VS::get_singleton()->free(sky);
VS::get_singleton()->free(texture);
}
diff --git a/scene/resources/sky_box.h b/scene/resources/sky_box.h
index 8298d1b3c0..9bd60cddaf 100644
--- a/scene/resources/sky_box.h
+++ b/scene/resources/sky_box.h
@@ -30,8 +30,8 @@
#ifndef Sky_H
#define Sky_H
+#include "os/thread.h"
#include "scene/resources/texture.h"
-
class Sky : public Resource {
GDCLASS(Sky, Resource);
@@ -97,6 +97,7 @@ public:
};
private:
+ Thread *sky_thread;
Color sky_top_color;
Color sky_horizon_color;
float sky_curve;
@@ -121,12 +122,20 @@ private:
RID texture;
bool update_queued;
+ bool regen_queued;
+
+ bool first_time;
+
+ void _thread_done(const Ref<Image> &p_image);
+ static void _thread_function(void *p_ud);
protected:
static void _bind_methods();
virtual void _radiance_changed();
+ Ref<Image> _generate_sky();
void _update_sky();
+
void _queue_update();
public:
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index bdb17c0ea5..d6a730647f 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -28,6 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "style_box.h"
+#include <limits.h>
bool StyleBox::test_mask(const Point2 &p_point, const Rect2 &p_rect) const {
@@ -161,7 +162,7 @@ void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const {
if (normal_map.is_valid())
normal_rid = normal_map->get_rid();
- VisualServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center, modulate, normal_rid);
+ VisualServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NinePatchAxisMode(axis_h), VS::NinePatchAxisMode(axis_v), draw_center, modulate, normal_rid);
}
void StyleBoxTexture::set_draw_center(bool p_draw) {
@@ -210,6 +211,28 @@ Rect2 StyleBoxTexture::get_region_rect() const {
return region_rect;
}
+void StyleBoxTexture::set_h_axis_stretch_mode(AxisStretchMode p_mode) {
+
+ axis_h = p_mode;
+ emit_changed();
+}
+
+StyleBoxTexture::AxisStretchMode StyleBoxTexture::get_h_axis_stretch_mode() const {
+
+ return axis_h;
+}
+
+void StyleBoxTexture::set_v_axis_stretch_mode(AxisStretchMode p_mode) {
+
+ axis_v = p_mode;
+ emit_changed();
+}
+
+StyleBoxTexture::AxisStretchMode StyleBoxTexture::get_v_axis_stretch_mode() const {
+
+ return axis_v;
+}
+
void StyleBoxTexture::set_modulate(const Color &p_modulate) {
if (modulate == p_modulate)
return;
@@ -245,6 +268,12 @@ void StyleBoxTexture::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_modulate", "color"), &StyleBoxTexture::set_modulate);
ClassDB::bind_method(D_METHOD("get_modulate"), &StyleBoxTexture::get_modulate);
+ ClassDB::bind_method(D_METHOD("set_h_axis_stretch_mode", "mode"), &StyleBoxTexture::set_h_axis_stretch_mode);
+ ClassDB::bind_method(D_METHOD("get_h_axis_stretch_mode"), &StyleBoxTexture::get_h_axis_stretch_mode);
+
+ ClassDB::bind_method(D_METHOD("set_v_axis_stretch_mode", "mode"), &StyleBoxTexture::set_v_axis_stretch_mode);
+ ClassDB::bind_method(D_METHOD("get_v_axis_stretch_mode"), &StyleBoxTexture::get_v_axis_stretch_mode);
+
ADD_SIGNAL(MethodInfo("texture_changed"));
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture");
@@ -260,9 +289,16 @@ void StyleBoxTexture::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_right", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin_size", "get_expand_margin_size", MARGIN_RIGHT);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_top", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin_size", "get_expand_margin_size", MARGIN_TOP);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin_size", "get_expand_margin_size", MARGIN_BOTTOM);
+ ADD_GROUP("Axis Stretch", "axis_stretch_");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "axis_stretch_horizontal", PROPERTY_HINT_ENUM, "Stretch,Tile,Tile Fit"), "set_h_axis_stretch_mode", "get_h_axis_stretch_mode");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "axis_stretch_vertical", PROPERTY_HINT_ENUM, "Stretch,Tile,Tile Fit"), "set_v_axis_stretch_mode", "get_v_axis_stretch_mode");
ADD_GROUP("Modulate", "modulate_");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "modulate_color"), "set_modulate", "get_modulate");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_center"), "set_draw_center", "get_draw_center");
+
+ BIND_CONSTANT(AXIS_STRETCH_MODE_STRETCH);
+ BIND_CONSTANT(AXIS_STRETCH_MODE_TILE);
+ BIND_CONSTANT(AXIS_STRETCH_MODE_TILE_FIT);
}
StyleBoxTexture::StyleBoxTexture() {
@@ -273,6 +309,9 @@ StyleBoxTexture::StyleBoxTexture() {
}
draw_center = true;
modulate = Color(1, 1, 1, 1);
+
+ axis_h = AXIS_STRETCH_MODE_STRETCH;
+ axis_v = AXIS_STRETCH_MODE_STRETCH;
}
StyleBoxTexture::~StyleBoxTexture() {
}
@@ -285,156 +324,508 @@ void StyleBoxFlat::set_bg_color(const Color &p_color) {
emit_changed();
}
-void StyleBoxFlat::set_light_color(const Color &p_color) {
+Color StyleBoxFlat::get_bg_color() const {
- light_color = p_color;
+ return bg_color;
+}
+
+void StyleBoxFlat::set_border_color_all(const Color &p_color) {
+ for (int i = 0; i < 4; i++) {
+
+ border_color.write()[i] = p_color;
+ }
emit_changed();
}
-void StyleBoxFlat::set_dark_color(const Color &p_color) {
+Color StyleBoxFlat::get_border_color_all() const {
+
+ return border_color[MARGIN_TOP];
+}
+void StyleBoxFlat::set_border_color(Margin p_border, const Color &p_color) {
- dark_color = p_color;
+ border_color.write()[p_border] = p_color;
emit_changed();
}
+Color StyleBoxFlat::get_border_color(Margin p_border) const {
-Color StyleBoxFlat::get_bg_color() const {
+ return border_color[p_border];
+}
- return bg_color;
+void StyleBoxFlat::set_border_width_all(int p_size) {
+ border_width[0] = p_size;
+ border_width[1] = p_size;
+ border_width[2] = p_size;
+ border_width[3] = p_size;
+ emit_changed();
}
-Color StyleBoxFlat::get_light_color() const {
+int StyleBoxFlat::get_border_width_min() const {
- return light_color;
+ return MIN(MIN(border_width[0], border_width[1]), MIN(border_width[2], border_width[3]));
}
-Color StyleBoxFlat::get_dark_color() const {
- return dark_color;
+void StyleBoxFlat::set_border_width(Margin p_margin, int p_width) {
+ border_width[p_margin] = p_width;
+ emit_changed();
+}
+
+int StyleBoxFlat::get_border_width(Margin p_margin) const {
+ return border_width[p_margin];
}
-void StyleBoxFlat::set_border_size(int p_size) {
+void StyleBoxFlat::set_border_blend(bool p_blend) {
- border_size = p_size;
+ blend_border = p_blend;
emit_changed();
}
-int StyleBoxFlat::get_border_size() const {
+bool StyleBoxFlat::get_border_blend() const {
- return border_size;
+ return blend_border;
}
-void StyleBoxFlat::_set_additional_border_size(Margin p_margin, int p_size) {
- additional_border_size[p_margin] = p_size;
+void StyleBoxFlat::set_corner_radius_all(int radius) {
+
+ for (int i = 0; i < 4; i++) {
+ corner_radius[i] = radius;
+ }
+
emit_changed();
}
+void StyleBoxFlat::set_corner_radius_individual(const int radius_top_left, const int radius_top_right, const int radius_botton_right, const int radius_bottom_left) {
+ corner_radius[0] = radius_top_left;
+ corner_radius[1] = radius_top_right;
+ corner_radius[2] = radius_botton_right;
+ corner_radius[3] = radius_bottom_left;
-int StyleBoxFlat::_get_additional_border_size(Margin p_margin) const {
- return additional_border_size[p_margin];
+ emit_changed();
+}
+int StyleBoxFlat::get_corner_radius_min() const {
+ int smallest = corner_radius[0];
+ for (int i = 1; i < 4; i++) {
+ if (smallest > corner_radius[i]) {
+ smallest = corner_radius[i];
+ }
+ }
+ return smallest;
}
-void StyleBoxFlat::set_border_blend(bool p_blend) {
+void StyleBoxFlat::set_corner_radius(const Corner p_corner, const int radius) {
- blend = p_blend;
+ corner_radius[p_corner] = radius;
emit_changed();
}
+int StyleBoxFlat::get_corner_radius(const Corner p_corner) const {
+ return corner_radius[p_corner];
+}
-bool StyleBoxFlat::get_border_blend() const {
+void StyleBoxFlat::set_expand_margin_size(Margin p_expand_margin, float p_size) {
+
+ expand_margin[p_expand_margin] = p_size;
+ emit_changed();
+}
+float StyleBoxFlat::get_expand_margin_size(Margin p_expand_margin) const {
+ return expand_margin[p_expand_margin];
+}
+void StyleBoxFlat::set_filled(bool p_filled) {
- return blend;
+ filled = p_filled;
+ emit_changed();
}
+bool StyleBoxFlat::is_filled() const {
-void StyleBoxFlat::set_draw_center(bool p_draw) {
+ return filled;
+}
- draw_center = p_draw;
+void StyleBoxFlat::set_shadow_color(const Color &p_color) {
+
+ shadow_color = p_color;
emit_changed();
}
-bool StyleBoxFlat::get_draw_center() const {
+Color StyleBoxFlat::get_shadow_color() const {
- return draw_center;
+ return shadow_color;
+}
+
+void StyleBoxFlat::set_shadow_size(const int &p_size) {
+
+ shadow_size = p_size;
+ emit_changed();
+}
+int StyleBoxFlat::get_shadow_size() const {
+
+ return shadow_size;
+}
+
+void StyleBoxFlat::set_anti_aliased(const bool &p_anti_aliased) {
+ anti_aliased = p_anti_aliased;
+ emit_changed();
+}
+bool StyleBoxFlat::is_anti_aliased() const {
+ return anti_aliased;
+}
+
+void StyleBoxFlat::set_aa_size(const int &p_aa_size) {
+ aa_size = CLAMP(p_aa_size, 1, 5);
+ emit_changed();
+}
+int StyleBoxFlat::get_aa_size() const {
+ return aa_size;
}
+
+void StyleBoxFlat::set_corner_detail(const int &p_corner_detail) {
+ corner_detail = CLAMP(p_corner_detail, 1, 128);
+ emit_changed();
+}
+int StyleBoxFlat::get_corner_detail() const {
+ return corner_detail;
+}
+
Size2 StyleBoxFlat::get_center_size() const {
return Size2();
}
-void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const {
+inline void set_inner_corner_radius(const Rect2 style_rect, const Rect2 inner_rect, const int corner_radius[4], int *inner_corner_radius) {
+ int border_left = inner_rect.position.x - style_rect.position.x;
+ int border_top = inner_rect.position.y - style_rect.position.y;
+ int border_right = style_rect.size.width - inner_rect.size.width - border_left;
+ int border_bottom = style_rect.size.height - inner_rect.size.height - border_top;
- VisualServer *vs = VisualServer::get_singleton();
- Rect2i r = p_rect;
+ int rad;
+ //tl
+ rad = MIN(border_top, border_left);
+ inner_corner_radius[0] = MAX(corner_radius[0] - rad, 0);
- for (int i = 0; i < border_size; i++) {
+ //tr
+ rad = MIN(border_top, border_bottom);
+ inner_corner_radius[1] = MAX(corner_radius[1] - rad, 0);
- Color color_upleft = light_color;
- Color color_downright = dark_color;
+ //br
+ rad = MIN(border_bottom, border_right);
+ inner_corner_radius[2] = MAX(corner_radius[2] - rad, 0);
- if (blend) {
+ //bl
+ rad = MIN(border_bottom, border_left);
+ inner_corner_radius[3] = MAX(corner_radius[3] - rad, 0);
+}
- color_upleft.r = (border_size - i) * color_upleft.r / border_size + i * bg_color.r / border_size;
- color_upleft.g = (border_size - i) * color_upleft.g / border_size + i * bg_color.g / border_size;
- color_upleft.b = (border_size - i) * color_upleft.b / border_size + i * bg_color.b / border_size;
+inline void draw_ring(Vector<Vector2> &verts, Vector<int> &indices, Vector<Color> &colors, const Rect2 style_rect, const int corner_radius[4],
+ const Rect2 ring_rect, const int border_width[4], const Color inner_color[4], const Color outer_color[4], const int corner_detail) {
- color_downright.r = (border_size - i) * color_downright.r / border_size + i * bg_color.r / border_size;
- color_downright.g = (border_size - i) * color_downright.g / border_size + i * bg_color.g / border_size;
- color_downright.b = (border_size - i) * color_downright.b / border_size + i * bg_color.b / border_size;
+ int vert_offset = verts.size();
+ if (!vert_offset) {
+ vert_offset = 0;
+ }
+ int adapted_corner_detail = (corner_radius[0] == 0 && corner_radius[1] == 0 && corner_radius[2] == 0 && corner_radius[3] == 0) ? 1 : corner_detail;
+ int rings = (border_width[0] == 0 && border_width[1] == 0 && border_width[2] == 0 && border_width[3] == 0) ? 1 : 2;
+ rings = 2;
+
+ int ring_corner_radius[4];
+ set_inner_corner_radius(style_rect, ring_rect, corner_radius, ring_corner_radius);
+
+ //corner radius center points
+ Vector<Point2> outer_points;
+ outer_points.push_back(ring_rect.position + Vector2(ring_corner_radius[0], ring_corner_radius[0])); //tl
+ outer_points.push_back(Point2(ring_rect.position.x + ring_rect.size.x - ring_corner_radius[1], ring_rect.position.y + ring_corner_radius[1])); //tr
+ outer_points.push_back(ring_rect.position + ring_rect.size - Vector2(ring_corner_radius[2], ring_corner_radius[2])); //br
+ outer_points.push_back(Point2(ring_rect.position.x + ring_corner_radius[3], ring_rect.position.y + ring_rect.size.y - ring_corner_radius[3])); //bl
+
+ Rect2 inner_rect;
+ inner_rect = ring_rect.grow_individual(-border_width[MARGIN_LEFT], -border_width[MARGIN_TOP], -border_width[MARGIN_RIGHT], -border_width[MARGIN_BOTTOM]);
+ int inner_corner_radius[4];
+
+ Vector<Point2> inner_points;
+ set_inner_corner_radius(style_rect, inner_rect, corner_radius, inner_corner_radius);
+ inner_points.push_back(inner_rect.position + Vector2(inner_corner_radius[0], inner_corner_radius[0])); //tl
+ inner_points.push_back(Point2(inner_rect.position.x + inner_rect.size.x - inner_corner_radius[1], inner_rect.position.y + inner_corner_radius[1])); //tr
+ inner_points.push_back(inner_rect.position + inner_rect.size - Vector2(inner_corner_radius[2], inner_corner_radius[2])); //br
+ inner_points.push_back(Point2(inner_rect.position.x + inner_corner_radius[3], inner_rect.position.y + inner_rect.size.y - inner_corner_radius[3])); //bl
+
+ //calculate the vert array
+ for (int corner_index = 0; corner_index < 4; corner_index++) {
+ for (int detail = 0; detail <= adapted_corner_detail; detail++) {
+ for (int inner_outer = (2 - rings); inner_outer < 2; inner_outer++) {
+ float radius;
+ Color color;
+ Point2 corner_point;
+ if (inner_outer == 0) {
+ radius = inner_corner_radius[corner_index];
+ color = *inner_color;
+ corner_point = inner_points[corner_index];
+ } else {
+ radius = ring_corner_radius[corner_index];
+ color = *outer_color;
+ corner_point = outer_points[corner_index];
+ }
+ float x = radius * (float)cos((double)corner_index * Math_PI / 2.0 + (double)detail / (double)adapted_corner_detail * Math_PI / 2.0 + Math_PI) + corner_point.x;
+ float y = radius * (float)sin((double)corner_index * Math_PI / 2.0 + (double)detail / (double)adapted_corner_detail * Math_PI / 2.0 + Math_PI) + corner_point.y;
+ verts.push_back(Vector2(x, y));
+ colors.push_back(color);
+ }
}
+ }
+
+ if (rings == 2) {
+ int vert_count = (adapted_corner_detail + 1) * 4 * rings;
+ //fill the indices and the colors for the border
+ for (int i = 0; i < vert_count; i++) {
+ //poly 1
+ indices.push_back(vert_offset + ((i + 0) % vert_count));
+ indices.push_back(vert_offset + ((i + 2) % vert_count));
+ indices.push_back(vert_offset + ((i + 1) % vert_count));
+ //poly 2
+ indices.push_back(vert_offset + ((i + 1) % vert_count));
+ indices.push_back(vert_offset + ((i + 2) % vert_count));
+ indices.push_back(vert_offset + ((i + 3) % vert_count));
+ }
+ }
+}
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r.position.x, r.position.y + r.size.y - 1), Size2(r.size.x, 1)), color_downright);
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r.position.x + r.size.x - 1, r.position.y), Size2(1, r.size.y)), color_downright);
+inline void adapt_values(int p_index_a, int p_index_b, int *adapted_values, const int *p_values, const real_t p_width, const int p_max_a, const int p_max_b) {
+ if (p_values[p_index_a] + p_values[p_index_b] > p_width) {
+ float factor;
+ int newValue;
- vs->canvas_item_add_rect(p_canvas_item, Rect2(r.position, Size2(r.size.x, 1)), color_upleft);
- vs->canvas_item_add_rect(p_canvas_item, Rect2(r.position, Size2(1, r.size.y)), color_upleft);
+ factor = (float)p_width / (float)(p_values[p_index_a] + p_values[p_index_b]);
- r.position.x++;
- r.position.y++;
- r.size.x -= 2;
- r.size.y -= 2;
+ newValue = (int)(p_values[p_index_a] * factor);
+ if (newValue < adapted_values[p_index_a]) {
+ adapted_values[p_index_a] = newValue;
+ }
+ newValue = (int)(p_values[p_index_b] * factor);
+ if (newValue < adapted_values[p_index_b]) {
+ adapted_values[p_index_b] = newValue;
+ }
+ } else {
+ adapted_values[p_index_a] = MIN(p_values[p_index_a], adapted_values[p_index_a]);
+ adapted_values[p_index_b] = MIN(p_values[p_index_b], adapted_values[p_index_b]);
+ }
+ adapted_values[p_index_a] = MIN(p_max_a, adapted_values[p_index_a]);
+ adapted_values[p_index_b] = MIN(p_max_b, adapted_values[p_index_b]);
+}
+void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const {
+
+ //PREPARATIONS
+
+ bool rounded_corners = (corner_radius[0] > 0) || (corner_radius[1] > 0) || (corner_radius[2] > 0) || (corner_radius[3] > 0);
+ bool aa_on = rounded_corners && anti_aliased;
+
+ Rect2 style_rect = p_rect.grow_individual(expand_margin[MARGIN_LEFT], expand_margin[MARGIN_TOP], expand_margin[MARGIN_RIGHT], expand_margin[MARGIN_BOTTOM]);
+ if (aa_on) {
+ style_rect = style_rect.grow(-((aa_size + 1) / 2));
}
- if (draw_center)
- vs->canvas_item_add_rect(p_canvas_item, Rect2(r.position, r.size), bg_color);
+ //adapt borders (prevent weired overlapping/glitchy drawings)
+ int width = style_rect.size.width;
+ int height = style_rect.size.height;
+ int adapted_border[4] = { INT_MAX, INT_MAX, INT_MAX, INT_MAX };
+ adapt_values(MARGIN_TOP, MARGIN_BOTTOM, adapted_border, border_width, height, height, height);
+ adapt_values(MARGIN_LEFT, MARGIN_RIGHT, adapted_border, border_width, width, width, width);
+
+ //adapt corners (prevent weired overlapping/glitchy drawings)
+ int adapted_corner[4] = { INT_MAX, INT_MAX, INT_MAX, INT_MAX };
+ adapt_values(CORNER_TOP_RIGHT, CORNER_BOTTOM_RIGHT, adapted_corner, corner_radius, height, height - adapted_border[MARGIN_BOTTOM], height - adapted_border[MARGIN_TOP]);
+ adapt_values(CORNER_TOP_LEFT, CORNER_BOTTOM_LEFT, adapted_corner, corner_radius, height, height - adapted_border[MARGIN_BOTTOM], height - adapted_border[MARGIN_TOP]);
+ adapt_values(CORNER_TOP_LEFT, CORNER_TOP_RIGHT, adapted_corner, corner_radius, width, width - adapted_border[MARGIN_RIGHT], width - adapted_border[MARGIN_LEFT]);
+ adapt_values(CORNER_BOTTOM_LEFT, CORNER_BOTTOM_RIGHT, adapted_corner, corner_radius, width, width - adapted_border[MARGIN_RIGHT], width - adapted_border[MARGIN_LEFT]);
+
+ Rect2 infill_rect = style_rect.grow_individual(-adapted_border[MARGIN_LEFT], -adapted_border[MARGIN_TOP], -adapted_border[MARGIN_RIGHT], -adapted_border[MARGIN_BOTTOM]);
+
+ Vector<Point2> verts;
+ Vector<int> indices;
+ Vector<Color> colors;
+
+ //DRAWING
+ VisualServer *vs = VisualServer::get_singleton();
+
+ //DRAW SHADOW
+ if (shadow_size > 0) {
+ int shadow_width[4] = { shadow_size, shadow_size, shadow_size, shadow_size };
+ Color shadow_colors[4] = { shadow_color, shadow_color, shadow_color, shadow_color };
+ Color shadow_colors_transparent[4];
+ for (int i = 0; i < 4; i++) {
+ shadow_colors_transparent[i] = Color(shadow_color.r, shadow_color.g, shadow_color.b, 0);
+ }
+ draw_ring(verts, indices, colors, style_rect, adapted_corner,
+ style_rect.grow(shadow_size), shadow_width, shadow_colors, shadow_colors_transparent, corner_detail);
+ }
- Rect2i r_add = p_rect;
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x - additional_border_size[MARGIN_LEFT], r_add.position.y - additional_border_size[MARGIN_TOP]), Size2(r_add.size.width + additional_border_size[MARGIN_LEFT] + additional_border_size[MARGIN_RIGHT], additional_border_size[MARGIN_TOP])), light_color);
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x - additional_border_size[MARGIN_LEFT], r_add.position.y), Size2(additional_border_size[MARGIN_LEFT], r_add.size.height)), light_color);
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x + r_add.size.width, r_add.position.y), Size2(additional_border_size[MARGIN_RIGHT], r_add.size.height)), dark_color);
- vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x - additional_border_size[MARGIN_LEFT], r_add.position.y + r_add.size.height), Size2(r_add.size.width + additional_border_size[MARGIN_LEFT] + additional_border_size[MARGIN_RIGHT], additional_border_size[MARGIN_BOTTOM])), dark_color);
+ //DRAW border
+ Color bg_color_array[4] = { bg_color, bg_color, bg_color, bg_color };
+ const Color *inner_color = ((blend_border) ? bg_color_array : border_color.read().ptr());
+ draw_ring(verts, indices, colors, style_rect, adapted_corner,
+ style_rect, adapted_border, inner_color, border_color.read().ptr(), corner_detail);
+
+ //DRAW INFILL
+ if (filled) {
+ int temp_vert_offset = verts.size();
+ int no_border[4] = { 0, 0, 0, 0 };
+ draw_ring(verts, indices, colors, style_rect, adapted_corner,
+ infill_rect, no_border, &bg_color, &bg_color, corner_detail);
+ int added_vert_count = verts.size() - temp_vert_offset;
+ //fill the indices and the colors for the center
+ for (int index = 0; index <= added_vert_count / 2; index += 2) {
+ int i = index;
+ //poly 1
+ indices.push_back(temp_vert_offset + i);
+ indices.push_back(temp_vert_offset + added_vert_count - 4 - i);
+ indices.push_back(temp_vert_offset + i + 2);
+ //poly 1
+ indices.push_back(temp_vert_offset + i);
+ indices.push_back(temp_vert_offset + added_vert_count - 2 - i);
+ indices.push_back(temp_vert_offset + added_vert_count - 4 - i);
+ }
+ }
+
+ if (aa_on) {
+
+ //HELPER ARRAYS
+ Color border_color_alpha[4];
+ for (int i = 0; i < 4; i++) {
+ Color c = border_color.read().ptr()[i];
+ border_color_alpha[i] = Color(c.r, c.g, c.b, 0);
+ }
+ Color alpha_bg = Color(bg_color.r, bg_color.g, bg_color.b, 0);
+ Color bg_color_array_alpha[4] = { alpha_bg, alpha_bg, alpha_bg, alpha_bg };
+
+ int aa_border_width[4] = { aa_size, aa_size, aa_size, aa_size };
+
+ if (filled) {
+ if (!blend_border) {
+ //INFILL AA
+ draw_ring(verts, indices, colors, style_rect, adapted_corner,
+ infill_rect.grow(aa_size), aa_border_width, bg_color_array, bg_color_array_alpha, corner_detail);
+ }
+ } else if (!(border_width[0] == 0 && border_width[1] == 0 && border_width[2] == 0 && border_width[3] == 0)) {
+ //DRAW INNER BORDER AA
+ draw_ring(verts, indices, colors, style_rect, adapted_corner,
+ infill_rect, aa_border_width, border_color_alpha, border_color.read().ptr(), corner_detail);
+ }
+ //DRAW OUTER BORDER AA
+ if (!(border_width[0] == 0 && border_width[1] == 0 && border_width[2] == 0 && border_width[3] == 0)) {
+ draw_ring(verts, indices, colors, style_rect, adapted_corner,
+ style_rect.grow(aa_size), aa_border_width, border_color.read().ptr(), border_color_alpha, corner_detail);
+ }
+ }
+
+ vs->canvas_item_add_triangle_array(p_canvas_item, indices, verts, colors);
}
float StyleBoxFlat::get_style_margin(Margin p_margin) const {
-
- return border_size;
+ return border_width[p_margin];
}
void StyleBoxFlat::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_bg_color", "color"), &StyleBoxFlat::set_bg_color);
ClassDB::bind_method(D_METHOD("get_bg_color"), &StyleBoxFlat::get_bg_color);
- ClassDB::bind_method(D_METHOD("set_light_color", "color"), &StyleBoxFlat::set_light_color);
- ClassDB::bind_method(D_METHOD("get_light_color"), &StyleBoxFlat::get_light_color);
- ClassDB::bind_method(D_METHOD("set_dark_color", "color"), &StyleBoxFlat::set_dark_color);
- ClassDB::bind_method(D_METHOD("get_dark_color"), &StyleBoxFlat::get_dark_color);
- ClassDB::bind_method(D_METHOD("set_border_size", "size"), &StyleBoxFlat::set_border_size);
- ClassDB::bind_method(D_METHOD("get_border_size"), &StyleBoxFlat::get_border_size);
+
+ ClassDB::bind_method(D_METHOD("set_border_color", "color"), &StyleBoxFlat::set_border_color_all);
+ ClassDB::bind_method(D_METHOD("get_border_color"), &StyleBoxFlat::get_border_color_all);
+
+ ClassDB::bind_method(D_METHOD("set_border_width_all", "width"), &StyleBoxFlat::set_border_width_all);
+ ClassDB::bind_method(D_METHOD("get_border_width_min"), &StyleBoxFlat::get_border_width_min);
+
+ ClassDB::bind_method(D_METHOD("set_border_width", "margin", "width"), &StyleBoxFlat::set_border_width);
+ ClassDB::bind_method(D_METHOD("get_border_width", "margin"), &StyleBoxFlat::get_border_width);
+
ClassDB::bind_method(D_METHOD("set_border_blend", "blend"), &StyleBoxFlat::set_border_blend);
ClassDB::bind_method(D_METHOD("get_border_blend"), &StyleBoxFlat::get_border_blend);
- ClassDB::bind_method(D_METHOD("set_draw_center", "size"), &StyleBoxFlat::set_draw_center);
- ClassDB::bind_method(D_METHOD("get_draw_center"), &StyleBoxFlat::get_draw_center);
+
+ ClassDB::bind_method(D_METHOD("set_corner_radius_individual", "radius_top_left", "radius_top_right", "radius_botton_right", "radius_bottom_left"), &StyleBoxFlat::set_corner_radius_individual);
+ ClassDB::bind_method(D_METHOD("set_corner_radius_all", "radius"), &StyleBoxFlat::set_corner_radius_all);
+
+ ClassDB::bind_method(D_METHOD("set_corner_radius", "corner", "radius"), &StyleBoxFlat::set_corner_radius);
+ ClassDB::bind_method(D_METHOD("get_corner_radius", "corner"), &StyleBoxFlat::get_corner_radius);
+
+ ClassDB::bind_method(D_METHOD("set_expand_margin", "margin", "size"), &StyleBoxFlat::set_expand_margin_size);
+ ClassDB::bind_method(D_METHOD("get_expand_margin", "margin"), &StyleBoxFlat::get_expand_margin_size);
+
+ ClassDB::bind_method(D_METHOD("set_filled", "filled"), &StyleBoxFlat::set_filled);
+ ClassDB::bind_method(D_METHOD("is_filled"), &StyleBoxFlat::is_filled);
+
+ ClassDB::bind_method(D_METHOD("set_shadow_color", "color"), &StyleBoxFlat::set_shadow_color);
+ ClassDB::bind_method(D_METHOD("get_shadow_color"), &StyleBoxFlat::get_shadow_color);
+
+ ClassDB::bind_method(D_METHOD("set_shadow_size", "size"), &StyleBoxFlat::set_shadow_size);
+ ClassDB::bind_method(D_METHOD("get_shadow_size"), &StyleBoxFlat::get_shadow_size);
+
+ ClassDB::bind_method(D_METHOD("set_anti_aliased", "anti_aliased"), &StyleBoxFlat::set_anti_aliased);
+ ClassDB::bind_method(D_METHOD("is_anti_aliased"), &StyleBoxFlat::is_anti_aliased);
+
+ ClassDB::bind_method(D_METHOD("set_aa_size", "size"), &StyleBoxFlat::set_aa_size);
+ ClassDB::bind_method(D_METHOD("get_aa_size"), &StyleBoxFlat::get_aa_size);
+
+ ClassDB::bind_method(D_METHOD("set_corner_detail", "detail"), &StyleBoxFlat::set_corner_detail);
+ ClassDB::bind_method(D_METHOD("get_corner_detail"), &StyleBoxFlat::get_corner_detail);
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "bg_color"), "set_bg_color", "get_bg_color");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "light_color"), "set_light_color", "get_light_color");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "dark_color"), "set_dark_color", "get_dark_color");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "border_size", PROPERTY_HINT_RANGE, "0,4096"), "set_border_size", "get_border_size");
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filled"), "set_filled", "is_filled");
+
+ ADD_GROUP("Border Width", "border_width_");
+ ADD_PROPERTYI(PropertyInfo(Variant::INT, "border_width_left", PROPERTY_HINT_RANGE, "0,1024,1"), "set_border_width", "get_border_width", MARGIN_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::INT, "border_width_top", PROPERTY_HINT_RANGE, "0,1024,1"), "set_border_width", "get_border_width", MARGIN_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::INT, "border_width_right", PROPERTY_HINT_RANGE, "0,1024,1"), "set_border_width", "get_border_width", MARGIN_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::INT, "border_width_bottom", PROPERTY_HINT_RANGE, "0,1024,1"), "set_border_width", "get_border_width", MARGIN_BOTTOM);
+
+ ADD_GROUP("Border", "border_");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "border_color"), "set_border_color", "get_border_color");
+
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "border_blend"), "set_border_blend", "get_border_blend");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_bg"), "set_draw_center", "get_draw_center");
+
+ ADD_GROUP("Corner Radius", "corner_radius_");
+ ADD_PROPERTYI(PropertyInfo(Variant::INT, "corner_radius_top_left", PROPERTY_HINT_RANGE, "0,1024,1"), "set_corner_radius", "get_corner_radius", CORNER_TOP_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::INT, "corner_radius_top_right", PROPERTY_HINT_RANGE, "0,1024,1"), "set_corner_radius", "get_corner_radius", CORNER_TOP_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::INT, "corner_radius_bottom_right", PROPERTY_HINT_RANGE, "0,1024,1"), "set_corner_radius", "get_corner_radius", CORNER_BOTTOM_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::INT, "corner_radius_bottom_left", PROPERTY_HINT_RANGE, "0,1024,1"), "set_corner_radius", "get_corner_radius", CORNER_BOTTOM_LEFT);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "corner_detail", PROPERTY_HINT_RANGE, "1,128,1"), "set_corner_detail", "get_corner_detail");
+
+ ADD_GROUP("Expand Margin", "expand_margin_");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_left", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_right", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_top", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_BOTTOM);
+
+ ADD_GROUP("Shadow", "shadow_");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "shadow_color"), "set_shadow_color", "get_shadow_color");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "shadow_size"), "set_shadow_size", "get_shadow_size");
+
+ ADD_GROUP("Anti Aliasing", "anti_aliasing_");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "anti_aliasing"), "set_anti_aliased", "is_anti_aliased");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "anti_aliasing_size", PROPERTY_HINT_RANGE, "1,5,1"), "set_aa_size", "get_aa_size");
}
StyleBoxFlat::StyleBoxFlat() {
bg_color = Color(0.6, 0.6, 0.6);
- light_color = Color(0.8, 0.8, 0.8);
- dark_color = Color(0.8, 0.8, 0.8);
- draw_center = true;
- blend = true;
- border_size = 0;
- additional_border_size[0] = 0;
- additional_border_size[1] = 0;
- additional_border_size[2] = 0;
- additional_border_size[3] = 0;
+ shadow_color = Color(0, 0, 0, 0.6);
+
+ border_color.append(Color(0.8, 0.8, 0.8));
+ border_color.append(Color(0.8, 0.8, 0.8));
+ border_color.append(Color(0.8, 0.8, 0.8));
+ border_color.append(Color(0.8, 0.8, 0.8));
+
+ blend_border = false;
+ filled = true;
+ anti_aliased = true;
+
+ shadow_size = 0;
+ corner_detail = 8;
+ aa_size = 1;
+
+ border_width[0] = 0;
+ border_width[1] = 0;
+ border_width[2] = 0;
+ border_width[3] = 0;
+
+ expand_margin[0] = 0;
+ expand_margin[1] = 0;
+ expand_margin[2] = 0;
+ expand_margin[3] = 0;
+
+ corner_radius[0] = 0;
+ corner_radius[1] = 0;
+ corner_radius[2] = 0;
+ corner_radius[3] = 0;
}
StyleBoxFlat::~StyleBoxFlat() {
}
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index 64ce3528aa..a750fae753 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -77,6 +77,14 @@ class StyleBoxTexture : public StyleBox {
GDCLASS(StyleBoxTexture, StyleBox);
+public:
+ enum AxisStretchMode {
+ AXIS_STRETCH_MODE_STRETCH,
+ AXIS_STRETCH_MODE_TILE,
+ AXIS_STRETCH_MODE_TILE_FIT,
+ };
+
+private:
float expand_margin[4];
float margin[4];
Rect2 region_rect;
@@ -84,6 +92,8 @@ class StyleBoxTexture : public StyleBox {
Ref<Texture> normal_map;
bool draw_center;
Color modulate;
+ AxisStretchMode axis_h;
+ AxisStretchMode axis_v;
protected:
virtual float get_style_margin(Margin p_margin) const;
@@ -109,6 +119,12 @@ public:
bool get_draw_center() const;
virtual Size2 get_center_size() const;
+ void set_h_axis_stretch_mode(AxisStretchMode p_mode);
+ AxisStretchMode get_h_axis_stretch_mode() const;
+
+ void set_v_axis_stretch_mode(AxisStretchMode p_mode);
+ AxisStretchMode get_v_axis_stretch_mode() const;
+
void set_modulate(const Color &p_modulate);
Color get_modulate() const;
@@ -118,44 +134,88 @@ public:
~StyleBoxTexture();
};
+VARIANT_ENUM_CAST(StyleBoxTexture::AxisStretchMode)
+
class StyleBoxFlat : public StyleBox {
GDCLASS(StyleBoxFlat, StyleBox);
Color bg_color;
- Color light_color;
- Color dark_color;
+ Color shadow_color;
+ PoolVector<Color> border_color;
- int border_size;
- int additional_border_size[4];
+ int border_width[4];
+ int expand_margin[4];
+ int corner_radius[4];
- bool draw_center;
- bool blend;
+ bool filled;
+ bool blend_border;
+ bool anti_aliased;
+
+ int corner_detail;
+ int shadow_size;
+ int aa_size;
protected:
virtual float get_style_margin(Margin p_margin) const;
static void _bind_methods();
public:
+ //Color
void set_bg_color(const Color &p_color);
- void set_light_color(const Color &p_color);
- void set_dark_color(const Color &p_color);
-
Color get_bg_color() const;
- Color get_light_color() const;
- Color get_dark_color() const;
- void set_border_size(int p_size);
- int get_border_size() const;
+ //Border Color
+ void set_border_color_all(const Color &p_color);
+ Color get_border_color_all() const;
+ void set_border_color(Margin p_border, const Color &p_color);
+ Color get_border_color(Margin p_border) const;
+
+ //BORDER
+ //width
+ void set_border_width_all(int p_size);
+ int get_border_width_min() const;
- void _set_additional_border_size(Margin p_margin, int p_size);
- int _get_additional_border_size(Margin p_margin) const;
+ void set_border_width(Margin p_margin, int p_size);
+ int get_border_width(Margin p_margin) const;
+ //blend
void set_border_blend(bool p_blend);
bool get_border_blend() const;
- void set_draw_center(bool p_draw);
- bool get_draw_center() const;
+ //CORNER
+ void set_corner_radius_all(int radius);
+ void set_corner_radius_individual(const int radius_top_left, const int radius_top_right, const int radius_botton_right, const int radius_bottom_left);
+ int get_corner_radius_min() const;
+
+ void set_corner_radius(Corner p_corner, const int radius);
+ int get_corner_radius(Corner p_corner) const;
+
+ void set_corner_detail(const int &p_corner_detail);
+ int get_corner_detail() const;
+
+ //EXPANDS
+ void set_expand_margin_size(Margin p_expand_margin, float p_size);
+ float get_expand_margin_size(Margin p_expand_margin) const;
+
+ //FILLED
+ void set_filled(bool p_draw);
+ bool is_filled() const;
+
+ //SHADOW
+ void set_shadow_color(const Color &p_color);
+ Color get_shadow_color() const;
+
+ void set_shadow_size(const int &p_size);
+ int get_shadow_size() const;
+
+ //ANTI_ALIASING
+ void set_anti_aliased(const bool &p_anit_aliasing);
+ bool is_anti_aliased() const;
+ //tempAA
+ void set_aa_size(const int &p_aa_size);
+ int get_aa_size() const;
+
virtual Size2 get_center_size() const;
virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const;
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index a3c683f857..9320676016 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -33,36 +33,36 @@
#define _VERTEX_SNAP 0.0001
#define EQ_VERTEX_DIST 0.00001
-bool SurfaceTool::Vertex::operator==(const Vertex &p_b) const {
+bool SurfaceTool::Vertex::operator==(const Vertex &p_vertex) const {
- if (vertex != p_b.vertex)
+ if (vertex != p_vertex.vertex)
return false;
- if (uv != p_b.uv)
+ if (uv != p_vertex.uv)
return false;
- if (uv2 != p_b.uv2)
+ if (uv2 != p_vertex.uv2)
return false;
- if (normal != p_b.normal)
+ if (normal != p_vertex.normal)
return false;
- if (binormal != p_b.binormal)
+ if (binormal != p_vertex.binormal)
return false;
- if (color != p_b.color)
+ if (color != p_vertex.color)
return false;
- if (bones.size() != p_b.bones.size())
+ if (bones.size() != p_vertex.bones.size())
return false;
for (int i = 0; i < bones.size(); i++) {
- if (bones[i] != p_b.bones[i])
+ if (bones[i] != p_vertex.bones[i])
return false;
}
for (int i = 0; i < weights.size(); i++) {
- if (weights[i] != p_b.weights[i])
+ if (weights[i] != p_vertex.weights[i])
return false;
}
diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h
index d02e170b02..fcc94753ca 100644
--- a/scene/resources/surface_tool.h
+++ b/scene/resources/surface_tool.h
@@ -102,8 +102,8 @@ public:
void add_normal(const Vector3 &p_normal);
void add_tangent(const Plane &p_tangent);
void add_uv(const Vector2 &p_uv);
- void add_uv2(const Vector2 &p_uv);
- void add_bones(const Vector<int> &p_indices);
+ void add_uv2(const Vector2 &p_uv2);
+ void add_bones(const Vector<int> &p_bones);
void add_weights(const Vector<float> &p_weights);
void add_smooth_group(bool p_smooth);
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 1d5aed0444..ac1bb105ac 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -883,7 +883,7 @@ RES ResourceFormatLoaderTheme::load(const String &p_path, const String &p_origin
ERR_FAIL_V(RES());
}
- sbflat->set_border_size(params[0].to_int());
+ sbflat->set_border_width_all(params[0].to_int());
if (!params[0].is_valid_integer()) {
@@ -929,8 +929,8 @@ RES ResourceFormatLoaderTheme::load(const String &p_path, const String &p_origin
dark = Color::html(params[3]);
}
- sbflat->set_dark_color(dark);
- sbflat->set_light_color(bright);
+ sbflat->set_border_color_all(bright);
+ // sbflat->set_dark_color(dark);
sbflat->set_bg_color(normal);
if (params.size() == ccodes + 5) {
diff --git a/scene/resources/theme.h b/scene/resources/theme.h
index 1dfea7f421..5744c142d4 100644
--- a/scene/resources/theme.h
+++ b/scene/resources/theme.h
@@ -143,8 +143,8 @@ public:
static void set_default(const Ref<Theme> &p_default);
static void set_default_icon(const Ref<Texture> &p_icon);
- static void set_default_style(const Ref<StyleBox> &p_default_style);
- static void set_default_font(const Ref<Font> &p_default_font);
+ static void set_default_style(const Ref<StyleBox> &p_style);
+ static void set_default_font(const Ref<Font> &p_font);
void set_default_theme_font(const Ref<Font> &p_default_font);
Ref<Font> get_default_theme_font() const;
@@ -159,7 +159,7 @@ public:
Ref<Shader> get_shader(const StringName &p_name, const StringName &p_type) const;
bool has_shader(const StringName &p_name, const StringName &p_type) const;
void clear_shader(const StringName &p_name, const StringName &p_type);
- void get_shader_list(const StringName &p_name, List<StringName> *p_list) const;
+ void get_shader_list(const StringName &p_type, List<StringName> *p_list) const;
void set_stylebox(const StringName &p_name, const StringName &p_type, const Ref<StyleBox> &p_style);
Ref<StyleBox> get_stylebox(const StringName &p_name, const StringName &p_type) const;
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index 99c506390c..7d7855811f 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -105,7 +105,7 @@ public:
void tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape);
Ref<Shape2D> tile_get_shape(int p_id, int p_shape_id) const;
- void tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_transform);
+ void tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset);
Transform2D tile_get_shape_transform(int p_id, int p_shape_id) const;
void tile_set_shape_one_way(int p_id, int p_shape_id, bool p_one_way);
@@ -121,7 +121,7 @@ public:
void tile_set_material(int p_id, const Ref<ShaderMaterial> &p_material);
Ref<ShaderMaterial> tile_get_material(int p_id) const;
- void tile_set_modulate(int p_id, const Color &p_color);
+ void tile_set_modulate(int p_id, const Color &p_modulate);
Color tile_get_modulate(int p_id) const;
void tile_set_occluder_offset(int p_id, const Vector2 &p_offset);
diff --git a/servers/arvr_server.h b/servers/arvr_server.h
index fd7c5470c3..06e0a4561c 100644
--- a/servers/arvr_server.h
+++ b/servers/arvr_server.h
@@ -88,7 +88,7 @@ protected:
public:
static ARVRServer *get_singleton();
- /*
+ /*
World scale allows you to specify a scale factor that is applied to all positioning vectors in our VR world in essence scaling up, or scaling down the world.
For stereoscopic rendering specifically this is very important to give an accurate sense of scale.
Add controllers into the mix and an accurate mapping of real world movement to percieved virtual movement becomes very important.
@@ -107,18 +107,18 @@ public:
actions be it straffing, teleporting, etc. Movement of the player by moving through the physical space is always tracked
in relation to this point.
- Note that the ARVROrigin spatial node in your scene automatically updates this property and it should be used instead of
+ Note that the ARVROrigin spatial node in your scene automatically updates this property and it should be used instead of
direct access to this property and it therefor is not available in GDScript
Note: this should not be used in AR and should be ignored by an AR based interface as it would throw what you're looking at in the real world
and in the virtual world out of sync
*/
Transform get_world_origin() const;
- void set_world_origin(const Transform p_origin);
+ void set_world_origin(const Transform p_world_origin);
/*
Requesting a reference frame results in a matrix being calculated that ensures the HMD is positioned to 0,0,0 facing 0,0,-1 (need to verify this direction)
- in the virtual world.
+ in the virtual world.
Note: this should not be used in AR and should be ignored by an AR based interface as it would throw what you're looking at in the real world
and in the virtual world out of sync
@@ -127,7 +127,7 @@ public:
void request_reference_frame(bool p_ignore_tilt, bool p_keep_height);
/*
- Interfaces are objects that 'glue' Godot to an AR or VR SDK such as the Oculus SDK, OpenVR, OpenHMD, etc.
+ Interfaces are objects that 'glue' Godot to an AR or VR SDK such as the Oculus SDK, OpenVR, OpenHMD, etc.
*/
void add_interface(const Ref<ARVRInterface> &p_interface);
void remove_interface(const Ref<ARVRInterface> &p_interface);
@@ -144,10 +144,10 @@ public:
void clear_primary_interface_if(const Ref<ARVRInterface> &p_primary_interface); /* this is automatically called if an interface destructs */
/*
- Our trackers are objects that expose the orientation and position of physical devices such as controller, anchor points, etc.
+ Our trackers are objects that expose the orientation and position of physical devices such as controller, anchor points, etc.
They are created and managed by our active AR/VR interfaces.
- Note that for trackers that
+ Note that for trackers that
*/
int get_free_tracker_id_for_type(TrackerType p_tracker_type);
void add_tracker(ARVRPositionalTracker *p_tracker);
diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp
index 0f15b43b41..dfb6406b38 100644
--- a/servers/audio/audio_driver_dummy.cpp
+++ b/servers/audio/audio_driver_dummy.cpp
@@ -45,7 +45,7 @@ Error AudioDriverDummy::init() {
channels = 2;
int latency = GLOBAL_DEF("audio/output_latency", 25);
- buffer_size = nearest_power_of_2(latency * mix_rate / 1000);
+ buffer_size = next_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_size * channels);
diff --git a/servers/audio/audio_filter_sw.h b/servers/audio/audio_filter_sw.h
index f5a07c4c8f..caf735436a 100644
--- a/servers/audio/audio_filter_sw.h
+++ b/servers/audio/audio_filter_sw.h
@@ -97,24 +97,24 @@ public:
/* inline methods */
-void AudioFilterSW::Processor::process_one(float &p_val) {
+void AudioFilterSW::Processor::process_one(float &p_sample) {
- float pre = p_val;
- p_val = (p_val * coeffs.b0 + hb1 * coeffs.b1 + hb2 * coeffs.b2 + ha1 * coeffs.a1 + ha2 * coeffs.a2);
+ float pre = p_sample;
+ p_sample = (p_sample * coeffs.b0 + hb1 * coeffs.b1 + hb2 * coeffs.b2 + ha1 * coeffs.a1 + ha2 * coeffs.a2);
ha2 = ha1;
hb2 = hb1;
hb1 = pre;
- ha1 = p_val;
+ ha1 = p_sample;
}
-void AudioFilterSW::Processor::process_one_interp(float &p_val) {
+void AudioFilterSW::Processor::process_one_interp(float &p_sample) {
- float pre = p_val;
- p_val = (p_val * coeffs.b0 + hb1 * coeffs.b1 + hb2 * coeffs.b2 + ha1 * coeffs.a1 + ha2 * coeffs.a2);
+ float pre = p_sample;
+ p_sample = (p_sample * coeffs.b0 + hb1 * coeffs.b1 + hb2 * coeffs.b2 + ha1 * coeffs.a1 + ha2 * coeffs.a2);
ha2 = ha1;
hb2 = hb1;
hb1 = pre;
- ha1 = p_val;
+ ha1 = p_sample;
coeffs.b0 += incr_coeffs.b0;
coeffs.b1 += incr_coeffs.b1;
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index a35826be21..0d63e7af82 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -74,7 +74,7 @@ protected:
virtual float get_stream_sampling_rate() = 0;
public:
- virtual void mix(AudioFrame *p_bufer, float p_rate_scale, int p_frames);
+ virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames);
AudioStreamPlaybackResampled() { mix_offset = 0; }
};
@@ -104,7 +104,7 @@ protected:
static void _bind_methods();
public:
- void set_audio_stream(const Ref<AudioStream> &audio_stream);
+ void set_audio_stream(const Ref<AudioStream> &p_audio_stream);
Ref<AudioStream> get_audio_stream() const;
void set_random_pitch(float p_pitch);
diff --git a/servers/audio/effects/audio_effect_distortion.h b/servers/audio/effects/audio_effect_distortion.h
index 2f84bd4dc7..afeb6ac7ec 100644
--- a/servers/audio/effects/audio_effect_distortion.h
+++ b/servers/audio/effects/audio_effect_distortion.h
@@ -71,16 +71,16 @@ public:
void set_mode(Mode p_mode);
Mode get_mode() const;
- void set_pre_gain(float pre_gain);
+ void set_pre_gain(float p_pre_gain);
float get_pre_gain() const;
- void set_keep_hf_hz(float keep_hf_hz);
+ void set_keep_hf_hz(float p_keep_hf_hz);
float get_keep_hf_hz() const;
- void set_drive(float drive);
+ void set_drive(float p_drive);
float get_drive() const;
- void set_post_gain(float post_gain);
+ void set_post_gain(float p_post_gain);
float get_post_gain() const;
AudioEffectDistortion();
diff --git a/servers/audio/effects/audio_effect_panner.h b/servers/audio/effects/audio_effect_panner.h
index 4b41fecc45..8c3edfbde0 100644
--- a/servers/audio/effects/audio_effect_panner.h
+++ b/servers/audio/effects/audio_effect_panner.h
@@ -54,7 +54,7 @@ protected:
public:
Ref<AudioEffectInstance> instance();
- void set_pan(float p_volume);
+ void set_pan(float p_cpanume);
float get_pan() const;
AudioEffectPanner();
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 3547f86eb3..f9fdd9432d 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -159,6 +159,8 @@ void AudioServer::_driver_process(int p_frames, int32_t *p_buffer) {
void AudioServer::_mix_step() {
+ bool solo_mode = false;
+
for (int i = 0; i < buses.size(); i++) {
Bus *bus = buses[i];
bus->index_cache = i; //might be moved around by editor, so..
@@ -166,6 +168,33 @@ void AudioServer::_mix_step() {
bus->channels[k].used = false;
}
+
+ if (bus->solo) {
+ //solo chain
+ solo_mode = true;
+ bus->soloed = true;
+ do {
+
+ if (bus != buses[0]) {
+ //everything has a send save for master bus
+ if (!bus_map.has(bus->send)) {
+ bus = buses[0]; //send to master
+ } else {
+ bus = bus_map[bus->send];
+ if (bus->index_cache >= bus->index_cache) { //invalid, send to master
+ bus = buses[0];
+ }
+ }
+
+ bus->soloed = true;
+ } else {
+ bus = NULL;
+ }
+
+ } while (bus);
+ } else {
+ bus->soloed = false;
+ }
}
//make callbacks for mixing the audio
@@ -192,24 +221,26 @@ void AudioServer::_mix_step() {
}
//process effects
- for (int j = 0; j < bus->effects.size(); j++) {
+ if (!bus->bypass) {
+ for (int j = 0; j < bus->effects.size(); j++) {
- if (!bus->effects[j].enabled)
- continue;
+ if (!bus->effects[j].enabled)
+ continue;
- for (int k = 0; k < bus->channels.size(); k++) {
+ for (int k = 0; k < bus->channels.size(); k++) {
- if (!bus->channels[k].active)
- continue;
- bus->channels[k].effect_instances[j]->process(bus->channels[k].buffer.ptr(), temp_buffer[k].ptr(), buffer_size);
- }
+ if (!bus->channels[k].active)
+ continue;
+ bus->channels[k].effect_instances[j]->process(bus->channels[k].buffer.ptr(), temp_buffer[k].ptr(), buffer_size);
+ }
- //swap buffers, so internal buffer always has the right data
- for (int k = 0; k < bus->channels.size(); k++) {
+ //swap buffers, so internal buffer always has the right data
+ for (int k = 0; k < bus->channels.size(); k++) {
- if (!buses[i]->channels[k].active)
- continue;
- SWAP(bus->channels[k].buffer, temp_buffer[k]);
+ if (!buses[i]->channels[k].active)
+ continue;
+ SWAP(bus->channels[k].buffer, temp_buffer[k]);
+ }
}
}
@@ -237,7 +268,24 @@ void AudioServer::_mix_step() {
AudioFrame *buf = bus->channels[k].buffer.ptr();
AudioFrame peak = AudioFrame(0, 0);
+
+ float volume = Math::db2linear(bus->volume_db);
+
+ if (solo_mode) {
+ if (!bus->soloed) {
+ volume = 0.0;
+ }
+ } else {
+ if (bus->mute) {
+ volume = 0.0;
+ }
+ }
+
+ //apply volume and compute peak
for (uint32_t j = 0; j < buffer_size; j++) {
+
+ buf[j] *= volume;
+
float l = ABS(buf[j].l);
if (l > peak.l) {
peak.l = l;
diff --git a/servers/audio_server.h b/servers/audio_server.h
index caa07891f7..c92ff6d3a0 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -125,6 +125,8 @@ private:
bool mute;
bool bypass;
+ bool soloed;
+
//Each channel is a stereo pair.
struct Channel {
bool used;
diff --git a/servers/physics/broad_phase_basic.cpp b/servers/physics/broad_phase_basic.cpp
index 679b9a31fc..05a2e1fdf8 100644
--- a/servers/physics/broad_phase_basic.cpp
+++ b/servers/physics/broad_phase_basic.cpp
@@ -169,10 +169,10 @@ void BroadPhaseBasic::set_pair_callback(PairCallback p_pair_callback, void *p_us
pair_userdata = p_userdata;
pair_callback = p_pair_callback;
}
-void BroadPhaseBasic::set_unpair_callback(UnpairCallback p_pair_callback, void *p_userdata) {
+void BroadPhaseBasic::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) {
unpair_userdata = p_userdata;
- unpair_callback = p_pair_callback;
+ unpair_callback = p_unpair_callback;
}
void BroadPhaseBasic::update() {
diff --git a/servers/physics/broad_phase_octree.cpp b/servers/physics/broad_phase_octree.cpp
index 2439fbeae9..e1aaf4e31a 100644
--- a/servers/physics/broad_phase_octree.cpp
+++ b/servers/physics/broad_phase_octree.cpp
@@ -78,7 +78,7 @@ int BroadPhaseOctree::cull_segment(const Vector3 &p_from, const Vector3 &p_to, C
int BroadPhaseOctree::cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) {
- return octree.cull_AABB(p_aabb, p_results, p_max_results, p_result_indices);
+ return octree.cull_aabb(p_aabb, p_results, p_max_results, p_result_indices);
}
void *BroadPhaseOctree::_pair_callback(void *self, OctreeElementID p_A, CollisionObjectSW *p_object_A, int subindex_A, OctreeElementID p_B, CollisionObjectSW *p_object_B, int subindex_B) {
diff --git a/servers/physics/broad_phase_octree.h b/servers/physics/broad_phase_octree.h
index 88d72a2bd8..bd3ba6677a 100644
--- a/servers/physics/broad_phase_octree.h
+++ b/servers/physics/broad_phase_octree.h
@@ -47,7 +47,7 @@ class BroadPhaseOctree : public BroadPhaseSW {
public:
// 0 is an invalid ID
- virtual ID create(CollisionObjectSW *p_object_, int p_subindex = 0);
+ virtual ID create(CollisionObjectSW *p_object, int p_subindex = 0);
virtual void move(ID p_id, const Rect3 &p_aabb);
virtual void set_static(ID p_id, bool p_static);
virtual void remove(ID p_id);
diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h
index a56253e33d..44786829af 100644
--- a/servers/physics/collision_object_sw.h
+++ b/servers/physics/collision_object_sw.h
@@ -98,7 +98,7 @@ protected:
void _set_static(bool p_static);
virtual void _shapes_changed() = 0;
- void _set_space(SpaceSW *space);
+ void _set_space(SpaceSW *p_space);
bool ray_pickable;
diff --git a/servers/physics/joints/cone_twist_joint_sw.cpp b/servers/physics/joints/cone_twist_joint_sw.cpp
index 51bc27ea7d..d00eab53d3 100644
--- a/servers/physics/joints/cone_twist_joint_sw.cpp
+++ b/servers/physics/joints/cone_twist_joint_sw.cpp
@@ -110,7 +110,7 @@ ConeTwistJointSW::ConeTwistJointSW(BodySW *rbA, BodySW *rbB, const Transform &rb
m_appliedImpulse = 0;
}
-bool ConeTwistJointSW::setup(real_t p_step) {
+bool ConeTwistJointSW::setup(real_t p_timestep) {
m_appliedImpulse = real_t(0.);
//set bias, sign, clear accumulator
@@ -237,7 +237,7 @@ bool ConeTwistJointSW::setup(real_t p_step) {
return true;
}
-void ConeTwistJointSW::solve(real_t timeStep) {
+void ConeTwistJointSW::solve(real_t p_timestep) {
Vector3 pivotAInW = A->get_transform().xform(m_rbAFrame.origin);
Vector3 pivotBInW = B->get_transform().xform(m_rbBFrame.origin);
@@ -261,7 +261,7 @@ void ConeTwistJointSW::solve(real_t timeStep) {
rel_vel = normal.dot(vel);
//positional error (zeroth order error)
real_t depth = -(pivotAInW - pivotBInW).dot(normal); //this is the error projected on the normal
- real_t impulse = depth * tau / timeStep * jacDiagABInv - rel_vel * jacDiagABInv;
+ real_t impulse = depth * tau / p_timestep * jacDiagABInv - rel_vel * jacDiagABInv;
m_appliedImpulse += impulse;
Vector3 impulse_vector = normal * impulse;
A->apply_impulse(pivotAInW - A->get_transform().origin, impulse_vector);
@@ -276,7 +276,7 @@ void ConeTwistJointSW::solve(real_t timeStep) {
// solve swing limit
if (m_solveSwingLimit) {
- real_t amplitude = ((angVelB - angVelA).dot(m_swingAxis) * m_relaxationFactor * m_relaxationFactor + m_swingCorrection * (real_t(1.) / timeStep) * m_biasFactor);
+ real_t amplitude = ((angVelB - angVelA).dot(m_swingAxis) * m_relaxationFactor * m_relaxationFactor + m_swingCorrection * (real_t(1.) / p_timestep) * m_biasFactor);
real_t impulseMag = amplitude * m_kSwing;
// Clamp the accumulated impulse
@@ -292,7 +292,7 @@ void ConeTwistJointSW::solve(real_t timeStep) {
// solve twist limit
if (m_solveTwistLimit) {
- real_t amplitude = ((angVelB - angVelA).dot(m_twistAxis) * m_relaxationFactor * m_relaxationFactor + m_twistCorrection * (real_t(1.) / timeStep) * m_biasFactor);
+ real_t amplitude = ((angVelB - angVelA).dot(m_twistAxis) * m_relaxationFactor * m_relaxationFactor + m_twistCorrection * (real_t(1.) / p_timestep) * m_biasFactor);
real_t impulseMag = amplitude * m_kTwist;
// Clamp the accumulated impulse
diff --git a/servers/physics/joints/cone_twist_joint_sw.h b/servers/physics/joints/cone_twist_joint_sw.h
index 65d26d0ca7..f0e029712c 100644
--- a/servers/physics/joints/cone_twist_joint_sw.h
+++ b/servers/physics/joints/cone_twist_joint_sw.h
@@ -104,8 +104,8 @@ public:
public:
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_CONE_TWIST; }
- virtual bool setup(real_t p_step);
- virtual void solve(real_t p_step);
+ virtual bool setup(real_t p_timestep);
+ virtual void solve(real_t p_timestep);
ConeTwistJointSW(BodySW *rbA, BodySW *rbB, const Transform &rbAFrame, const Transform &rbBFrame);
diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp
index e4349bda9a..e1cd6ee7e5 100644
--- a/servers/physics/joints/generic_6dof_joint_sw.cpp
+++ b/servers/physics/joints/generic_6dof_joint_sw.cpp
@@ -298,7 +298,7 @@ bool Generic6DOFJointSW::testAngularLimitMotor(int axis_index) {
return m_angularLimits[axis_index].needApplyTorques();
}
-bool Generic6DOFJointSW::setup(real_t p_step) {
+bool Generic6DOFJointSW::setup(real_t p_timestep) {
// Clear accumulated impulses for the next simulation step
m_linearLimits.m_accumulatedImpulse = Vector3(real_t(0.), real_t(0.), real_t(0.));
@@ -347,8 +347,8 @@ bool Generic6DOFJointSW::setup(real_t p_step) {
return true;
}
-void Generic6DOFJointSW::solve(real_t timeStep) {
- m_timeStep = timeStep;
+void Generic6DOFJointSW::solve(real_t p_timestep) {
+ m_timeStep = p_timestep;
//calculateTransforms();
diff --git a/servers/physics/joints/generic_6dof_joint_sw.h b/servers/physics/joints/generic_6dof_joint_sw.h
index 4af0c93876..587a5850df 100644
--- a/servers/physics/joints/generic_6dof_joint_sw.h
+++ b/servers/physics/joints/generic_6dof_joint_sw.h
@@ -264,8 +264,8 @@ public:
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_6DOF; }
- virtual bool setup(real_t p_step);
- virtual void solve(real_t p_step);
+ virtual bool setup(real_t p_timestep);
+ virtual void solve(real_t p_timestep);
//! Calcs global transform of the offsets
/*!
diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h
index bae2839b71..818922a989 100644
--- a/servers/physics/physics_server_sw.h
+++ b/servers/physics/physics_server_sw.h
@@ -127,7 +127,7 @@ public:
virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value);
virtual void area_set_transform(RID p_area, const Transform &p_transform);
- virtual Variant area_get_param(RID p_parea, AreaParameter p_param) const;
+ virtual Variant area_get_param(RID p_area, AreaParameter p_param) const;
virtual Transform area_get_transform(RID p_area) const;
virtual void area_set_ray_pickable(RID p_area, bool p_enable);
diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h
index aa1975b655..52623c019d 100644
--- a/servers/physics/shape_sw.h
+++ b/servers/physics/shape_sw.h
@@ -385,7 +385,7 @@ public:
virtual void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const;
virtual Vector3 get_support(const Vector3 &p_normal) const;
- virtual bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const;
+ virtual bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal) const;
virtual bool intersect_point(const Vector3 &p_point) const;
virtual Vector3 get_closest_point_to(const Vector3 &p_point) const;
diff --git a/servers/physics_2d/broad_phase_2d_basic.cpp b/servers/physics_2d/broad_phase_2d_basic.cpp
index a0bcd37fbc..76094ad98c 100644
--- a/servers/physics_2d/broad_phase_2d_basic.cpp
+++ b/servers/physics_2d/broad_phase_2d_basic.cpp
@@ -124,10 +124,10 @@ void BroadPhase2DBasic::set_pair_callback(PairCallback p_pair_callback, void *p_
pair_userdata = p_userdata;
pair_callback = p_pair_callback;
}
-void BroadPhase2DBasic::set_unpair_callback(UnpairCallback p_pair_callback, void *p_userdata) {
+void BroadPhase2DBasic::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) {
unpair_userdata = p_userdata;
- unpair_callback = p_pair_callback;
+ unpair_callback = p_unpair_callback;
}
void BroadPhase2DBasic::update() {
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.h b/servers/physics_2d/broad_phase_2d_hash_grid.h
index 2234557857..0cb3edb94f 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.h
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.h
@@ -167,7 +167,7 @@ class BroadPhase2DHashGrid : public BroadPhase2DSW {
void _check_motion(Element *p_elem);
public:
- virtual ID create(CollisionObject2DSW *p_object_, int p_subindex = 0);
+ virtual ID create(CollisionObject2DSW *p_object, int p_subindex = 0);
virtual void move(ID p_id, const Rect2 &p_aabb);
virtual void set_static(ID p_id, bool p_static);
virtual void remove(ID p_id);
diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h
index 5e29132e8d..ad8edb0b3d 100644
--- a/servers/physics_2d/collision_object_2d_sw.h
+++ b/servers/physics_2d/collision_object_2d_sw.h
@@ -90,7 +90,7 @@ protected:
void _set_static(bool p_static);
virtual void _shapes_changed() = 0;
- void _set_space(Space2DSW *space);
+ void _set_space(Space2DSW *p_space);
CollisionObject2DSW(Type p_type);
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index c698d614b8..3805075ac3 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -722,11 +722,11 @@ uint32_t Physics2DServerSW::body_get_object_instance_id(RID p_body) const {
return body->get_instance_id();
};
-void Physics2DServerSW::body_set_collision_layer(RID p_body, uint32_t p_flags) {
+void Physics2DServerSW::body_set_collision_layer(RID p_body, uint32_t p_layer) {
Body2DSW *body = body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_collision_layer(p_flags);
+ body->set_collision_layer(p_layer);
};
uint32_t Physics2DServerSW::body_get_collision_layer(RID p_body) const {
@@ -737,11 +737,11 @@ uint32_t Physics2DServerSW::body_get_collision_layer(RID p_body) const {
return body->get_collision_layer();
};
-void Physics2DServerSW::body_set_collision_mask(RID p_body, uint32_t p_flags) {
+void Physics2DServerSW::body_set_collision_mask(RID p_body, uint32_t p_mask) {
Body2DSW *body = body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_collision_mask(p_flags);
+ body->set_collision_mask(p_mask);
};
uint32_t Physics2DServerSW::body_get_collision_mask(RID p_body) const {
diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h
index 830ba91c98..e767aad1da 100644
--- a/servers/physics_2d/physics_2d_server_sw.h
+++ b/servers/physics_2d/physics_2d_server_sw.h
@@ -134,7 +134,7 @@ public:
virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value);
virtual void area_set_transform(RID p_area, const Transform2D &p_transform);
- virtual Variant area_get_param(RID p_parea, AreaParameter p_param) const;
+ virtual Variant area_get_param(RID p_area, AreaParameter p_param) const;
virtual Transform2D area_get_transform(RID p_area) const;
virtual void area_set_monitorable(RID p_area, bool p_monitorable);
virtual void area_set_collision_mask(RID p_area, uint32_t p_mask);
@@ -169,8 +169,8 @@ public:
virtual void body_remove_shape(RID p_body, int p_shape_idx);
virtual void body_clear_shapes(RID p_body);
- virtual void body_set_shape_disabled(RID p_body, int p_shape, bool p_disabled);
- virtual void body_set_shape_as_one_way_collision(RID p_body, int p_shape, bool p_enabled);
+ virtual void body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled);
+ virtual void body_set_shape_as_one_way_collision(RID p_body, int p_shape_idx, bool p_enable);
virtual void body_attach_object_instance_id(RID p_body, uint32_t p_ID);
virtual uint32_t body_get_object_instance_id(RID p_body) const;
@@ -182,7 +182,7 @@ public:
virtual uint32_t body_get_collision_layer(RID p_body) const;
virtual void body_set_collision_mask(RID p_body, uint32_t p_mask);
- virtual uint32_t body_get_collision_mask(RID p_) const;
+ virtual uint32_t body_get_collision_mask(RID p_body) const;
virtual void body_set_param(RID p_body, BodyParameter p_param, real_t p_value);
virtual real_t body_get_param(RID p_body, BodyParameter p_param) const;
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index a17d1f6a12..29f879d8e9 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -678,25 +678,21 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
}
}
- if (col_obj->get_type() == CollisionObject2DSW::TYPE_BODY) {
+ if (col_obj->is_shape_set_as_one_way_collision(j)) {
- const Body2DSW *body = static_cast<const Body2DSW *>(col_obj);
- if (col_obj->is_shape_set_as_one_way_collision(j)) {
+ Vector2 cd[2];
+ Physics2DServerSW::CollCbkData cbk;
+ cbk.max = 1;
+ cbk.amount = 0;
+ cbk.ptr = cd;
+ cbk.valid_dir = body_shape_xform.get_axis(1).normalized();
+ ;
+ cbk.valid_depth = 10e20;
- Vector2 cd[2];
- Physics2DServerSW::CollCbkData cbk;
- cbk.max = 1;
- cbk.amount = 0;
- cbk.ptr = cd;
- cbk.valid_dir = body_shape_xform.get_axis(1).normalized();
- ;
- cbk.valid_depth = 10e20;
-
- Vector2 sep = mnormal; //important optimization for this to work fast enough
- bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * (hi + contact_max_allowed_penetration), col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), Physics2DServerSW::_shape_col_cbk, &cbk, &sep, 0);
- if (!collided || cbk.amount == 0) {
- continue;
- }
+ Vector2 sep = mnormal; //important optimization for this to work fast enough
+ bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * (hi + contact_max_allowed_penetration), col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), Physics2DServerSW::_shape_col_cbk, &cbk, &sep, 0);
+ if (!collided || cbk.amount == 0) {
+ continue;
}
}
diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp
index 7b0e5ab445..27732b9c29 100644
--- a/servers/physics_2d_server.cpp
+++ b/servers/physics_2d_server.cpp
@@ -245,11 +245,11 @@ Dictionary Physics2DDirectSpaceState::_intersect_ray(const Vector2 &p_from, cons
return d;
}
-Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryParameters> &psq, int p_max_results) {
+Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results) {
Vector<ShapeResult> sr;
sr.resize(p_max_results);
- int rc = intersect_shape(psq->shape, psq->transform, psq->motion, psq->margin, sr.ptr(), sr.size(), psq->exclude, psq->collision_layer, psq->object_type_mask);
+ int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, sr.ptr(), sr.size(), p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
Array ret;
ret.resize(rc);
for (int i = 0; i < rc; i++) {
@@ -266,10 +266,10 @@ Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryP
return ret;
}
-Array Physics2DDirectSpaceState::_cast_motion(const Ref<Physics2DShapeQueryParameters> &psq) {
+Array Physics2DDirectSpaceState::_cast_motion(const Ref<Physics2DShapeQueryParameters> &p_shape_query) {
float closest_safe, closest_unsafe;
- bool res = cast_motion(psq->shape, psq->transform, psq->motion, psq->margin, closest_safe, closest_unsafe, psq->exclude, psq->collision_layer, psq->object_type_mask);
+ bool res = cast_motion(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, closest_safe, closest_unsafe, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
if (!res)
return Array();
Array ret;
@@ -307,12 +307,12 @@ Array Physics2DDirectSpaceState::_intersect_point(const Vector2 &p_point, int p_
return r;
}
-Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryParameters> &psq, int p_max_results) {
+Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results) {
Vector<Vector2> ret;
ret.resize(p_max_results * 2);
int rc = 0;
- bool res = collide_shape(psq->shape, psq->transform, psq->motion, psq->margin, ret.ptr(), p_max_results, rc, psq->exclude, psq->collision_layer, psq->object_type_mask);
+ bool res = collide_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, ret.ptr(), p_max_results, rc, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
if (!res)
return Array();
Array r;
@@ -321,11 +321,11 @@ Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryPar
r[i] = ret[i];
return r;
}
-Dictionary Physics2DDirectSpaceState::_get_rest_info(const Ref<Physics2DShapeQueryParameters> &psq) {
+Dictionary Physics2DDirectSpaceState::_get_rest_info(const Ref<Physics2DShapeQueryParameters> &p_shape_query) {
ShapeRestInfo sri;
- bool res = rest_info(psq->shape, psq->transform, psq->motion, psq->margin, &sri, psq->exclude, psq->collision_layer, psq->object_type_mask);
+ bool res = rest_info(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, &sri, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
Dictionary r;
if (!res)
return r;
diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp
index fbf104c6ac..86bf6253ee 100644
--- a/servers/physics_server.cpp
+++ b/servers/physics_server.cpp
@@ -270,11 +270,11 @@ Dictionary PhysicsDirectSpaceState::_intersect_ray(const Vector3 &p_from, const
return d;
}
-Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParameters> &psq, int p_max_results) {
+Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results) {
Vector<ShapeResult> sr;
sr.resize(p_max_results);
- int rc = intersect_shape(psq->shape, psq->transform, psq->margin, sr.ptr(), sr.size(), psq->exclude, psq->collision_layer, psq->object_type_mask);
+ int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, sr.ptr(), sr.size(), p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
Array ret;
ret.resize(rc);
for (int i = 0; i < rc; i++) {
@@ -290,10 +290,10 @@ Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParam
return ret;
}
-Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameters> &psq, const Vector3 &p_motion) {
+Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameters> &p_shape_query, const Vector3 &p_motion) {
float closest_safe, closest_unsafe;
- bool res = cast_motion(psq->shape, psq->transform, p_motion, psq->margin, closest_safe, closest_unsafe, psq->exclude, psq->collision_layer, psq->object_type_mask);
+ bool res = cast_motion(p_shape_query->shape, p_shape_query->transform, p_motion, p_shape_query->margin, closest_safe, closest_unsafe, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
if (!res)
return Array();
Array ret;
@@ -302,12 +302,12 @@ Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameter
ret[1] = closest_unsafe;
return ret;
}
-Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParameters> &psq, int p_max_results) {
+Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results) {
Vector<Vector3> ret;
ret.resize(p_max_results * 2);
int rc = 0;
- bool res = collide_shape(psq->shape, psq->transform, psq->margin, ret.ptr(), p_max_results, rc, psq->exclude, psq->collision_layer, psq->object_type_mask);
+ bool res = collide_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, ret.ptr(), p_max_results, rc, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
if (!res)
return Array();
Array r;
@@ -316,11 +316,11 @@ Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParamet
r[i] = ret[i];
return r;
}
-Dictionary PhysicsDirectSpaceState::_get_rest_info(const Ref<PhysicsShapeQueryParameters> &psq) {
+Dictionary PhysicsDirectSpaceState::_get_rest_info(const Ref<PhysicsShapeQueryParameters> &p_shape_query) {
ShapeRestInfo sri;
- bool res = rest_info(psq->shape, psq->transform, psq->margin, &sri, psq->exclude, psq->collision_layer, psq->object_type_mask);
+ bool res = rest_info(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, &sri, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask);
Dictionary r;
if (!res)
return r;
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 9405f6e012..3b4ba313e6 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -331,6 +331,7 @@ public:
virtual void light_set_projector(RID p_light, RID p_texture) = 0;
virtual void light_set_negative(RID p_light, bool p_enable) = 0;
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0;
+ virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0;
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) = 0;
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) = 0;
@@ -712,6 +713,7 @@ public:
RID texture;
RID normal_map;
int count;
+ bool antialiased;
CommandPolygon() {
type = TYPE_POLYGON;
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 49f9e161fa..f8350ce0f8 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -1563,9 +1563,9 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "reflect", TYPE_VEC3, { TYPE_VEC3, TYPE_VEC3, TYPE_VOID } },
{ "refract", TYPE_VEC3, { TYPE_VEC3, TYPE_VEC3, TYPE_FLOAT, TYPE_VOID } },
- { "facefordward", TYPE_VEC2, { TYPE_VEC2, TYPE_VEC2, TYPE_VEC2, TYPE_VOID } },
- { "facefordward", TYPE_VEC3, { TYPE_VEC3, TYPE_VEC3, TYPE_VEC3, TYPE_VOID } },
- { "facefordward", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_VEC4, TYPE_VOID } },
+ { "faceforward", TYPE_VEC2, { TYPE_VEC2, TYPE_VEC2, TYPE_VEC2, TYPE_VOID } },
+ { "faceforward", TYPE_VEC3, { TYPE_VEC3, TYPE_VEC3, TYPE_VEC3, TYPE_VOID } },
+ { "faceforward", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_VEC4, TYPE_VOID } },
{ "matrixCompMult", TYPE_MAT2, { TYPE_MAT2, TYPE_MAT2, TYPE_VOID } },
{ "matrixCompMult", TYPE_MAT3, { TYPE_MAT3, TYPE_MAT3, TYPE_VOID } },
diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp
index 584f45412e..13517fa409 100644
--- a/servers/visual/visual_server_canvas.cpp
+++ b/servers/visual/visual_server_canvas.cpp
@@ -392,14 +392,14 @@ void VisualServerCanvas::canvas_item_set_draw_behind_parent(RID p_item, bool p_e
canvas_item->behind = p_enable;
}
-void VisualServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_colors, float p_width, bool p_antialiased) {
+void VisualServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width, bool p_antialiased) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandLine *line = memnew(Item::CommandLine);
ERR_FAIL_COND(!line);
- line->color = p_colors;
+ line->color = p_color;
line->from = p_from;
line->to = p_to;
line->width = p_width;
@@ -632,7 +632,7 @@ void VisualServerCanvas::canvas_item_add_primitive(RID p_item, const Vector<Poin
canvas_item->commands.push_back(prim);
}
-void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, RID p_normal_map) {
+void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, RID p_normal_map, bool p_antialiased) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -661,6 +661,7 @@ void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2
polygon->colors = p_colors;
polygon->indices = indices;
polygon->count = indices.size();
+ polygon->antialiased = p_antialiased;
canvas_item->rect_dirty = true;
canvas_item->commands.push_back(polygon);
@@ -745,6 +746,7 @@ void VisualServerCanvas::canvas_item_add_particles(RID p_item, RID p_particles,
//take the chance and request processing for them, at least once until they become visible again
VSG::storage->particles_request_process(p_particles);
+ canvas_item->rect_dirty = true;
canvas_item->commands.push_back(part);
}
@@ -758,6 +760,7 @@ void VisualServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p
mm->multimesh = p_mesh;
mm->skeleton = p_skeleton;
+ canvas_item->rect_dirty = true;
canvas_item->commands.push_back(mm);
}
@@ -1001,11 +1004,11 @@ void VisualServerCanvas::canvas_light_set_shadow_buffer_size(RID p_light, int p_
RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light);
ERR_FAIL_COND(!clight);
- int new_size = nearest_power_of_2(p_size);
+ int new_size = next_power_of_2(p_size);
if (new_size == clight->shadow_buffer_size)
return;
- clight->shadow_buffer_size = nearest_power_of_2(p_size);
+ clight->shadow_buffer_size = next_power_of_2(p_size);
if (clight->shadow_buffer.is_valid()) {
VSG::storage->free(clight->shadow_buffer);
diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h
index 48e3186ece..b9ad88286d 100644
--- a/servers/visual/visual_server_canvas.h
+++ b/servers/visual/visual_server_canvas.h
@@ -171,14 +171,14 @@ public:
void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable);
void canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width = 1.0, bool p_antialiased = false);
- void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_line, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false);
+ void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false);
void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color);
void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color);
void canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID());
void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), bool p_clip_uv = true);
void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, VS::NinePatchAxisMode p_x_axis_mode = VS::NINE_PATCH_STRETCH, VS::NinePatchAxisMode p_y_axis_mode = VS::NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID());
void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID());
- void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID());
+ void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID(), bool p_antialiased = false);
void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID());
void canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_skeleton = RID());
void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_skeleton = RID());
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index cc4fe0809d..e66c8a1e21 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -2902,7 +2902,7 @@ Vector<RID> VisualServerRaster::instances_cull_aabb(const AABB& p_aabb, RID p_sc
int culled=0;
Instance *cull[1024];
- culled=scenario->octree.cull_AABB(p_aabb,cull,1024);
+ culled=scenario->octree.cull_aabb(p_aabb,cull,1024);
for (int i=0;i<culled;i++) {
@@ -4376,7 +4376,7 @@ void VisualServerRaster::canvas_light_set_shadow_buffer_size(RID p_light, int p_
ERR_FAIL_COND(p_size<32 || p_size>16384);
- clight->shadow_buffer_size=nearest_power_of_2(p_size);
+ clight->shadow_buffer_size=next_power_of_2(p_size);
if (clight->shadow_buffer.is_valid()) {
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 596dd5c10e..fff37a71b3 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -786,6 +786,7 @@ public:
BIND2(light_set_projector, RID, RID)
BIND2(light_set_negative, RID, bool)
BIND2(light_set_cull_mask, RID, uint32_t)
+ BIND2(light_set_reverse_cull_face_mode, RID, bool)
BIND2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
BIND2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
@@ -1059,7 +1060,7 @@ public:
BIND8(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, RID, bool)
BIND11(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID)
BIND7(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID)
- BIND6(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID)
+ BIND7(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, bool)
BIND8(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int, RID)
BIND3(canvas_item_add_mesh, RID, const RID &, RID)
BIND3(canvas_item_add_multimesh, RID, RID, RID)
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 11a9c8c9c1..fb298e3ed7 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -910,7 +910,7 @@ Vector<ObjectID> VisualServerScene::instances_cull_aabb(const Rect3 &p_aabb, RID
int culled = 0;
Instance *cull[1024];
- culled = scenario->octree.cull_AABB(p_aabb, cull, 1024);
+ culled = scenario->octree.cull_aabb(p_aabb, cull, 1024);
for (int i = 0; i < culled; i++) {
@@ -978,16 +978,6 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance, VS::InstanceF
switch (p_flags) {
- case VS::INSTANCE_FLAG_CAST_SHADOW: {
- if (p_enabled == true) {
- instance->cast_shadows = VS::SHADOW_CASTING_SETTING_ON;
- } else {
- instance->cast_shadows = VS::SHADOW_CASTING_SETTING_OFF;
- }
-
- instance->base_material_changed(); // to actually compute if shadows are visible or not
-
- } break;
case VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS: {
instance->visible_in_all_rooms = p_enabled;
@@ -1001,6 +991,12 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance, VS::InstanceF
}
}
void VisualServerScene::instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting) {
+
+ Instance *instance = instance_owner.get(p_instance);
+ ERR_FAIL_COND(!instance);
+
+ instance->cast_shadows = p_shadow_casting_setting;
+ instance->base_material_changed(); // to actually compute if shadows are visible or not
}
void VisualServerScene::instance_geometry_set_material_override(RID p_instance, RID p_material) {
@@ -1048,8 +1044,9 @@ void VisualServerScene::_update_instance(Instance *p_instance) {
VSG::storage->particles_set_emission_transform(p_instance->base, p_instance->transform);
}
- if (p_instance->aabb.has_no_surface())
+ if (p_instance->aabb.has_no_surface()) {
return;
+ }
#if 0
if (p_instance->base_type == VS::INSTANCE_PARTICLES) {
@@ -2645,11 +2642,11 @@ static float _get_normal_advance(const Vector3 &p_normal) {
return 1.0 / normal.dot(unorm);
}
-void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, const GIProbeDataCell *cells, InstanceGIProbeData::LocalData *local_data, const uint32_t *leaves, int leaf_count, const InstanceGIProbeData::LightCache &light_cache, int sign) {
+void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, const GIProbeDataCell *cells, InstanceGIProbeData::LocalData *local_data, const uint32_t *leaves, int p_leaf_count, const InstanceGIProbeData::LightCache &light_cache, int p_sign) {
- int light_r = int(light_cache.color.r * light_cache.energy * 1024.0) * sign;
- int light_g = int(light_cache.color.g * light_cache.energy * 1024.0) * sign;
- int light_b = int(light_cache.color.b * light_cache.energy * 1024.0) * sign;
+ int light_r = int(light_cache.color.r * light_cache.energy * 1024.0) * p_sign;
+ int light_g = int(light_cache.color.g * light_cache.energy * 1024.0) * p_sign;
+ int light_b = int(light_cache.color.b * light_cache.energy * 1024.0) * p_sign;
float limits[3] = { float(header->width), float(header->height), float(header->depth) };
Plane clip[3];
@@ -2685,7 +2682,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co
uint64_t us = OS::get_singleton()->get_ticks_usec();
- for (int i = 0; i < leaf_count; i++) {
+ for (int i = 0; i < p_leaf_count; i++) {
uint32_t idx = leaves[i];
@@ -2750,7 +2747,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co
float local_radius = light_cache.radius * light_cache.transform.basis.get_axis(2).length();
- for (int i = 0; i < leaf_count; i++) {
+ for (int i = 0; i < p_leaf_count; i++) {
uint32_t idx = leaves[i];
@@ -3278,8 +3275,9 @@ void VisualServerScene::render_probes() {
void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
- if (p_instance->update_aabb)
+ if (p_instance->update_aabb) {
_update_instance_aabb(p_instance);
+ }
if (p_instance->update_materials) {
diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h
index a4895382a4..910e75c3e3 100644
--- a/servers/visual/visual_server_scene.h
+++ b/servers/visual/visual_server_scene.h
@@ -567,7 +567,7 @@ public:
_FORCE_INLINE_ uint32_t _gi_bake_find_cell(const GIProbeDataCell *cells, int x, int y, int z, int p_cell_subdiv);
void _bake_gi_downscale_light(int p_idx, int p_level, const GIProbeDataCell *p_cells, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data, float p_propagate);
void _bake_gi_probe_light(const GIProbeDataHeader *header, const GIProbeDataCell *cells, InstanceGIProbeData::LocalData *local_data, const uint32_t *leaves, int p_leaf_count, const InstanceGIProbeData::LightCache &light_cache, int p_sign);
- void _bake_gi_probe(Instance *p_probe);
+ void _bake_gi_probe(Instance *p_gi_probe);
bool _check_gi_probe(Instance *p_gi_probe);
void _setup_gi_probe(Instance *p_instance);
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 20223f9651..ca040e9355 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -225,6 +225,7 @@ public:
FUNC2(light_set_projector, RID, RID)
FUNC2(light_set_negative, RID, bool)
FUNC2(light_set_cull_mask, RID, uint32_t)
+ FUNC2(light_set_reverse_cull_face_mode, RID, bool)
FUNC2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
FUNC2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail)
@@ -482,7 +483,7 @@ public:
FUNC8(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, RID, bool)
FUNC11(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID)
FUNC7(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID)
- FUNC6(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID)
+ FUNC7(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, bool)
FUNC8(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int, RID)
FUNC3(canvas_item_add_mesh, RID, const RID &, RID)
FUNC3(canvas_item_add_multimesh, RID, RID, RID)
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 65dd4d7661..cb1f96c23f 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -298,6 +298,9 @@ RID VisualServer::get_white_texture() {
return white_texture;
}
+#define SMALL_VEC2 Vector2(0.00001, 0.00001)
+#define SMALL_VEC3 Vector3(0.00001, 0.00001, 0.00001)
+
Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, Rect3 &r_aabb, Vector<Rect3> r_bone_aabb) {
PoolVector<uint8_t>::Write vw = r_vertex_array.write();
@@ -339,7 +342,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
if (i == 0) {
- aabb = Rect2(src[i], Vector2());
+ aabb = Rect2(src[i], SMALL_VEC2); //must have a bit of size
} else {
aabb.expand_to(src[i]);
@@ -355,7 +358,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
if (i == 0) {
- aabb = Rect2(src[i], Vector2());
+ aabb = Rect2(src[i], SMALL_VEC2); //must have a bit of size
} else {
aabb.expand_to(src[i]);
@@ -385,7 +388,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
if (i == 0) {
- aabb = Rect3(src[i], Vector3());
+ aabb = Rect3(src[i], SMALL_VEC3);
} else {
aabb.expand_to(src[i]);
@@ -401,7 +404,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
if (i == 0) {
- aabb = Rect3(src[i], Vector3());
+ aabb = Rect3(src[i], SMALL_VEC3);
} else {
aabb.expand_to(src[i]);
@@ -733,8 +736,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
if (bptr->size.x < 0) {
//first
- bptr[idx] = Rect3();
- bptr[idx].position = v;
+ bptr[idx] = Rect3(v, SMALL_VEC3);
any_valid = true;
} else {
bptr[idx].expand_to(v);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index ddf32a9ea1..5e0a390a21 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -371,6 +371,7 @@ public:
virtual void light_set_projector(RID p_light, RID p_texture) = 0;
virtual void light_set_negative(RID p_light, bool p_enable) = 0;
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0;
+ virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0;
// omni light
enum LightOmniShadowMode {
@@ -743,7 +744,6 @@ public:
virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario = RID()) const = 0;
enum InstanceFlags {
- INSTANCE_FLAG_CAST_SHADOW,
INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS,
INSTANCE_FLAG_USE_BAKED_LIGHT,
INSTANCE_FLAG_MAX
@@ -798,7 +798,7 @@ public:
virtual void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), bool p_clip_uv = true) = 0;
virtual void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, NinePatchAxisMode p_x_axis_mode = NINE_PATCH_STRETCH, NinePatchAxisMode p_y_axis_mode = NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID()) = 0;
virtual void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID()) = 0;
- virtual void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID()) = 0;
+ virtual void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID(), bool p_antialiased = false) = 0;
virtual void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID()) = 0;
virtual void canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_skeleton = RID()) = 0;
virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_skeleton = RID()) = 0;
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 4ed17168e8..804395f8d3 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -180,7 +180,8 @@ Files extracted from the upstream source:
- contrib/minizip/{crypt.h,ioapi.{c,h},zip.{c,h},unzip.{c,h}}
Important: Some files have Godot-made changes for use in core/io.
-TODO: Properly sync with version 1.2.4 and document changes.
+They are marked with `/* GODOT start */` and `/* GODOT end */`
+comments and a patch is provided in the minizip/ folder.
## misc
diff --git a/thirdparty/minizip/LICENSE-InfoZip.txt b/thirdparty/minizip/LICENSE-InfoZip.txt
deleted file mode 100644
index bcfe47e978..0000000000
--- a/thirdparty/minizip/LICENSE-InfoZip.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-This is version 2007-Mar-4 of the Info-ZIP license.
-The definitive version of this document should be available at
-ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely and
-a copy at http://www.info-zip.org/pub/infozip/license.html.
-
-
-Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
-
-For the purposes of this copyright and license, "Info-ZIP" is defined as
-the following set of individuals:
-
- Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois,
- Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth,
- Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz,
- David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko,
- Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs,
- Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda,
- Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren,
- Rich Wales, Mike White.
-
-This software is provided "as is," without warranty of any kind, express
-or implied. In no event shall Info-ZIP or its contributors be held liable
-for any direct, indirect, incidental, special or consequential damages
-arising out of the use of or inability to use this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the above disclaimer and the following restrictions:
-
- 1. Redistributions of source code (in whole or in part) must retain
- the above copyright notice, definition, disclaimer, and this list
- of conditions.
-
- 2. Redistributions in binary form (compiled executables and libraries)
- must reproduce the above copyright notice, definition, disclaimer,
- and this list of conditions in documentation and/or other materials
- provided with the distribution. The sole exception to this condition
- is redistribution of a standard UnZipSFX binary (including SFXWiz) as
- part of a self-extracting archive; that is permitted without inclusion
- of this license, as long as the normal SFX banner has not been removed
- from the binary or disabled.
-
- 3. Altered versions--including, but not limited to, ports to new operating
- systems, existing ports with new graphical interfaces, versions with
- modified or added functionality, and dynamic, shared, or static library
- versions not from Info-ZIP--must be plainly marked as such and must not
- be misrepresented as being the original source or, if binaries,
- compiled from the original source. Such altered versions also must not
- be misrepresented as being Info-ZIP releases--including, but not
- limited to, labeling of the altered versions with the names "Info-ZIP"
- (or any variation thereof, including, but not limited to, different
- capitalizations), "Pocket UnZip," "WiZ" or "MacZip" without the
- explicit permission of Info-ZIP. Such altered versions are further
- prohibited from misrepresentative use of the Zip-Bugs or Info-ZIP
- e-mail addresses or the Info-ZIP URL(s), such as to imply Info-ZIP
- will provide support for the altered versions.
-
- 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip,"
- "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its
- own source and binary releases.
diff --git a/thirdparty/minizip/LICENSE-MiniZip.txt b/thirdparty/minizip/LICENSE-MiniZip.txt
deleted file mode 100644
index 0e8950f86f..0000000000
--- a/thirdparty/minizip/LICENSE-MiniZip.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-Credits
-
- Gilles Vollant - Original MiniZip author
- Even Rouault - ZIP64 unzip Support
- Daniel Borca - BZip Compression method support in unzip
- Mathias Svensson - ZIP64 zip support
- Mathias Svensson - BZip Compression method support in zip
-
- This version has been modified for Godot Engine
-
-
-License
-----------------------------------------------------------------------------
- Condition of use and distribution are the same than zlib :
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
-----------------------------------------------------------------------------
diff --git a/thirdparty/minizip/MiniZip_info.txt b/thirdparty/minizip/MiniZip_info.txt
new file mode 100644
index 0000000000..57d7152420
--- /dev/null
+++ b/thirdparty/minizip/MiniZip_info.txt
@@ -0,0 +1,74 @@
+MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant - version 1.1 64 bits from Mathias Svensson
+
+Introduction
+---------------------
+MiniZip 1.1 is built from MiniZip 1.0 by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html )
+
+When adding ZIP64 support into minizip it would result into risk of breaking compatibility with minizip 1.0.
+All possible work was done for compatibility.
+
+
+Background
+---------------------
+When adding ZIP64 support Mathias Svensson found that Even Rouault have added ZIP64
+support for unzip.c into minizip for a open source project called gdal ( http://www.gdal.org/ )
+
+That was used as a starting point. And after that ZIP64 support was added to zip.c
+some refactoring and code cleanup was also done.
+
+
+Changed from MiniZip 1.0 to MiniZip 1.1
+---------------------------------------
+* Added ZIP64 support for unzip ( by Even Rouault )
+* Added ZIP64 support for zip ( by Mathias Svensson )
+* Reverted some changed that Even Rouault did.
+* Bunch of patches received from Gulles Vollant that he received for MiniZip from various users.
+* Added unzip patch for BZIP Compression method (patch create by Daniel Borca)
+* Added BZIP Compress method for zip
+* Did some refactoring and code cleanup
+
+
+Credits
+
+ Gilles Vollant - Original MiniZip author
+ Even Rouault - ZIP64 unzip Support
+ Daniel Borca - BZip Compression method support in unzip
+ Mathias Svensson - ZIP64 zip support
+ Mathias Svensson - BZip Compression method support in zip
+
+ Resources
+
+ ZipLayout http://result42.com/projects/ZipFileLayout
+ Command line tool for Windows that shows the layout and information of the headers in a zip archive.
+ Used when debugging and validating the creation of zip files using MiniZip64
+
+
+ ZIP App Note http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+ Zip File specification
+
+
+Notes.
+ * To be able to use BZip compression method in zip64.c or unzip64.c the BZIP2 lib is needed and HAVE_BZIP2 need to be defined.
+
+License
+----------------------------------------------------------
+ Condition of use and distribution are the same than zlib :
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+----------------------------------------------------------
+
diff --git a/thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch b/thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch
new file mode 100644
index 0000000000..8e66416a43
--- /dev/null
+++ b/thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch
@@ -0,0 +1,295 @@
+diff --git a/thirdparty/minizip/ioapi.c b/thirdparty/minizip/ioapi.c
+index 49958f61f..0afbdc06a 100644
+--- a/thirdparty/minizip/ioapi.c
++++ b/thirdparty/minizip/ioapi.c
+@@ -68,8 +68,15 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
+ p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
+ p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
+ p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
++ /* GODOT start */
++ p_filefunc64_32->zfile_func64.alloc_mem = p_filefunc32->alloc_mem;
++ p_filefunc64_32->zfile_func64.free_mem = p_filefunc32->free_mem;
++ /* GODOT end */
+ }
+
++/* GODOT start */
++/*
++// GODOT end
+
+
+ static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
+@@ -233,3 +240,6 @@ void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
+ pzlib_filefunc_def->zerror_file = ferror_file_func;
+ pzlib_filefunc_def->opaque = NULL;
+ }
++// GODOT start
++*/
++/* GODOT end */
+diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
+index 8309c4cf8..f25ab6464 100644
+--- a/thirdparty/minizip/ioapi.h
++++ b/thirdparty/minizip/ioapi.h
+@@ -145,6 +145,10 @@ typedef struct zlib_filefunc_def_s
+ close_file_func zclose_file;
+ testerror_file_func zerror_file;
+ voidpf opaque;
++ /* GODOT start */
++ alloc_func alloc_mem;
++ free_func free_mem;
++ /* GODOT end */
+ } zlib_filefunc_def;
+
+ typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
+@@ -161,6 +165,10 @@ typedef struct zlib_filefunc64_def_s
+ close_file_func zclose_file;
+ testerror_file_func zerror_file;
+ voidpf opaque;
++ /* GODOT start */
++ alloc_func alloc_mem;
++ free_func free_mem;
++ /* GODOT end */
+ } zlib_filefunc64_def;
+
+ void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
+diff --git a/thirdparty/minizip/unzip.c b/thirdparty/minizip/unzip.c
+index 7617f41f1..32e27bd65 100644
+--- a/thirdparty/minizip/unzip.c
++++ b/thirdparty/minizip/unzip.c
+@@ -157,6 +157,9 @@ typedef struct
+ uLong compression_method; /* compression method (0==store) */
+ ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
+ int raw;
++ /* GODOT start */
++ int extra_size;
++ /* GODOT end */
+ } file_in_zip64_read_info_s;
+
+
+@@ -606,9 +609,10 @@ local unzFile unzOpenInternal (const void *path,
+ us.z_filefunc.zseek32_file = NULL;
+ us.z_filefunc.ztell32_file = NULL;
+ if (pzlib_filefunc64_32_def==NULL)
+- fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);
+- else
+- us.z_filefunc = *pzlib_filefunc64_32_def;
++ /* GODOT start */
++ return NULL; // standard i/o not supported
++ us.z_filefunc = *pzlib_filefunc64_32_def;
++ /* GODOT end */
+ us.is64bitOpenFunction = is64bitOpenFunction;
+
+
+@@ -800,6 +804,18 @@ extern unzFile ZEXPORT unzOpen64 (const void *path)
+ return unzOpenInternal(path, NULL, 1);
+ }
+
++/* GODOT start */
++extern void* unzGetOpaque(unzFile file) {
++
++ unz64_s* s;
++ if (file==NULL)
++ return NULL;
++ s=(unz64_s*)file;
++
++ return s->z_filefunc.zfile_func64.opaque;
++};
++/* GODOT end */
++
+ /*
+ Close a ZipFile opened with unzipOpen.
+ If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
+@@ -1018,10 +1034,20 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
+
+ if (lSeek!=0)
+ {
+- if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+- lSeek=0;
+- else
+- err=UNZ_ERRNO;
++ /* GODOT start */
++ if (lSeek<0) {
++ // WORKAROUND for backwards seeking
++ z_off_t pos = ZTELL64(s->z_filefunc, s->filestream);
++ if (ZSEEK64(s->z_filefunc, s->filestream,pos+lSeek,ZLIB_FILEFUNC_SEEK_SET)==0)
++ lSeek=0;
++ else
++ err=UNZ_ERRNO;
++ } else {
++ if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
++ lSeek=0;
++ else
++ err=UNZ_ERRNO;
++ }
+ }
+
+ while(acc < file_info.size_file_extra)
+@@ -1575,8 +1601,10 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
+ }
+ else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
+ {
+- pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
+- pfile_in_zip_read_info->stream.zfree = (free_func)0;
++ /* GODOT start */
++ pfile_in_zip_read_info->stream.zalloc = s->z_filefunc.zfile_func64.alloc_mem;
++ pfile_in_zip_read_info->stream.zfree = s->z_filefunc.zfile_func64.free_mem;
++ /* GODOT end */
+ pfile_in_zip_read_info->stream.opaque = (voidpf)0;
+ pfile_in_zip_read_info->stream.next_in = 0;
+ pfile_in_zip_read_info->stream.avail_in = 0;
+@@ -1608,6 +1636,9 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
+ iSizeVar;
+
+ pfile_in_zip_read_info->stream.avail_in = (uInt)0;
++ /* GODOT start */
++ pfile_in_zip_read_info->extra_size = iSizeVar;
++ /* GODOT end */
+
+ s->pfile_in_zip_read = pfile_in_zip_read_info;
+ s->encrypted = 0;
+@@ -1638,6 +1669,85 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
+ return UNZ_OK;
+ }
+
++/* GODOT start */
++extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
++
++ unz64_s* s;
++ file_in_zip64_read_info_s* pfile_in_zip_read_info;
++ if (file==NULL)
++ return UNZ_PARAMERROR;
++ s=(unz64_s*)file;
++ pfile_in_zip_read_info=s->pfile_in_zip_read;
++
++ if (pfile_in_zip_read_info==NULL)
++ return UNZ_PARAMERROR;
++
++ if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED) { // don't know how to support bzip
++ return UNZ_INTERNALERROR;
++ };
++
++ if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) {
++
++ pfile_in_zip_read_info->rest_read_compressed =
++ s->cur_file_info.compressed_size - pos;
++ pfile_in_zip_read_info->rest_read_uncompressed =
++ s->cur_file_info.uncompressed_size - pos;
++
++ pfile_in_zip_read_info->pos_in_zipfile =
++ s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
++ pfile_in_zip_read_info->extra_size + pos;
++
++ pfile_in_zip_read_info->stream.avail_in = (uInt)0;
++ pfile_in_zip_read_info->stream.total_out = pos;
++
++ return ZSEEK64(pfile_in_zip_read_info->z_filefunc,
++ pfile_in_zip_read_info->filestream,
++ pfile_in_zip_read_info->byte_before_the_zipfile + pfile_in_zip_read_info->pos_in_zipfile,
++ ZLIB_FILEFUNC_SEEK_SET);
++
++ } else { // gzip
++
++ if (pos < pfile_in_zip_read_info->stream.total_out) { // negative seek, rewind
++
++ pfile_in_zip_read_info->rest_read_compressed =
++ s->cur_file_info.compressed_size ;
++ pfile_in_zip_read_info->rest_read_uncompressed =
++ s->cur_file_info.uncompressed_size ;
++
++ pfile_in_zip_read_info->pos_in_zipfile =
++ s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
++ pfile_in_zip_read_info->extra_size;
++
++ (void)inflateReset(&pfile_in_zip_read_info->stream);
++
++ pfile_in_zip_read_info->stream.avail_in = (uInt)0;
++ pfile_in_zip_read_info->stream.total_out = 0;
++ pfile_in_zip_read_info->stream.next_in = 0;
++ };
++
++ // not sure where to read, so read on the stack
++ {
++ char buf[512];
++ int to_read = pos - pfile_in_zip_read_info->stream.total_out;
++ while (to_read) {
++
++ int len = to_read > sizeof(buf)?sizeof(buf):to_read;
++ int read = unzReadCurrentFile(file, buf, len);
++ if (read < 0) {
++ return read;
++ };
++ to_read -= read;
++ if (read == UNZ_EOF) {
++ return pos;
++ };
++ };
++ };
++ };
++
++ return pos;
++};
++/* GODOT end */
++
+ extern int ZEXPORT unzOpenCurrentFile (unzFile file)
+ {
+ return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
+diff --git a/thirdparty/minizip/unzip.h b/thirdparty/minizip/unzip.h
+index 3183968b7..54e65ad8a 100644
+--- a/thirdparty/minizip/unzip.h
++++ b/thirdparty/minizip/unzip.h
+@@ -202,6 +202,10 @@ extern int ZEXPORT unzClose OF((unzFile file));
+ these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+ return UNZ_OK if there is no problem. */
+
++/* GODOT start */
++extern void* unzGetOpaque(unzFile file);
++/* GODOT end */
++
+ extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
+ unz_global_info *pglobal_info));
+
+@@ -390,6 +394,13 @@ extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
+ (UNZ_ERRNO for IO error, or zLib error for uncompress error)
+ */
+
++/* GODOT start */
++extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos);
++/*
++ Seek to position in uncompressed data
++*/
++/* GODOT end */
++
+ extern z_off_t ZEXPORT unztell OF((unzFile file));
+
+ extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
+diff --git a/thirdparty/minizip/zip.c b/thirdparty/minizip/zip.c
+index 3c34fc8bd..d7093e745 100644
+--- a/thirdparty/minizip/zip.c
++++ b/thirdparty/minizip/zip.c
+@@ -854,9 +854,11 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
+
+ ziinit.z_filefunc.zseek32_file = NULL;
+ ziinit.z_filefunc.ztell32_file = NULL;
+- if (pzlib_filefunc64_32_def==NULL)
+- fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
+- else
++ /* GODOT start */
++ if (pzlib_filefunc64_32_def==NULL) {
++ //fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
++ } else
++ /* GODOT end */
+ ziinit.z_filefunc = *pzlib_filefunc64_32_def;
+
+ ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
+@@ -1210,8 +1212,10 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
+ {
+ if(zi->ci.method == Z_DEFLATED)
+ {
+- zi->ci.stream.zalloc = (alloc_func)0;
+- zi->ci.stream.zfree = (free_func)0;
++ /* GODOT start */
++ zi->ci.stream.zalloc = zi->z_filefunc.zfile_func64.alloc_mem;
++ zi->ci.stream.zfree = zi->z_filefunc.zfile_func64.free_mem;
++ /* GODOT end */
+ zi->ci.stream.opaque = (voidpf)0;
+
+ if (windowBits>0)
diff --git a/thirdparty/minizip/ioapi.c b/thirdparty/minizip/ioapi.c
index d6063a5fe6..2b42df4abd 100644
--- a/thirdparty/minizip/ioapi.c
+++ b/thirdparty/minizip/ioapi.c
@@ -6,7 +6,7 @@
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read LICENSE-MiniZip.txt
+ For more info read MiniZip_info.txt
*/
@@ -68,11 +68,15 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
+ /* GODOT start */
p_filefunc64_32->zfile_func64.alloc_mem = p_filefunc32->alloc_mem;
p_filefunc64_32->zfile_func64.free_mem = p_filefunc32->free_mem;
+ /* GODOT end */
}
+/* GODOT start */
/*
+// GODOT end
static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
@@ -119,6 +123,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
return file;
}
+
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
{
uLong ret;
@@ -140,6 +145,7 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
return ret;
}
+
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
{
ZPOS64_T ret;
@@ -234,4 +240,6 @@ void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
pzlib_filefunc_def->zerror_file = ferror_file_func;
pzlib_filefunc_def->opaque = NULL;
}
+// GODOT start
*/
+/* GODOT end */
diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
index cb6cb7e766..f25ab6464f 100644
--- a/thirdparty/minizip/ioapi.h
+++ b/thirdparty/minizip/ioapi.h
@@ -1,11 +1,12 @@
-/* this file is part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
+/* ioapi.h -- IO base function header for compress/uncompress .zip
+ part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read LICENSE-MiniZip.txt
+ For more info read MiniZip_info.txt
Changes
@@ -40,6 +41,7 @@
#endif
#include <stdio.h>
+#include <stdlib.h>
#include "zlib.h"
#if defined(USE_FILE32API)
@@ -122,14 +124,14 @@ extern "C" {
-typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode);
-typedef uLong (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size);
-typedef uLong (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size);
-typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream);
-typedef int (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream);
+typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
+typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
+typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
+typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
-typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream);
-typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin);
+typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
+typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
/* here is the "old" 32 bits structure structure */
@@ -143,13 +145,15 @@ typedef struct zlib_filefunc_def_s
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
- alloc_func alloc_mem;
- free_func free_mem;
+ /* GODOT start */
+ alloc_func alloc_mem;
+ free_func free_mem;
+ /* GODOT end */
} zlib_filefunc_def;
-typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
-typedef long (ZCALLBACK *seek64_file_func) (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin);
-typedef voidpf (ZCALLBACK *open64_file_func) (voidpf opaque, const void* filename, int mode);
+typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
+typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
+typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
typedef struct zlib_filefunc64_def_s
{
@@ -161,13 +165,14 @@ typedef struct zlib_filefunc64_def_s
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
- alloc_func alloc_mem;
- free_func free_mem;
-
+ /* GODOT start */
+ alloc_func alloc_mem;
+ free_func free_mem;
+ /* GODOT end */
} zlib_filefunc64_def;
-void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def);
-void fill_fopen_filefunc (zlib_filefunc_def* pzlib_filefunc_def);
+void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
+void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
/* now internal definition, only for zip.c and unzip.h */
typedef struct zlib_filefunc64_32_def_s
@@ -186,9 +191,9 @@ typedef struct zlib_filefunc64_32_def_s
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
-voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode);
-long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin);
-ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream);
+voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
+long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
+ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
diff --git a/thirdparty/minizip/unzip.c b/thirdparty/minizip/unzip.c
index 7aa0a86d13..32e27bd657 100644
--- a/thirdparty/minizip/unzip.c
+++ b/thirdparty/minizip/unzip.c
@@ -10,7 +10,7 @@
Modifications for Zip64 support on both zip and unzip
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read LICENSE-MiniZip.txt
+ For more info read MiniZip_info.txt
------------------------------------------------------------------------------------
@@ -157,7 +157,9 @@ typedef struct
uLong compression_method; /* compression method (0==store) */
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
int raw;
- int extra_size;
+ /* GODOT start */
+ int extra_size;
+ /* GODOT end */
} file_in_zip64_read_info_s;
@@ -205,10 +207,10 @@ typedef struct
*/
-local int unz64local_getByte (
+local int unz64local_getByte OF((
const zlib_filefunc64_32_def* pzlib_filefunc_def,
voidpf filestream,
- int *pi);
+ int *pi));
local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)
{
@@ -232,10 +234,10 @@ local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, v
/* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets
*/
-local int unz64local_getShort (
+local int unz64local_getShort OF((
const zlib_filefunc64_32_def* pzlib_filefunc_def,
voidpf filestream,
- uLong *pX);
+ uLong *pX));
local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
voidpf filestream,
@@ -259,10 +261,10 @@ local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
return err;
}
-local int unz64local_getLong (
+local int unz64local_getLong OF((
const zlib_filefunc64_32_def* pzlib_filefunc_def,
voidpf filestream,
- uLong *pX);
+ uLong *pX));
local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
voidpf filestream,
@@ -294,10 +296,10 @@ local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
return err;
}
-local int unz64local_getLong64 (
+local int unz64local_getLong64 OF((
const zlib_filefunc64_32_def* pzlib_filefunc_def,
voidpf filestream,
- ZPOS64_T *pX);
+ ZPOS64_T *pX));
local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def,
@@ -410,7 +412,7 @@ extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
Locate the Central directory of a zipfile (at the end, just before
the global comment)
*/
-local ZPOS64_T unz64local_SearchCentralDir (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream);
+local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
{
unsigned char* buf;
@@ -472,9 +474,9 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
Locate the Central directory 64 of a zipfile (at the end, just before
the global comment)
*/
-local ZPOS64_T unz64local_SearchCentralDir64 (
+local ZPOS64_T unz64local_SearchCentralDir64 OF((
const zlib_filefunc64_32_def* pzlib_filefunc_def,
- voidpf filestream);
+ voidpf filestream));
local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
voidpf filestream)
@@ -606,9 +608,11 @@ local unzFile unzOpenInternal (const void *path,
us.z_filefunc.zseek32_file = NULL;
us.z_filefunc.ztell32_file = NULL;
- if (pzlib_filefunc64_32_def==NULL)
- return NULL; // standard i/o not supported
- us.z_filefunc = *pzlib_filefunc64_32_def;
+ if (pzlib_filefunc64_32_def==NULL)
+ /* GODOT start */
+ return NULL; // standard i/o not supported
+ us.z_filefunc = *pzlib_filefunc64_32_def;
+ /* GODOT end */
us.is64bitOpenFunction = is64bitOpenFunction;
@@ -617,10 +621,8 @@ local unzFile unzOpenInternal (const void *path,
path,
ZLIB_FILEFUNC_MODE_READ |
ZLIB_FILEFUNC_MODE_EXISTING);
- if (us.filestream==NULL) {
- printf("no stream\n");
+ if (us.filestream==NULL)
return NULL;
- };
central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
if (central_pos)
@@ -743,7 +745,6 @@ local unzFile unzOpenInternal (const void *path,
if (err!=UNZ_OK)
{
- printf("err is %i, %x\n", err, err);
ZCLOSE64(us.z_filefunc, us.filestream);
return NULL;
}
@@ -803,15 +804,17 @@ extern unzFile ZEXPORT unzOpen64 (const void *path)
return unzOpenInternal(path, NULL, 1);
}
+/* GODOT start */
extern void* unzGetOpaque(unzFile file) {
- unz64_s* s;
- if (file==NULL)
- return NULL;
- s=(unz64_s*)file;
+ unz64_s* s;
+ if (file==NULL)
+ return NULL;
+ s=(unz64_s*)file;
- return s->z_filefunc.zfile_func64.opaque;
+ return s->z_filefunc.zfile_func64.opaque;
};
+/* GODOT end */
/*
Close a ZipFile opened with unzipOpen.
@@ -878,7 +881,7 @@ local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
/*
Get Info about the current file in the zipfile, with internal only info
*/
-local int unz64local_GetCurrentFileInfoInternal (unzFile file,
+local int unz64local_GetCurrentFileInfoInternal OF((unzFile file,
unz_file_info64 *pfile_info,
unz_file_info64_internal
*pfile_info_internal,
@@ -887,7 +890,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
- uLong commentBufferSize);
+ uLong commentBufferSize));
local int unz64local_GetCurrentFileInfoInternal (unzFile file,
unz_file_info64 *pfile_info,
@@ -1031,19 +1034,20 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
if (lSeek!=0)
{
- if (lSeek<0) {
- // WORKAROUND for backwards seeking
- z_off_t pos = ZTELL64(s->z_filefunc, s->filestream);
- if (ZSEEK64(s->z_filefunc, s->filestream,pos+lSeek,ZLIB_FILEFUNC_SEEK_SET)==0)
- lSeek=0;
- else
- err=UNZ_ERRNO;
- } else {
- if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
- lSeek=0;
- else
- err=UNZ_ERRNO;
- }
+ /* GODOT start */
+ if (lSeek<0) {
+ // WORKAROUND for backwards seeking
+ z_off_t pos = ZTELL64(s->z_filefunc, s->filestream);
+ if (ZSEEK64(s->z_filefunc, s->filestream,pos+lSeek,ZLIB_FILEFUNC_SEEK_SET)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ } else {
+ if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ }
}
while(acc < file_info.size_file_extra)
@@ -1597,8 +1601,10 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
}
else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
{
+ /* GODOT start */
pfile_in_zip_read_info->stream.zalloc = s->z_filefunc.zfile_func64.alloc_mem;
pfile_in_zip_read_info->stream.zfree = s->z_filefunc.zfile_func64.free_mem;
+ /* GODOT end */
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = 0;
pfile_in_zip_read_info->stream.avail_in = 0;
@@ -1608,7 +1614,6 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
else
{
- printf("NO OPEN ZLIB %i\n",err);
TRYFREE(pfile_in_zip_read_info);
return err;
}
@@ -1631,7 +1636,9 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
iSizeVar;
pfile_in_zip_read_info->stream.avail_in = (uInt)0;
- pfile_in_zip_read_info->extra_size = iSizeVar;
+ /* GODOT start */
+ pfile_in_zip_read_info->extra_size = iSizeVar;
+ /* GODOT end */
s->pfile_in_zip_read = pfile_in_zip_read_info;
s->encrypted = 0;
@@ -1662,82 +1669,84 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
return UNZ_OK;
}
+/* GODOT start */
extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
- unz64_s* s;
- file_in_zip64_read_info_s* pfile_in_zip_read_info;
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz64_s*)file;
- pfile_in_zip_read_info=s->pfile_in_zip_read;
-
- if (pfile_in_zip_read_info==NULL)
- return UNZ_PARAMERROR;
-
- if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED) { // don't know how to support bzip
- return UNZ_INTERNALERROR;
- };
-
- if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) {
-
- pfile_in_zip_read_info->rest_read_compressed =
- s->cur_file_info.compressed_size - pos;
- pfile_in_zip_read_info->rest_read_uncompressed =
- s->cur_file_info.uncompressed_size - pos;
-
- pfile_in_zip_read_info->pos_in_zipfile =
- s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
- pfile_in_zip_read_info->extra_size + pos;
-
- pfile_in_zip_read_info->stream.avail_in = (uInt)0;
- pfile_in_zip_read_info->stream.total_out = pos;
-
- return ZSEEK64(pfile_in_zip_read_info->z_filefunc,
- pfile_in_zip_read_info->filestream,
- pfile_in_zip_read_info->byte_before_the_zipfile + pfile_in_zip_read_info->pos_in_zipfile,
- ZLIB_FILEFUNC_SEEK_SET);
-
- } else { // gzip
-
- if (pos < pfile_in_zip_read_info->stream.total_out) { // negative seek, rewind
-
- pfile_in_zip_read_info->rest_read_compressed =
- s->cur_file_info.compressed_size ;
- pfile_in_zip_read_info->rest_read_uncompressed =
- s->cur_file_info.uncompressed_size ;
-
- pfile_in_zip_read_info->pos_in_zipfile =
- s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
- pfile_in_zip_read_info->extra_size;
-
- (void)inflateReset(&pfile_in_zip_read_info->stream);
-
- pfile_in_zip_read_info->stream.avail_in = (uInt)0;
- pfile_in_zip_read_info->stream.total_out = 0;
- pfile_in_zip_read_info->stream.next_in = 0;
- };
-
- // not sure where to read, so read on the stack
- {
- char buf[512];
- int to_read = pos - pfile_in_zip_read_info->stream.total_out;
- while (to_read) {
-
- int len = to_read > sizeof(buf)?sizeof(buf):to_read;
- int read = unzReadCurrentFile(file, buf, len);
- if (read < 0) {
- return read;
- };
- to_read -= read;
- if (read == UNZ_EOF) {
- return pos;
- };
- };
- };
- };
-
- return pos;
+ unz64_s* s;
+ file_in_zip64_read_info_s* pfile_in_zip_read_info;
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz64_s*)file;
+ pfile_in_zip_read_info=s->pfile_in_zip_read;
+
+ if (pfile_in_zip_read_info==NULL)
+ return UNZ_PARAMERROR;
+
+ if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED) { // don't know how to support bzip
+ return UNZ_INTERNALERROR;
+ };
+
+ if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) {
+
+ pfile_in_zip_read_info->rest_read_compressed =
+ s->cur_file_info.compressed_size - pos;
+ pfile_in_zip_read_info->rest_read_uncompressed =
+ s->cur_file_info.uncompressed_size - pos;
+
+ pfile_in_zip_read_info->pos_in_zipfile =
+ s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
+ pfile_in_zip_read_info->extra_size + pos;
+
+ pfile_in_zip_read_info->stream.avail_in = (uInt)0;
+ pfile_in_zip_read_info->stream.total_out = pos;
+
+ return ZSEEK64(pfile_in_zip_read_info->z_filefunc,
+ pfile_in_zip_read_info->filestream,
+ pfile_in_zip_read_info->byte_before_the_zipfile + pfile_in_zip_read_info->pos_in_zipfile,
+ ZLIB_FILEFUNC_SEEK_SET);
+
+ } else { // gzip
+
+ if (pos < pfile_in_zip_read_info->stream.total_out) { // negative seek, rewind
+
+ pfile_in_zip_read_info->rest_read_compressed =
+ s->cur_file_info.compressed_size ;
+ pfile_in_zip_read_info->rest_read_uncompressed =
+ s->cur_file_info.uncompressed_size ;
+
+ pfile_in_zip_read_info->pos_in_zipfile =
+ s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
+ pfile_in_zip_read_info->extra_size;
+
+ (void)inflateReset(&pfile_in_zip_read_info->stream);
+
+ pfile_in_zip_read_info->stream.avail_in = (uInt)0;
+ pfile_in_zip_read_info->stream.total_out = 0;
+ pfile_in_zip_read_info->stream.next_in = 0;
+ };
+
+ // not sure where to read, so read on the stack
+ {
+ char buf[512];
+ int to_read = pos - pfile_in_zip_read_info->stream.total_out;
+ while (to_read) {
+
+ int len = to_read > sizeof(buf)?sizeof(buf):to_read;
+ int read = unzReadCurrentFile(file, buf, len);
+ if (read < 0) {
+ return read;
+ };
+ to_read -= read;
+ if (read == UNZ_EOF) {
+ return pos;
+ };
+ };
+ };
+ };
+
+ return pos;
};
+/* GODOT end */
extern int ZEXPORT unzOpenCurrentFile (unzFile file)
{
@@ -1797,7 +1806,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
return UNZ_PARAMERROR;
- if (pfile_in_zip_read_info->read_buffer==NULL)
+ if ((pfile_in_zip_read_info->read_buffer == NULL))
return UNZ_END_OF_LIST_OF_FILE;
if (len==0)
return 0;
diff --git a/thirdparty/minizip/unzip.h b/thirdparty/minizip/unzip.h
index f67c3b2fa8..54e65ad8ab 100644
--- a/thirdparty/minizip/unzip.h
+++ b/thirdparty/minizip/unzip.h
@@ -10,7 +10,7 @@
Modifications for Zip64 support on both zip and unzip
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read LICENSE-MiniZip.txt
+ For more info read MiniZip_info.txt
---------------------------------------------------------------------------------
@@ -150,9 +150,9 @@ typedef struct unz_file_info_s
tm_unz tmu_date;
} unz_file_info;
-extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
+extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
const char* fileName2,
- int iCaseSensitivity);
+ int iCaseSensitivity));
/*
Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
@@ -163,8 +163,8 @@ extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
*/
-extern unzFile ZEXPORT unzOpen (const char *path);
-extern unzFile ZEXPORT unzOpen64 (const void *path);
+extern unzFile ZEXPORT unzOpen OF((const char *path));
+extern unzFile ZEXPORT unzOpen64 OF((const void *path));
/*
Open a Zip file. path contain the full pathname (by example,
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
@@ -181,44 +181,45 @@ extern unzFile ZEXPORT unzOpen64 (const void *path);
*/
-extern unzFile ZEXPORT unzOpen2 (const char *path,
- zlib_filefunc_def* pzlib_filefunc_def);
+extern unzFile ZEXPORT unzOpen2 OF((const char *path,
+ zlib_filefunc_def* pzlib_filefunc_def));
/*
Open a Zip file, like unzOpen, but provide a set of file low level API
for read/write the zip file (see ioapi.h)
*/
-extern unzFile ZEXPORT unzOpen2_64 (const void *path,
- zlib_filefunc64_def* pzlib_filefunc_def);
+extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
+ zlib_filefunc64_def* pzlib_filefunc_def));
/*
Open a Zip file, like unz64Open, but provide a set of file low level API
for read/write the zip file (see ioapi.h)
*/
-extern int ZEXPORT unzClose (unzFile file);
+extern int ZEXPORT unzClose OF((unzFile file));
/*
Close a ZipFile opened with unzipOpen.
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
return UNZ_OK if there is no problem. */
+/* GODOT start */
extern void* unzGetOpaque(unzFile file);
+/* GODOT end */
+extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
+ unz_global_info *pglobal_info));
-extern int ZEXPORT unzGetGlobalInfo (unzFile file,
- unz_global_info *pglobal_info);
-
-extern int ZEXPORT unzGetGlobalInfo64 (unzFile file,
- unz_global_info64 *pglobal_info);
+extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,
+ unz_global_info64 *pglobal_info));
/*
Write info about the ZipFile in the *pglobal_info structure.
No preparation of the structure is needed
return UNZ_OK if there is no problem. */
-extern int ZEXPORT unzGetGlobalComment (unzFile file,
+extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
char *szComment,
- uLong uSizeBuf);
+ uLong uSizeBuf));
/*
Get the global comment string of the ZipFile, in the szComment buffer.
uSizeBuf is the size of the szComment buffer.
@@ -229,22 +230,22 @@ extern int ZEXPORT unzGetGlobalComment (unzFile file,
/***************************************************************************/
/* Unzip package allow you browse the directory of the zipfile */
-extern int ZEXPORT unzGoToFirstFile (unzFile file);
+extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
/*
Set the current file of the zipfile to the first file.
return UNZ_OK if there is no problem
*/
-extern int ZEXPORT unzGoToNextFile (unzFile file);
+extern int ZEXPORT unzGoToNextFile OF((unzFile file));
/*
Set the current file of the zipfile to the next file.
return UNZ_OK if there is no problem
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
*/
-extern int ZEXPORT unzLocateFile (unzFile file,
+extern int ZEXPORT unzLocateFile OF((unzFile file,
const char *szFileName,
- int iCaseSensitivity);
+ int iCaseSensitivity));
/*
Try locate the file szFileName in the zipfile.
For the iCaseSensitivity signification, see unzStringFileNameCompare
@@ -288,23 +289,23 @@ extern int ZEXPORT unzGoToFilePos64(
/* ****************************************** */
-extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file,
+extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file,
unz_file_info64 *pfile_info,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
- uLong commentBufferSize);
+ uLong commentBufferSize));
-extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
+extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
unz_file_info *pfile_info,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
- uLong commentBufferSize);
+ uLong commentBufferSize));
/*
Get Info about the current file
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
@@ -321,7 +322,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
/** Addition for GDAL : START */
-extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 (unzFile file);
+extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
/** Addition for GDAL : END */
@@ -331,24 +332,24 @@ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 (unzFile file);
from it, and close it (you can close it before reading all the file)
*/
-extern int ZEXPORT unzOpenCurrentFile (unzFile file);
+extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
/*
Open for reading data the current file in the zipfile.
If there is no error, the return value is UNZ_OK.
*/
-extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file,
- const char* password);
+extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
+ const char* password));
/*
Open for reading data the current file in the zipfile.
password is a crypting password
If there is no error, the return value is UNZ_OK.
*/
-extern int ZEXPORT unzOpenCurrentFile2 (unzFile file,
+extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
int* method,
int* level,
- int raw);
+ int raw));
/*
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
if raw==1
@@ -358,11 +359,11 @@ extern int ZEXPORT unzOpenCurrentFile2 (unzFile file,
but you CANNOT set method parameter as NULL
*/
-extern int ZEXPORT unzOpenCurrentFile3 (unzFile file,
+extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
int* method,
int* level,
int raw,
- const char* password);
+ const char* password));
/*
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
if raw==1
@@ -373,15 +374,15 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file,
*/
-extern int ZEXPORT unzCloseCurrentFile (unzFile file);
+extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
/*
Close the file in zip opened with unzOpenCurrentFile
Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/
-extern int ZEXPORT unzReadCurrentFile (unzFile file,
+extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
voidp buf,
- unsigned len);
+ unsigned len));
/*
Read bytes from the current file (opened by unzOpenCurrentFile)
buf contain buffer where data must be copied
@@ -393,26 +394,28 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file,
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
*/
+/* GODOT start */
extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos);
/*
Seek to position in uncompressed data
*/
+/* GODOT end */
-extern z_off_t ZEXPORT unztell (unzFile file);
+extern z_off_t ZEXPORT unztell OF((unzFile file));
-extern ZPOS64_T ZEXPORT unztell64 (unzFile file);
+extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
/*
Give the current position in uncompressed data
*/
-extern int ZEXPORT unzeof (unzFile file);
+extern int ZEXPORT unzeof OF((unzFile file));
/*
return 1 if the end of file was reached, 0 elsewhere
*/
-extern int ZEXPORT unzGetLocalExtrafield (unzFile file,
+extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
voidp buf,
- unsigned len);
+ unsigned len));
/*
Read extra field from the current file (opened by unzOpenCurrentFile)
This is the local-header version of the extra field (sometimes, there is
diff --git a/thirdparty/minizip/zip.c b/thirdparty/minizip/zip.c
index 27a3d3cdc1..d7093e7457 100644
--- a/thirdparty/minizip/zip.c
+++ b/thirdparty/minizip/zip.c
@@ -7,7 +7,7 @@
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read LICENSE-MiniZip.txt
+ For more info read MiniZip_info.txt
Changes
Oct-2009 - Mathias Svensson - Remove old C style function prototypes
@@ -283,7 +283,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
*/
-local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte);
+local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte));
local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)
{
unsigned char buf[8];
@@ -307,7 +307,7 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def,
return ZIP_OK;
}
-local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte);
+local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte));
local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
{
unsigned char* buf=(unsigned char*)dest;
@@ -344,7 +344,7 @@ local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
/****************************************************************************/
-local int zip64local_getByte (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi);
+local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi));
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi)
{
@@ -368,7 +368,7 @@ local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,vo
/* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets
*/
-local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX);
+local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
{
@@ -390,7 +390,7 @@ local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
return err;
}
-local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX);
+local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
{
@@ -420,7 +420,7 @@ local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
return err;
}
-local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX);
+local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));
local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
@@ -475,7 +475,7 @@ local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def
Locate the Central directory of a zipfile (at the end, just before
the global comment)
*/
-local ZPOS64_T zip64local_SearchCentralDir (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream);
+local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
{
@@ -537,7 +537,7 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
the global comment)
*/
-local ZPOS64_T zip64local_SearchCentralDir64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream);
+local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
{
@@ -854,9 +854,11 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
ziinit.z_filefunc.zseek32_file = NULL;
ziinit.z_filefunc.ztell32_file = NULL;
+ /* GODOT start */
if (pzlib_filefunc64_32_def==NULL) {
- //fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
+ //fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
} else
+ /* GODOT end */
ziinit.z_filefunc = *pzlib_filefunc64_32_def;
ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
@@ -1114,9 +1116,9 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
zi->ci.flag = flagBase;
if ((level==8) || (level==9))
zi->ci.flag |= 2;
- if (level==2)
+ if ((level==2))
zi->ci.flag |= 4;
- if (level==1)
+ if ((level==1))
zi->ci.flag |= 6;
if (password != NULL)
zi->ci.flag |= 1;
@@ -1210,9 +1212,10 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
{
if(zi->ci.method == Z_DEFLATED)
{
- zi->ci.stream.zalloc = zi->z_filefunc.zfile_func64.alloc_mem;
- zi->ci.stream.zfree = zi->z_filefunc.zfile_func64.free_mem;
-
+ /* GODOT start */
+ zi->ci.stream.zalloc = zi->z_filefunc.zfile_func64.alloc_mem;
+ zi->ci.stream.zfree = zi->z_filefunc.zfile_func64.free_mem;
+ /* GODOT end */
zi->ci.stream.opaque = (voidpf)0;
if (windowBits>0)
diff --git a/thirdparty/minizip/zip.h b/thirdparty/minizip/zip.h
index 37478b34c0..8aaebb6234 100644
--- a/thirdparty/minizip/zip.h
+++ b/thirdparty/minizip/zip.h
@@ -1,4 +1,5 @@
-/* Version 1.1, February 14h, 2010
+/* zip.h -- IO on .zip files using zlib
+ Version 1.1, February 14h, 2010
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
@@ -6,7 +7,7 @@
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
- For more info read LICENSE-MiniZip.txt
+ For more info read MiniZip_info.txt
---------------------------------------------------------------------------
@@ -39,8 +40,6 @@
#ifndef _zip12_H
#define _zip12_H
-#include <stdlib.h>
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -114,8 +113,8 @@ typedef const char* zipcharpc;
#define APPEND_STATUS_CREATEAFTER (1)
#define APPEND_STATUS_ADDINZIP (2)
-extern zipFile ZEXPORT zipOpen (const char *pathname, int append);
-extern zipFile ZEXPORT zipOpen64 (const void *pathname, int append);
+extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
+extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
/*
Create a zipfile.
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
@@ -135,17 +134,17 @@ extern zipFile ZEXPORT zipOpen64 (const void *pathname, int append);
Of couse, you can use RAW reading and writing to copy the file you did not want delte
*/
-extern zipFile ZEXPORT zipOpen2 (const char *pathname,
+extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
int append,
zipcharpc* globalcomment,
- zlib_filefunc_def* pzlib_filefunc_def);
+ zlib_filefunc_def* pzlib_filefunc_def));
-extern zipFile ZEXPORT zipOpen2_64 (const void *pathname,
+extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
int append,
zipcharpc* globalcomment,
- zlib_filefunc64_def* pzlib_filefunc_def);
+ zlib_filefunc64_def* pzlib_filefunc_def));
-extern int ZEXPORT zipOpenNewFileInZip (zipFile file,
+extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
@@ -154,9 +153,9 @@ extern int ZEXPORT zipOpenNewFileInZip (zipFile file,
uInt size_extrafield_global,
const char* comment,
int method,
- int level);
+ int level));
-extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file,
+extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
@@ -166,7 +165,7 @@ extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file,
const char* comment,
int method,
int level,
- int zip64);
+ int zip64));
/*
Open a file in the ZIP for writing.
@@ -185,7 +184,7 @@ extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file,
*/
-extern int ZEXPORT zipOpenNewFileInZip2 (zipFile file,
+extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
@@ -195,10 +194,10 @@ extern int ZEXPORT zipOpenNewFileInZip2 (zipFile file,
const char* comment,
int method,
int level,
- int raw);
+ int raw));
-extern int ZEXPORT zipOpenNewFileInZip2_64 (zipFile file,
+extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
@@ -209,12 +208,12 @@ extern int ZEXPORT zipOpenNewFileInZip2_64 (zipFile file,
int method,
int level,
int raw,
- int zip64);
+ int zip64));
/*
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
*/
-extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file,
+extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
@@ -229,9 +228,9 @@ extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file,
int memLevel,
int strategy,
const char* password,
- uLong crcForCrypting);
+ uLong crcForCrypting));
-extern int ZEXPORT zipOpenNewFileInZip3_64 (zipFile file,
+extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
@@ -248,7 +247,7 @@ extern int ZEXPORT zipOpenNewFileInZip3_64 (zipFile file,
const char* password,
uLong crcForCrypting,
int zip64
- );
+ ));
/*
Same than zipOpenNewFileInZip2, except
@@ -257,7 +256,7 @@ extern int ZEXPORT zipOpenNewFileInZip3_64 (zipFile file,
crcForCrypting : crc of file to compress (needed for crypting)
*/
-extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file,
+extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
@@ -275,10 +274,10 @@ extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file,
uLong crcForCrypting,
uLong versionMadeBy,
uLong flagBase
- );
+ ));
-extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file,
+extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
@@ -297,7 +296,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file,
uLong versionMadeBy,
uLong flagBase,
int zip64
- );
+ ));
/*
Same than zipOpenNewFileInZip4, except
versionMadeBy : value for Version made by field
@@ -305,25 +304,25 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file,
*/
-extern int ZEXPORT zipWriteInFileInZip (zipFile file,
+extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
const void* buf,
- unsigned len);
+ unsigned len));
/*
Write data in the zipfile
*/
-extern int ZEXPORT zipCloseFileInZip (zipFile file);
+extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
/*
Close the current file in the zipfile
*/
-extern int ZEXPORT zipCloseFileInZipRaw (zipFile file,
+extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
uLong uncompressed_size,
- uLong crc32);
+ uLong crc32));
-extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file,
+extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
ZPOS64_T uncompressed_size,
- uLong crc32);
+ uLong crc32));
/*
Close the current file in the zipfile, for file opened with
@@ -331,14 +330,14 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file,
uncompressed_size and crc32 are value for the uncompressed size
*/
-extern int ZEXPORT zipClose (zipFile file,
- const char* global_comment);
+extern int ZEXPORT zipClose OF((zipFile file,
+ const char* global_comment));
/*
Close the zipfile
*/
-extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader);
+extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader));
/*
zipRemoveExtraInfoBlock - Added by Mathias Svensson